Strange Circuit?...

R

Ricketty C

Guest
I thought this was a simple circuit to measure a current on the 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, seems to work ok. 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 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.

With no caps the roll off was around -20dB at 42 kHz. I thought I might get better response using lower value resistors if the parasitic 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!

I am missing something very fundamental here. The original resistors are 620k and 215k. I think this zip file contains all the files needed.

http://arius.com/temp/CurrentMon.zip

--

Rick C.

- Get 1,000 miles of free Supercharging
- Tesla referral code - https://ts.la/richard11209
 
On Tue, 18 Aug 2020 00:35:28 -0700 (PDT), Ricketty C
<gnuarm.deletethisbit@gmail.com> wrote:

I thought this was a simple circuit to measure a current on the 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, seems to work ok. 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 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.

With no caps the roll off was around -20dB at 42 kHz. I thought I might get better response using lower value resistors if the parasitic 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!

I am missing something very fundamental here. The original resistors are 620k and 215k. I think this zip file contains all the files needed.

http://arius.com/temp/CurrentMon.zip

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.

RL
 
On Tuesday, August 18, 2020 at 8:26:33 AM UTC-4, legg wrote:
On Tue, 18 Aug 2020 00:35:28 -0700 (PDT), Ricketty C
gnuarm.deletethisbit@gmail.com> wrote:

I thought this was a simple circuit to measure a current on the 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, seems to work ok. 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 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.

With no caps the roll off was around -20dB at 42 kHz. I thought I might get better response using lower value resistors if the parasitic 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!

I am missing something very fundamental here. The original resistors are 620k and 215k. I think this zip file contains all the files needed.

http://arius.com/temp/CurrentMon.zip

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.

I am testing a design by using it as a component in the test simulation. Maybe 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 circuit. 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
 
On Tuesday, August 18, 2020 at 10:50:17 AM UTC-4, Ricketty C wrote:
On Tuesday, August 18, 2020 at 8:26:33 AM UTC-4, legg wrote:
On Tue, 18 Aug 2020 00:35:28 -0700 (PDT), Ricketty C
gnuarm.deletethisbit@gmail.com> wrote:

I thought this was a simple circuit to measure a current on the 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, seems to work ok. 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 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.

With no caps the roll off was around -20dB at 42 kHz. I thought I might get better response using lower value resistors if the parasitic 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!

I am missing something very fundamental here. The original resistors are 620k and 215k. I think this zip file contains all the files needed.

http://arius.com/temp/CurrentMon.zip

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.

I am testing a design by using it as a component in the test simulation. Maybe 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 circuit. 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 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 common mode voltage level. The first amp runs on 5 volts so the divider resistors bring the input voltage to within that range.

The signal level is very low, so a second amp is used to boost the level. The current measurement is the voltage output on COUT.

Without the filter caps the first amp is -3dB at 300 kHz and the overall 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.

I had forgotten that the amp is only 350kHz GBW and was trying to 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 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 resistors 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.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 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
 
On Tue, 18 Aug 2020 08:48:31 -0700 (PDT), Ricketty C
<gnuarm.deletethisbit@gmail.com> wrote:

On Tuesday, August 18, 2020 at 10:50:17 AM UTC-4, Ricketty C wrote:
On Tuesday, August 18, 2020 at 8:26:33 AM UTC-4, legg wrote:
On Tue, 18 Aug 2020 00:35:28 -0700 (PDT), Ricketty C
gnuarm.deletethisbit@gmail.com> wrote:

I thought this was a simple circuit to measure a current on the 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, seems to work ok. 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 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.

With no caps the roll off was around -20dB at 42 kHz. I thought I might get better response using lower value resistors if the parasitic 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!

I am missing something very fundamental here. The original resistors are 620k and 215k. I think this zip file contains all the files needed.

http://arius.com/temp/CurrentMon.zip

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.

I am testing a design by using it as a component in the test simulation. Maybe 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 circuit. 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 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 common mode voltage level. The first amp runs on 5 volts so the divider resistors bring the input voltage to within that range.

The signal level is very low, so a second amp is used to boost the level. The current measurement is the voltage output on COUT.

Without the filter caps the first amp is -3dB at 300 kHz and the overall 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.

I had forgotten that the amp is only 350kHz GBW and was trying to 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 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 resistors 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.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 point is too close to 5 volts in spite of what the data sheet says?

The sim below will run in your unzipped directory
and give a frequency plot.
If you remove the 5V supply, it won\'t.

RL

Version 4
SHEET 1 1752 708
WIRE -48 -192 -64 -192
WIRE 112 -192 32 -192
WIRE 240 -192 192 -192
WIRE -64 -112 -64 -192
WIRE -64 -112 -272 -112
WIRE -32 -112 -64 -112
WIRE 80 -112 48 -112
WIRE 240 -112 240 -192
WIRE 240 -112 80 -112
WIRE 288 -112 240 -112
WIRE -64 0 -64 -112
WIRE 80 0 80 -112
WIRE 624 32 560 32
WIRE 752 32 688 32
WIRE -224 64 -224 32
WIRE 80 128 80 80
WIRE 128 128 80 128
WIRE 176 128 128 128
WIRE 320 128 256 128
WIRE 432 128 400 128
WIRE 544 128 512 128
WIRE 592 128 544 128
WIRE 624 128 592 128
WIRE 752 128 752 32
WIRE 752 128 704 128
WIRE 400 160 400 128
WIRE -240 192 -272 192
WIRE -240 224 -240 192
WIRE 656 256 640 256
WIRE 224 272 208 272
WIRE 656 272 656 256
WIRE 224 288 224 272
WIRE 544 288 544 128
WIRE 624 288 544 288
WIRE 80 304 80 128
WIRE 192 304 80 304
WIRE 752 304 752 128
WIRE 752 304 688 304
WIRE 976 304 752 304
WIRE 320 320 320 128
WIRE 320 320 256 320
WIRE 368 320 320 320
WIRE 480 320 448 320
WIRE 544 320 480 320
WIRE 624 320 544 320
WIRE -240 336 -240 304
WIRE -64 336 -64 80
WIRE -16 336 -64 336
WIRE 192 336 -16 336
WIRE 480 352 480 320
WIRE 656 352 656 336
WIRE -64 368 -64 336
WIRE 224 368 224 352
WIRE 576 432 576 416
WIRE 480 448 480 432
WIRE -64 464 -64 448
FLAG 224 368 0
FLAG -64 464 0
FLAG -16 336 U1+
FLAG 224 272 5V
FLAG 288 -112 MOT
IOPIN 288 -112 BiDir
FLAG 656 352 0
FLAG 656 256 5V
FLAG 400 160 0
FLAG 128 128 U1-
FLAG 592 128 U2-
FLAG 544 320 U2+
FLAG 320 128 Current
FLAG 480 448 0
FLAG -272 -112 PSU
IOPIN -272 -112 BiDir
FLAG 976 304 COUT
IOPIN 976 304 Out
FLAG -272 192 5V
IOPIN -272 192 BiDir
FLAG 576 432 0
FLAG -240 336 0
FLAG -224 64 0
SYMBOL res -80 352 R0
SYMATTR InstName R3
SYMATTR Value 215k
SYMBOL res 64 -16 R0
SYMATTR InstName R4
SYMATTR Value 620k
SYMBOL res 160 144 R270
WINDOW 0 32 32 VTop 2
WINDOW 3 32 86 VTop 2
SYMATTR InstName R5
SYMATTR Value 215k
SYMBOL res 64 -128 R90
WINDOW 0 0 56 VBottom 2
WINDOW 3 32 56 VTop 2
SYMATTR InstName R1
SYMATTR Value 0R010
SYMBOL TLV2333 224 256 R0
SYMATTR InstName U1
SYMBOL res -80 -16 R0
SYMATTR InstName R2
SYMATTR Value 620k
SYMBOL res 608 144 R270
WINDOW 0 32 32 VTop 2
WINDOW 3 32 86 VTop 2
SYMATTR InstName R9
SYMATTR Value 1Meg
SYMBOL TLV2333 656 240 R0
SYMATTR InstName U2
SYMBOL res 352 336 R270
WINDOW 0 32 32 VTop 2
WINDOW 3 32 86 VTop 2
SYMATTR InstName R6
SYMATTR Value 10k
SYMBOL res 416 144 R270
WINDOW 0 32 32 VTop 2
WINDOW 3 32 86 VTop 2
SYMATTR InstName R8
SYMATTR Value 10k
SYMBOL res 464 336 R0
SYMATTR InstName R7
SYMATTR Value 100k
SYMBOL cap 560 352 R0
SYMATTR InstName C1
SYMATTR Value 10nF
SYMBOL cap 688 16 R90
WINDOW 0 0 61 VBottom 2
WINDOW 3 0 -4 VBottom 2
SYMATTR InstName C2
SYMATTR Value 100pF
SYMBOL voltage -240 208 R0
WINDOW 123 0 0 Left 2
WINDOW 39 0 0 Left 2
SYMATTR InstName V1
SYMATTR Value 5
SYMBOL voltage 48 -192 R90
WINDOW 0 -32 56 VBottom 2
WINDOW 3 32 56 VTop 2
WINDOW 123 -4 56 VBottom 2
WINDOW 39 0 0 Left 2
SYMATTR InstName V2
SYMATTR Value \"\"
SYMATTR Value2 AC 0.05
SYMBOL voltage -224 -64 R0
WINDOW 123 0 0 Left 2
WINDOW 39 0 0 Left 2
SYMATTR InstName V3
SYMATTR Value 10
SYMBOL voltage 96 -192 R270
WINDOW 0 32 56 VTop 2
WINDOW 3 -32 56 VBottom 2
WINDOW 123 0 0 Left 2
WINDOW 39 0 0 Left 2
SYMATTR InstName V4
SYMATTR Value .05
TEXT 504 -256 Right 4 ;Motor Current Measurement
TEXT 152 -56 Left 3 ;10A = 0.1V
TEXT 792 344 Left 3 ;10A = 3.18V\\n4.5A = 1.43V\\n3.5A = 1.11V
TEXT 240 424 Left 3 ;10A = 0.035V
TEXT -8 352 Left 2 ;@16Vin U1+ = \\n16*215/835 = 4.12V
TEXT -384 488 Left 2 !.ac dec 10 1 1E5
LINE Normal 336 400 368 336
 
