I thought this was a simple circuit to measure a current on the high side w ith a lower voltage op amp. Input resistors couple with the feedback resis tor to keep the op amp inputs at safe levels. No big deal, seems to work o k. I used a second amp to dig the signal out of the dirt.
Then it appeared I would need some filtering so the current measured would be an average of the PWM signal used to control the device. The caps I add ed didn't seem to do exactly what I was looking for and when I removed them I realized there was something going on that was limiting the band width. Seems it is the basic circuit without filter caps.
With no caps the roll off was around -20dB at 42 kHz. I thought I might ge t better response using lower value resistors if the parasitic capacitance was causing this (620k is a bit high). Using lower resistor values makes i t worse! With 46k4 and 20k resistors the first stage is -110 dB down!
I am missing something very fundamental here. The original resistors are 6
20k and 215k. I think this zip file contains all the files needed.
formatting link
--
Rick C.
- Get 1,000 miles of free Supercharging
- Tesla referral code - https://ts.la/richard11209
I'm not sure what you are looking at - but you have to place supply voltages and signal sources into your simulation, before they will run. Just labeling a net won't do that.
e with a lower voltage op amp. Input resistors couple with the feedback re sistor to keep the op amp inputs at safe levels. No big deal, seems to wor k ok. I used a second amp to dig the signal out of the dirt.
ld be an average of the PWM signal used to control the device. The caps I added didn't seem to do exactly what I was looking for and when I removed t hem I realized there was something going on that was limiting the band widt h. Seems it is the basic circuit without filter caps.
get better response using lower value resistors if the parasitic capacitan ce was causing this (620k is a bit high). Using lower resistor values make s it worse! With 46k4 and 20k resistors the first stage is -110 dB down!
e 620k and 215k. I think this zip file contains all the files needed.
I am testing a design by using it as a component in the test simulation. M aybe you didn't see the main schematic? I guess I should have said the top level schematic is MotorCurrent_highside_test.asc
Opps, I added the end use circuit to the zip file rather than the test circ uit. I've uploaded a new zip file. Thanks for pointing out the mistake.
--
Rick C.
+ Get 1,000 miles of free Supercharging
+ Tesla referral code - https://ts.la/richard11209
ide with a lower voltage op amp. Input resistors couple with the feedback resistor to keep the op amp inputs at safe levels. No big deal, seems to w ork ok. I used a second amp to dig the signal out of the dirt.
ould be an average of the PWM signal used to control the device. The caps I added didn't seem to do exactly what I was looking for and when I removed them I realized there was something going on that was limiting the band wi dth. Seems it is the basic circuit without filter caps.
ht get better response using lower value resistors if the parasitic capacit ance was causing this (620k is a bit high). Using lower resistor values ma kes it worse! With 46k4 and 20k resistors the first stage is -110 dB down!
are 620k and 215k. I think this zip file contains all the files needed.
Maybe you didn't see the main schematic? I guess I should have said the t op level schematic is MotorCurrent_highside_test.asc
rcuit. I've uploaded a new zip file. Thanks for pointing out the mistake.
I see I also did not explain the problem well. The signal source is SIG wh ich controls the current drawn through the circuit. The circuit turns this into a small voltage across the 0.01 ohm resistor, but at a high common mo de voltage level. The first amp runs on 5 volts so the divider resistors b ring the input voltage to within that range.
The signal level is very low, so a second amp is used to boost the level. T he current measurement is the voltage output on COUT.
Without the filter caps the first amp is -3dB at 300 kHz and the overall ci rcuit is -3dB at 3.2 kHz with a low frequency gain of -10dB. With the caps the -3dB points are 1.7 kHz first stage and 850 Hz overall which is probab ly fine.
I had forgotten that the amp is only 350kHz GBW and was trying to open up t he response without the caps, so used lower value resistors for R2, R3, R4 and R5 with similar ratios. It was rather late and I probably should have put it off until later. However, when I use 46k4 and 20k resistors in the first stage the low frequency response drops to -70 dB overall instead of -
10 dB! With these resistors the DC operating point of the first stage amp is 4.82V vs 4.12V with the original resistors. I tried 10k and 3.6k resist ors and that is even worse with the DC balance out of whack.
I'd like to understand what is going on when the values of these resistors change with similar ratios. The common mode range of the inputs is Vcc+0.1 V (not the absolute max of Vcc+0.3V). Still, I would expect any of these o perating voltages to be ok. Is that the problem, the DC operating point is too close to 5 volts in spite of what the data sheet says?
--
Rick C.
-- Get 1,000 miles of free Supercharging
-- Tesla referral code - https://ts.la/richard11209
h side with a lower voltage op amp. Input resistors couple with the feedba ck resistor to keep the op amp inputs at safe levels. No big deal, seems t o work ok. I used a second amp to dig the signal out of the dirt.
d would be an average of the PWM signal used to control the device. The ca ps I added didn't seem to do exactly what I was looking for and when I remo ved them I realized there was something going on that was limiting the band width. Seems it is the basic circuit without filter caps.
might get better response using lower value resistors if the parasitic capa citance was causing this (620k is a bit high). Using lower resistor values makes it worse! With 46k4 and 20k resistors the first stage is -110 dB do wn!
rs are 620k and 215k. I think this zip file contains all the files needed.
n. Maybe you didn't see the main schematic? I guess I should have said th e top level schematic is MotorCurrent_highside_test.asc
circuit. I've uploaded a new zip file. Thanks for pointing out the mista ke.
which controls the current drawn through the circuit. The circuit turns t his into a small voltage across the 0.01 ohm resistor, but at a high common mode voltage level. The first amp runs on 5 volts so the divider resistor s bring the input voltage to within that range.
. The current measurement is the voltage output on COUT.
circuit is -3dB at 3.2 kHz with a low frequency gain of -10dB. With the c aps the -3dB points are 1.7 kHz first stage and 850 Hz overall which is pro bably fine.
p the response without the caps, so used lower value resistors for R2, R3, R4 and R5 with similar ratios. It was rather late and I probably should ha ve put it off until later. However, when I use 46k4 and 20k resistors in t he first stage the low frequency response drops to -70 dB overall instead o f -10 dB! With these resistors the DC operating point of the first stage a mp is 4.82V vs 4.12V with the original resistors. I tried 10k and 3.6k res istors and that is even worse with the DC balance out of whack.
rs change with similar ratios. The common mode range of the inputs is Vcc+
0.1V (not the absolute max of Vcc+0.3V). Still, I would expect any of thes e operating voltages to be ok. Is that the problem, the DC operating point is too close to 5 volts in spite of what the data sheet says?
Thanks for taking a look.
Did you download the new .zip file? Open MotorCurrent_highside_test.asc an d you will see all the power supplies and signal generators. I also includ ed a .plt file so all the relevant signals will automatically be opened in the plot window.
--
Rick C.
-+ Get 1,000 miles of free Supercharging
-+ Tesla referral code - https://ts.la/richard11209
gh side with a lower voltage op amp. Input resistors couple with the feedb ack resistor to keep the op amp inputs at safe levels. No big deal, seems to work ok. I used a second amp to dig the signal out of the dirt.
ed would be an average of the PWM signal used to control the device. The c aps I added didn't seem to do exactly what I was looking for and when I rem oved them I realized there was something going on that was limiting the ban d width. Seems it is the basic circuit without filter caps.
might get better response using lower value resistors if the parasitic cap acitance was causing this (620k is a bit high). Using lower resistor value s makes it worse! With 46k4 and 20k resistors the first stage is -110 dB d own!
ors are 620k and 215k. I think this zip file contains all the files needed .
on. Maybe you didn't see the main schematic? I guess I should have said t he top level schematic is MotorCurrent_highside_test.asc
t circuit. I've uploaded a new zip file. Thanks for pointing out the mist ake.
G which controls the current drawn through the circuit. The circuit turns this into a small voltage across the 0.01 ohm resistor, but at a high commo n mode voltage level. The first amp runs on 5 volts so the divider resisto rs bring the input voltage to within that range.
l. The current measurement is the voltage output on COUT.
l circuit is -3dB at 3.2 kHz with a low frequency gain of -10dB. With the caps the -3dB points are 1.7 kHz first stage and 850 Hz overall which is pr obably fine.
up the response without the caps, so used lower value resistors for R2, R3, R4 and R5 with similar ratios. It was rather late and I probably should h ave put it off until later. However, when I use 46k4 and 20k resistors in the first stage the low frequency response drops to -70 dB overall instead of -10 dB! With these resistors the DC operating point of the first stage amp is 4.82V vs 4.12V with the original resistors. I tried 10k and 3.6k re sistors and that is even worse with the DC balance out of whack.
ors change with similar ratios. The common mode range of the inputs is Vcc
+0.1V (not the absolute max of Vcc+0.3V). Still, I would expect any of the se operating voltages to be ok. Is that the problem, the DC operating poin t is too close to 5 volts in spite of what the data sheet says?
like an INAxxx or similar. sot23 and a sense resistor
and you will see all the power supplies and signal generators. I also inc luded a .plt file so all the relevant signals will automatically be opened in the plot window.
Sorry, you don't need that device because it is left over from another sche matic this was copied from, rip both of those transistors out. All those s ignal sources can go other than 5V and SIG.
Not trying to argue with anything, trying to understand.
Please refer to the third post I made in this thread. That describes what I think it should do and what I am not understanding about how it mucks up. In a nutshell it seems to work ok with the 620k and 215k resistors, but w ith smaller values in similar ratios it seems to go wonky dropping the base gain of the first amp at low frequencies. There is something fundamental about this arrangement I'm not getting.
Larkin might be right that this is a crap design to attempt, because of res istor mismatching. But the motor voltage won't vary a lot and I can use 0.
1% tolerance resistors. We need them for some other parts of the circuit a nyway. Mostly this is to set a current limit to the motor. Seems the moto rs are strong enough to damage themselves if run to the stops.
--
Rick C.
+- Get 1,000 miles of free Supercharging
+- Tesla referral code - https://ts.la/richard11209
There are lots of cheap specific high-side current sense chips. And tricky ways to do it yourself.
One can also float the opamp on the high rail and build up a lot of gain before dealing with the common-mode. I've done that in NMR gradient amp shunts, where I needed PPM accuracy at pretty high bandwidths.
Get gain first, deal with common-mode second. The circuit above does the exact opposite... worse, actually.
high side with a lower voltage op amp. Input resistors couple with the fe edback resistor to keep the op amp inputs at safe levels. No big deal, see ms to work ok. I used a second amp to dig the signal out of the dirt.
sured would be an average of the PWM signal used to control the device. Th e caps I added didn't seem to do exactly what I was looking for and when I removed them I realized there was something going on that was limiting the band width. Seems it is the basic circuit without filter caps.
t I might get better response using lower value resistors if the parasitic capacitance was causing this (620k is a bit high). Using lower resistor va lues makes it worse! With 46k4 and 20k resistors the first stage is -110 d B down!
istors are 620k and 215k. I think this zip file contains all the files nee ded.
ation. Maybe you didn't see the main schematic? I guess I should have sai d the top level schematic is MotorCurrent_highside_test.asc
test circuit. I've uploaded a new zip file. Thanks for pointing out the m istake.
SIG which controls the current drawn through the circuit. The circuit tur ns this into a small voltage across the 0.01 ohm resistor, but at a high co mmon mode voltage level. The first amp runs on 5 volts so the divider resi stors bring the input voltage to within that range.
evel. The current measurement is the voltage output on COUT.
rall circuit is -3dB at 3.2 kHz with a low frequency gain of -10dB. With t he caps the -3dB points are 1.7 kHz first stage and 850 Hz overall which is probably fine.
en up the response without the caps, so used lower value resistors for R2, R3, R4 and R5 with similar ratios. It was rather late and I probably shoul d have put it off until later. However, when I use 46k4 and 20k resistors in the first stage the low frequency response drops to -70 dB overall inste ad of -10 dB! With these resistors the DC operating point of the first sta ge amp is 4.82V vs 4.12V with the original resistors. I tried 10k and 3.6k resistors and that is even worse with the DC balance out of whack.
istors change with similar ratios. The common mode range of the inputs is Vcc+0.1V (not the absolute max of Vcc+0.3V). Still, I would expect any of these operating voltages to be ok. Is that the problem, the DC operating p oint is too close to 5 volts in spite of what the data sheet says?
Yeah, I've never designed a high side current sense before and I realized r ight away the gain of the first stage has to be below 1, below the ratio of the power supplies in fact. Trying to generate gain while referenced to t he higher voltage rail with parts I'm already using is problematic. That w ould require a rail around 10 volts that is referenced to the higher voltag e. Too many parts.
I may try using one of the available chips for this. I was trying to avoid adding a new item to the BoM.
--
Rick C.
++ Get 1,000 miles of free Supercharging
++ Tesla referral code - https://ts.la/richard11209
he high side with a lower voltage op amp. Input resistors couple with the feedback resistor to keep the op amp inputs at safe levels. No big deal, s eems to work ok. I used a second amp to dig the signal out of the dirt.
easured would be an average of the PWM signal used to control the device. The caps I added didn't seem to do exactly what I was looking for and when I removed them I realized there was something going on that was limiting th e band width. Seems it is the basic circuit without filter caps.
ght I might get better response using lower value resistors if the parasiti c capacitance was causing this (620k is a bit high). Using lower resistor values makes it worse! With 46k4 and 20k resistors the first stage is -110 dB down!
esistors are 620k and 215k. I think this zip file contains all the files n eeded.
ulation. Maybe you didn't see the main schematic? I guess I should have s aid the top level schematic is MotorCurrent_highside_test.asc
e test circuit. I've uploaded a new zip file. Thanks for pointing out the mistake.
is SIG which controls the current drawn through the circuit. The circuit t urns this into a small voltage across the 0.01 ohm resistor, but at a high common mode voltage level. The first amp runs on 5 volts so the divider re sistors bring the input voltage to within that range.
level. The current measurement is the voltage output on COUT.
verall circuit is -3dB at 3.2 kHz with a low frequency gain of -10dB. With the caps the -3dB points are 1.7 kHz first stage and 850 Hz overall which is probably fine.
open up the response without the caps, so used lower value resistors for R2 , R3, R4 and R5 with similar ratios. It was rather late and I probably sho uld have put it off until later. However, when I use 46k4 and 20k resistor s in the first stage the low frequency response drops to -70 dB overall ins tead of -10 dB! With these resistors the DC operating point of the first s tage amp is 4.82V vs 4.12V with the original resistors. I tried 10k and 3.
6k resistors and that is even worse with the DC balance out of whack.
esistors change with similar ratios. The common mode range of the inputs i s Vcc+0.1V (not the absolute max of Vcc+0.3V). Still, I would expect any o f these operating voltages to be ok. Is that the problem, the DC operating point is too close to 5 volts in spite of what the data sheet says?
right away the gain of the first stage has to be below 1, below the ratio of the power supplies in fact. Trying to generate gain while referenced to the higher voltage rail with parts I'm already using is problematic. That would require a rail around 10 volts that is referenced to the higher volt age. Too many parts.
the high side with a lower voltage op amp. Input resistors couple with th e feedback resistor to keep the op amp inputs at safe levels. No big deal, seems to work ok. I used a second amp to dig the signal out of the dirt.
measured would be an average of the PWM signal used to control the device. The caps I added didn't seem to do exactly what I was looking for and whe n I removed them I realized there was something going on that was limiting the band width. Seems it is the basic circuit without filter caps.
ought I might get better response using lower value resistors if the parasi tic capacitance was causing this (620k is a bit high). Using lower resisto r values makes it worse! With 46k4 and 20k resistors the first stage is -1
10 dB down!
resistors are 620k and 215k. I think this zip file contains all the files needed.
imulation. Maybe you didn't see the main schematic? I guess I should have said the top level schematic is MotorCurrent_highside_test.asc
the test circuit. I've uploaded a new zip file. Thanks for pointing out t he mistake.
e is SIG which controls the current drawn through the circuit. The circuit turns this into a small voltage across the 0.01 ohm resistor, but at a hig h common mode voltage level. The first amp runs on 5 volts so the divider resistors bring the input voltage to within that range.
he level. The current measurement is the voltage output on COUT.
overall circuit is -3dB at 3.2 kHz with a low frequency gain of -10dB. Wi th the caps the -3dB points are 1.7 kHz first stage and 850 Hz overall whic h is probably fine.
o open up the response without the caps, so used lower value resistors for R2, R3, R4 and R5 with similar ratios. It was rather late and I probably s hould have put it off until later. However, when I use 46k4 and 20k resist ors in the first stage the low frequency response drops to -70 dB overall i nstead of -10 dB! With these resistors the DC operating point of the first stage amp is 4.82V vs 4.12V with the original resistors. I tried 10k and
3.6k resistors and that is even worse with the DC balance out of whack.
resistors change with similar ratios. The common mode range of the inputs is Vcc+0.1V (not the absolute max of Vcc+0.3V). Still, I would expect any of these operating voltages to be ok. Is that the problem, the DC operati ng point is too close to 5 volts in spite of what the data sheet says?
V
ed right away the gain of the first stage has to be below 1, below the rati o of the power supplies in fact. Trying to generate gain while referenced to the higher voltage rail with parts I'm already using is problematic. Th at would require a rail around 10 volts that is referenced to the higher vo ltage. Too many parts.
void adding a new item to the BoM.
The motor is controlled through a H-bridge and I prefer not to muck with th e logic levels with low side sensing (the ground for the motor is common wi th the logic ground). I guess a 10 mohm resistance won't actually muck wit h the logic levels much. I suppose I could be talked into that.
What I'd really like at the moment is to know what happens in this circuit when the first stage resistors are lowered in value without changing the ra tio appreciably. The gain goes from about 1/3 ~ -10dB to -70 dB or worse a s the values are made smaller.
I'm looking at using a current sense chip, but I'd like to understand what is going on with the simulation of this circuit which is the same as the sp ecial chips. Heck, the INA199 even shows it working from a 5 volt supply w ith up to a 26 volt sense resistor common mode voltage.
--
Rick C.
--- Get 1,000 miles of free Supercharging
--- Tesla referral code - https://ts.la/richard11209
When all 4 resistors in the diff amp are reduced by a factor of ten, I see no difference in the gain plots. You will see the same if you make those changes in the texted sim that was posted.
If you will copy the exact sims that you are comparing, that apparently show otherwise, I'll look at them.
asc and you will see all the power supplies and signal generators. I also included a .plt file so all the relevant signals will automatically be open ed in the plot window.
chematic this was copied from, rip both of those transistors out. All thos e signal sources can go other than 5V and SIG.
at I think it should do and what I am not understanding about how it mucks up. In a nutshell it seems to work ok with the 620k and 215k resistors, bu t with smaller values in similar ratios it seems to go wonky dropping the b ase gain of the first amp at low frequencies. There is something fundament al about this arrangement I'm not getting.
resistor mismatching. But the motor voltage won't vary a lot and I can use 0.1% tolerance resistors. We need them for some other parts of the circui t anyway. Mostly this is to set a current limit to the motor. Seems the m otors are strong enough to damage themselves if run to the stops.
You can't rip out the transistor with no model???
Ok, I modified the files so they will run without the transistor model whic h isn't needed for the sim. However... the changes to the resistors are in the current sense component, not the top level, so it would require changi ng all three files, the two schematics and the symbol file, to create the t wo sets of resistors. I expect a parameter can be passed into a component to set the resistor values... but too much work.
So if you have a model working with the 620k and 215k values, the zip file now contains files which will simulate with component values of 1/10th the the values you have. The gain at low frequency is -117.5 dB while the corr ectly working circuit is -50 dB as expected.
I had to work to figure out what your circuit was showing in the frequency plot. Your AC input value is -26 dB, but all the rest are the right value relative to that (-50 dB at U2+ relative to the input signal). I see one h uge difference. Your test circuit doesn't bias the inputs to the proper vo ltage. You need to take the current sense resistor to 16V which should put U1+ at 4.12V.
This must have something to do with it. But I get the same DC level with b oth sets of resistors while the AC levels are hugely different.
--
Rick C.
--+ Get 1,000 miles of free Supercharging
--+ Tesla referral code - https://ts.la/richard11209
.asc and you will see all the power supplies and signal generators. I also included a .plt file so all the relevant signals will automatically be ope ned in the plot window.
schematic this was copied from, rip both of those transistors out. All tho se signal sources can go other than 5V and SIG.
hat I think it should do and what I am not understanding about how it mucks up. In a nutshell it seems to work ok with the 620k and 215k resistors, b ut with smaller values in similar ratios it seems to go wonky dropping the base gain of the first amp at low frequencies. There is something fundamen tal about this arrangement I'm not getting.
resistor mismatching. But the motor voltage won't vary a lot and I can us e 0.1% tolerance resistors. We need them for some other parts of the circu it anyway. Mostly this is to set a current limit to the motor. Seems the motors are strong enough to damage themselves if run to the stops.
Yeah, I see the ground issue. That's not so important since none of the si gnals we are working with need to have accurate data near ground... except for calibration. Some of the sensors require a DC offset measurement to be taken and subtracted from each reading for optimum accuracy. I believe th ey already have a bias built in so the zero value is not at ground though. Otherwise I guess the offset error could put some measurements below groun d which would be hard to correct for.
I'll need to verify these offsets are high enough or add more to it. Nope, some are only 14 mV. So I'll need to add an offset to the zero level.
The O2 sensor is an oddly specified part. Seems that even though they don' t explicitly indicated it, the gain factor is pretty consistent, but the of fset varies a LOT. The pressure sensors seem to be similar, but perhaps no t to the same extent. The pressure sensor error can be cut in half by cali brating the zero offset. The O2 sensor at normal conditions (20.9% O2 and STP 1 atm) varies between 9 and 13 mV. They talk about being very "linear" with a 4 point calibration matching a straight line with an r^2 of several 9s. But it is hard to do that calibration on every unit.
Otherwise they just don't tell you how accurate the O2 sensor is out of the box.
--
Rick C.
-+- Get 1,000 miles of free Supercharging
-+- Tesla referral code - https://ts.la/richard11209
.asc and you will see all the power supplies and signal generators. I also included a .plt file so all the relevant signals will automatically be ope ned in the plot window.
schematic this was copied from, rip both of those transistors out. All tho se signal sources can go other than 5V and SIG.
hat I think it should do and what I am not understanding about how it mucks up. In a nutshell it seems to work ok with the 620k and 215k resistors, b ut with smaller values in similar ratios it seems to go wonky dropping the base gain of the first amp at low frequencies. There is something fundamen tal about this arrangement I'm not getting.
resistor mismatching. But the motor voltage won't vary a lot and I can us e 0.1% tolerance resistors. We need them for some other parts of the circu it anyway. Mostly this is to set a current limit to the motor. Seems the motors are strong enough to damage themselves if run to the stops.
Ok, that was it. Even though the current drawn was only 200 uA, that seems to mess up the frequency response. I biased up the output to 0.25V and it works the champ. The sim seems to run much faster too. I guess there is something about that low an output that mucks with finding the DC operating point.
Thanks for the help.
--
Rick C.
-++ Get 1,000 miles of free Supercharging
-++ Tesla referral code - https://ts.la/richard11209
ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here.
All logos and trade names are the property of their respective owners.