Tuesday, 10 June 2014

Lego Web Bot

I built this little guy a while ago and just havn't had a chance to post it yet. Its a rover built using Lego mindstorms that has a place for an iPod touch to be put inside, and that iPod touch connects to a web site hosted by my laptop when I want to run this thing, and another iPod, or phone or computer or whatever connects to another webpage served by the laptop that has an input page on it.

The iPod in the robot is a 4th gen iPod touch with a tinkerbrick case put on it (of course I have a lego case on my iPod :))
 Here are a couple pictures of the rover, showing the general structure and how the iPod is mounted inside:
 The rover uses a light sensor to react to the webpage that the iPod is connected to changing colour; you can see the light sensor sitting between the motors in this pic.
 iPod placed inside:
 And locked down. Note the camera is visible for future use :)

 Both the lock button on the iPod and the USB port on the NXT brick are acessable from the top when the cover is lifted:
 And the NXT brick's charge port is avalible from the bottom:
This is a video showing an early version of the webpages that are served by the computer
And the final version of the webpage:
Once you have watched those, it will be a bit easier to explain what goes on, so far as I know anyway. My friend actually built the webpage and javascript that runs this whole thing, but here is how I understand that it works: The laptop uses node.js to serve two webpages over the local network, one an input page that has buttons that can be clicked with a mouse, or a finger on a touchscreen, as well as the wasd and arrow keys on the keyboard, and uses those inputs *insert internet server black magic that I have no idea what goes on here* to change the colour of another webpage in real time. So I simply set up my laptop, start the node.js server from a command prompt, and direct the iPods to the IP address of the laptop, plus /input or /output for the respective pages and go to town. It feels magical to me. Anyway, here is the video that you really want to see, the rover actually moving. Note that my camera is getting really really old, and the delays that you see between touching the button on the iPod, the rover moving, and the sound are all due to the camera. In reality, the control is almost instantanious.

No comments:

Post a Comment