12. Output by H-Bridge driver L298

joliebrise

New Member
Never having used a H-Bridge driver before, I produced a circuit diagram from various sources.

MFA 919D motor drawing 1.5A @ 6v.
1.2v Voltage drop across L298

  1. Is it correct?
  2. Is it necessary to ground both sensor pins 1 and 15?
  3. What do you think about Alan Bond's addition of a 220R to reduce motor noise on the negative rail?
  4. He also suggests adding a transistor into the input line to clean up the signal as there are problems with 2.4GHz. How do you do this as there are no circuit diagrams?



Tony
 
Last edited:

Andrew Cowan

Senior Member
For a high power motor, that 200R resistor is a bad idea - it will case the noise of the motor to reach the L298, as well as reducing the available voltage.

A
 

inglewoodpete

Senior Member
The 220 ohm resistor will complicate things.

I use many L298s - they are a tough H-bridge when wired correctly. From memory, pin 8 of the L298 is the logic earth.

Pins 1 & 15 are the power earth for each H-bridge and must be connected to the 0v rail. It is optional to use a low value resistor (Eg 0.1 ohms) to connect either of these pins to 0v to allow current monitoring. I only insert the current-sensing resistors when needed (usually during development).

You safest protection of the PICAXE from the motor back-emf is the bridge rectifier and 470uF capacitor. Also ensure the 0.01uF or 0.1uF capacitor is mounted as close as possible to the PICAXE power pins.
 
Last edited:

afb

Member
Alan Bond here - a PICAXE ESC circuit I published on the Technobots website used a 10 ohm resistor (not 220ohm) and I was driving a power MOSFET not an L298. Absolutely no motor current should ever flow in the 10 ohm resistor, the motor takes and returns its current from the 7.2v battery shown in your diagram, so the resistor *won't* drop the motor voltage. I run a fast electric speedboat at 30A with a similarly configured ESC and would need over 300V to develop that current in the 10 ohm resistor (wonder how long it would last for?) - think about it!

In my case, only the power MOSFET gate current ever flows in that resistor - the purpose of the resistor is to prevent motor current from finding an easier route to the main battery 0v via the receiver 0v wiring which has happened on some of the (badly wired!) model boats my club members have presented me with. At high currents that was causing radio malfunction. OK, the things should have been wired properly, but that true-ism doesn't stop designers incorporating reverse polarity protection into their products for example!

