Tuesday, November 8, 2016

On Teaching 5th Grade Programming

I know that 5th graders can code. 

The kids last year did a great job programming their Lego Mindstorm NXT robots in LabView, although I witnessed some confusion about the graphical representations. Perhaps Scratch, specifically Scratch 4 Arduino (S4A), might be an option. MiniBloq would be another possibility.

Still, I feel it will be easier for kids to learn a syntactically simple text-based language, like Python, Lua, BASIC, or SPIN. Why not C-syntax languages? I have witnessed too much time wasted on syntax problems--semicolons and braces--which I think distracts from core learning.

It is a bit of a quandary for me. What do you think?

Microcontroller Board

Low cost is a key factor. We'll have 5-7 teams, so anything that costs $25 or less would be affordable.

With DIP microcontrollers, we could use breadboards (adding slightly to cost) but kids may spend more time troubleshooting loose wires than solving the problem so I'd prefer to build a baseboard.

I am a huge fan of 3-pin servo-style connectors for my robots which greatly simplifies wiring, but non-reversable connectors would be better.

There's always the Raspberry Pi Zero at only $5. The cost is right but the kids may have to learn some basic Linux and we'd need a baseboard with serial or bluetooth. And honestly a Pi is way overpowered for what I have in mind.


Since learning Python, it feels like the BASIC of the new century. It's way more powerful, but simple to learn the basics, is wildly cross-platform portable, hugely popular, and much more. 

And of course I'm a big fan of MicroPython, which powers OpenMV Cam.

However, it is quite a challenge to find an suitable microcontroller board with a full MicroPython port that doesn't cost too much. PyBoard is over budget and requires a baseboard too. Teensy 3.5 and is powerful and low cost, but requires a baseboard and the port isn't done yet. 


Seems good for education and the interpreter is somewhat lightweight like MicroPython but, similarly, choices of microcontroller boards appear to be limited. And Lua is nowhere near as popular as Python so they might struggle more to find help after the club.


This old language lends itself well to education. It's about as lightweight as interpreters come, so I should be able to get a BASIC implementation running on my PIPduino, which would be free for the club (thanks to glacially slow sales).

Coridium's $10 ARM-based BASIC Chip, which is an LPC1114, is designed for embedded use and even the cost of fabbing a baseboard wouldn't kill the budget.

But BASIC isn't standardized across platforms so I'm not sure they could readily apply what they've learned on their PCs like they could with Python or even Lua.


  1. Could you get MicroPython running on the affordable NUCLEO-L432KC or NUCLEO-L476RG boards? They both have

    I personally don't like Python for robotics because I want to catch as many typos or other errors before I start the robot running, not during. Does MicroPython address this somehow? But maybe for kids, it is valuable to let them run a half-broken program.

    1. Thanks for the comment! And Good thinking. I was actually looking at the nucleo boards not long ago.

      You bring up a great point about typos with an interpreted language. Also, pointed out to me by a few pals locally, these kids don't have great typing skills so the frustration would get high quickly.

      I am going to go with Google Blockly graphical programming and PICAXE which are low cost PIC microcontrollers that use compiled basic. They have a Blockly app for Chromebooks which we have ready access to at school. More in a future post. :)

  2. Maybe consider teaching the kids using Rust. You would get compile-time error-checking. You would be able to make it work on smaller processors and it should run way faster than MicroPython. You could write all of the code running on the board in Rust, so if your kids ever want to see what is happening at a lower level or write some lower-level code themselves, they don't have to learn a new language. Rust already works on ARM Cortex processors, and there is a project to get it working on 8-bit AVRs as well. Maybe you can write some libraries that keep the kids away from the more advanced language features like references.


Note: Only a member of this blog may post a comment.