Now that I’ve finished teaching my first microcontroller class to Tokyo Hackerspace, I must say that it was quite an enlightening experience. To put it mildly, I was pretty nervous about teaching it. Microcontrollers are a complex topic that combines software skill, hardware skill, toolchains, and hardware platforms. It’s not really a class to teach for the faint of heart, and most schools take three to six months to teach the subject…to engineering majors. So trying to cram all of that into a four hour class and teach it to people of differing backgrounds gave me loads of anxiety.

I think the difficult part was trying to figure out where to start. The famous saying, “ a journey of a thousand miles…” was useless to me because I couldn’t even decide where to take my first step. I eventually decided that I wouldn’t cover anything. I wanted to run things as simply as possible and get people toggling LEDs, moving motors, and reading sensors quickly.

To say that I wouldn’t cover anything is being a bit overdramatic. I structured things into a series of labs and prepared detailed lab notes on handouts that discussed everything I wanted to say. The lab notes also contained step-by-step instructions on how to perform the lab. Rather than being an instructor, I wanted to try being more of a lab assistant and have the class be a guided tutorial. The results were very impressive.

Before I get into how it went, I should probably give some background on my previous classes. I had also taught a beginning electronics class to Tokyo Hackerspace. That class was structured in a lecture format where I or the other instructor had a set of powerpoint slides and discussed the theory of how electronics worked: current, voltage, resistance, capacitance, etc… There was little hands-on because there was a great deal of information to cover in order to give people the foundation they needed to start understanding electronic circuits. Or that was what I thought. Thinking back, the class went pretty well, since the attendees were motivated to learn about electronics. However after about an hour of lecturing on circuit principles, people started to yawn and become disengaged. At the end of the class, I could see that people were worn out, however I don’t think it was due to deep thought about the material. I think it was a struggle for people to maintain their attention span through the three hours of materials that we presented.

This class was completely different. It was a repeating series of an approximately 10 minute introduction followed by having everyone work on the microcontroller programming exercise on their own. I wrote out the exact steps for the lab, down to the code they needed to type into their text editor. I was a little worried that it would trivialize the class, but I also wanted things to run smoothly and quickly so they could feel how it was to actually write, compile, download, and test working code without having to spend a lot of time thinking about programming or debugging.

It turned out that my worries were unfounded. Once people were able to get the lab exercise working, and they got it working quickly, then they proceeded to customize it to do different things. One of the first exercises was to blink an LED. I was actually impressed with the look of satisfaction most of them had by being able to blink an LED, however it didn’t stop there. Once they got it to blink, they then started playing around with the blinking frequency and varying the duty cycle. They were also testing what the frequency thresholds were for the human eye to perceive a blinking LED.

Another exercise was to add a command to the command line shell I had written. This command would simply print “hello world” to the terminal program. It sounds trivial, but they had to compile a USB stack (FreakUSB), install the driver, write the command function to print the text, and add it to the command table in the code. It was all discussed in detail in the lab notes so they were able to get through it fairly quickly. However again, once people had gotten their command working in the command shell, they then started writing their own commands to turn on and off the LEDs and adding it to the command table. This ended up happening so often that I almost had to forcefully stop people from performing their own mods and customizations to the labs so that I could move the class forward.

After they had the background from writing a simple program to turn on an LED to integrating their own commands into the command shell, we were finally able to get to driving servo motors. There was actually another lab after the servo motors, which was to set up the analog/digital converters to read temperature sensors. We never got to it. It was pretty much over after they got the motors working. They started calculating the relationship between the pulse width and the servo angles, using the info from the previous labs to periodically “blink” a servo by moving it back and forth, adding different horns to the servos to see what was possible to attach to it, and basically being oblivious to me trying to move the class to the next lab.

The total class ran over five hours, although I had only scheduled it for four. After the class, people didn’t seem tired at all. They were excited about different ideas that they had for integrating the microcontrollers to PCs to do motor control, music, motion detection, etc. There was a lot of discussion after the class and one of the hackerspace members’ wives made dinner (Hainan chicken rice, a Singaporean specialty…yum).

During dinner, I showed some interested people how to build the Chibi wireless stack and integrate it on to the development platform we were using. The dev boards were the Chibi boards I had built so they had an integrated 802.15.4 RF radio. Once they got the wireless links up, they started IM’ing each other on their AVRs. It was really an  interesting sight to see. Wireless sensor network purists would have rolled over in their graves…

Overall, this class taught me some important lessons:

  • People respond much better when you give them control over the information
    • Rather than presenting things to them, I gave them all the information in handouts and let them learn it at their own pace. I’m not sure if this is due to the internet and people being used to controlling their information consumption or if its just a more of a natural way to learn things. When I was in school, information was always force fed to me through lectures so I always thought this was the natural way that things were taught.
  • Focus on application
    • Practical application of the principles you’re trying to teach is the best way to burn it into people’s heads. Once they understand logically why or how something is done, then the information gets absorbed quickly. The best way is to have people do it themselves so they can discover how to do (or not do) something. I think this is a natural way to learn, and centuries ago, apprenticeships replaced schooling for how people were educated.
  • Teaching is best done in context
    • This is kind of related to practical application. In having a sparse introduction followed by people performing the labs, questions naturally came up. Rather than me shoving information down their throats, these questions came up in the context of what they were doing so they could immediately understand, for instance, why it was better to use a bitshift operator to set register bits, rather than directly using hex values. If I had tried to explain it beforehand, I'm not sure how well the information would have been absorbed.
And finally, I think that education will play a major role in the whole movement towards open hardware and software. All the openness in the world won’t make a difference to people if they don’t understand what it is they’re looking at or how to use it. However once people understand how to do something, then as I saw during the class, it won't be long before they get hooked on trying to customize and modify it. Academia is one outlet for education, but in my opinion, people and organizations involved in open hardware/software such as hackerspaces have some distinct advantages. One is that they’re usually more concerned with practical applications rather than the complete theory. Another is that many in the movement are working on cool projects that mix technology with things like art, music, motion, and connectivity. Overall, it was a great class and I seemed to be the one that learned the most from it. I'm looking forward to doing more of them :)

P.S. For those interested, I'm going to be reworking my lab notes and materials based on what I've learned from this class. Once they're complete, then I'll be publishing them under the Creative Commons license. I'm hoping that other people/groups can use them as a template or reference for teaching microcontrollers to others.


PPS: The electronics class I mentioned above is the one I taught about three months ago with one of the other members. It has since been taken over by him and he's worked hard on remaking it into more of a hands-on class. I think most of us in Tokyo Hackerspace have realized that hands-on education is the only way to teach classes.