Robot in a night

So in the spirit of complete disclosure I have to say that the robot was from a kit, and that the only additions were three resistors and a bluetooth module but still  its pretty cool that home / hobby electronics has progressed to the point where its possible to build a robot in one night that you can control over bluetooth from a cellphone.

20140303_085757 (Resized)

The base of the robot is a Pololu Zumo ( As per the website these are a small, tracked robot platform that is less than 10 cm on each side – small enough to qualify for Mini Sumo competitions I got mine from along with the 100:1 metal gear motors and a Funduino Uno.

20140303_090342 (Resized)

Onto that I added a JY-MCU bluetooth module. These can be found on multiple websites for around $8USD. Looking through the various forum posts it appears that people have had various levels of success in interfacing and using these modules in their project, mainly due to the limited documentation available, the various levels of firmware (which generally is either not listed on the site selling the module or is incorrect) and the copied-out-of-china lineage most of the available offerings have.

20140303_085813 (Resized)

About 6 months ago I purchased three of these modules off deal extreme for a good price but thus far they have just sat in my interesting parts bin waiting for a worthy project to come along. Now after my success with them on this robot I’m going to jump on again and grab some more as they seem to have a whole lot of potential.

The first step in getting the module to work was wiring it up to the Pololu shield. The module apparently takes 3.6 to 6v according to the silk screen but several other blogs indicated that in fact the modules liked nothing other than 3.3v to work correctly. Fortunately the Uno clone has a 3.3v regulator on board with enough capacity to power one of these units. Connect this to the VCC pin on the bluetooth module and the GND pin to the GND on the shield and half the jobs done. The TXD pin can be connected to any of the free pins on the Pololu shield (I used pin 5) and then connect the RXD pin (via a 1k resistor) to another pin (I used 4). Also connect the RXD pin to GND via either a 2.2k resistor or as I did two 1k resistors in series. This is to level shift the 5v output from the Arduino to something more 3.3v friendly. Make sure when choosing the data pins that you don’t wire it up to a pin that is already used for motor control or the buzzer or something, Check the datasheet!

20140303_085833 (Resized)

The shield is quite well designed in that unlike most Arduino shields all the components face the Arduino board so careful placement is needed to ensure that nothing collides but at the same time is really annoying. There is little if no prototyping space on the shield and what space there is is almost written off due to clearance issues with the USB socket on the Arduino board. As a result I had to squish all the bluetooth stuff in one corner.

20140303_085823 (Resized)

Once the hardware side of things is done its time to start on the software. The Arduino code is really simple. A software serial port is setup on pins 4 and 5 (or whatever pins you choose to connect the bluetooth module to). In the loop section of the code the any data coming in the serial port is read into a single byte variable which is then compared to expected values in 5 “IF” statements. If the expected byte was received then the robot triggers the motor outputs in the expected direction. Code available on GitHub.

On the cellphone side of things a quick program was chucked together in the MIT app inventor software online. One drop down list automatically populates on program start with a list of all paired devices. When a device is picked from the list then the software tries to open a serial connection with the chosen device. Once the connection is open then the 5 direction buttons are activated allowing you with the press of a button to send one of 5 bytes representing the ASCII characters L, R, F, B and S (left, right, forward, back and stop).

Screenshot_2014-03-03-08-59-51 (Resized)

Unfortunately at the moment the MIT software doesn’t have a button down function meaning that it only sends the command once when the button is first pressed. Basically this means that the two options are to either tell the robot to drive forward when the button is pressed and continue until another command is received or to drive forward for a set period of time and then stop until another button is pressed. Ideally the software would send through the forward command as long as the button was held down and would stop as soon as the button was released. If anyone can thing of a way of doing this programmatically using only a single trigger when the button is initially pressed I’d love to know 😀



Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s