So what inspired you to build Pi2D2?
Growing up, I’ve always had a fascination for, and also a kind of a fear of, animatronics – you know, like the old Chuck E. Cheese-style robots and things. I was working with some people here in the barrio – we were restoring some old animatronics from a restaurant from the Eighties – and that’s when the Raspberry Pi came out. So my first thought was that I can just use this to control the animatronics, but then I also had other ideas. I thought I’d really like to make an R2D2 that was controlled with the Raspberry Pi. I saw that someone else online had already beaten me to it – they’d made a voice-activated R2D2 using the Raspberry Pi, and I thought that was really cool – but then I thought ‘What would I like to do with mine?’
I thought it would be kind of cool to be able to have direct control of him through a keyboard or a remote control, and then my wife had this old… like a Pico pocket projector that she bought off eBay that she wanted to use for a classroom, but she couldn’t really use it. And I thought I could do something with this, so I had the idea of just having a remote control R2D2 that could move around and would have a little projector that could project images against the wall, and also use him as a soundboard, where I could put as many sound files as I wanted onto it and have him go around the office here at Telltale Games and harass people.
And then I saw another tutorial online, which was about a guy that made a project called Cambot, where he used a webcam mounted on an RC remote control car that was powered by the Raspberry Pi. So I was able to take what he did and apply it to my own project. So, you know, a lot of these elements already existed, and it was a matter of putting it together and making it work.
What can Pi2D2 do, then? What features have you given him?
So it’s got a little USB stick that you can put in and load as many WAV files, MP3 files, even movie files, as you want. Once that’s put in, and you turn on the R2D2, he will join whatever Wi-Fi network you tell him to join. So then there’s a webpage; if you go to the IP address of the R2D2, you’re presented with a webpage, and it shows you a webcam and it shows you all the buttons for all the sounds that you put on your USB drive. You can hit keyboard shortcuts to play any sounds you want, and you can turn the projector on and off at will. You can play any video you want to from the webpage.
And that’s basically what it does. Working at a videogame company, I used the traditional keyboard controls for a moving character – so it’s WASD to move him around, and Space, and I can rotate his dome and look around and have him go up to people and talk to them, and kinda freak people out a bit at work.
Yeah I toyed with that – at the time when I was developing it, I didn’t really find a good library that did touch controls that well, but I think things have come out since then that do provide that, so that’s definitely something [to consider]. I have a lot of upgrades that I want to do to it and that’s one. I also want to… it’s kind of tricky to have him join whatever Wi-Fi network that you’re on, so I think I’m going to make it so that instead, he’s his own little Wi-Fi hotspot, so any computer can just log into him and then be presented with the webpage to control him. So that’s definitely the thing I want to do next.
So what’s powering it all?
It’s using a LiPo battery – actually two LiPo batteries – and one of them controls the Raspberry Pi, which is running the Raspbian Linux image, and then the other battery controls the DC motors for rotating the dome and the legs. So when you switch on the Raspberry Pi (and it usually takes about twenty seconds to boot up), it will join your Wi-Fi network automatically. Currently what I have him doing is, once he’s logged onto the network, he pings a PHP script on my server which provides you with his IP address, so then you can go to your browser, enter that IP address and you’re presented with the webpage and webcam and the buttons, and you can control him however you want.
You seem to have some storage compartments built in as well?
Yeah the original toy comes with two little storage compartments on the side. One has a little upholder that extends, and you can put in a glass of beer or something, and the other one was left empty. It was important to me for whatever reason to keep the upholder intact, which I was able to do. And then the other side, when you open it, that’s where the charging ports are for the projector and the battery for the motors, and that’s also where you insert your USB drive that has all the sounds and videos and that. I have it where if you name the files in a certain way – like 1.wav, 2.wav – those keys on your keyboard will also play it, if you want to have super quick control.
How much time do you think it took?
It was a pretty long project. I didn’t work on it full time, obviously, but I probably worked on it over a period of six months, and most of the time was writing the software. A lot of the software was written in Python – like the controls for the webcam, the soundboard and everything – so most of the time was getting the software running and getting the kinks worked out. Like where if it loses a Wi-Fi connection it tries to rejoin and things like that. So, yeah, I definitely want to revisit it, and obviously the second time round you can do it a lot better than you did the first, so I’d like to go back.
Maybe you could introduce C3PO for the next one…
You know, here at Telltale we’re working on a Borderlands game and I thought it’d be really fun to make a Borderlands robot that would go around the office and harass people. So, you know… you never know.
You can check out the original hacked R2D2, with facial recognition that inspired Andrew over at: http://hackaday.com/2013/03/23/hacked-interactive-r2d2-controlled-by-raspberry-pi/.
For the full list of hardware components used to make Pi2D2, see Andrew’s blog: http://www.langleycreations.com/blog/?p=17.