Using microcontrollers in an Introductory course

Are there any advantages to using small microcontrollers (such as an Arduino, etc.) with tactile, physical I/O (such as buttons, LEDs, robotic actuators, etc.)? For instance, does it help create more interest in learning computer programming, or widen the potential audience among kids and undergrads for going further in their CS education?

• I think there are two questions here: one about the appeal for adult students (undergrads), and one for kids. Since the current answers don't focus on kids, I would recommend focusing the question on adults. May 23 '17 at 21:28

Microcontrollers can address two important aspects.

The first is bridging the gap between the code, and the real world. Particularly if you have sensors (accelerometer, buttons) and outputs (an LED array, sound, motors). Not just to address the robotics aspect (which can rapidly get complex), but some simple game concepts (patterns, reactions). Nothing which is any harder than doing the same on a Raspberry Pi with a GPIO extension, but potentially cheaper hardware (which is important if it is likely to get fried). Also, if you want a battery powered device, or a small data-logger, a microbit is more suitable than a Raspberry-Pi.

For introductory use, I think creating a simple tilt-sensitive animation is a very effective way of making 'coding' seem more real. Yes, the coding gets more complicated if you want to do more - but starting in a block editor or python avoids this.

The more tactile, less 'black box' approach to coding seems (according to research by the BBC) seems to provide more up-front interest to less technical students.

The second aspect is working in a resource-constrained environment. Admittedly this is more a advanced concept to teach, but the microcontroller is 'clearly' a different beast to a laptop or a phone. Having some restrictions sometimes help people to solve problems more easily than giving them the blank sheet of 'plus anything you can find a python library for'. A computer small enough to wear on a lanyard will shift the way students think about what is possible.

If the goal is to create more interest in learning programming (as you state above), then Arduinos are not the strongest vehicles for reaching that end. The logic of void setup() and void loop() are not immediately accessible nor intuitive to a student brand new to programming. For one who is experienced and/or is inclined toward mechanical/electrical engineering, then Arduinos are fantastic.

That being said, I have seen firsthand how a Raspberry Pi can indeed be that inspiring device for wanting to learn more.

• It's a full computer. The simple fact that you can spend \$35 on a computer (not including peripherals) is mind-blowing to start. The sheer size/cost is initially surprising and piques curiosity. Plus, this makes for a great conversation about operating systems and open source.
• Students can level up. A student can begin with Scratch, make music with Sonic Pi, make art with Processing, hack Minecraft with Python, learn the basics of the Linux command line, and potentially move on to Java with BlueJ. To me, it is the essence of "low-floor, high-ceiling" when it comes to learning programming.
• GPIO pins unite programming and physical computing. A student who becomes adept at Scratch can move on to interacting with lights, buttons, and sensors even from just within Scratch. Using a variety of accessories, such as the Pi Camera or the Sense Hat, students can go from software to hardware seamlessly.

I could go on and on, but I think in terms of creating excitement and interest, the Pi is incredibly successful.

• In my opinion the two main disadvantages of the Raspberry Pi are the cost (besides the Pi you'll also need displays and keyboard+mouse), and the complexity of running a full Linux system. Learning how to use a new operating system by itself can already be a barrier to entry, and it can be time-consuming to troubleshoot and fix the OS if something goes wrong. An Arduino can in that respect can be easier as flashing a new program is a fresh start. Additionally there is plenty of room for a variety of skill levels, as there are tools which allow block-based programming of the Arduino too. May 25 '17 at 15:13
• Fair points. As for the cost, and I know this is not universal, my school has quite a few old displays/keyboard/mice. Without older peripherals to use, then the cost issue does arise. Additionally, the HDMI-VGA connection with older displays is not without its issues. The command-line environment aside, I think the latest PIXEL desktop goes a long way to making the OS more beginner-friendly. Out of curiosity, what are the block-based tools for Arduino? I always used the now-defunct codebender on a Chromebook, so I haven't seen a non-text based IDE. May 25 '17 at 19:13
• There are Scratch plugins for interfacing with Arduino and mod called S4A. There is also library called BlocklyDuino which is a port of Blockly to generate code for the Arduino. One project which uses it is iForge. I'm also using a 3rd party Arduino called the LightBlue Bean which can be programmed over bluetooth from an iPad. It can be programmed with blocks in the iPad apps Tickle and Bean Forge. May 26 '17 at 15:41

Advantages compared to what? I will assume compared to programming abstract applications on a desktop.

Programming abstract applications on a microcontroller does not provide any obvious advantages, beyond teaching students what a microcontroller is.

You get advantages when it comes to what I call "Applied Programming".

On a desktop, it's difficult (but not impossible) to come up with something that's within students' capabilities to program, is useful or fun, and of which you can't download a better version from the internet.

If your application involves hardware, you can't download it from the internet. Microcontrollers + hardware allow students to build something "tangible". Something they can see and touch. For some - but not all - students this offers far greater motivation, especially in a context that is more akin to a workshop than a classroom.

If you're not producing something tangible, I don't see much benefit to using microcontrollers. Microcontrollers are not the only way to produce something tangible, but given their low price point they are a competitive option.

• Welcome to Computer Science Educators! This is quite a useful answer. I hope we'll see more contributions from you in the future! Mar 11 '18 at 18:27
• Thanks. [This comment will self destruct after some time has passed.] Mar 11 '18 at 19:25