Out: Hot rods. In: Robots.

Publication date: 4 May 2010
Originally published, in a smaller version, 2009 in Atomic: Maximum Power Computing
Last modified 03-Dec-2011.

 

Back when the integrated circuit was young, it was a selling point to say that a gadget contained a "silicon chip". Nowadays, we're surprised if a car or telephone or microwave oven doesn't have a CPU.

The downside of this is that if something goes wrong with modern devices, you often can't fix them without buying a whole new circuit board, which for unusual or several-years-old appliances may be ridiculously expensive. (Don't even ask about cars.)

The upside, though, is that even as the repairability and hackability of common household devices has been falling, the accessibility of computerised control systems for home hobbyists has been going up. This has opened up whole new vistas for the part-time hardware hacker.

The CPUs in cars and appliances are usually integrated into a "microcontroller" (C, for short), a tiny little computer built into one chip. The simplest microcontrollers have the brainpower of a personal computer from 1980, but often rather less memory, because the programs they have to run are usually tiny. You don't need a million lines of code to run a dishwasher.

Several modern microcontrollers, though, have the CPU power of a PC from 1990, or even 2000. And it's not terribly hard to hook them up to, say, a Flash memory card, if you need bulk storage.

Actually, it's not hard to hook a modern microcontroller up to pretty much anything. Just look at blogs like Hack A Day or Make Online, where every second post seems to mention a microcontroller.

The Cs in these projects are "single-board microcontrollers", little circuit boards that contain a C and supporting components. They don't do anything you couldn't do with the bare microcontroller and extra bits you bought yourself, but they make development a lot easier. They let you easily connect input and output devices, a power supply, and a data cable to load a program onto the C from a "real" computer.

Yes, you do have to do some actual programming to make a microcontroller do stuff. But there are several easy-to-learn languages that work with one or more flavour of C. The good old "BASIC Stamp" - first sold in the early 1990s, and still available, along with umpteen clones - has a BASIC interpreter in ROM. There are several other languages specially made to be highly accessible to new coders, and which work well with Cs; look, for instance, at the development suite that comes with the deservedly-ubiquitous Arduino and its clones, the related "Processing", and the Parallax Propeller's "Spin". (See also "Fritzing", which aims to simplify turning your hacked-up C project into an actual product.)

And you can even get point-and-click graphical-flowchart programming interfaces for microcontrollers, like for instance the dirt cheap PICAXE. If you're not even comfortable with an electronics-prototyping "breadboard", let alone soldering, check out Lego's "Mindstorms" gear! The basic Mindstorms programming interface is point-and-click, but that's all you need for a lot of tasks, and there are numerous more powerful languages that work with Mindstorms controllers too. Third-party companies even make add-on sensors (and compatible parts made of metal!). So Lego is now a surprisingly capable robotics prototyping system.

It's been possible to do this sort of thing since the early personal-computer days - people hooked up many odd devices to their Apple II or Commodore 64, often via the serial or parallel port. (Parallel ports weren't standard equipment for a lot of early home computers, by the way; you can now get a couple of terabytes of hard disk space for the price of a lousy parallel-port card for an Apple II.)

The difference between doing it with a desktop computer then and doing it with a microcontroller now, besides better entry-level programming languages, is that a computer able to do this stuff in the early 80s was really expensive (even without a parallel port...). But single-board Cs are very cheap. And can, you know, fit in a cigarette packet and run from a 9V battery.

Look at the fancy "Duemilanove" board that's currently the top of the "Arduino" line, for instance. It'll cost you less than forty Australian dollars; less than $30, in the States. And another $40 will buy you more than enough loose transistors and switches and resistors and LEDs and motors and buzzers and wire for lots of educational experimenting.

And this is a high-powered C board, that can do a lot more than most people need. If all you want is an ordinary single-board microcontroller, you can pay considerably less. Or a little more, for a "development board" with a lot of fiddly stuff already done for you. Oh, and then there's Atmel's AVR Butterfly, which has a joystick, speaker, clock, flash RAM, temperature and voltage sensors, and a little LCD screen, for twenty US dollars.

The microcontroller world also doesn't move as fast as PC technology, but better, cheaper Cs are still coming along all the time.

These things are so cheap, and so accessible, that people are even using them for tasks that obviously do not actually require a general-purpose stored-program computer with multiple inputs and outputs. There are lots of electronics projects - think of a "sun tracker" to aim a solar panel, say - that clearly only actually need a few logic gates. Such projects can quite easily be assembled out of simple components, with just a few transistors and/or relays and perhaps a couple of mechanical linkages.

But when you can buy a real computer with thousands, or millions, of transistors for pocket change, why not?

Your tabletop physical Pong machine could be controlled by pinball-machine components from 1950... or by an ATmega168. See also the even-more-conceptually-simple, also-microcontroller-equipped, robotic crawling pumpkin.

An ATmega168 chip costs about four bucks, by the way. That's without a programmer, but still. Playing with microcontrollers is not exactly the sport of kings.

It's actually reached the point where microcontrollers are the first port of call for anybody who wants to make something with a bit of logic in it. Nobody's figured out an excuse to put a microcontroller in a Tweenbot yet, but it's clearly only a matter of time.

I mean, let's say you want to make a little two-wheeled "inverted pendulum" balancing robot, for instance. You can do that with a pretty simple analogue circuit. (That site is fantastic, by the way.) Heck, you can almost do it with one switch.

Or you can use a microcontroller, as many people have. (There are, of course, numerous Lego versions. Lego parts even sneak into many of the non-Lego ones. It makes the occasional makes a Fischertechnik version a pleasant change.)

