Step 3: Test (with kitties)
Once you have made the connections between the Bluetooth mate, Arduino, and L298N motor-controller, it is time to install the batteries into the battery compartment. and load the code to the Arduino.
With the code loaded, you will need to "pair" the bluetooth adapter and Bluetooth Mate on your computer. The process to do this will be slightly different depending on what Operating System you are using. First plug in any standard bluetooth adapter
The following steps will describe how to pair your Bluetooth device using Ubuntu 10.10:
Step 1. Turn On Bluetooth-bot and make sure the power LED on the Bluetooth mate is On (blinking red).
Step 2. Open your bluetooth manager (System > Preferences > Bluetooth Manager) - if not installed, open terminal and type:
"sudo aptitude install blueman", and then continue.
Step 3. Click the Search button to discover new devices.
Step 4. Right click on the Bluetooth Mate from the list (mine was listed as "FireFly - A4C7") and select the option for "Serial port" - you might also see your cell phone show up on the list if available, make sure you select the correct device.
Step 5. Now you will see a dialog box asking for the passcode of the Bluetooth Mate - mine was set by default to "1234".
Step 6. With the passcode entered, your Bluetooth Mate should now be connected to your PC - the red blinking light on the Bluetooth mate will turn solid green to let you know that it is connected.
Step 7. To control the bot, open a terminal and type the following: "screen /dev/rfcomm0 115200"
The full instructional video on how to set up your Bluetooth-bot with your PC is here:
Now you should be controlling your robot using the keyboard. Make sure the Caps lock is turned Off and use the following keys (lower-case i, j, k, and l) to make your robot move. Holding a key down will result in constant movement, let go and the bot should stop:
forward = "i"
reverse = "k"
left = "j"
right = "l"
speed value UP = "."
speed value DOWN = ","
max speed = "/"
Additionally, you can change the speed value that is written to the motors by pressing the period, comma, and back-slash keys. The "comma" key is used to lower the speed value (from 0-255), the "period" key is used to raise the speed value (increments of 5), and the "back-slash" key is used to set the speed_value to 255 (max).
Any other key that is pressed on the computer keyboard with the terminal open, will yield a response (the LED will blink), but no motor action will be commanded. If you would like to assign different keys to the control functions, simply open the serial monitor (at 115,200 bps) and press the key you would like to use - the Arduino will display the BYTE value on the serial monitor of any key that is pressed, so you can record the value shown and modify the sketch accordingly.
Once you get your Bluetooth-bot working, feel free to add more movement functions and modify the code as you please - if you mess it up, just download the original code again. The code is also available on the next page for viewing.