On Tuesday, August 18, 2020 at 2:28:45 PM UTC-4, legg wrote:
On Tue, 18 Aug 2020 08:48:31 -0700 (PDT), Ricketty C
gnuarm.deletethisbit@gmail.com> wrote:

On Tuesday, August 18, 2020 at 10:50:17 AM UTC-4, Ricketty C wrote:
On Tuesday, August 18, 2020 at 8:26:33 AM UTC-4, legg wrote:
On Tue, 18 Aug 2020 00:35:28 -0700 (PDT), Ricketty C
gnuarm.deletethisbit@gmail.com> wrote:

I thought this was a simple circuit to measure a current on the 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, seems to work ok. 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 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.

With no caps the roll off was around -20dB at 42 kHz. I thought I might get better response using lower value resistors if the parasitic 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!

I am missing something very fundamental here. The original resistors are 620k and 215k. I think this zip file contains all the files needed.

http://arius.com/temp/CurrentMon.zip

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.

I am testing a design by using it as a component in the test simulation. Maybe 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 circuit. 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 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 common mode voltage level. The first amp runs on 5 volts so the divider resistors bring the input voltage to within that range.

The signal level is very low, so a second amp is used to boost the level.. The current measurement is the voltage output on COUT.

Without the filter caps the first amp is -3dB at 300 kHz and the overall 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.

I had forgotten that the amp is only 350kHz GBW and was trying to 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 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 resistors 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.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 point is too close to 5 volts in spite of what the data sheet says?

The sim below will run in your unzipped directory
and give a frequency plot.
If you remove the 5V supply, it won\'t.

Thanks for taking a look.

Did you download the new .zip file? Open MotorCurrent_highside_test.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 opened in the plot window.

--

Rick C.

-+ Get 1,000 miles of free Supercharging
-+ Tesla referral code - https://ts.la/richard11209
 
On Tue, 18 Aug 2020 14:34:27 -0400, legg <legg@nospam.magma.ca> wrote:

On Tue, 18 Aug 2020 08:48:31 -0700 (PDT), Ricketty C
gnuarm.deletethisbit@gmail.com> wrote:

On Tuesday, August 18, 2020 at 10:50:17 AM UTC-4, Ricketty C wrote:
On Tuesday, August 18, 2020 at 8:26:33 AM UTC-4, legg wrote:
On Tue, 18 Aug 2020 00:35:28 -0700 (PDT), Ricketty C
gnuarm.deletethisbit@gmail.com> wrote:

I thought this was a simple circuit to measure a current on the 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, seems to work ok. 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 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.

With no caps the roll off was around -20dB at 42 kHz. I thought I might get better response using lower value resistors if the parasitic 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!

I am missing something very fundamental here. The original resistors are 620k and 215k. I think this zip file contains all the files needed.

http://arius.com/temp/CurrentMon.zip

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.

I am testing a design by using it as a component in the test simulation. Maybe 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 circuit. 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 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 common mode voltage level. The first amp runs on 5 volts so the divider resistors bring the input voltage to within that range.

The signal level is very low, so a second amp is used to boost the level. The current measurement is the voltage output on COUT.

Without the filter caps the first amp is -3dB at 300 kHz and the overall 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.

I had forgotten that the amp is only 350kHz GBW and was trying to 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 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 resistors 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.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 point is too close to 5 volts in spite of what the data sheet says?

The sim below will run in your unzipped directory
and give a frequency plot.
If you remove the 5V supply, it won\'t.

RL

Version 4
SHEET 1 1752 708
WIRE -48 -192 -64 -192
WIRE 112 -192 32 -192
WIRE 240 -192 192 -192
WIRE -64 -112 -64 -192
WIRE -64 -112 -272 -112
WIRE -32 -112 -64 -112
WIRE 80 -112 48 -112
WIRE 240 -112 240 -192
WIRE 240 -112 80 -112
WIRE 288 -112 240 -112
WIRE -64 0 -64 -112
WIRE 80 0 80 -112
WIRE 624 32 560 32
WIRE 752 32 688 32
WIRE -224 64 -224 32
WIRE 80 128 80 80
WIRE 128 128 80 128
WIRE 176 128 128 128
WIRE 320 128 256 128
WIRE 432 128 400 128
WIRE 544 128 512 128
WIRE 592 128 544 128
WIRE 624 128 592 128
WIRE 752 128 752 32
WIRE 752 128 704 128
WIRE 400 160 400 128
WIRE -240 192 -272 192
WIRE -240 224 -240 192
WIRE 656 256 640 256
WIRE 224 272 208 272
WIRE 656 272 656 256
WIRE 224 288 224 272
WIRE 544 288 544 128
WIRE 624 288 544 288
WIRE 80 304 80 128
WIRE 192 304 80 304
WIRE 752 304 752 128
WIRE 752 304 688 304
WIRE 976 304 752 304
WIRE 320 320 320 128
WIRE 320 320 256 320
WIRE 368 320 320 320
WIRE 480 320 448 320
WIRE 544 320 480 320
WIRE 624 320 544 320
WIRE -240 336 -240 304
WIRE -64 336 -64 80
WIRE -16 336 -64 336
WIRE 192 336 -16 336
WIRE 480 352 480 320
WIRE 656 352 656 336
WIRE -64 368 -64 336
WIRE 224 368 224 352
WIRE 576 432 576 416
WIRE 480 448 480 432
WIRE -64 464 -64 448
FLAG 224 368 0
FLAG -64 464 0
FLAG -16 336 U1+
FLAG 224 272 5V
FLAG 288 -112 MOT
IOPIN 288 -112 BiDir
FLAG 656 352 0
FLAG 656 256 5V
FLAG 400 160 0
FLAG 128 128 U1-
FLAG 592 128 U2-
FLAG 544 320 U2+
FLAG 320 128 Current
FLAG 480 448 0
FLAG -272 -112 PSU
IOPIN -272 -112 BiDir
FLAG 976 304 COUT
IOPIN 976 304 Out
FLAG -272 192 5V
IOPIN -272 192 BiDir
FLAG 576 432 0
FLAG -240 336 0
FLAG -224 64 0
SYMBOL res -80 352 R0
SYMATTR InstName R3
SYMATTR Value 215k
SYMBOL res 64 -16 R0
SYMATTR InstName R4
SYMATTR Value 620k
SYMBOL res 160 144 R270
WINDOW 0 32 32 VTop 2
WINDOW 3 32 86 VTop 2
SYMATTR InstName R5
SYMATTR Value 215k
SYMBOL res 64 -128 R90
WINDOW 0 0 56 VBottom 2
WINDOW 3 32 56 VTop 2
SYMATTR InstName R1
SYMATTR Value 0R010
SYMBOL TLV2333 224 256 R0
SYMATTR InstName U1
SYMBOL res -80 -16 R0
SYMATTR InstName R2
SYMATTR Value 620k
SYMBOL res 608 144 R270
WINDOW 0 32 32 VTop 2
WINDOW 3 32 86 VTop 2
SYMATTR InstName R9
SYMATTR Value 1Meg
SYMBOL TLV2333 656 240 R0
SYMATTR InstName U2
SYMBOL res 352 336 R270
WINDOW 0 32 32 VTop 2
WINDOW 3 32 86 VTop 2
SYMATTR InstName R6
SYMATTR Value 10k
SYMBOL res 416 144 R270
WINDOW 0 32 32 VTop 2
WINDOW 3 32 86 VTop 2
SYMATTR InstName R8
SYMATTR Value 10k
SYMBOL res 464 336 R0
SYMATTR InstName R7
SYMATTR Value 100k
SYMBOL cap 560 352 R0
SYMATTR InstName C1
SYMATTR Value 10nF
SYMBOL cap 688 16 R90
WINDOW 0 0 61 VBottom 2
WINDOW 3 0 -4 VBottom 2
SYMATTR InstName C2
SYMATTR Value 100pF
SYMBOL voltage -240 208 R0
WINDOW 123 0 0 Left 2
WINDOW 39 0 0 Left 2
SYMATTR InstName V1
SYMATTR Value 5
SYMBOL voltage 48 -192 R90
WINDOW 0 -32 56 VBottom 2
WINDOW 3 32 56 VTop 2
WINDOW 123 -4 56 VBottom 2
WINDOW 39 0 0 Left 2
SYMATTR InstName V2
SYMATTR Value \"\"
SYMATTR Value2 AC 0.05
SYMBOL voltage -224 -64 R0
WINDOW 123 0 0 Left 2
WINDOW 39 0 0 Left 2
SYMATTR InstName V3
SYMATTR Value 10
SYMBOL voltage 96 -192 R270
WINDOW 0 32 56 VTop 2
WINDOW 3 -32 56 VBottom 2
WINDOW 123 0 0 Left 2
WINDOW 39 0 0 Left 2
SYMATTR InstName V4
SYMATTR Value .05
TEXT 504 -256 Right 4 ;Motor Current Measurement
TEXT 152 -56 Left 3 ;10A = 0.1V
TEXT 792 344 Left 3 ;10A = 3.18V\\n4.5A = 1.43V\\n3.5A = 1.11V
TEXT 240 424 Left 3 ;10A = 0.035V
TEXT -8 352 Left 2 ;@16Vin U1+ = \\n16*215/835 = 4.12V
TEXT -384 488 Left 2 !.ac dec 10 1 1E5
LINE Normal 336 400 368 336

