PLS help me confirm my HBridge current sensing schematic

Status
Not open for further replies.

fabbie

New Member
As you can see at the schematic, i placed a 0.1ohm sense resistor at the power supply negative rail. Furthermore, i used a differential opamp to amplify my voltage drop across my sense resistor to match my current flow across the sense resistor. From my simulation here, it might seem successful (except for a small percentage of error), but in practical i have to no idea wwhat will happen. Therefore, i just want to confirm and get the necessary confidence that this H-bridge with the current sensing will work.
Also, i added a transistor at the sense resistor for specifically for my PWM enable since im only limited to 1 PWM channel for 1 Hbridge driver.
Pls provide me with comments and opinions. THX THX THX :wink:
 

Attachments

  • hcurrent.jpg
    40.1 KB · Views: 1,342
Looks mostly ok. Some notes:
1. I don't see any purpose for the 4 10k resistors on the H-bridge.
2. Why is there a "PIC PWM Enable"? If you make both inputs low, the bridge will be off.
3. The op amp will not work in this configuration. Fully differential setups like this generate large offset errors with mismatched resistors values. This will swamp the actual 4mV input signal.
But you don't have any need for a differential circuit, the resistor has one end referenced to ground. So a simple low offset op amp in a non-inverting configuration (2 resistors) will do fine.
This may not be a good op amp for measuring a 4 mV signal with any degree of reliability due to its inherent input offset voltage. Some versions of LM741 can have as much as 6mV of offset error. You can try to null it out with external circuitry, but there's still some thermal drift, it's just easier to start with a low offset part.

You do not need a dual supply op amp for this application.

If you are trying to send this current to the PIC's ADC, you will want a larger signal level than 40mV. Make it 100x larger. Check and see if your op amp has a 5v supply how much voltage it can put out, it may only be 4.5v or 4v or so if it's not described as "rail to rail". You will also need to filter the signal since it will be pulses at the PWM's freq.
 
Oh i didnt know that differential opamps generate large offset value compared to non-inverting opamps.
The 40mV simulated here is JUST AN EXAMPLE to ensure that my opamp is MULTIPLYING correctly. It is highly unlikely the current flow would be 40mV since i would be driving the motor(SORRY for not mentioning).

Do i really need to increase the opamp gain that high?x100. According to Nigel's tutorial, Vref/1023. I assumed that my ADC would be able to read small voltage even 40mV.
I didnt know there were non-dual supply opamps. But normally if im not wrong the -Vcc of the opamp is used to amplify negative voltage?
Lastly, how do i filter the signal? place capacitors between the opamp input and GND?
 
Here are 2 references which I extracted from the L298 datasheet. This should give you a rough idea of a pretty standard H-Bridge circuit. Note that the pics left out the diode bridge.
1) The basic idea is to keep the path of large current as simple as possible, and try to confine control circuits to low-current areas, ie logic circuits.
2) Is there really a need to use such a small sense resistor, then amplify the signal? Why not just use a larger-valued power resistor, and leave out your amplifier circuit. Using your circuit readings, 4mA across 0.1ohm is only going to dissipate 0.16mW of power. Standard resistors can support 0.25W-1W. Power resistors can support a few watts of power dissipation. Unless of course you are dealing with a micromotor circuit, then such a simple control scheme will not be sufficient.

P.S. You can always download the L298 datasheet if you are unsure of the pics.
 

Attachments

  • l298con.jpg
    13.8 KB · Views: 791
  • l298.jpg
    43.8 KB · Views: 946
My motor which is a 12VDC currently draws 300mA without any load(my schematic ampere value is just an example).
According to ohm's law, which is V=IR, IF my motor draws 1 ampere from my battery supply and if i use a larger valued resistor, the voltage drop across it would be far higher.
Since im only using a 12V battery power supply, I intend to let MOST of my 12V drop across my motor. I seem cant think of any other way
 
Well, firstly, motors don't obey ohm's law.
Next, the torque a motor produces depends on current, and not voltage.
Lastly, is your aim to control RPM or to limit current? Neither of this dictates that the voltage across the motor must be 12V, neither does it need to maintain any sort of voltage across it. If the circuit cannot achieve the desired torque, then the problem lies mainly in the power source and the motor used rather than the choice of resistor used.
Even if you use a 1ohm resistor, at 1A, which is quite high for a 80mm/120mm DC fan, or maybe what a DC motor may draw, the voltage drop is a mere 1V, with power dissipation of 1W. That's not too big a compromise IMO. Working with voltages so small is going to make the circuit susceptible to noise. Even my DMM often flunctuates in the range of 4mV.
 
hmmm...seem dificult for me to accept this. Most of the time i apply anything in terms of voltage and current in ohm's law. Of course, i agree that the current controls the torque but when you stated that voltage does not affect the motor really suprised me.
For an example, will the motor torque of a 1V 5A supply be the same as a 12V 5A supply? I thought that we also have power dissipation to consider
 
In electronics, Ohm's Law ONLY applies for resistors. But you must know that 99% of circuits out there don't only contain resistors.

I did not state that torque is totally independent of voltage. Under very short duty cycles at a sufficiently high frequency, the 2 sources do give the same torque. What I'm trying to say is that when we speak of motor control, we are referring to current control. Current is the property here which is controlled, not voltage. Transistors and FETs are current control devices. If you want to find out more about motor behaviour, there's a very good **broken link removed** here.

Anyway, your circuit will work by all means, to some extent. What we are pointing out here is the bad design practices, sources of interferences and unnecessary complexity in your circuit. If you are a masochist and believe in learning the hard way, by all means
 