As for the input line story I must hold my hand up. Reading the Rev-Ed guide it said and still says! (Manual 1, section 1, page 8) inputs need to be less than 0.2Vss for LO and greater than 08.Vss for HI - OK I thought, standard Schmitt Trigger type i/ps. When 2.4Ghz sets came along with only a 3.3v receiver o/p swing, the units I'd made up til then stopped working - so I buffered the input to get a 5v swing. Much, much, later I was pointed at Hippy's nice little summary of PICAXE input types and found there were TTL inputs as well !!!!! - by sheer bad luck my earliest designs had all used a schmitt input for the receiver signal and the Rev-Ed documentation (which maybe I didn't read thoroughly enough) had lead me to believe they were ALL Schmitt inputs.
 

boriz

Senior Member
I think Joliebrise is generally making a good point.

There should be a separate sub-forum for this kind of stuff.
 

joliebrise

New Member
Alan, thanks for your reply.

As I read it, you are suggesting removing the 220R and forget about the input transistor.

Pins 1 and 15 should be connected directly to earth. (Inglewoodpete)

I don't see how Picaxe can use pin 1 and 15 to sense overload current so as to cut off the power to the motor = electronic fuse.

Fusing the motor at stall current.
My first instinct is to put only one next to the motor as the current will be the same either side. In practice, should you have one either side of the motor?

Adding a reverse polarity dioed is an interesting idea, what is your views on this as I don't see any on your circuits.

Tony
 

inglewoodpete

Senior Member
Pins 1 and 15 should be connected directly to earth. (Inglewoodpete)

I don't see how Picaxe can use pin 1 and 15 to sense overload current so as to cut off the power to the motor = electronic fuse.
Ensure you follow the data sheet when connecting the L298 into a circuit.

Measuring current and current overload by adding current sense resistors:
Initially, let's make some assumptions. We will drive a 12v motor with H-bridge #1, and use a 0.1 ohm resistor between pin 1 and 0v. As shown in the block diagram in my copy of the L298 datasheet (STMicroelectronics), the sense connection would be at the top or pin 1 end of the resistor. Connect this point to an ADC input of the PICAXE - it's probably safest to connect the PICAXE to pin 1 with a 4.7 kohm resistor for safety.

When the motor is turned on, the motor current will also flow through the 0.1 ohm resistor. When current flows through a resistor, a voltage will be developed across the resistor. E=IxR.

Assume 1.8amps flow through the motor and resistor.

E=IxR = 1.8A x 0.1ohms = 0.18V or 180mV will drop across the resistor.

By using a ReadADC10 command into a word variable in the PICAXE, you should read a value of about 36 or 37, assuming you use a 5 volt power supply for the PICAXE. The mathematics:

Reading=(Vin/Vs)x1023 = (0.18/5)*1023=36.8 ... or an integer value in the word register of 36 or 37.

The PICAXE can be programmed to turn the motor driver off when it detects a value. == an electronic fuse.
 

afb

Member
Tony
1. As I read it, you are suggesting removing the 220R and forget about the input transistor.

2. Adding a reverse polarity dioed is an interesting idea, what is your views on this as I don't see any on your circuits.
Tony

My input stage buffer also had the effect of inverting the receiver pulse so if you are using any of my code as an example you need to change the PULSIN command accordingly eg pulsin 3,0,w0 would become pulsin 3,1,w0.

Your 220 ohm (I suggested 10 ohm) is no more necessary than the safety catch on a gun - like Smith & Wesson, I just thought it was a good idea to protect people from themselves. I only mentioned the concept of fitting reverse polarity protection to products as an example of how some designers do exactly that.

In some designs I have used a diode to drop the receiver voltage to the PICAXE by 0.7v in case people use a battery pack of 4 primary cells (4x1.5=6v) in their boats, to get more power for a sail winch for example, which would overvolt the PICAXE. This also then performs the function of reverse polarity protection for the PICAXE and associated signal circuitry.

In power circuits the voltage drop of a series diode (and the power dissipation) can be a problem so some designers fit reverse biased diodes across the supply rail to clamp any applied reverse polarity to one diode drop and have a fuse upstream which they hope will blow before the diodes fail. Charred or burnt out diodes can also be witness to the fact that reverse polarity has been applied if warranty is in question.
 
Last edited:

joliebrise

New Member
Modified circuit diagram using your comments.

Having taught electronics, one common occurance was connecting the power supply the wrong way, adding the dioed will solve this problem. This will also take into acount of Alan's comments about boaters using 6v supply.

The idea of an electronic fuse appeals to me, it gets rid of components and uses the features of both IC's. The Picaxe's pin connections have been rearranged so that the power sensing goes to pin 4 ADC and Enable pwm to pin 2

 
Last edited:

MartinM57

Moderator
A 4.5v battery and a 1n40001 will give about 3.8v at the PICAXE V+ pin (maybe a bit more if the PICAXE is taking negligible current) - are you happy with that?

Reverse polarity protection diodes are conventionally put on the downstream side of the switch in the positive line. I suppose it will work as shown, but you have to be careful not taking short cuts when wiring to connect any earth connection direct to the battery -ve (thus bypassing it completely). I'd move it to the normal place...

I'm not convinced about the 10R resistor, but if you are happy with it, go ahead...
 
Last edited:

inglewoodpete

Senior Member
A 4.5v battery and a 1n40001 will give about 3.8v at the PICAXE V+ pin (maybe a bit more if the PICAXE is taking negligible current) - are you happy with that?

Reverse polarity protection diodes are conventionally put on the downstream side of the switch in the positive line. I suppose it will work as shown, but you have to be careful not taking short cuts when wiring to connect any earth connection direct to the battery -ve (thus bypassing it completely). I'd move it to the normal place...

I'm not convinced about the 10R resistor, but if you are happy with it, go ahead...
I have to agree with Martin's concerns. I don't see the benefit of the 10R resistor. A shottky series diode would be more appropriate than a EM4001 or 1N1418.

I also have misgivings about driving the L298's inputs with a PICAXE running on 3.8v. I have not consulted the datasheet for the minimum drive voltage for the logic side of the L298 or attempted to do any breadboard testing but it would be wise to thoroughly test this area.

On the positive side, I have used PWM to drive the enable pin on the L298 very successfully.
 

joliebrise

New Member
Goggled "reverse voltage protection dioed" and was astonished at the variety of methods. Full bridge rectifier so it does not matter which way round you connect.

As a simple sole, I will stick to a simple dioed. I have changed the circuit and the dioed to a 1A 1n5817 Schottky having forward voltage drop of 0.45V = Vf



Alan Bond's idea of using a diode to drop the voltage down to 5.3v when using a 6V battery pack has merits as the increased voltage on servos makes a significant power difference.
I have not got round to sorting out the power packs for my boat.
Four motors/picaxe/drivers!

Now to build the Stripboard
 
Last edited:

slurp

Senior Member
To avoid current from the motor impacting on the controller I'd cut the resistor tie and take that back separately to the battery. Similarly I'd make a separate +ve connection close to the battery - probably the other side of the diode.

I'd add a larger capacitor to help the controller bridge transient supply dips caused by the motor

Best regards,

colin
 
Top