That circuit won\'t work. Resistor tolerances will wreck the CMRR.

There are ways to do high-side current sensing.
 
On Tue, 18 Aug 2020 12:06:02 -0700 (PDT), Ricketty C
<gnuarm.deletethisbit@gmail.com> wrote:

<snip>
The sim below will run in your unzipped directory
and give a frequency plot.
If you remove the 5V supply, it won\'t.

Thanks for taking a look.

Did you download the new .zip file? Open MotorCurrent_highside_test.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 opened in the plot window.

missing AOD4185.

If you\'re only interested in the current monitor,
you might just limit to those parts.

Is the problem with the breadboard not acting like
the model, or vice versa?

Hard to argue with a model, if you don\'t have the
hardware.

RL
 
onsdag den 19. august 2020 kl. 00.06.13 UTC+2 skrev John Larkin:
On Tue, 18 Aug 2020 14:34:27 -0400, legg <legg@nospam.magma.ca> wrote:

On Tue, 18 Aug 2020 08:48:31 -0700 (PDT), Ricketty C
gnuarm.deletethisbit@gmail.com> wrote:

On Tuesday, August 18, 2020 at 10:50:17 AM UTC-4, Ricketty C wrote:
On Tuesday, August 18, 2020 at 8:26:33 AM UTC-4, legg wrote:
On Tue, 18 Aug 2020 00:35:28 -0700 (PDT), Ricketty C
gnuarm.deletethisbit@gmail.com> wrote:

I thought this was a simple circuit to measure a current on the 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, seems to work ok. 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 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.

With no caps the roll off was around -20dB at 42 kHz. I thought I might get better response using lower value resistors if the parasitic 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!

I am missing something very fundamental here. The original resistors are 620k and 215k. I think this zip file contains all the files needed..

http://arius.com/temp/CurrentMon.zip

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.

I am testing a design by using it as a component in the test simulation. Maybe 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 circuit. 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 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 common mode voltage level. The first amp runs on 5 volts so the divider resistors bring the input voltage to within that range.

The signal level is very low, so a second amp is used to boost the level. The current measurement is the voltage output on COUT.

Without the filter caps the first amp is -3dB at 300 kHz and the overall 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.

I had forgotten that the amp is only 350kHz GBW and was trying to 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 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 resistors 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.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 point is too close to 5 volts in spite of what the data sheet says?

The sim below will run in your unzipped directory
and give a frequency plot.
If you remove the 5V supply, it won\'t.

RL

Version 4
SHEET 1 1752 708
WIRE -48 -192 -64 -192
WIRE 112 -192 32 -192
WIRE 240 -192 192 -192
WIRE -64 -112 -64 -192
WIRE -64 -112 -272 -112
WIRE -32 -112 -64 -112
WIRE 80 -112 48 -112
WIRE 240 -112 240 -192
WIRE 240 -112 80 -112
WIRE 288 -112 240 -112
WIRE -64 0 -64 -112
WIRE 80 0 80 -112
WIRE 624 32 560 32
WIRE 752 32 688 32
WIRE -224 64 -224 32
WIRE 80 128 80 80
WIRE 128 128 80 128
WIRE 176 128 128 128
WIRE 320 128 256 128
WIRE 432 128 400 128
WIRE 544 128 512 128
WIRE 592 128 544 128
WIRE 624 128 592 128
WIRE 752 128 752 32
WIRE 752 128 704 128
WIRE 400 160 400 128
WIRE -240 192 -272 192
WIRE -240 224 -240 192
WIRE 656 256 640 256
WIRE 224 272 208 272
WIRE 656 272 656 256
WIRE 224 288 224 272
WIRE 544 288 544 128
WIRE 624 288 544 288
WIRE 80 304 80 128
WIRE 192 304 80 304
WIRE 752 304 752 128
WIRE 752 304 688 304
WIRE 976 304 752 304
WIRE 320 320 320 128
WIRE 320 320 256 320
WIRE 368 320 320 320
WIRE 480 320 448 320
WIRE 544 320 480 320
WIRE 624 320 544 320
WIRE -240 336 -240 304
WIRE -64 336 -64 80
WIRE -16 336 -64 336
WIRE 192 336 -16 336
WIRE 480 352 480 320
WIRE 656 352 656 336
WIRE -64 368 -64 336
WIRE 224 368 224 352
WIRE 576 432 576 416
WIRE 480 448 480 432
WIRE -64 464 -64 448
FLAG 224 368 0
FLAG -64 464 0
FLAG -16 336 U1+
FLAG 224 272 5V
FLAG 288 -112 MOT
IOPIN 288 -112 BiDir
FLAG 656 352 0
FLAG 656 256 5V
FLAG 400 160 0
FLAG 128 128 U1-
FLAG 592 128 U2-
FLAG 544 320 U2+
FLAG 320 128 Current
FLAG 480 448 0
FLAG -272 -112 PSU
IOPIN -272 -112 BiDir
FLAG 976 304 COUT
IOPIN 976 304 Out
FLAG -272 192 5V
IOPIN -272 192 BiDir
FLAG 576 432 0
FLAG -240 336 0
FLAG -224 64 0
SYMBOL res -80 352 R0
SYMATTR InstName R3
SYMATTR Value 215k
SYMBOL res 64 -16 R0
SYMATTR InstName R4
SYMATTR Value 620k
SYMBOL res 160 144 R270
WINDOW 0 32 32 VTop 2
WINDOW 3 32 86 VTop 2
SYMATTR InstName R5
SYMATTR Value 215k
SYMBOL res 64 -128 R90
WINDOW 0 0 56 VBottom 2
WINDOW 3 32 56 VTop 2
SYMATTR InstName R1
SYMATTR Value 0R010
SYMBOL TLV2333 224 256 R0
SYMATTR InstName U1
SYMBOL res -80 -16 R0
SYMATTR InstName R2
SYMATTR Value 620k
SYMBOL res 608 144 R270
WINDOW 0 32 32 VTop 2
WINDOW 3 32 86 VTop 2
SYMATTR InstName R9
SYMATTR Value 1Meg
SYMBOL TLV2333 656 240 R0
SYMATTR InstName U2
SYMBOL res 352 336 R270
WINDOW 0 32 32 VTop 2
WINDOW 3 32 86 VTop 2
SYMATTR InstName R6
SYMATTR Value 10k
SYMBOL res 416 144 R270
WINDOW 0 32 32 VTop 2
WINDOW 3 32 86 VTop 2
SYMATTR InstName R8
SYMATTR Value 10k
SYMBOL res 464 336 R0
SYMATTR InstName R7
SYMATTR Value 100k
SYMBOL cap 560 352 R0
SYMATTR InstName C1
SYMATTR Value 10nF
SYMBOL cap 688 16 R90
WINDOW 0 0 61 VBottom 2
WINDOW 3 0 -4 VBottom 2
SYMATTR InstName C2
SYMATTR Value 100pF
SYMBOL voltage -240 208 R0
WINDOW 123 0 0 Left 2
WINDOW 39 0 0 Left 2
SYMATTR InstName V1
SYMATTR Value 5
SYMBOL voltage 48 -192 R90
WINDOW 0 -32 56 VBottom 2
WINDOW 3 32 56 VTop 2
WINDOW 123 -4 56 VBottom 2
WINDOW 39 0 0 Left 2
SYMATTR InstName V2
SYMATTR Value \"\"
SYMATTR Value2 AC 0.05
SYMBOL voltage -224 -64 R0
WINDOW 123 0 0 Left 2
WINDOW 39 0 0 Left 2
SYMATTR InstName V3
SYMATTR Value 10
SYMBOL voltage 96 -192 R270
WINDOW 0 32 56 VTop 2
WINDOW 3 -32 56 VBottom 2
WINDOW 123 0 0 Left 2
WINDOW 39 0 0 Left 2
SYMATTR InstName V4
SYMATTR Value .05
TEXT 504 -256 Right 4 ;Motor Current Measurement
TEXT 152 -56 Left 3 ;10A = 0.1V
TEXT 792 344 Left 3 ;10A = 3.18V\\n4.5A = 1.43V\\n3.5A = 1.11V
TEXT 240 424 Left 3 ;10A = 0.035V
TEXT -8 352 Left 2 ;@16Vin U1+ = \\n16*215/835 = 4.12V
TEXT -384 488 Left 2 !.ac dec 10 1 1E5
LINE Normal 336 400 368 336


