Tuesday, January 1, 2013

Arduino Esplora as a fully wireless controller

I have finally cobbled together a fully wireless two-way controller using the Arduino Esplora board released in December.  It uses an XBee radio for two way communications, straps on a battery pack, and has a sketch to send and receive commands and send joystick & button presses.

In previous posts, I documented the Arduino Esplora "display" interface headers and I interfaced an XBee radio to two of the data lines on that header (which happen to be the hardware TTL level serial port).  The program communicated to a PC connected to another XBee via a USB board.  The solution was not truly "wireless" as the Esplora was still connected to a PC for USB 5 volt power (the designers did not make any known provisions for power beyond the USB port on the board).

Today I extended the Esplora project on two fronts.  First I used portions of the Arduino example code "EsploraKart" to map Esplora button presses and joystick movements to ASCII characters.  These are sent out via the XBee on Serial1 rather than the stock Keyboard method though.  I left in the two-way communication with the Esplora for sending sensor state and receiving RGB LED and buzzer commands to show the two-way functionality of the radio.

I also needed a battery source for 5 volts.  A nice Lithium Ion battery pack would be ideal but again attaching such is not in the current Esplora design.  So I hacked it.  I took an Energizer USB battery, usually used to power a cell phone in a jam and fed power into the USB port.  I attached it with a rubber band as time was rather short.

I loaded the new sketch and it worked.  It sends ASCII letters when the buttons are pressed and the joystick moves.  This can be used to control a computer game that expects such characters.  The Esplora may also be polled by the computer (all this wirelessly) for sensor info or to set the LED or buzzer.  Maybe a game creator would have the Esplora buzz when a game was lost or time up?  Or have the LED green for good progress, red otherwise?  The possibilities for expansion are quite large.

The code is again available as Open Source on my GitHub repository at https://github.com/TheKitty/EsploraSerial under in the EsploraXbeeController directory.  I think it's about 10 kilobytes or so, plenty of room to expand the functionality.

Here is a video of the controller in action:



Where should the project go next?