The messages are sent over a bluetooth connection between the sender and the bot. For my usage, I used a HTC WIldfire running the Blueterm application to send serial commands to bot. The bluetooth module I used on the bot is Bluesmirf Gold which has a default baud rate as 115200. I don't have an FTDI cable to change the baud rate. The baud rate setting shouldn't matter much but whatever is the baud rate of the module, you should set up a serial port of the same baud rate in the arduino code. Otherwise you'll get undefined states and the bot won't function as wanted < imagine R2D2 scream >.
Step 1: Parts
Bluesmirf Gold (or any suitable bluetooth module)
Double line LCD based on the Hitachi HD44780 (most common)
Two 100 rpm geared motors
L298 motor driver
Connectors for the birch strip
Lots of single strand wire
General Purpose Board (GPB) ....... if you choose to solder everything
Solder (lots of it if you choose to solder everything)
If you can procure a Arduino shield kit, things will be much easier and more reliable as the present connections to the arduino are not very tight. In India, a shield board is quite expensive and I couldn't find it any where I searched. (if you are from Bangalore and are an electronics geek, you should be familiar with SP Road :P). total cost is about 80 to 100 dollars. The bluesmirf is the most expensive part at 60 dollars.
Step 2: LCD Wiring
The LCD was wired up as shown in the tutorial on LadyAda. I just soldered everything on to a pcb and made an
extension for it using the ribbon cable to allow it to be flexible. I also used a birch strip to make it easily
link for the tutorial: www.ladyada.net/learn/lcd/charlcd.html
The connections are tabulated below for easy reference:
3 Contrast Adjustment Pot
4 Arduino pin 2
5 Ground (always in write mode)
6 Arduino pin 3
7 No connection
8 No connection
9 No connection
10 No connection
11 Arduino pin 4
12 Arduino pin 5
13 Arduino pin 6
14 Arduino pin 7
Step 3: Motor Driver Wiring
The L298 doesn't come in a standard DIP (dual inline package). Hence you can't mount it on a breadboard. You
have to solder it onto a GPB. This is what I did and drew some wires out of every pin to allow for connection to
the arduino and the bread board.
The pin connections are tabulated below for easy reference:
2 Pin 1 of motor 1
3 Pin 2 of motor 1
4 9V supply of motor
5 Arduino pin 8
6 +5V from arduino
7 Arduino pin 9
9 +5V from arduino
10 Arduino pin 10
11 +5V from arduino
12 Arduino pin 11
13 Pin 1 of motor 2
14 Pin 2 of motor 2
This is the easiest connection scheme and it uses the least no of arduino pins, 4. I have made the enables always
high by connecting them to +5V and the current sensing always low by connecting to ground. Look at the pin
diagram to find the pin functions.
Step 4: Bluesmirf Prep
Step 5: Arduino Connections:
Step 6: Arduino Code
//setting up LCD using the LiquidCrystal library
//setting up motor pins as output
//defining an lcd of 16*2
//starting serial link
/*the wires might have gotten interchanged a little so fiddle around with which pin goes high when to get the
proper code for movement in any direction*/
//function for forward movement
//function for backward movement
//function for turning left on its axis
//function for turning right on its axis
//function for stopping all motion
void move_code(char x)
//function for displaying message while in motion and controlling the movement of bot
lcd.print("You typed shit..");
//function for displaying message typed
Step 7: Housing and Final Construction:
I used an old plastic box meant for sweets to house the arduino and the breadboard. I cut small holes in the lid to allow the ribbon cable for the LCD, the connector for the bluemsirf, and the wires to the motors go out. I used a rectangular piece of wood to hold the motors and attach it to the base of the box. I wanted to mount the LCD high by using some ice cream sticks, rubber bands and a stationary clip but the lid wasn't stable enough. I used some ice cream sticks for balancing the bot cause i didn't have any castor wheels.
Step 8: Why It Screwed Up
The main reasons for it not working well were:
1. The batteries were not powerful enough, all the pics where the lcd is bright were taken using a USB wall wart. And the wheels barely used to turn when in movement mode.
2. The cable management was not clean so qt every stage I had to keep checking whether any wires had come off. And if they had come off, it was very difficult for my fingers to go through the maze of wires to reconnect the loose wires.
3.The Housing I had chosen was very small and fitting all the components with enough space for arrangement was very difficult.
How one should rectify the above problems:
1.Get a bunch of AA rechargeable batteries and use a 6 pack of them. That should be enough for movement at a relatively controllable speed. These motors were rated for 9V so using lower rated motors could help increase the speed.
2.Get an arduino shield kit and connect all loose wires to the shield. Since the shield fits snugly on an arduino, no wires will come loose during any stage.
3.Get a bigger box or leave all the components out in the open instead of stuffing them into the box. That messes up the chances of the components working properly cause the stresses on the wires can loosen the wires from their original location.
Step 9: Controls and Conclusion
The controls for the bot are as follows:
a Turn left
d Turn right
% stop and go to display mode
% When in display mode, clear the screen and return to movement mode
It can be controlled as i said before by using any computer or phone running a terminal program which can communicate over bluetooth.
I've been wanting to make this ever since I got my hands on the bluesmirf module 7 months ago and its been a nice experience involving many topics such as motor control, lcd displays and serial communication, even if it didn't turn out as well as I planned. Atleast I have a clean LCD connection system for future endeavours and i established that the Bluesmirf works perfectly. All in all it
took me 3 days to do this. If you have better equipment and a shield kit, it should take even lesser. Basically, it was a lot of fun. I would like to thank my parents for running around with me when I ran out of parts and I had to go buy them when it was raining cats and dogs. Without them I would have been stuck with a fried LCD and wouldn't have been able to finish this. I don't have many pictures as I started the instructable after I had almost finished the bot. Any queries? Please comment.
And I'm entering this in the Microcontrollers and Making Stuff Move contests. I promise that if I win in either of them, I will churn out much better projects and improve this one to make it work perfectly (that robot kit they are giving for the Microcontroller contest is perfect for this :D and a Bus Pirate will be an excellent addition to my non existent set of equipment).So please vote for me if you like my Instructable!!!!