That circuit won\'t work. Resistor tolerances will wreck the CMRR.

There are ways to do high-side current sensing.

like an INAxxx or similar. sot23 and a sense resistor
 
On Tuesday, August 18, 2020 at 6:16:00 PM UTC-4, legg wrote:
On Tue, 18 Aug 2020 12:06:02 -0700 (PDT), Ricketty C
gnuarm.deletethisbit@gmail.com> wrote:

snip
The sim below will run in your unzipped directory
and give a frequency plot.
If you remove the 5V supply, it won\'t.

Thanks for taking a look.

Did you download the new .zip file? Open MotorCurrent_highside_test.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 opened in the plot window.

missing AOD4185.

Sorry, you don\'t need that device because it is left over from another schematic this was copied from, rip both of those transistors out. All those signal sources can go other than 5V and SIG.


If you\'re only interested in the current monitor,
you might just limit to those parts.

Is the problem with the breadboard not acting like
the model, or vice versa?

Hard to argue with a model, if you don\'t have the
hardware.

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 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 fundamental about this arrangement I\'m not getting.

Larkin might be right that this is a crap design to attempt, because of 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 circuit 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.

--

Rick C.

+- Get 1,000 miles of free Supercharging
+- Tesla referral code - https://ts.la/richard11209
 
On Tue, 18 Aug 2020 15:40:53 -0700 (PDT), Lasse Langwadt Christensen
<langwadt@fonz.dk> wrote:

onsdag den 19. august 2020 kl. 00.06.13 UTC+2 skrev John Larkin:
On Tue, 18 Aug 2020 14:34:27 -0400, legg <legg@nospam.magma.ca> wrote:

On Tue, 18 Aug 2020 08:48:31 -0700 (PDT), Ricketty C
gnuarm.deletethisbit@gmail.com> wrote:

On Tuesday, August 18, 2020 at 10:50:17 AM UTC-4, Ricketty C wrote:
On Tuesday, August 18, 2020 at 8:26:33 AM UTC-4, legg wrote:
On Tue, 18 Aug 2020 00:35:28 -0700 (PDT), Ricketty C
gnuarm.deletethisbit@gmail.com> wrote:

I thought this was a simple circuit to measure a current on the 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, seems to work ok. 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 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.

With no caps the roll off was around -20dB at 42 kHz. I thought I might get better response using lower value resistors if the parasitic 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!

I am missing something very fundamental here. The original resistors are 620k and 215k. I think this zip file contains all the files needed.

http://arius.com/temp/CurrentMon.zip

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.

I am testing a design by using it as a component in the test simulation. Maybe 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 circuit. 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 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 common mode voltage level. The first amp runs on 5 volts so the divider resistors bring the input voltage to within that range.

The signal level is very low, so a second amp is used to boost the level. The current measurement is the voltage output on COUT.

Without the filter caps the first amp is -3dB at 300 kHz and the overall 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.

I had forgotten that the amp is only 350kHz GBW and was trying to 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 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 resistors 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.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 point is too close to 5 volts in spite of what the data sheet says?

The sim below will run in your unzipped directory
and give a frequency plot.
If you remove the 5V supply, it won\'t.

RL

Version 4
SHEET 1 1752 708
WIRE -48 -192 -64 -192
WIRE 112 -192 32 -192
WIRE 240 -192 192 -192
WIRE -64 -112 -64 -192
WIRE -64 -112 -272 -112
WIRE -32 -112 -64 -112
WIRE 80 -112 48 -112
WIRE 240 -112 240 -192
WIRE 240 -112 80 -112
WIRE 288 -112 240 -112
WIRE -64 0 -64 -112
WIRE 80 0 80 -112
WIRE 624 32 560 32
WIRE 752 32 688 32
WIRE -224 64 -224 32
WIRE 80 128 80 80
WIRE 128 128 80 128
WIRE 176 128 128 128
WIRE 320 128 256 128
WIRE 432 128 400 128
WIRE 544 128 512 128
WIRE 592 128 544 128
WIRE 624 128 592 128
WIRE 752 128 752 32
WIRE 752 128 704 128
WIRE 400 160 400 128
WIRE -240 192 -272 192
WIRE -240 224 -240 192
WIRE 656 256 640 256
WIRE 224 272 208 272
WIRE 656 272 656 256
WIRE 224 288 224 272
WIRE 544 288 544 128
WIRE 624 288 544 288
WIRE 80 304 80 128
WIRE 192 304 80 304
WIRE 752 304 752 128
WIRE 752 304 688 304
WIRE 976 304 752 304
WIRE 320 320 320 128
WIRE 320 320 256 320
WIRE 368 320 320 320
WIRE 480 320 448 320
WIRE 544 320 480 320
WIRE 624 320 544 320
WIRE -240 336 -240 304
WIRE -64 336 -64 80
WIRE -16 336 -64 336
WIRE 192 336 -16 336
WIRE 480 352 480 320
WIRE 656 352 656 336
WIRE -64 368 -64 336
WIRE 224 368 224 352
WIRE 576 432 576 416
WIRE 480 448 480 432
WIRE -64 464 -64 448
FLAG 224 368 0
FLAG -64 464 0
FLAG -16 336 U1+
FLAG 224 272 5V
FLAG 288 -112 MOT
IOPIN 288 -112 BiDir
FLAG 656 352 0
FLAG 656 256 5V
FLAG 400 160 0
FLAG 128 128 U1-
FLAG 592 128 U2-
FLAG 544 320 U2+
FLAG 320 128 Current
FLAG 480 448 0
FLAG -272 -112 PSU
IOPIN -272 -112 BiDir
FLAG 976 304 COUT
IOPIN 976 304 Out
FLAG -272 192 5V
IOPIN -272 192 BiDir
FLAG 576 432 0
FLAG -240 336 0
FLAG -224 64 0
SYMBOL res -80 352 R0
SYMATTR InstName R3
SYMATTR Value 215k
SYMBOL res 64 -16 R0
SYMATTR InstName R4
SYMATTR Value 620k
SYMBOL res 160 144 R270
WINDOW 0 32 32 VTop 2
WINDOW 3 32 86 VTop 2
SYMATTR InstName R5
SYMATTR Value 215k
SYMBOL res 64 -128 R90
WINDOW 0 0 56 VBottom 2
WINDOW 3 32 56 VTop 2
SYMATTR InstName R1
SYMATTR Value 0R010
SYMBOL TLV2333 224 256 R0
SYMATTR InstName U1
SYMBOL res -80 -16 R0
SYMATTR InstName R2
SYMATTR Value 620k
SYMBOL res 608 144 R270
WINDOW 0 32 32 VTop 2
WINDOW 3 32 86 VTop 2
SYMATTR InstName R9
SYMATTR Value 1Meg
SYMBOL TLV2333 656 240 R0
SYMATTR InstName U2
SYMBOL res 352 336 R270
WINDOW 0 32 32 VTop 2
WINDOW 3 32 86 VTop 2
SYMATTR InstName R6
SYMATTR Value 10k
SYMBOL res 416 144 R270
WINDOW 0 32 32 VTop 2
WINDOW 3 32 86 VTop 2
SYMATTR InstName R8
SYMATTR Value 10k
SYMBOL res 464 336 R0
SYMATTR InstName R7
SYMATTR Value 100k
SYMBOL cap 560 352 R0
SYMATTR InstName C1
SYMATTR Value 10nF
SYMBOL cap 688 16 R90
WINDOW 0 0 61 VBottom 2
WINDOW 3 0 -4 VBottom 2
SYMATTR InstName C2
SYMATTR Value 100pF
SYMBOL voltage -240 208 R0
WINDOW 123 0 0 Left 2
WINDOW 39 0 0 Left 2
SYMATTR InstName V1
SYMATTR Value 5
SYMBOL voltage 48 -192 R90
WINDOW 0 -32 56 VBottom 2
WINDOW 3 32 56 VTop 2
WINDOW 123 -4 56 VBottom 2
WINDOW 39 0 0 Left 2
SYMATTR InstName V2
SYMATTR Value \"\"
SYMATTR Value2 AC 0.05
SYMBOL voltage -224 -64 R0
WINDOW 123 0 0 Left 2
WINDOW 39 0 0 Left 2
SYMATTR InstName V3
SYMATTR Value 10
SYMBOL voltage 96 -192 R270
WINDOW 0 32 56 VTop 2
WINDOW 3 -32 56 VBottom 2
WINDOW 123 0 0 Left 2
WINDOW 39 0 0 Left 2
SYMATTR InstName V4
SYMATTR Value .05
TEXT 504 -256 Right 4 ;Motor Current Measurement
TEXT 152 -56 Left 3 ;10A = 0.1V
TEXT 792 344 Left 3 ;10A = 3.18V\\n4.5A = 1.43V\\n3.5A = 1.11V
TEXT 240 424 Left 3 ;10A = 0.035V
TEXT -8 352 Left 2 ;@16Vin U1+ = \\n16*215/835 = 4.12V
TEXT -384 488 Left 2 !.ac dec 10 1 1E5
LINE Normal 336 400 368 336


