Let's Make Robots!

RC car


As some of you may already know, I'm building an RC car which will ignore user input and prevent a crash when necessary. It'll run on an arduino platform. I'm waiting for my parts ATM and doing whatever I can on the chassis I already had (making a motor mount, making a deck to put the electronics on, fitting in a battery...).

All pics can be found here.

 

UPDATE May 5th, 2011

I just finished a 5V regulator to power my Arduino UNO board. Of course I kinda forgot Arduino accepts a voltage of 6-12 V. Stupid me. Going to mount the motor the the chassis and maybe cut out the deck.

 

UPDATE May 7th, 2011

Got the motor mounted, and tested it... Boy this thing is LOUD and powerful!

My mailorder arrived, trying some things out with the arduino. Love that thing already :D I'm still waiting for my other mailorder with 20 transistors and 2mm pin sockets for my H-bridge and my 2nd xBee. Will keep you guys up to date!

PS: I know the servo doesn't work with PWM, made a mistake.

 

UPDATE May 12th, 2011

Cut out the new deck and it rocks! There's just enought space between the base and the deck to fit the battery between them. Also, I've mounted the servo and tested the steering. I'm still waiting for those transistors :( 

Update 2: mounted the Sharp IR sensors, pictures are still here.

 

UPDATE May 22nd, 2011

Got my transistors and soldered toghetter my H-bridge... Now I only need to solder a 5V regulator and som pin headers to make all the connections to my µC. I'll keep you guys updated.

 

UPDATE May 26th, 2011

I completed the PCB which holds the H-bridge and a 5V-regulator. There is a problem with the H-bridge though... I use the BD911 and BD912 transistors in my H-bridge and they are not repsonding as I expected them too. More info in the fourth vid.

Datasheets on the transistors can be found here. Can anyone confirm that I should feed 5V to the base to make these things switch on/off?

-

UPDATE July 19th, 2011

Since I couldn't get the H-bridge to work, I just tested the system with one transistor and a potentiometer (see pic). I found out that I will need a transistor to drive every transistor in the H-bridge. Too bad all radioshack-like shops in the neighbourhood are closed for vacation at the moment. Seems this project will take a lot longer than expected. I was happy to see the wheels finally spinning though :)

 

UPDATE March 20th, 2012

Alright, this has been some time! I kind of lost my eye on this project for a few months, but now I'm back on it! I've just finished soldering up the motorcontroller (pic below) and am now going to start figuring out how xBees work and communicate, so that will take a while to complete. At the moment, I'm kind of doing two projects at the same time, so it can be another while before I update this.

Comment viewing options

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

Instead of TIP 31 and 32, you might check out

 http://www.me.umn.edu/courses/me2011/arduino/technotes/tip120data.pdf

The TIP 120, 121, 122 (NPNs) and TIP 125, 126, 127 (PNPs) are darlingtons and take much less current in their inputs (20 mA for a 5 Amp output current) to get the output current you need without over-taxing your Arduino. Be sure and notice that the collector-emitter voltage is fairly high, though.  You would still need a higher voltage power supply for the motors.

 

Take a look at this, it may be a little bit simpler and solve your problem.

 

It works great. Interlock circuit prevents shorts when A B are 1 1.

It sounds like you are sending your PNP transistors the wrong voltage to turn them on. Or you are not "fully saturating" them to turn them on fully. Can you post a schematic of your h-bridge?

Your BD911 transistors are NPN, and the BD912 are the complementary PNP. The difference is that an NPN needs a positive voltage bias at the base to turn on, and the PNP needs a negative voltage bias at the base to turn on.

So you will typically see your NPN transistors at the "top" of the h-bridge with their collectors connected to the battery and their emitters connected to the motor leads. The PNP transistors will be at the "bottom" of the h-bridge with their emitters connected to the motor leads and their collectors connected to ground.

