Microcontroller programming is useful but complicated for makers. New tools can make it accessible to all

microcontroller-programmingWhen I designed the curriculum for my middle school Physical Computing course, I envisioned microcontroller programming as the pinnacle of student progress in the course. A microcontroller is essentially a tiny computer on a circuit board. They usually retail for under $50, and they allow students to connect sensors, motors, LEDs, and other electronics connected to IO pins by writing code and uploading their code to the board. Arduinos, Humming Birds, and Raspberry Pis are examples of popular microcontrollers.

I felt that if I could get my students to the point where they could read sensor input from the physical world, process that data on an Arduino board, and execute instructions based on it, they would have developed a great understanding of the fundamentals of the course. I felt that these skills would transfer to nearly any electronics task, and with additional research, my students would be able to invent and build nearly anything they wanted to.

The problem is that microcontroller programming is complicated in several ways. Also, unlike the video game controllers or battery powered cars that students were building earlier in the course, the concept of what an Arduino board is, what it does, and why they should care, is completely foreign to most students.

In order to get students to succeed at this daunting task, I needed to give them an experience where they could see an authentic need for a microcontroller. I then needed to scaffold things like circuit construction and programming for them, so they could develop those skills in a way that was engaging and not frustrating.

Next page: Microcontrollers have big possibility for makers


In my last column, I explained how littleBits, a collection of electronic components that snap together magnetically, scaffold sophisticated electronics concepts for students who are then able to create useful and meaningful circuits and tools.

I was thrilled a couple of weeks ago, when one of my students was creating a basketball game in Little Bits, and he ran into a brick wall. He wanted to detect when a ball went through a hoop using a sensor and change the value displayed on the Number bit, which is a digital, seven-segment display. The problem is that the number displayed on this bit is determined by the voltage in the circuit. The only way to change the number is to manipulate the voltage. Furthermore, he needed the number to increase each time a basket was scored, so he needed his circuit to “remember” what the previous voltage was and increase it based on that value. To do this, he needed a microcontroller.

Thus, littleBits created the opportunity for my student to see first-hand why a microcontroller is important to him and what it is capable of doing. Fortunately, littleBits also sells an Aruduino bit that can magnetically click into place between the sensor on the hoop and the number bit. This bit replaces the traditional rows of header pins with three littleBit magnetic input connections on the left and three output ports on the right.

This is huge. It means that the student who needs to control his or her circuit programmatically is now able to do so without having to strip wires, connect components on breadboards, or deal with the complexity of a circuit design. This level of simplification is just the right amount of scaffolding that a student needs to engage meaningfully in programmable electronics.

Next page: New tool makes microcontroller programming easier


Of course, circuit design is only one of several challenges for students programming a microcontroller. Students who are novice programmers will also struggle to write the actual code. For several years, graphics-based programming tools like Scratch or Tynker have helped students learn programming fundamentals without having to struggle with the tedium of code writing. Arduinos, however, are programmed in a proprietary language that is based on Processing. This can be daunting for students who have never written code before.

Fortunately, a Spanish company called Citilab has developed a Scratch derivative that can be used to program an Arduino. Technically, S4A (Scratch for Arduino) code executes on a connected computer, not directly on the Arduino. It works by reading and writing to Arduino pins every 75ms, so this limits invention to those that can be tethered to a nearby computer. But this may be a great way to introduce beginner programmers to writing code for a microcontroller.

The Arduino bit addition to the littleBits library has effectively put microcontroller programming into the hands of young students regardless of their experience level. By eliminating the tedium of circuit building and breadboarding, the Arduino Bit leverages the power of the sophisticated but simple click-and-build system of littleBit circuit design. By combining this bit with a graphics based programming environment such as Scratch for Arduino, novice makers are will have an outstanding entry point into microcontroller programming.

Ultimately, they can progress to more traditional Arduino boards with circuits they build on breadboards. When this happens, they will be limited only by their imagination.

Trevor Shaw has worked as an ed-tech leader, speaker, writer, consultant, and classroom teacher for more than 20 years. He is currently the director of technology at the Dwight-Englewood School and can be reached at @shawt, +TrevorShaw, and shawt@d-e.org.