Let's Make Robots!

Bluetooth Remote Control Treaded Chassis

Controlled via phone accelerometers and Bluetooth
RC_tank_no_PWM_schematic.pdf36.09 KB
RC_tank_no_PWM_ATtiny2313.c3.43 KB
RC_Tank_no_PWM_NokiaE75.py_.txt3.61 KB
Serial_Control.vi_.txt39.71 KB
Bluetooth_and_accelerometer_RC_tank_with_PWM.zip40.73 KB

This is my first robot using an Atmel ATtiny2313 Microcontroller.  It uses an L298N H-bridge with no PWM, with plans to add PWM.  I've included schematic and code in the files.  The high current/low voltage Tamiya motors were swapped out for Solarbotics RM3 motors.  The gearbox is a Tamiya Twin motor gearbox.  The Bluetooth module is the Roving Networks RN-41-SM and is available at Mouser.com for $45.

The Cell phone is programmed in Python for S60 v2.0.0.  The computer program is a LabVIEW 8.20 virtual instrument control.  Remove the _.txt extension when using these two files.



 I've added PWM for independent speed control of each motor as a function of accelerometer values in the phone.  The last video shows a demonstration of the PWM version.  The zip file 'Bluetooth_and_accelerometer_RC_tank_with_PWM.zip' includes all PWM version code and updated schematic.  This revision was mostly changing code - the only hardware changes was the addition of a couple of wires to connect the PWM outputs of the microcontroller to the enable inputs of the H-bridge, which required moving a couple of IO pins to get at the necessary dedicated PWM pins.

The improvements made to this revision:

  • PWM
  • Graphical accelerometer feedback on phone python script
  • Bluetooth automatically turned on when off in python script (before it failed when BT was off)
  • New communication scheme to transmit direction and PWM commands to vehicle - has the form {<dir><left PWM><right PWM>}
  • Automatic shutoff - microcontroller firmware stops the motors if no commands are received within 100ms (accomplished with 16-bit timer), which prevents the robot from continuing to move when the Bluetooth connection is terminated or fails. This requires the phone to transmit constantly.

You may also notice it looks more responsive. That's because I was using a lowpass filter when reading accelerometer data in the first revision, oops!


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

The default SM0 should work fine for use with serial port profile (SPP).  You can get a zip of example programs HERE.  I acquired that link from Cambridge University Press on a page for the book Bluetooth Essentials for Programmers.  Good luck I'd like to hear about your experience with JSR82 so please let me know how it goes.  You may consider checking out that book too because the code might be difficult to digest without it.

For fast prototyping I suggest using Python on an Android or Symbian S60 OS.  But if you are great with Java and don't know Python it could take longer.


Hi, it's been long time. First of all I wanted to say THANKS, that book helped me a lot to understand bluetooth programming. I was able to communicate with the module from different phones. I used JSR82, it took me a while to get used to Java and J2ME but using JSR82 is a little esear than what I though, the IDE I used is Netbeans (it is great!!!). You can watch a little demonstration on YouTube http://www.youtube.com/watch?v=dUg5PjmH-hw of a program I did,  i used it to turn on and off a led I also used an Arduino. If you want I can give you the code.



I'll definitely check out your java source if you post a link (I host my code on sourceforge.net).  Thanks for the update, glad to hear of your success!

I tried to use labview file u gave.. But itz not working.. Getting some error.. M using an RN-42 module.. And am nt able to change comport.. Plz help.. M a complete beginner

Knowing the error would be useful information... for starters are you using LabVIEW 8.20 or later and did you remove the _.txt extension when using the file so it looks like Serial_Control.vi?  You also need to to add the bluetooth device first and determine what COM port it is on.  Also include what operating system you're using.

I used latest version of labview.. M using windows7. Yep itz in .vi format. I also hv sm other problem.. Am using ATMEGA16.. I used sme other program to communicate with it using the code u gave.. For ATMEGA16 should i make change in code??

Thanks for ur help:-)

probably, reference the datasheets for differences in register names :)

Sir am using a motor which uses about 9A to work.. Sen how should i make the connections??

Am thinking about using relays.. Is der any motor driver IC available for this?

If am using a relay how should i do the connections?

Thank u sir

You can design an H-bridge with relays or MOSFETs (MOSFETs being the preferred one), or you can buy a medium to high current dual motor driver from somewhere like pololu.com.  I suggest a non-smokable design!