That circuit won\'t work. Resistor tolerances will wreck the CMRR.

There are ways to do high-side current sensing.

like an INAxxx or similar. sot23 and a sense resistor

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.
 
On Tuesday, August 18, 2020 at 6:55:48 PM UTC-4, John Larkin wrote:
On Tue, 18 Aug 2020 15:40:53 -0700 (PDT), Lasse Langwadt Christensen
langwadt@fonz.dk> wrote:

onsdag den 19. august 2020 kl. 00.06.13 UTC+2 skrev John Larkin:
On Tue, 18 Aug 2020 14:34:27 -0400, legg <legg@nospam.magma.ca> wrote:

On Tue, 18 Aug 2020 08:48:31 -0700 (PDT), Ricketty C
gnuarm.deletethisbit@gmail.com> wrote:

On Tuesday, August 18, 2020 at 10:50:17 AM UTC-4, Ricketty C wrote:
On Tuesday, August 18, 2020 at 8:26:33 AM UTC-4, legg wrote:
On Tue, 18 Aug 2020 00:35:28 -0700 (PDT), Ricketty C
gnuarm.deletethisbit@gmail.com> wrote:

I thought this was a simple circuit to measure a current on the 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, seems to work ok. 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 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.

With no caps the roll off was around -20dB at 42 kHz. I thought I might get better response using lower value resistors if the parasitic 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!

I am missing something very fundamental here. The original resistors are 620k and 215k. I think this zip file contains all the files needed.

http://arius.com/temp/CurrentMon.zip

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.

I am testing a design by using it as a component in the test simulation. Maybe 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 circuit. 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 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 common mode voltage level. The first amp runs on 5 volts so the divider resistors bring the input voltage to within that range.

The signal level is very low, so a second amp is used to boost the level. The current measurement is the voltage output on COUT.

Without the filter caps the first amp is -3dB at 300 kHz and the overall 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.

I had forgotten that the amp is only 350kHz GBW and was trying to 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 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 resistors 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.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 point is too close to 5 volts in spite of what the data sheet says?

The sim below will run in your unzipped directory
and give a frequency plot.
If you remove the 5V supply, it won\'t.

RL

Version 4
SHEET 1 1752 708
WIRE -48 -192 -64 -192
WIRE 112 -192 32 -192
WIRE 240 -192 192 -192
WIRE -64 -112 -64 -192
WIRE -64 -112 -272 -112
WIRE -32 -112 -64 -112
WIRE 80 -112 48 -112
WIRE 240 -112 240 -192
WIRE 240 -112 80 -112
WIRE 288 -112 240 -112
WIRE -64 0 -64 -112
WIRE 80 0 80 -112
WIRE 624 32 560 32
WIRE 752 32 688 32
WIRE -224 64 -224 32
WIRE 80 128 80 80
WIRE 128 128 80 128
WIRE 176 128 128 128
WIRE 320 128 256 128
WIRE 432 128 400 128
WIRE 544 128 512 128
WIRE 592 128 544 128
WIRE 624 128 592 128
WIRE 752 128 752 32
WIRE 752 128 704 128
WIRE 400 160 400 128
WIRE -240 192 -272 192
WIRE -240 224 -240 192
WIRE 656 256 640 256
WIRE 224 272 208 272
WIRE 656 272 656 256
WIRE 224 288 224 272
WIRE 544 288 544 128
WIRE 624 288 544 288
WIRE 80 304 80 128
WIRE 192 304 80 304
WIRE 752 304 752 128
WIRE 752 304 688 304
WIRE 976 304 752 304
WIRE 320 320 320 128
WIRE 320 320 256 320
WIRE 368 320 320 320
WIRE 480 320 448 320
WIRE 544 320 480 320
WIRE 624 320 544 320
WIRE -240 336 -240 304
WIRE -64 336 -64 80
WIRE -16 336 -64 336
WIRE 192 336 -16 336
WIRE 480 352 480 320
WIRE 656 352 656 336
WIRE -64 368 -64 336
WIRE 224 368 224 352
WIRE 576 432 576 416
WIRE 480 448 480 432
WIRE -64 464 -64 448
FLAG 224 368 0
FLAG -64 464 0
FLAG -16 336 U1+
FLAG 224 272 5V
FLAG 288 -112 MOT
IOPIN 288 -112 BiDir
FLAG 656 352 0
FLAG 656 256 5V
FLAG 400 160 0
FLAG 128 128 U1-
FLAG 592 128 U2-
FLAG 544 320 U2+
FLAG 320 128 Current
FLAG 480 448 0
FLAG -272 -112 PSU
IOPIN -272 -112 BiDir
FLAG 976 304 COUT
IOPIN 976 304 Out
FLAG -272 192 5V
IOPIN -272 192 BiDir
FLAG 576 432 0
FLAG -240 336 0
FLAG -224 64 0
SYMBOL res -80 352 R0
SYMATTR InstName R3
SYMATTR Value 215k
SYMBOL res 64 -16 R0
SYMATTR InstName R4
SYMATTR Value 620k
SYMBOL res 160 144 R270
WINDOW 0 32 32 VTop 2
WINDOW 3 32 86 VTop 2
SYMATTR InstName R5
SYMATTR Value 215k
SYMBOL res 64 -128 R90
WINDOW 0 0 56 VBottom 2
WINDOW 3 32 56 VTop 2
SYMATTR InstName R1
SYMATTR Value 0R010
SYMBOL TLV2333 224 256 R0
SYMATTR InstName U1
SYMBOL res -80 -16 R0
SYMATTR InstName R2
SYMATTR Value 620k
SYMBOL res 608 144 R270
WINDOW 0 32 32 VTop 2
WINDOW 3 32 86 VTop 2
SYMATTR InstName R9
SYMATTR Value 1Meg
SYMBOL TLV2333 656 240 R0
SYMATTR InstName U2
SYMBOL res 352 336 R270
WINDOW 0 32 32 VTop 2
WINDOW 3 32 86 VTop 2
SYMATTR InstName R6
SYMATTR Value 10k
SYMBOL res 416 144 R270
WINDOW 0 32 32 VTop 2
WINDOW 3 32 86 VTop 2
SYMATTR InstName R8
SYMATTR Value 10k
SYMBOL res 464 336 R0
SYMATTR InstName R7
SYMATTR Value 100k
SYMBOL cap 560 352 R0
SYMATTR InstName C1
SYMATTR Value 10nF
SYMBOL cap 688 16 R90
WINDOW 0 0 61 VBottom 2
WINDOW 3 0 -4 VBottom 2
SYMATTR InstName C2
SYMATTR Value 100pF
SYMBOL voltage -240 208 R0
WINDOW 123 0 0 Left 2
WINDOW 39 0 0 Left 2
SYMATTR InstName V1
SYMATTR Value 5
SYMBOL voltage 48 -192 R90
WINDOW 0 -32 56 VBottom 2
WINDOW 3 32 56 VTop 2
WINDOW 123 -4 56 VBottom 2
WINDOW 39 0 0 Left 2
SYMATTR InstName V2
SYMATTR Value \"\"
SYMATTR Value2 AC 0.05
SYMBOL voltage -224 -64 R0
WINDOW 123 0 0 Left 2
WINDOW 39 0 0 Left 2
SYMATTR InstName V3
SYMATTR Value 10
SYMBOL voltage 96 -192 R270
WINDOW 0 32 56 VTop 2
WINDOW 3 -32 56 VBottom 2
WINDOW 123 0 0 Left 2
WINDOW 39 0 0 Left 2
SYMATTR InstName V4
SYMATTR Value .05
TEXT 504 -256 Right 4 ;Motor Current Measurement
TEXT 152 -56 Left 3 ;10A = 0.1V
TEXT 792 344 Left 3 ;10A = 3.18V\\n4.5A = 1.43V\\n3.5A = 1.11V
TEXT 240 424 Left 3 ;10A = 0.035V
TEXT -8 352 Left 2 ;@16Vin U1+ = \\n16*215/835 = 4.12V
TEXT -384 488 Left 2 !.ac dec 10 1 1E5
LINE Normal 336 400 368 336


