Hacking my Roomba

2018

Like most programmers, I live alone, which means I end up in charge of rather more housework than I am altogether prepared to do. To fix it, I bought a Roomba. Specifically, I bought the cheapest Roomba there is, on the basis that it's a robot that cleans my floor and I didn't entirely understand what the premium version of that product would be.

It turns out that the cheap one can't be scheduled to run at a particular time. At least, OK, you could do it using the buttons on top if you buy this tiny internet-enabled robot designed to sit next to buttons and press them when you activate it.. If you take the face-plate off, there's a serial port, and if you send the number 135 into it, the Roomba will clean the floor.

The serial port in the top of a Roomba

Perhaps the normal way of doing this is with an Arduino, but I don't really know how those work. I'm a JavaScript guy, so I did what I knew and bought a Raspberry Pi Zero W, a voltage regulator, a logic level converter, and quite a lot of wires.

I then wrote a Node.js library to control the Roomba, using a standard serial port library, and the Pi's in-built GPIO control command. It worked very well, and I was able to SSH into my vacuum cleaner and tell it to hoover the floor.

Which is great and all, but it's not entirely less effort than walking over and pressing the button. But because I'm using Node here, I could add an Express server. By making it a Progressive Web App, I could even make it install on my phone's home screen. As long as I'm on the network, I am living in a wholly non-sinister future where I am using a Nexus 5 Android to control a helper droid made by a firm called iRobot. It sure is lucky there's no way this could possibly end in dystopia.. If I go one step further, and With a password, I can clean the floor from anywhere. I can connect it to If This Then That and clean the floor with my voice.

Which means I now legitimately own a Smart Device, and so the obvious question is, can it run Doom? And I mean, yes, it's a regular PC. I just happen to have taped it to a vacuum cleaner, for which it can hardly be blamed. Although to be fair I didn't tape a screen to it so while it can merrily play Doom to itself, you wouldn't be able to join in.

By this point I've done everything I wanted: I've got a server running that lets me control the Roomba, I can schedule it, I can start it cleaning, and send it home, and it'll play its merry Roomba song when it gets there. I can do everything the premium housework-robot can do and more… and yet somehow I don't feel like I'm using the hack to its full potential.

Because the serial connection doesn't just mimic the buttons. I can control the Roomba more directly. I can turn the lights on and off; I can turn the brush motors on and off; I can read the sensors; I can even upload my own merry Roomba songs so it will play I Want To Break Free while it trundles around cleaning my floor. And I can drive the wheels myself.

And to be honest, I'm not using the other end of the hack to its full potential. I've got a web browser at my disposal. I don't have to limit myself to buttons and links any more. I have APIs to access webcams and touchscreens, and even the accelerometers on my phone. And I can even access my gamepad. So naturally I rigged my Roomba so I could drive it around with a videogame controller.

I guess I could have stopped there.

But actually, there's another thing modern web browsers can do: they can stream video. So I fitted a camera to the Pi, and now it really can play Doom. Sure, not actual Doom, but I've got I mean the Roomba can't go up or down stairs, but then arguably you can't do that in Doom anyway. and I can control it with a gamepad. That's a first-person shooter in my book.

And yes, I do mean "shooter". Because I mounted the camera on the back of the Roomba, and the back of the Roomba has a vent — all vacuum cleaners do, or else they'd explode if they sucked in too much air and it couldn't go anywhere. So as well as Backwards, so it would feel right with the camera mounted on the rear., I mapped the A button to the suction fan. Arranging a few This is an olden-days videogame technique called 'scaled sprites'. around my room, I can move around them and shoot them with blasts of air, killing them.

And so I present: Doomba.