To turn on the motor in one direction, you need to send a positive voltage to the base of one NPN, and a low voltage (logic low) to the base of the PNP that is diagonally across from the NPN you are turning on.

If you are already doing this, then the issue is that you are partially turning on the PNPs, instead of fully turning them on. What value resistors do you have at the base of the transistors? You may need to adjust them to get the PNP fully turned on.

Oh, one more thing. There is a voltage drop from the collector to the emitter (Vce) of each transistor. So you feed 7.2V in at the top of the NPNs, but it is going to drop 1V to 3V (depending on how much current you are running through it). The PNP transistor diagonally across from the NPN provides the current a path to ground through the motor. When the PNP transistor is fully turned on (saturated), the voltage at its emitter will not be 0V, it will be between 1V and 3V (again depending on the amount of current). So the voltage difference supplied to the motor is going to be significantly less than 7.2V.

Try turning on your h-bridge as I described above (logic high to the NPN base, logic low to the PNP base) and measure the voltage you get across the motor. If your motor is pulling less than 5A, you should get a decent amount of voltage. If you are closer to 10A, you may have to use a higher voltage battery to supply your h-bridge. 

First of, thanks a lot for the info!

My H-bridge is built up exactly as you described it (schematic). The problem is indeed the not being fully saturated part (as I said in the video, switch half on, bad with my words...). I originally used 5kOhm resistors for R1 and R2 but, when that didnt work, I went to 2.5 kOHm for both. Still nothing.

Do you know what value the resistors should have? is it even less? Or am I going completely the  wrong way with this and do I need a higher resistance value?

Again, thanks!

I hate to say this, but you still have problems.

The resistors R1 & R2 depend on the transistors you are using and how much current you draw for your motors.

As a general rule, to reach saturation for a switching circuit, the base should get a bias of 1/10th the current passing between collector and emitter. This is true for most transistors. The person saying to use the Hfe is mistaken. (I.E. Dead wrong.)

Hfe is used for audio circuits where you never want the transistor in saturation (which is to say, Full On & Full Off).

For a switching application, you always want the transistor to saturate, so look only at the values for saturation when using the transistor in a switching capacity. Using a current as high as 1/10th the collector/emitter current will put almost any transistor in saturation. [Ok, 'always' and 'never' are a little strong, -there are exceptions, but this is not one of those.]

ADDED NOTE: I researched the TIP31 and TIP32 and find this line on both spec sheets:

VCE(sat)

* Collector-Emitter Saturation Voltage

IC = 3A, IB = 375mA

1.2

V

Notice this is for saturation use.   VCE(sat) is the voltage across collector and emitter when the transistor is fully on.  So using these transistors, you should have read about 1.2 volts across each when the transistor is fully on. (This means there is a problem with the voltage readings)   Note next the third box.  These transistors are the exception to the general rule of ten times for saturation.

It says, IC = 3A, IB = 375 mA.  That means to drive the transistor to give 3 amps out (IC), you must apply 375 milliamps to the base.  This is only a gain of 8, not 10.  That is the answer to that question. If you want 3 Amps output using TIP31 & TIP32, you must supply 375 mA to the base of each transistor that is turned on. It specifies also that the base voltage at saturation will be 1.8 volts, so the base resistor for a 5 volt supply must drop 5.0 - 1.8 or 3.2 volts across it.  By Ohm's law 3.2 volts / .375 A  = 8.53 Ohms for one transistor, however, you must turn on two transistors needing 375 mA each (750 mA total)

And BTW, if both transistors have 1.2 volts across them when fully ON, then that mean 2.4 volts is used up in the transistors. If you are using a 5 volt supply,you have only 2.6 volts powering your motors.

That schematic I drew was an example for low-current-drain motors, but after seeing the electric arc when you powered the motor in the first video, I suspect your motors draw more current.

