Wednesday, February 1, 2012

HexBot Arduino - Netduino Wireless IR Controller

I got a new IR toy, a HexBot, and wanted to create an IR controller similar to what I did with my helicopter.
I also got a new Netduino Plus board that I wanted to try!

I ran into some problems with the netduino board while trying to create a simple IR emitter, because the netduino utilizes the .NET Micro Framework, which generates managed code and hence can't do real-time to the microsecond responses to generate the IR pulses.

So I went back to the arduino board, and used the old decoding program to get the pulses.
It's quite a simpler device, with just four buttons. The IR pulses are in the arduino code attached below.

But, I wanted to use my netduino too! so I created a program (utilizing NeonMika Webserver) to load a html page that shows the possible moves, and goes back to the server on each click, to activate ports.
I first tried to get SPI working between netduino and arduino, but it didn't work right away, and since I just need 4 flags, one for each direction, I found it easier to just allocate 4 pins for the communication between the devices.
Netduino pins 1-4 to arduino 4-7. Once pin 4 is ON, the arduino code sends the forward pulse. Same for each other direction.

Attached is the code for the webserver, and the arduino!

For now you can control the HexBot with a cellphone (on the same network) by browsing to the netduino (port 8080).

I have a few ideas on what to move next. Maybe store paths and image recognition to identify obstacles?

Here is the robot walking.

And here the new remote control!

A closer look at the setup, Arduino and Netduino playing nice

Netduino Plus webpage used:

And the Arduino code to handle the netduino requests and emit IR pulses: