Brandon's Blog

9/18/2018

The Robot

The kids came up with a wacky idea to build a robot, which has been a complete blast.

I took a look at the available kits, and they’re undoubtedly impressive. Some are pretty much stylized RC cars, some don’t require building at all, and some try to use apps to enable some basic programming or at least scripting.  Never one to enjoy the shrink-wrapped solution, I stole a few ideas from the marketplace and struck off on my own.

It’s truly striking what Arduino and Raspberry Pi have done to the landscape.  Even as late as my college years, PIC microcontrollers were not as much pricey as difficult to work with, and easier solutions that weren’t ground-up DIY jobs were indeed fairly expensive.  Programming required flashing via a serial port, which was typically adapted to USB on the way to a laptop running very creaky C-based tooling.  Processing power was scarce, and the add-on and adapter scene was thin.

The Arduino-versus-Rpi debate is a difficult one.  An Arduino is a gift-wrapped microcontroller with all the good and bad stuff that comes with that: no general purpose as we know them, friendly but more bare-metal hardware interaction, lots of focused third-party libraries for robotics and automation, and good hardware support for things like generating timed pulsed waves and blinky lights.  Rpi gives you a whole other host of benefits: full Linux support with any programming language you’d like, wifi, storage, rougher but still available electronics integration, and a huge array of compatible devices.  You give up something no matter which way you go, but - depending on what you want to do - there’s almost always at least one good choice.

We went Rpi and haven’t looked back: because of the drivers and capabilities of Linux, I’ve been able to interact with the robot over wifi while it’s powered with an ordinary consumer USB battery pack.  A growing array of microcontroller-based daughter boards fill some of the gaps created by the more computer-like Rpi as opposed to the more task-focused Arduino.  Strikingly, these little boards are sophisticated, relatively (very relatively) user-friendly devices that generally cost between $5 and $15 apiece.  We need one for locomotive motor control, one for power control, and one for 180-degree servo control.  That set, plus a motor/gearbox/wheel kit, some mostly scrap electronic parts for hookup, scrap wood for a chassis, and some spare boxes and packaging for body parts, and we are working toward a workable model.  We built the gearbox ourselves from a boxed set at the kitchen table.  It’s layers of kit-based DIY with a good bit of custom engineering.

I wanted to add talking functionality, something that would have been entirely impossible several years ago.  Now it was as easy as a little USB portable speaker plugged into the Rpi, and a connection to a free (up to 1 MB of text per month) Google service to transcribe voice input and send back MP3s of synthesized speech.  I had it running in about 15 minutes with Python.

I have a clear ambition to make this grow with the kids, meaning I need to be tight enough with my codebase that it can eventually be adapted or expanded by the kids.  I’m not sure if this will ever actually happen, but it’s important to me that it becomes accessible to them if they’re interested.

It’s interesting to see their perspective on things.  Growing up in a moment that perhaps lacks game-changing breakthroughs but is more typified by the complete pedestrianization of what would previously be considered black frigging magic, you never know what will impress them.  They are keenly aware that I am (currently) “making the robot talk” with my computer, and that’s clearly not as impressive as the Alexa voice responding from the ether.  They crave autonomy, something I doubt I would have even thought to covet as a child.  They want it to go and do of its own accord, and they want to speak to it and have it speak back.  They appear somewhat mystified, but surprisingly not frustrated, when I give them the engineer’s assessments of each of their ideas: impossible, too tough for our budget, too tough for my knowledge, doable, easy.

I have purposefully avoided any kind of chassis materials that appear pre-made or purpose-built in any way.  I would prefer to use a Clorox wipe container (the current torso) than something from a kit.  I think they feel the improvisation of it, and I’m frequently fielding materials suggestions: use a Rubbermaid container, use a can of beans, use an old box, use a toilet paper tube.  It’s a fun exercise in craftsmanship and improvisation to view your household trash and sundries as potential parts for a robot. They have impressed me with their creativity, especially in an era that nearly gives up on a device if its charge port becomes loose.

My personal goal is to see a dance of the Hokey Pokey within a month or so.  We’ll see how it goes, and where they want to go with it from there.