That circuit won\'t work. Resistor tolerances will wreck the CMRR.

There are ways to do high-side current sensing.

like an INAxxx or similar. sot23 and a sense resistor

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.

Yeah, I\'ve never designed a high side current sense before and I realized 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 voltage. 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
 
onsdag den 19. august 2020 kl. 01.14.20 UTC+2 skrev Ricketty C:
On Tuesday, August 18, 2020 at 6:55:48 PM UTC-4, John Larkin wrote:
On Tue, 18 Aug 2020 15:40:53 -0700 (PDT), Lasse Langwadt Christensen
langwadt@fonz.dk> wrote:

onsdag den 19. august 2020 kl. 00.06.13 UTC+2 skrev John Larkin:
On Tue, 18 Aug 2020 14:34:27 -0400, legg <legg@nospam.magma.ca> wrote:

On Tue, 18 Aug 2020 08:48:31 -0700 (PDT), Ricketty C
gnuarm.deletethisbit@gmail.com> wrote:

On Tuesday, August 18, 2020 at 10:50:17 AM UTC-4, Ricketty C wrote:
On Tuesday, August 18, 2020 at 8:26:33 AM UTC-4, legg wrote:
On Tue, 18 Aug 2020 00:35:28 -0700 (PDT), Ricketty C
gnuarm.deletethisbit@gmail.com> wrote:

I thought this was a simple circuit to measure a current on the 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, seems to work ok. 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 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.

With no caps the roll off was around -20dB at 42 kHz. I thought I might get better response using lower value resistors if the parasitic 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!

I am missing something very fundamental here. The original resistors are 620k and 215k. I think this zip file contains all the files needed.

http://arius.com/temp/CurrentMon.zip

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.

I am testing a design by using it as a component in the test simulation. Maybe 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 circuit. 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 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 common mode voltage level. The first amp runs on 5 volts so the divider resistors bring the input voltage to within that range.

The signal level is very low, so a second amp is used to boost the level. The current measurement is the voltage output on COUT.

Without the filter caps the first amp is -3dB at 300 kHz and the overall 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.

I had forgotten that the amp is only 350kHz GBW and was trying to 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 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 resistors 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.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 point is too close to 5 volts in spite of what the data sheet says?

The sim below will run in your unzipped directory
and give a frequency plot.
If you remove the 5V supply, it won\'t.

RL

Version 4
SHEET 1 1752 708
WIRE -48 -192 -64 -192
WIRE 112 -192 32 -192
WIRE 240 -192 192 -192
WIRE -64 -112 -64 -192
WIRE -64 -112 -272 -112
WIRE -32 -112 -64 -112
WIRE 80 -112 48 -112
WIRE 240 -112 240 -192
WIRE 240 -112 80 -112
WIRE 288 -112 240 -112
WIRE -64 0 -64 -112
WIRE 80 0 80 -112
WIRE 624 32 560 32
WIRE 752 32 688 32
WIRE -224 64 -224 32
WIRE 80 128 80 80
WIRE 128 128 80 128
WIRE 176 128 128 128
WIRE 320 128 256 128
WIRE 432 128 400 128
WIRE 544 128 512 128
WIRE 592 128 544 128
WIRE 624 128 592 128
WIRE 752 128 752 32
WIRE 752 128 704 128
WIRE 400 160 400 128
WIRE -240 192 -272 192
WIRE -240 224 -240 192
WIRE 656 256 640 256
WIRE 224 272 208 272
WIRE 656 272 656 256
WIRE 224 288 224 272
WIRE 544 288 544 128
WIRE 624 288 544 288
WIRE 80 304 80 128
WIRE 192 304 80 304
WIRE 752 304 752 128
WIRE 752 304 688 304
WIRE 976 304 752 304
WIRE 320 320 320 128
WIRE 320 320 256 320
WIRE 368 320 320 320
WIRE 480 320 448 320
WIRE 544 320 480 320
WIRE 624 320 544 320
WIRE -240 336 -240 304
WIRE -64 336 -64 80
WIRE -16 336 -64 336
WIRE 192 336 -16 336
WIRE 480 352 480 320
WIRE 656 352 656 336
WIRE -64 368 -64 336
WIRE 224 368 224 352
WIRE 576 432 576 416
WIRE 480 448 480 432
WIRE -64 464 -64 448
FLAG 224 368 0
FLAG -64 464 0
FLAG -16 336 U1+
FLAG 224 272 5V
FLAG 288 -112 MOT
IOPIN 288 -112 BiDir
FLAG 656 352 0
FLAG 656 256 5V
FLAG 400 160 0
FLAG 128 128 U1-
FLAG 592 128 U2-
FLAG 544 320 U2+
FLAG 320 128 Current
FLAG 480 448 0
FLAG -272 -112 PSU
IOPIN -272 -112 BiDir
FLAG 976 304 COUT
IOPIN 976 304 Out
FLAG -272 192 5V
IOPIN -272 192 BiDir
FLAG 576 432 0
FLAG -240 336 0
FLAG -224 64 0
SYMBOL res -80 352 R0
SYMATTR InstName R3
SYMATTR Value 215k
SYMBOL res 64 -16 R0
SYMATTR InstName R4
SYMATTR Value 620k
SYMBOL res 160 144 R270
WINDOW 0 32 32 VTop 2
WINDOW 3 32 86 VTop 2
SYMATTR InstName R5
SYMATTR Value 215k
SYMBOL res 64 -128 R90
WINDOW 0 0 56 VBottom 2
WINDOW 3 32 56 VTop 2
SYMATTR InstName R1
SYMATTR Value 0R010
SYMBOL TLV2333 224 256 R0
SYMATTR InstName U1
SYMBOL res -80 -16 R0
SYMATTR InstName R2
SYMATTR Value 620k
SYMBOL res 608 144 R270
WINDOW 0 32 32 VTop 2
WINDOW 3 32 86 VTop 2
SYMATTR InstName R9
SYMATTR Value 1Meg
SYMBOL TLV2333 656 240 R0
SYMATTR InstName U2
SYMBOL res 352 336 R270
WINDOW 0 32 32 VTop 2
WINDOW 3 32 86 VTop 2
SYMATTR InstName R6
SYMATTR Value 10k
SYMBOL res 416 144 R270
WINDOW 0 32 32 VTop 2
WINDOW 3 32 86 VTop 2
SYMATTR InstName R8
SYMATTR Value 10k
SYMBOL res 464 336 R0
SYMATTR InstName R7
SYMATTR Value 100k
SYMBOL cap 560 352 R0
SYMATTR InstName C1
SYMATTR Value 10nF
SYMBOL cap 688 16 R90
WINDOW 0 0 61 VBottom 2
WINDOW 3 0 -4 VBottom 2
SYMATTR InstName C2
SYMATTR Value 100pF
SYMBOL voltage -240 208 R0
WINDOW 123 0 0 Left 2
WINDOW 39 0 0 Left 2
SYMATTR InstName V1
SYMATTR Value 5
SYMBOL voltage 48 -192 R90
WINDOW 0 -32 56 VBottom 2
WINDOW 3 32 56 VTop 2
WINDOW 123 -4 56 VBottom 2
WINDOW 39 0 0 Left 2
SYMATTR InstName V2
SYMATTR Value \"\"
SYMATTR Value2 AC 0.05
SYMBOL voltage -224 -64 R0
WINDOW 123 0 0 Left 2
WINDOW 39 0 0 Left 2
SYMATTR InstName V3
SYMATTR Value 10
SYMBOL voltage 96 -192 R270
WINDOW 0 32 56 VTop 2
WINDOW 3 -32 56 VBottom 2
WINDOW 123 0 0 Left 2
WINDOW 39 0 0 Left 2
SYMATTR InstName V4
SYMATTR Value .05
TEXT 504 -256 Right 4 ;Motor Current Measurement
TEXT 152 -56 Left 3 ;10A = 0.1V
TEXT 792 344 Left 3 ;10A = 3.18V\\n4.5A = 1.43V\\n3.5A = 1.11V
TEXT 240 424 Left 3 ;10A = 0.035V
TEXT -8 352 Left 2 ;@16Vin U1+ = \\n16*215/835 = 4.12V
TEXT -384 488 Left 2 !.ac dec 10 1 1E5
LINE Normal 336 400 368 336