Now, once you've got a computer-controlled balancing doodad, it's much easier to tune its behaviour, and unexpectedly complex tuning issues are to be expected for real-world applications like, say, a full-sized Segway clone. That second page has a lengthy explanation of the large number of problems you have to solve in order to make a balancing scooter that won't, when faced with any of a large number of common real-world situations, whip your face into the ground before you can get past the "f" at the start of the word you're trying to say. For systems that actually need a complex sensor and control setup, a microcontroller lets you handle all of the connect-this-to-that issues without creating a terrifying analogue rats' nest.

You could also probably make a pulse oximeter with a few breadboarded components - especially if you're allowed to use simple integrated circuits. But if you want a pretty screen...

And the list goes on. A dice reader! An algae bioreactors! A slot machine! A wrist-mounted flamethrower!

(And a whole genre of useless machinery for which including a microcontroller is part of the joke.)

Sure, most of the capacity of the Cs in just about all of these projects is wasted. Many of them could have been made in days of yore, out of switches and latching relays and springs and cams. And in the early personal-computer days, the idea of using a whole dedicated general-purpose computer to do sensing and control tasks in small hobby devices was outrageous. But nowadays microcontroller boards are cheap, and you can just use a little program to create very complex control systems.

If you don't find this new Age of the Microcontroller Hobbyist rather exciting, I contend that your imagination may be defective. We are now, unexpectedly, living in an age when children can no longer get a proper chemistry set, but can make autonomous robots.

I'm immensely excited to see what those kids make when they grow up.

(And also a little afraid.)

Other columns

Learning to love depreciation

Overclockers: Get in early!

Stuff I Hate

Why Macs annoy me

USB: It's worth what you pay

"Great product! Doesn't work!"

The virus I want to see

Lies, damned lies and marketing

Unconventional wisdom

How not to e-mail me

Dan's Quick Guide to Memory Effect, You Idiots

Your computer is not alive

What's the point of robot pets?

Learning from spam

Why it doesn't matter whether censorware works

The price of power

The CPU Cooler Snap Judgement Guide

Avoiding electrocution

Video memory mysteries

New ways to be wrong

Clearing the VR hurdles

Not So Super

Do you have a license for that Athlon?

Cool bananas

Getting rid of the disks

LCDs, CRTs, and geese

Filling up the laptop

IMAX computing

Digital couch potatoes, arise!

Invisible miracles

Those darn wires

Wossit cost, then?

PFC decoded

Cheap high-res TV: Forget it.

V-Pr0n

Dan Squints At The Future, Again

The programmable matter revolution

Sounding better

Reality Plus™!

I want my Tidy-Bot!

Less go, more show

In search of stupidity

It's SnitchCam time!

Power struggle

Speakers versus headphones

Getting paid to play

Hurdles on the upgrade path

Hatin' on lithium ion

Wanted: Cheap giant bit barrel

The screen you'll be using tomorrow

Cool gadget. Ten bucks.

Open Sesame!

Absolutely accurate predictions

The truth about everything

Burr walnut computing

Nothing new behind the lens

Do it yourself. Almost.

The quest for physicality

Tool time

Pretty PCs - the quest continues

The USB drive time bomb

Closer to quietness

Stuff You Should Want

The modular car

Dumb smart houses

Enough already with the megapixels

Inching toward the NAS of our dreams

Older than dirt

The Synthetics are coming

Pr0nBack!

Game Over is nigh

The Embarrassingly Easy Case Mod

Dumb then, smart now

Fuel cells - are we there yet?

A PC full of magnets

Knowledge is weakness

One Laptop Per Me

The Land of Wind, Ghosts and Minimised Windows

Things that change, things that don't

Water power

Great interface disasters

Doughnut-shaped universes

Grease and hard drive change

Save me!

Impossible antenna, only $50!

I'm ready for my upgrade

The Great Apathetic Revolution

Protect the Wi-Fi wilderness!

Wi-Fi pirate radio

The benign botnet

Meet the new DRM, same as the old DRM

Your laptop is lying to you

Welcome to super-surveillance

Lemon-fresh power supplies

A>B>C>A!

Internet washing machines, and magic rip-off boxes

GPGPU and the Law of New Features

Are you going to believe me, or your lying eyes?

We're all prisoners of game theory

I think I'm turning cyborg-ese, I really think so

Half an ounce of electrons

Next stop, clay tablets

A bold new computer metaphor

Won't someone PLEASE think of the hard drives?!

Alternate history

From aerial torpedoes to RoboCars

How fast is a hard drive? How long is a piece of string?

"In tonight's episode of Fallout 4..."

How hot is too hot?

Nerd Skill Number One

What'll be free next?

Out: Hot rods. In: Robots.

500 gig per second, if we don't get a flat

No spaceship? No sale.

The shifting goalposts of AI

Steal This Education

Next stop: Hardware piracy

A hundred years of EULAs

The triumph of niceness

The daily grind

Speed kings

Alt-tCRASH

Game crazy

Five trillion bits flying in loose formation

Cannibalise the corpses!

One-note NPCs

Big Brother is watching you play

Have you wasted enough time today?

The newt hits! You die...

Stuck in the foothills

A modest censorship proposal

In Praise of the Fisheye

Filenames.WTF

The death of the manual

Of magic lanterns, and MMORPGs

When you have eliminated the impossible...

Welcome to dream-land

Welcome to my museum

Stomp, don't sprint!

Grinding myself down

Pathfinding to everywhere

A deadly mouse trap

If it looks random, it probably isn't

Identical voices and phantom swords

Boing!

Socialised entertainment

Warfare. Aliens. Car crashes. ENTERTAINMENT!

On the h4xx0ring of p4sswordZ

Seeing past the normal

Science versus SoftRAM

Righteous bits

Random... ish... numbers

I get letters

Money for nothing

Of course you'd download a car. Or a gun!

A comforting lie



Give Dan some money!
(and no-one gets hurt)