Introduction: Robot Platform Including H-bridges From $10 R/C Car
Every time I go into a store I keep an eye out for cheap stuff that's hackable. I've been seeing in CVS pharmacy and a few other places the "Thunder Tumbler" or similarly named R/C car. CVS has had in the past good hackable toys so I thought to take a chance and see what you got for $9.99 plus tax. Turns out, you get a sweet little robot platform that has some things going for it.
* Dual motors and skid steering. Motors, gearboxes and wheels are already assembled and mounted on a chassis. Not the best of chassis but still it's workable. The motors where designed to run at 6V at full speed, but we don't need nearly the top speed this toy was meant to do so four rechargeable AA batteries (4.8V) should work fine.
* The printed circuit board that drives the toy itself is a basic single sided board with though-hole components, not surface mount. This is the key thing that makes this toy a sweet hackable deal. It has a transistor based H-bridge with forward and reverse for each motor. You can hack into the PCB with a little desoldering and presto, that dual channel h-bridge is now doing your bidding.
* The data signals for the h-bridge can be plain old 5v, straight out of your microcontroller. It will probably work with 3.3V signals as well, I just haven't tried it.
* As mentioned the chassis is OK but not great. Still, it allows me to mount my normal setup for this sort of thing, a solderless breadboard with an arduino clone attached. (The DC boarduino from adafruit industries).
* The built-in battery case takes (4) AA's. Four rechargeable ones works out great as the motor power supply.
* They even give you a 9V battery which I use to power the microcontroller via the boarduino's voltage regulator. Having separate batteries for the motors (the rechargable AA's) and for the data/control electronics (microcontrollers, sensors, etc) is a good idea to cut down on interference problems.
Step 1: Tools and Materials
To start you'll need a Thunder Tumbler R/C Car, available from many stores.
Along with that, you need a power source for the motors. I would suggest four AA batteries (rechargeable or not) that go into the regular battery slot on the car.
The point of this whole thing is to turn this toy into something that can be controlled easily with a microcontroller, so you should have your own microcontroller and know how to program it. The basic hack is controller neutral but does have some requirements:
* To control both left and right motors in forward and reverse, you need 4 digital outputs from the controller, preferably PWM outputs for all 4 so you can control the speed of the motors. That's for the simple, basic hack. The arduino has 6 PWM outputs, so I was covered there. A more advanced hack can get that down to 2 PWM outputs and 2 regular digital outputs needed for controllers with less PWM ability. However after playing around with it I found the effort needed to do so was not worth it. YMMV. I will describe the more advanced hack and what it will take to accomplish.
* I tested it with a 5V controller, so 5V data signals to the h-bridges. This worked well. They probably would work with 3.3V signals, but that has not been tested.
* I desoldered the standard DIP package 16 pin chip on the PCB and replaced it with a 16 pin IC socket. You can do that or put in headers of some flavor if you so wish. Really it's about what will work for you, just have something that allows you to connect into your controller as needed.
Tool wise, you'll need things like a #1 phillips screwdriver, an xacto knife or other cutting tool, a soldering iron and desoldering ability of some sort. I never could get the sucking up desoldering tools to work well so use the copper mesh stuff instead. Again, YMMV.
Step 2: Take the Shell Off the Tumbler
For purposes of this instructable, I'll be calling the Thunder Tumbler Radio Controlled 360 Degree Rally Car the "Tumbler", the printed circuit board inside the Tumbler the "PCB" and any microcontroller board/stamp the "controller". So you know my shorthand.
First thing is to take the shell off the Tumbler so you can get access to the PCB. On the bottom there are two screws (see the pictures) that are outside the main body of the Tumbler. Remove those screws and the shell can come off. I would suggest you save all the screws you remove, even for things like the shell you are leaving off. You can maybe use them later for mounting other things to the Tumbler.
Once the shell can be removed, take it off gently, it still has some wires attached. Those are the antenna (not important) and two LEDs that light up when either wheel is powered. I've left those wires and LEDs attached to my Tumbler, but you might want to just cut them and desolder later on the PCB to get them out of the way. Another YMMV point.
Once the shell has been gently pulled off, you can see the crossbar piece that it was screwed to. Take that off as well. This gives you access to the PCB.
On the PCB, there is one screw that holds it in place. Gently take that out and lift the PCB out of it's pocket. Now you can get access to the soldered side of the PCB and do some desoldering of the IC.
At this point I took an xacto and cut the plastic bits that held on the LED wires on the shell. So now I have the LEDs and the antenna wires loose off the PCB, and can put the shell aside.
Step 3: Desolder the Chip Off the PCB
There is one 16 pin chip that does it all for the Tumbler. It takes the inputs from the receiver components and figures out what the signals are, then outputs to the two h-bridges to control the wheels.
Desoldering the chip is straight forward. However you do it, take a little care as the solder pads have other components close by or even on the same pad as the chip itself. You'll have to resolder it all back so they are connected when this is over.
I soldered back on a 16 pin socket because I wanted to put the chip back on the board to test it. Upon reflection, I should have put on standard 0.1" female headers. Something that I could plug jumper wires into easily. The socket works OK but it is not ideal. Once again, YMMV. You could resolder in wires that go directly into your controller. Whatever works, just make sure you resolder the other pins together that perhaps got desoldered on the PCB, the ones that shared the same solder pad with a chip pin.
Step 4: Test the PCB and Add on Your Controller
Note - There is a small chance the PCB in other Tumblers has different pinouts, so you will want to check yours to see. These boards where made for the absolute cheapest they could be that day, and other days might have had something else be cheaper. Then again, the pin configuration is based on the integrated circuit, which probably doesn't change on a day to day basis. So this should be close. :)
After looking at the PCB and doing some testing, I found out the following pin info:
pin 2 - ground
pin 6,7 - controls the left motor h-bridge
pin 10,11 - controls the right motor h-bridge
pin 13 - Vcc output from the battery.
I'm assuming the other pins are housekeeping and getting the input from the receiver components. While having a wireless input into the PCB might be handy for something in the future, right now I'm interested in the h-bridges and how you control them.
The h-bridge for each side is made of 4 power transistors and 2 regular transistors. On my PCB, the power transistors where a pair of H8050 and H8550, controlled by a couple of regular transistors, C945s. All are in the TO-92 physical package. I suspect that other transistors might be used on other PCBs, it was a matter of who had what in stock at a cheap price that day. I found some datasheets for the H8050 and H8550 and it looks like each h-bridge is rated to 1.5 Amps. Again, there might be different components on other PCBs on other Tumblers, but the basic 1.5A rating should stay the same.
For each h-bridge, there is a pair of pins that controls it. Pins #6 and #7 for the left side, and #10 and #11 for the right side.
Pin 6: OFF, Pin 7: OFF - nothing, no movement
PIN 6: ON, Pin 7: OFF - wheel rotates - forward direction
PIN 6: OFF, Pin 7: ON - wheel rotates - reverse direction
PIN 6: ON, Pin 7: ON - untested, suspect this might fry something in a puff of smoke.
Pin 10: OFF, Pin 11: OFF - nothing, no movement
PIN 10: ON, Pin 11: OFF - wheel rotates - reverse direction
PIN 10: OFF, Pin 11: ON - wheel rotates - forward direction
PIN 10: ON, Pin 11: ON - untested, suspect this might fry something in a puff of smoke.
For the pins on the "OFF" position, N/C or ground both seem to work. On general principle I suggest sticking to ground and not N/C.
What does this all mean?
To drive a particular side of the robot, you need two digital outputs, hopefully PWM capable. For both sides it takes four outputs. For instance, if I wanted to go forward at 40% max speed I would set my pins like this:
pin 6: PWM signal at 40%
pin 7: ground (PWM 0%)
pin 10: ground (PWM 0%)
pin 11: PWM signal at 40%
I've been using the standard Arduino PWM frequency of around 500Hz and that works for switching the h-bridges off and on just fine. I would not be surprised if the components handled up to the 20KHz range.
When hooking up your microcontroller and using a different battery for the data signals (like the 9V I used), don't forget to "share a ground" wire between the two. If you look at my pictures, that is why I have a wire from the #2 pin on the IC Socket into the ground plane of my breadboard.
So for my test setup, I used the Arduino PWM signals:
Arduino : Tumbler
pin 9 ---- pin 6
pin 10 --- pin 7
pin 3 ---- pin 11
pin 11 --- pin 10
Here is some hardwired, ugly test code. However, it does work and proves the general idea. It is a loop that goes like this:
drive forward at 50% power for 2 seconds
wait 2 seconds
drive in reverse at 50% power for 2 seconds
wait 2 seconds
loop to top
It's showing me that this is not the most precise motor/wheel alignment I've seen, but it does work. I'll work on better wheel control code over time - need to get the laser rangefinder working first!
// by Ray Alderman
// Connections to the Tumber PCB
// Arduino : Tumbler
// pin 9 ---- pin 6
// pin 10 --- pin 7
// pin 3 ---- pin 11
// pin 11 --- pin 10
// ground --- pin 2 (ground)
int RightFwd = 3; // PWM Output to go Foward on Right Wheel
int RightRev = 11; // PWM Output to go Reverse on Right Wheel
int LeftFwd = 9; // PWM Output to go Forward on Left Wheel
int LeftRev = 10; // PWM Output to go Reverse on Left Wheel
int delaytime = 2000; // delay between steps
int speedval = 127; // speed forward and reverse, at 50% (of 255 max)
digitalWrite(RightFwd, LOW); // Make sure Output is initally at LOW
digitalWrite(RightRev, LOW); // Make sure Output is initally at LOW
digitalWrite(LeftFwd, LOW); // Make sure Output is initally at LOW
digitalWrite(LeftRev, LOW); // Make sure Output is initally at LOW
analogWrite(LeftFwd, speedval); // turns on the left wheel in forward direction at the speed value
analogWrite(RightFwd, speedval); // turns on the right wheel in forward direction at the speed value
analogWrite(LeftFwd, 0); // turns off the left wheel
analogWrite(RightFwd, 0); // turns off the right wheel
analogWrite(LeftRev, speedval); // turns on the left wheel in reverse direction at the speed value
analogWrite(RightRev, speedval); // turns on the right wheel in reverse direction at the speed value
Step 5: Optional - Add Some Data Logic to Reduce PWM Needs
Note - I started down this path and even started on soldering up a miniboard with components, but found it to be too much work for too little payoff. YMMV.
I was used to thinking of robot wheels in terms of two control pins, enable and direction. The enable pin was where you put your PWM signal and direction was a simple binary for forward/reverse. So you would need only two PWM signals for the robot, one for the left and one for the right. Here's my quick and dirty digital logic for it. I was going to use simple TTL circuits and a couple of 74HC Chips,
74HC04 - hex inverter
74HC08- quad 2-input AND gate
Now of course in my parts bin I don't have any AND gates, I only have NAND gates. So I was going to use the leftover inverters from the hex to do the job, and the two chips would have everything I need. That would work, but after playing around with it I decided to not go to the trouble - again YMMV. I will say that on a solderless breadboard this is a lot of wires .
InvictaJ26 made it!
We have a be nice policy.
Please be positive and constructive.