That circuit won\'t work. Resistor tolerances will wreck the CMRR.

There are ways to do high-side current sensing.

like an INAxxx or similar. sot23 and a sense resistor

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.

Yeah, I\'ve never designed a high side current sense before and I realized 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 voltage. 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.

why high side sensing?
 
On Tuesday, August 18, 2020 at 7:24:19 PM UTC-4, Lasse Langwadt Christensen wrote:
onsdag den 19. august 2020 kl. 01.14.20 UTC+2 skrev Ricketty C:
On Tuesday, August 18, 2020 at 6:55:48 PM UTC-4, John Larkin wrote:
On Tue, 18 Aug 2020 15:40:53 -0700 (PDT), Lasse Langwadt Christensen
langwadt@fonz.dk> wrote:

onsdag den 19. august 2020 kl. 00.06.13 UTC+2 skrev John Larkin:
On Tue, 18 Aug 2020 14:34:27 -0400, legg <legg@nospam.magma.ca> wrote:

On Tue, 18 Aug 2020 08:48:31 -0700 (PDT), Ricketty C
gnuarm.deletethisbit@gmail.com> wrote:

On Tuesday, August 18, 2020 at 10:50:17 AM UTC-4, Ricketty C wrote:
On Tuesday, August 18, 2020 at 8:26:33 AM UTC-4, legg wrote:
On Tue, 18 Aug 2020 00:35:28 -0700 (PDT), Ricketty C
gnuarm.deletethisbit@gmail.com> wrote:

I thought this was a simple circuit to measure a current on the 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, seems to work ok. 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 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.

With no caps the roll off was around -20dB at 42 kHz. I thought I might get better response using lower value resistors if the parasitic 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!

I am missing something very fundamental here. The original resistors are 620k and 215k. I think this zip file contains all the files needed.

http://arius.com/temp/CurrentMon.zip

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.

I am testing a design by using it as a component in the test simulation. Maybe 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 circuit. 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 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 common mode voltage level. The first amp runs on 5 volts so the divider resistors bring the input voltage to within that range.

The signal level is very low, so a second amp is used to boost the level. The current measurement is the voltage output on COUT.

Without the filter caps the first amp is -3dB at 300 kHz and the overall 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.

I had forgotten that the amp is only 350kHz GBW and was trying to 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 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 resistors 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.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 point is too close to 5 volts in spite of what the data sheet says?

The sim below will run in your unzipped directory
and give a frequency plot.
If you remove the 5V supply, it won\'t.

RL

Version 4
SHEET 1 1752 708
WIRE -48 -192 -64 -192
WIRE 112 -192 32 -192
WIRE 240 -192 192 -192
WIRE -64 -112 -64 -192
WIRE -64 -112 -272 -112
WIRE -32 -112 -64 -112
WIRE 80 -112 48 -112
WIRE 240 -112 240 -192
WIRE 240 -112 80 -112
WIRE 288 -112 240 -112
WIRE -64 0 -64 -112
WIRE 80 0 80 -112
WIRE 624 32 560 32
WIRE 752 32 688 32
WIRE -224 64 -224 32
WIRE 80 128 80 80
WIRE 128 128 80 128
WIRE 176 128 128 128
WIRE 320 128 256 128
WIRE 432 128 400 128
WIRE 544 128 512 128
WIRE 592 128 544 128
WIRE 624 128 592 128
WIRE 752 128 752 32
WIRE 752 128 704 128
WIRE 400 160 400 128
WIRE -240 192 -272 192
WIRE -240 224 -240 192
WIRE 656 256 640 256
WIRE 224 272 208 272
WIRE 656 272 656 256
WIRE 224 288 224 272
WIRE 544 288 544 128
WIRE 624 288 544 288
WIRE 80 304 80 128
WIRE 192 304 80 304
WIRE 752 304 752 128
WIRE 752 304 688 304
WIRE 976 304 752 304
WIRE 320 320 320 128
WIRE 320 320 256 320
WIRE 368 320 320 320
WIRE 480 320 448 320
WIRE 544 320 480 320
WIRE 624 320 544 320
WIRE -240 336 -240 304
WIRE -64 336 -64 80
WIRE -16 336 -64 336
WIRE 192 336 -16 336
WIRE 480 352 480 320
WIRE 656 352 656 336
WIRE -64 368 -64 336
WIRE 224 368 224 352
WIRE 576 432 576 416
WIRE 480 448 480 432
WIRE -64 464 -64 448
FLAG 224 368 0
FLAG -64 464 0
FLAG -16 336 U1+
FLAG 224 272 5V
FLAG 288 -112 MOT
IOPIN 288 -112 BiDir
FLAG 656 352 0
FLAG 656 256 5V
FLAG 400 160 0
FLAG 128 128 U1-
FLAG 592 128 U2-
FLAG 544 320 U2+
FLAG 320 128 Current
FLAG 480 448 0
FLAG -272 -112 PSU
IOPIN -272 -112 BiDir
FLAG 976 304 COUT
IOPIN 976 304 Out
FLAG -272 192 5V
IOPIN -272 192 BiDir
FLAG 576 432 0
FLAG -240 336 0
FLAG -224 64 0
SYMBOL res -80 352 R0
SYMATTR InstName R3
SYMATTR Value 215k
SYMBOL res 64 -16 R0
SYMATTR InstName R4
SYMATTR Value 620k
SYMBOL res 160 144 R270
WINDOW 0 32 32 VTop 2
WINDOW 3 32 86 VTop 2
SYMATTR InstName R5
SYMATTR Value 215k
SYMBOL res 64 -128 R90
WINDOW 0 0 56 VBottom 2
WINDOW 3 32 56 VTop 2
SYMATTR InstName R1
SYMATTR Value 0R010
SYMBOL TLV2333 224 256 R0
SYMATTR InstName U1
SYMBOL res -80 -16 R0
SYMATTR InstName R2
SYMATTR Value 620k
SYMBOL res 608 144 R270
WINDOW 0 32 32 VTop 2
WINDOW 3 32 86 VTop 2
SYMATTR InstName R9
SYMATTR Value 1Meg
SYMBOL TLV2333 656 240 R0
SYMATTR InstName U2
SYMBOL res 352 336 R270
WINDOW 0 32 32 VTop 2
WINDOW 3 32 86 VTop 2
SYMATTR InstName R6
SYMATTR Value 10k
SYMBOL res 416 144 R270
WINDOW 0 32 32 VTop 2
WINDOW 3 32 86 VTop 2
SYMATTR InstName R8
SYMATTR Value 10k
SYMBOL res 464 336 R0
SYMATTR InstName R7
SYMATTR Value 100k
SYMBOL cap 560 352 R0
SYMATTR InstName C1
SYMATTR Value 10nF
SYMBOL cap 688 16 R90
WINDOW 0 0 61 VBottom 2
WINDOW 3 0 -4 VBottom 2
SYMATTR InstName C2
SYMATTR Value 100pF
SYMBOL voltage -240 208 R0
WINDOW 123 0 0 Left 2
WINDOW 39 0 0 Left 2
SYMATTR InstName V1
SYMATTR Value 5
SYMBOL voltage 48 -192 R90
WINDOW 0 -32 56 VBottom 2
WINDOW 3 32 56 VTop 2
WINDOW 123 -4 56 VBottom 2
WINDOW 39 0 0 Left 2
SYMATTR InstName V2
SYMATTR Value \"\"
SYMATTR Value2 AC 0.05
SYMBOL voltage -224 -64 R0
WINDOW 123 0 0 Left 2
WINDOW 39 0 0 Left 2
SYMATTR InstName V3
SYMATTR Value 10
SYMBOL voltage 96 -192 R270
WINDOW 0 32 56 VTop 2
WINDOW 3 -32 56 VBottom 2
WINDOW 123 0 0 Left 2
WINDOW 39 0 0 Left 2
SYMATTR InstName V4
SYMATTR Value .05
TEXT 504 -256 Right 4 ;Motor Current Measurement
TEXT 152 -56 Left 3 ;10A = 0.1V
TEXT 792 344 Left 3 ;10A = 3.18V\\n4.5A = 1.43V\\n3.5A = 1.11V
TEXT 240 424 Left 3 ;10A = 0.035V
TEXT -8 352 Left 2 ;@16Vin U1+ = \\n16*215/835 = 4.12V
TEXT -384 488 Left 2 !.ac dec 10 1 1E5
LINE Normal 336 400 368 336