For an example, if your motors draw 3 amps from the h-bridge, then 0.375 amp must be supplied to the bases of the transistors to turn them fully on (called saturation). I calculate a resistor value of a bit over 4 ohms needed, --HOWEVER, this is a big problem for the controller chip. It cannot supply 750 milliamps to drive such a motor. If powering motors needing higher currents, you must have one or more buffer stages in between.

If your controller can only output 40 milliamps (Arduino), then a buffer stage can raise that to 400 milliamps (use a different transistor for ten times the current for saturation) but you need 750 mA to turn on two transistors at the same time, so you would need a third stage.  See what I mean?

Now the other schematic, because it has additional stages, would drive higher current motors, except that it has some problems in design as well.

If you look at the spec sheet for a 74LS86, you will see this:

 

I OH HIGH Level Output Current  -   0.4 mA

I OL LOW Level Output Current  -   8 mA

 

 

This tells us that 74LS86 chip only supplies 8mA to ground on a low output and even less (0.4 mA) on a high level output.

This is not enough to drive the 2N2222s to saturation in order to drive the TIP power transistors. [In 74LS series, the L stands for "Low power".]

 Furthermore, the exclusive-or circuit does solve the potential shorting problem in the original design with the PNPs on top and NPNs on the bottom but you need an additional buffer between it and the 2N2222s. If the 2N2222s are driven to saturation, they would supply current for one transistor, but not the 750 mA needed to drive two TIP transistors. You could put two in paralell on each side so each only supplies half the current, but remember they will still need 75 mA between them on their inputs.

I hope this explained things well enough. Let me know if it is still clear as mud.

 

If your NPN transistors are turning on fully (saturated), and your PNPs are not, try a lower value for R1 and R2. I think you are safe with 1k, but I would really need to know how much current your motors are pulling.

Can you measure a few things for me?

  • What is the voltage drop from the collector to the emitter of your active NPN when the motor is supposed to be on?
  • What is the voltage drop from the emitter to the collector of your active PNP when the motor is supposed to be on?
  • What is the current going through your motor or into the collector of the active NPN when your motor is on?
  • What is the current going into the base of each transistor?

If the 1k value doesn't work for R1 and R2, and since you are already saturating the NPNs, I think you will need to use separate base resistors for each of the transistors. I have usually seen it done with each transistor having its own base resistor. This will let you play with different values for the resistors at the bases of the PNPs to try to drive them to saturate.

The following measurements were done without motor attached, with 2.5kOhm resistors and with a battery voltage of 7.61V

  • NPN which gets 5V: 0V
  • PNP which gets 5V: 4.67V
  • NPN which gets 0V (GND): 7.23V
  • PNP which gets 0V (GND): 0V
  • Voltage across motor connectors: 4.32V (positive side = 5V side)

I'm guessing the problem is in the PNP which gets 5V? :)

When I switch the 2 control pins I get the following:

  • NPN which gets 5V: 2.41V
  • PNP which gets 5V: 4.67V
  • NPN which gets 0V (GND): 7.21V
  • PNP which gets 0V (GND): 0.06V
  • Voltage across motor connectors: 4.36V (positive side = 5V side)

 

I think that the problem is indeed in the saturation part... When I find the time, I'll buy 4 potentiometers, so I can easily set the right resistor value for each transistor..

Does this sound about right? Thanks!

The inconsistency between the two control pin settings is weird. I'm talking about how you have essentially no voltage drop across one NPN when you turn it on, but the other NPN gets 2.41V across it when you turn it on.

Also, without the motor or some resistive load in place, I'm not sure you can really test the circuit, because the normal path of current is through the motor, and now that is open.

The link Birdmum posted was dead for me. Here's another site with useful info on this topic:

http://www.kpsec.freeuk.com/trancirc.htm

Scroll down to 'Choosing a suitable NPN transistor' and it will explain how to calculate the approximate value of the base resistor.

remembered reading something about hFE. I did a search and found a page that mentioned that using the current draw through the transistor along with voltage and hFE you can calculate the value of the base resistor. The page is http://www.rason.org/Projects/transwit/transwit.htm