Checkmate, really i did not mean to offend you in anyway. Sometimes, i consider the best way to learn is to have a good discussion(like what happen here). Can u please explain to me the relation of motor POWER to motor Current. I simply thought that there was a voltage drop across the motor which contribute to the motor power dissipation. Therfore, by maximizing the voltage drop across the motor, i could maximise the motor power since P=VI.

Also, i forgotten to mention this. The purpose im doing this circuit is to make an overload through the use of a PIC. In a worst case scenario, thea motor stalling of a 12V motor could shoot up to 4A. Using a 1 ohm resistor would have a 4V drop across it using V=IR.
 
No worries. There's no offence here.
P=VI is a universal law, applies to all eletronic devices, including motors. But it does not state the relation between V and I. Ohm's law can't be used here either since a motor is not a resistor. So they came up with terms such as capacitance and inductance. A motor is usually modeled as an inductor and resistor (usually small) in series. Capacitance and inductance add an additional time variable to the equations. At the same time, you must know that the internal workings of a DC motor works on switching inputs, therefore you actually have current swings. Furthermore, the torque and current is related via Lenz's Law.
I do not know how much you know on all these stuff, but if you really want to know the exact relation between motor torque and current, you'll have to do some serious reading. We can only guide you here. The rest will have to depend on yourself.
 
The common point on the 741's supplies still needs a ground as stated in a previous post :?
 
No wories. Use a 0.5ohm resistor then. Detecting 2V is definitely easier than detecting 40mV for the PIC.
Or use 0.25ohm if you cannot find a resistor that cannot support the power dissipation. What matters is that you know the implications of changing these resistor values.

P.S. : 4A of current is pretty high. What power source are you running and what's the application of the motor?
 
Ok thx. I'll try to change to sense resistor to slightly larger(according to your recommendation).
Just to recap, the problem with the sense resistor tiny value(0.1 ohm) is mainly because of the opamp offset error am i right?
 
ohm's law is just as universal as P = VI is. the only difference is that when you have a reactive component (inductor or capacitor) you use Z (impedance) instead of R (resistance)

and Z = R + jX

for inductors X = XL
for capacitors X = -Xc
 
Universal is just a term. Trying not to be too technical here, or merely providing textbook definitions. For one, semiconductors don't obey Ohm's Law. Laws are always correct by definition in the physics context, provided the assumptions are satisfied.
 
samcheetah said:
ohm's law is just as universal as P = VI is. the only difference is that when you have a reactive component (inductor or capacitor) you use Z (impedance) instead of R (resistance)

It's only 'universal' for resistors, anything else can be different - for the capacitors and inductors you mentioned frequency affects the result, and ohms law takes no account of frequency. Fair enough, you can calculate the impedance at a particular frequency, but you have to do this every time the frequency changes - no such problems with resistors.

As already mentioned, it doesn't apply to semiconductors - or anything which doesn't have a fixed resistance (at least not in a usable fashion). It certainly doesn't apply to a DC motor, whose 'resistance' is dependent upon it's load.
 
I'm sure that the microscopic version of ohm's Law
current density = conductance x electric field strength
is universally correct. But definitely not very useful in circuit design.
Not trying to be tacky here, but when they say that all electronic theory is based on Ohm's Law, I believe they are actually referring to this version. Just trying to bring out the importance of this lesser-known representation of Ohm's Law.
 
OK i'll keep that in mind. It changes my perspective in alot of things :idea: . Anyway, i hope my schematic design goes well.

I just want to confirm 2 things;
1) Does it matter whether i use differential or non-inverting opamp configuration?
2) If im using PWM signal, how would my current(ampere) waveform be like? I never really gave amy thought about the current waveform. Do i need some kind of filter to stabilise it or i can just leave it as it is. Since im building a current overload, im not even sure can the current drastically increase since PWM is used.
 

1. The differential is used only when the ground of your input signal is different than the ground of your output signal. There are a lot of problems with fully differentials so don't do it since you don't need it.
The "dual supply" configuration is only used if you need to read negative voltages, output a negative voltage, or your op amp's common mode input or output does not include ground (unusual). Your PIC would not be able to read negative voltages on its ADC and in fact can be damaged if you apply them.
2. It will need filtering. A simple RC filter with the cutoff less than the PWM freq will do nicely. Don't make it really, really low freq cutoff or it will be slow to respond to current changes.

The PIC's ADC reads Vref/1023. With a 5V Vref, that's about a 5mV step, and the PIC has an offset error of a couple of steps (check your part's spec). So with a 40 mV signal, you'd only be able to read about 8 steps total, with an uncertainty of maybe 25%. When you're doing an op amp, just go ahead and amplify it so the max signal you want to read will fit into the opamp's max swing and the PIC's max input voltage. A PIC driven by 5V should not be provided an analog input over 5V. If you're powering an op amp with 5V it can't output over 5V, many can only go up to the 5v source minus a volt or so.
 

talking about textbook definitions, have a look at https://en.wikipedia.org/wiki/Ohm's_law

the statement of ohms law is

the ratio of the potential difference (or voltage drop) between the ends of a conductor (and resistor) to the current flowing through it is a constant, provided the temperature doesn't change

V = IR is just the mathematical expression for ohm's law. it doesnt mean that everytime we have to take R. ohm's law only tells that the ratio of the voltage and current is constant. it doesnt say that the ratio is called resistance. you can name it anything; resistance, impedance, samcheetah :lol: or whatever!!!!!

and of course ohm's law doesnt hold true for semiconductors. i never said it did. and we werent even talking about semiconductors. and i didnt even talk about any assumptions with ohm's law.

Nigel Goodwin said:
Fair enough, you can calculate the impedance at a particular frequency, but you have to do this every time the frequency changes - no such problems with resistors.

i agree !!!!!! but who told you to change the frequency. Ohm's law is a relationship between voltage and current. and when you observe the relationship between two quantities you have to keep the others constant.

i hope that helps
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…