Posts Tagged robot

Android controlled Arduino bot

This is a project which me and a friend of mine (bytesandlogics.wordpress.com) attempted long time back.

It is a robot which is controlled by a cell phone.

It makes use of the Arduino and the android platform. It’s a simple bot which has an arduino board, powered by the Atmega328 microcontroller, as the brain. However the microcontroller receives its command from an Android phone.

The inspiration for the project was to acquire the ability to affect the physical environment around us using a device to which everyone has access to ….Cell phone.

The following components were used in making it:

  • Arduino boards
  • RF Transmitter/Receiver
  • L293D motor driver
  • Motors
  • Laptop
  • Android phone

So….this is how it works..

The first stage of this project is to have a graphical user interface with which the people can interact. As the robot, at this stage, only needs to maneuver in two dimensions, the GUI is not as impressive as it would need to be for more advanced applications. Currently it is just a group of 5 buttons namely…front, back, right, left and stop.

The real action is however the one that cannot be seen. This was the tough part actually. Since none of us was well versed with java and Android programming, it took a fair amount of searching and learning in order to get the communication set up. Right now only the bare basics of communications have been included in the project.

When the application is run, it first checks to see if the Bluetooth on the phone is enabled. If not it asks permission to enable it.

Next the list of the devices with which the phone had previously paired with is presented. Since the app is in a very crude stage, the ability of searching for new devices has not been included.

Once the device is selected it establishes a link with it. Here the other device with which the phone communicates is my laptop. The laptop acts as a server and has a python script running which bridges the link between the Bluetooth and the USB serial port.

Once the link is established, the user can press one off the buttons to maneuver the bot. Behind every button click there is a listener which then takes a byte code representing that button and sends it to the server.

The server is a Python script running on the laptop. It is nothing but a tunnel which directs the input from the bluetooth to the serial port.

The server then forwards this number to the serial port.

The serial port has an arduino board attached to it which is further connected to the RF transmitter.

The transmitter was in turn attached to another arduino board. To work with RF communication we used the VirtualWire library which is very well documented and made the job really easy.

The transmitter then forwards this code to the receiver on the bot. On getting the data from the RF receiver the microcontroller calls upon the appropriate functions which set the inputs of the Motor driver ic L293D to HIGH & LOW values correspondingly to maneuver the robot.

As you might have noticed, we had to take the longer route here. Since we dont have a bluetooth module for direct contact with the arduino, we had to use the laptop as an intermediate (with the module the laptop wont be required at all).

You can check out the video of what we ended up with at: Here ‘s the video

Advertisements

, , ,

1 Comment