Microcontroller - Sunday

Released! I had a blast this week working with these electronics projects. I'll definitely be doing more over the course of the next year. There's something strangely gratifying about lighting up a few LEDs on command or receiving input from a simple keypad. Especially when you have to wire them up and write the code yourself. Writing in C was like going back to my CSE 142 course at the University of Washington. Although no one is grading me this time and if I screw up I can catch components on fire. Check out the demos on youtube below. And contact me if you need a part list or wiring diagram and I'd be happy to provide one.

Demos
Lighting - http://www.youtube.com/watch?v=pI2g945pEy0
Big Red Button - http://www.youtube.com/watch?v=9tkcO66Bc8M
Meeting Calculator - http://www.youtube.com/watch?v=Xk0m1Xe7pKE

Source Code
http://github.com/pcorliss/Teensy-Projects

A few things that went better than expected

  • It was awesome to dig back in my electronics bin and pull out some of my crazy ideas for electronics projects. Then actually move forward on them, spend the time and complete them. Releasing anything is usually satisfying, but coming back to something I had previously set aside and finishing it up is redeeming.
  • Electronics projects seem unique to me in that you can get going pretty quickly and without a lot of effort. The equivalent of a hello world on a microcontroller might be reading switch input or lighting up an LED. But it doesn't take much more to wire up multiple LEDs and really start creating something pretty cool without investing a lot of time. Whereas with a lot of the frameworks and languages like Ruby and Python that I've been working on, hello world is easy, but as soon as you want to do something non-standard it's a monumental challenge to find the proper syntax and setup.

Challenges

  • My C is rusty. Thankfully I was able to glean enough from various internet forums to fill in the gaps left by my intro to programming course back in the Fall of 1999. Now I feel old.
  • I started programming back when your average consumer grade desktop machine had roughly a 400Mhz CPU to work with. Since then the bulk of my programming work has taken place on multi-core 2Ghz+ machines. The Teensy only runs at 16Mhz, and you can step it down further to save on power.  So using the Teensy chip where adding an extra instruction in your control loop can cause a noticeable flicker in your LEDs is quite a change of pace. 
  • All of the projects this week draw power over USB which is limited to 400 mA. This caused a few issues where it was possible I wouldn't be able to light as many LEDs simultaneously as I would have liked and required me to rely on techniques where LEDs were switched on and off quickly to conserve power.
  • You can see in the meeting calculator video that a lot of wire was used for wiring the 7-segment displays. Each one requires 8 wires for each segment (digit plus decimal point) and a 9th for 5V supply. It took about 3 hours to get the entire project wired up. Not including tweaking and finding small shorts or poor connections. And that was before I had even written the software to something as simple as display a digit or handle the matrix.

Features Missed

  • I didn't have an appropriate box to mount the projects in so I ended up using a bread board for all of them. Which means it's likely that these projects will never be standalone and we'll be stuck on the breadboard for the foreseeable future.
  • The chip socket I had doesn't actually work with my teensy 1.0. So I had to scrap using it on a circuit board. I ended up just using the breadboard instead.