That circuit won\'t work. Resistor tolerances will wreck the CMRR.

There are ways to do high-side current sensing.

like an INAxxx or similar. sot23 and a sense resistor

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.

Yeah, I\'ve never designed a high side current sense before and I realized 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 voltage. 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.


why high side sensing?

The motor is controlled through a H-bridge and I prefer not to muck with the logic levels with low side sensing (the ground for the motor is common with the logic ground). I guess a 10 mohm resistance won\'t actually muck with 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 ratio appreciably. The gain goes from about 1/3 ~ -10dB to -70 dB or worse as 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 special chips. Heck, the INA199 even shows it working from a 5 volt supply with 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
 
On Tue, 18 Aug 2020 15:47:28 -0700 (PDT), Ricketty C
<gnuarm.deletethisbit@gmail.com> wrote:

On Tuesday, August 18, 2020 at 6:16:00 PM UTC-4, legg wrote:
On Tue, 18 Aug 2020 12:06:02 -0700 (PDT), Ricketty C
gnuarm.deletethisbit@gmail.com> wrote:

snip
The sim below will run in your unzipped directory
and give a frequency plot.
If you remove the 5V supply, it won\'t.

Thanks for taking a look.

Did you download the new .zip file? Open MotorCurrent_highside_test.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 opened in the plot window.

missing AOD4185.

Sorry, you don\'t need that device because it is left over from another schematic this was copied from, rip both of those transistors out. All those signal sources can go other than 5V and SIG.


If you\'re only interested in the current monitor,
you might just limit to those parts.

Is the problem with the breadboard not acting like
the model, or vice versa?

Hard to argue with a model, if you don\'t have the
hardware.

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 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 fundamental about this arrangement I\'m not getting.

Larkin might be right that this is a crap design to attempt, because of 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 circuit 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.

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.

So far, none run, out of the box.

RL
 
On Tue, 18 Aug 2020 22:30:55 -0400, legg <legg@nospam.magma.ca> wrote:

On Tue, 18 Aug 2020 15:47:28 -0700 (PDT), Ricketty C
gnuarm.deletethisbit@gmail.com> wrote:

On Tuesday, August 18, 2020 at 6:16:00 PM UTC-4, legg wrote:
On Tue, 18 Aug 2020 12:06:02 -0700 (PDT), Ricketty C
gnuarm.deletethisbit@gmail.com> wrote:

snip
The sim below will run in your unzipped directory
and give a frequency plot.
If you remove the 5V supply, it won\'t.

Thanks for taking a look.

Did you download the new .zip file? Open MotorCurrent_highside_test.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 opened in the plot window.

missing AOD4185.

Sorry, you don\'t need that device because it is left over from another schematic this was copied from, rip both of those transistors out. All those signal sources can go other than 5V and SIG.


If you\'re only interested in the current monitor,
you might just limit to those parts.

Is the problem with the breadboard not acting like
the model, or vice versa?

Hard to argue with a model, if you don\'t have the
hardware.

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 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 fundamental about this arrangement I\'m not getting.

Larkin might be right that this is a crap design to attempt, because of 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 circuit 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.

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.

So far, none run, out of the box.
.. . . and remember there are limits on the output current
of this low power amp, particularly when pulling towards
ground.

RL
 
On Tuesday, August 18, 2020 at 10:25:14 PM UTC-4, legg wrote:
On Tue, 18 Aug 2020 15:47:28 -0700 (PDT), Ricketty C
gnuarm.deletethisbit@gmail.com> wrote:

On Tuesday, August 18, 2020 at 6:16:00 PM UTC-4, legg wrote:
On Tue, 18 Aug 2020 12:06:02 -0700 (PDT), Ricketty C
gnuarm.deletethisbit@gmail.com> wrote:

snip
The sim below will run in your unzipped directory
and give a frequency plot.
If you remove the 5V supply, it won\'t.

Thanks for taking a look.

Did you download the new .zip file? Open MotorCurrent_highside_test.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 opened in the plot window.

missing AOD4185.

Sorry, you don\'t need that device because it is left over from another schematic this was copied from, rip both of those transistors out. All those signal sources can go other than 5V and SIG.


If you\'re only interested in the current monitor,
you might just limit to those parts.

Is the problem with the breadboard not acting like
the model, or vice versa?

Hard to argue with a model, if you don\'t have the
hardware.

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 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 fundamental about this arrangement I\'m not getting.

Larkin might be right that this is a crap design to attempt, because of 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 circuit 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.

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.

So far, none run, out of the box.

You can\'t rip out the transistor with no model???

Ok, I modified the files so they will run without the transistor model which 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 changing all three files, the two schematics and the symbol file, to create the two 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 correctly 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 huge difference. Your test circuit doesn\'t bias the inputs to the proper voltage. 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 both 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
 
On Tuesday, August 18, 2020 at 10:27:27 PM UTC-4, legg wrote:
On Tue, 18 Aug 2020 22:30:55 -0400, legg <legg@nospam.magma.ca> wrote:

On Tue, 18 Aug 2020 15:47:28 -0700 (PDT), Ricketty C
gnuarm.deletethisbit@gmail.com> wrote:

On Tuesday, August 18, 2020 at 6:16:00 PM UTC-4, legg wrote:
On Tue, 18 Aug 2020 12:06:02 -0700 (PDT), Ricketty C
gnuarm.deletethisbit@gmail.com> wrote:

snip
The sim below will run in your unzipped directory
and give a frequency plot.
If you remove the 5V supply, it won\'t.

Thanks for taking a look.

Did you download the new .zip file? Open MotorCurrent_highside_test..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 opened in the plot window.

missing AOD4185.

Sorry, you don\'t need that device because it is left over from another schematic this was copied from, rip both of those transistors out. All those signal sources can go other than 5V and SIG.


If you\'re only interested in the current monitor,
you might just limit to those parts.

Is the problem with the breadboard not acting like
the model, or vice versa?

Hard to argue with a model, if you don\'t have the
hardware.

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 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 fundamental about this arrangement I\'m not getting.

Larkin might be right that this is a crap design to attempt, because of 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 circuit 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.

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.

So far, none run, out of the box.

. . . and remember there are limits on the output current
of this low power amp, particularly when pulling towards
ground.

Yeah, I see the ground issue. That\'s not so important since none of the signals 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 they 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 ground 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 offset varies a LOT. The pressure sensors seem to be similar, but perhaps not to the same extent. The pressure sensor error can be cut in half by calibrating 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
 
On Tuesday, August 18, 2020 at 10:27:27 PM UTC-4, legg wrote:
On Tue, 18 Aug 2020 22:30:55 -0400, legg <legg@nospam.magma.ca> wrote:

On Tue, 18 Aug 2020 15:47:28 -0700 (PDT), Ricketty C
gnuarm.deletethisbit@gmail.com> wrote:

On Tuesday, August 18, 2020 at 6:16:00 PM UTC-4, legg wrote:
On Tue, 18 Aug 2020 12:06:02 -0700 (PDT), Ricketty C
gnuarm.deletethisbit@gmail.com> wrote:

snip
The sim below will run in your unzipped directory
and give a frequency plot.
If you remove the 5V supply, it won\'t.

Thanks for taking a look.

Did you download the new .zip file? Open MotorCurrent_highside_test..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 opened in the plot window.

missing AOD4185.

Sorry, you don\'t need that device because it is left over from another schematic this was copied from, rip both of those transistors out. All those signal sources can go other than 5V and SIG.


If you\'re only interested in the current monitor,
you might just limit to those parts.

Is the problem with the breadboard not acting like
the model, or vice versa?

Hard to argue with a model, if you don\'t have the
hardware.

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 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 fundamental about this arrangement I\'m not getting.

Larkin might be right that this is a crap design to attempt, because of 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 circuit 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.

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.

So far, none run, out of the box.

. . . and remember there are limits on the output current
of this low power amp, particularly when pulling towards
ground.

RL

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
 

Welcome to EDABoard.com

Sponsor

Back
Top