analog inputs: op-amp + divider - Russian - now MCP6004

Hardware inside and outside of the ECU
User avatar
kb1gtt
contributor
contributor
Posts: 3758
Joined: Tue Sep 10, 2013 1:42 am
Location: ME of USA

Re: analog inputs: op-amp + divider - Russian - LMV324IDT

Post by kb1gtt »

Digikey BOM updated to correct buggered diodes. Digikey BOM found here https://www.digikey.com/classic/RegisteredUser/BOMBillOfMaterials.aspx?path=1&exist=1&id=1504225 replacement diode is BAS70-04FILM
Welcome to the friendlier side of internet crazy :)
User avatar
AndreyB
Site Admin
Posts: 14333
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Github Username: rusefillc
Slack: Andrey B

Re: analog inputs: op-amp + divider - Russian - LMV324IDT

Post by AndreyB »

Q: What is the purpose of the OP AMPs on this board?

A: two reasons:
1) op-amp isolates the voltage divider from the input circuitry - this way we are not affecting whatever is going on in the input wire, this means we can attach this input board in a slave mode with the original ECU still on while we want to just sniff what's going on. This case we are not using the pull-up or pull-down resistors, we are just following and divinding the input voltage.
2) extra protection for the MCU ADC
Very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions

Always looking for C/C++/Java/PHP developers! Please help us see https://rusefi.com/s/howtocontribute
User avatar
AndreyB
Site Admin
Posts: 14333
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Github Username: rusefillc
Slack: Andrey B

Re: analog inputs: op-amp + divider - Russian - LMV324IDT

Post by AndreyB »

Ops:
We have an issue with the schematics: op-amp channel #3 pinout is wrong:
Image
but we have
Image
and this is wrong:
Image

This affects the 'Adc Amp 12ch rev 0.2' module, but this DOES NOT affect Frankenstein because on Frankenstein apparently the board does not follow the schematics:
Image
Very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions

Always looking for C/C++/Java/PHP developers! Please help us see https://rusefi.com/s/howtocontribute
User avatar
mobyfab
Posts: 139
Joined: Tue Oct 29, 2013 10:09 am
Location: Versailles, France

Re: analog inputs: op-amp + divider - Russian - LMV324IDT

Post by mobyfab »

Why did you put the divider after the opamp ?

The higher output resistance might affect the ADC. (but no much)
User avatar
AndreyB
Site Admin
Posts: 14333
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Github Username: rusefillc
Slack: Andrey B

Re: analog inputs: op-amp + divider - Russian - LMV324IDT

Post by AndreyB »

mobyfab wrote:Why did you put the divider after the op-amp?
So that I can use this schematic to sniff wires while the stock ECU is running the engine.

These resistor values should be fine four stm32 ADC.
Very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions

Always looking for C/C++/Java/PHP developers! Please help us see https://rusefi.com/s/howtocontribute
User avatar
mobyfab
Posts: 139
Joined: Tue Oct 29, 2013 10:09 am
Location: Versailles, France

Re: analog inputs: op-amp + divider - Russian - LMV324IDT

Post by mobyfab »

I see :)

Yeah the ADC has 1kohm/8pF input so it should not affect it too much.
User avatar
UnaClocker
Posts: 46
Joined: Tue May 13, 2014 12:14 am
Location: Tacoma, WA

Re: analog inputs: op-amp + divider - Russian - LMV324IDT

Post by UnaClocker »

Why use op amps at all? Just adds more cost to the BOM and more complexity to the build of the board. More components to fail (as you've already experienced). You can simply use voltage dividers. ECM's all over the world have had 5v CPU's for decades, and 12v electrical systems, they simply use a voltage divider to get the 12v down to 5v. You can do the same thing to get down inside the 3.3v range. Even with 0-5v signals coming in like the TPS (if you can't just run the TPS off 3.3v) or a wideband O2 sensor (you can recalibrate some of them to give a 0-3.3v signal).
That's about the only signals that you're going to get that are over 3.3v, everything else is based off the reference voltage you feed to it (coolant/air temp sensors, crank sensors (which would come in as digital anyways), etc)..
edit: also, as for protecting the MCU, just put a 10k inline between the voltage divider and the MCU, it'll prevent enough current from flowing to damage the chip.
Brian from Tacoma, WA
84 Dodge Rampage
01 PT Cruiser
User avatar
AndreyB
Site Admin
Posts: 14333
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Github Username: rusefillc
Slack: Andrey B

Re: analog inputs: op-amp + divider - Russian - LMV324IDT

Post by AndreyB »

Very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions

Always looking for C/C++/Java/PHP developers! Please help us see https://rusefi.com/s/howtocontribute
User avatar
UnaClocker
Posts: 46
Joined: Tue May 13, 2014 12:14 am
Location: Tacoma, WA

Re: analog inputs: op-amp + divider - Russian - LMV324IDT

Post by UnaClocker »

Yeah, I only read page 1, didn't notice the extra pages before replying. Fair enough.
Brian from Tacoma, WA
84 Dodge Rampage
01 PT Cruiser
User avatar
AndreyB
Site Admin
Posts: 14333
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Github Username: rusefillc
Slack: Andrey B

Re: analog inputs: op-amp + divider - Russian - LMV324IDT

Post by AndreyB »

Question about the rail-to-railness of out op-amps.

Supply voltage is 4.5v (board powered via USB), input is a 10K pull-up - to the same 4.5v
What is the expected op-amp output? Because I am getting 3.9v, is that expected, or is it supposed to be higher? Wonder if the cheap op-amps do not perform well or if that's in my head.

The datasheet is @ http://www.ti.com/lit/ds/symlink/lmv324.pdf but after 120 seconds of reading I cannot produce the answer.
Very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions

Always looking for C/C++/Java/PHP developers! Please help us see https://rusefi.com/s/howtocontribute
User avatar
kb1gtt
contributor
contributor
Posts: 3758
Joined: Tue Sep 10, 2013 1:42 am
Location: ME of USA

Re: analog inputs: op-amp + divider - Russian - LMV324IDT

Post by kb1gtt »

Is that op-amp input, or harness input that you are measuring the input voltage? Also per figure 23, the positive rail should be off by only 10mV so you are far worse than the expected.
Welcome to the friendlier side of internet crazy :)
User avatar
AndreyB
Site Admin
Posts: 14333
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Github Username: rusefillc
Slack: Andrey B

Re: analog inputs: op-amp + divider - Russian - LMV324IDT

Post by AndreyB »

I've just tried the same with original Texas Instrument chip and I get more or less the same results: 4.5v input gives 4.0 output. Why?

I am testing this on pull-up channels, so I have a disconnected board permanently powered up from USB @ 4.5v and I check voltages right on op-amp pads: pads #5 & #10 are where I measure input voltage and pads #6 and #9 are where I measure output voltage.

Jared, you have a Frankenstein board. Can you check the same on one of the channels with a pull-up resistor?
Very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions

Always looking for C/C++/Java/PHP developers! Please help us see https://rusefi.com/s/howtocontribute
DaWaN
Posts: 51
Joined: Sat Sep 20, 2014 6:54 pm
Location: Benschop, Netherlands

Re: analog inputs: op-amp + divider - Russian - LMV324IDT

Post by DaWaN »

kb1gtt wrote:Is that op-amp input, or harness input that you are measuring the input voltage? Also per figure 23, the positive rail should be off by only 10mV so you are far worse than the expected.
Not entirely true: because these inputs have to source about 1.5mA due to the resistor divider you can see a drop of up to 50mV, but 500mV seems a bit extreme.. Not sure what is going on.
Russian: can you measure the total resistance to ground of an unpowered board at pads #6 and #9 ? It should be around 3kOhms, but if it is less it explains at least the behavior of the op-amp.
Where did you source the opamp ? any chance of getting a fake or something like a LM324 ?
User avatar
AndreyB
Site Admin
Posts: 14333
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Github Username: rusefillc
Slack: Andrey B

Re: analog inputs: op-amp + divider - Russian - LMV324IDT

Post by AndreyB »

DaWaN wrote: Russian: can you measure the total resistance to ground of an unpowered board at pads #6 and #9 ? It should be around 3kOhms, but if it is less it explains at least the behavior of the op-amp.
Where did you source the opamp ? any chance of getting a fake or something like a LM324 ?
Just measured and confirm #6<>GND and #9<>GND are both 3KOhm, these are outputs going into the x2 1.5K voltage divider so that's as expected I guess.

I have chips from two different sources: from a reputable digikey and from a pretty random eBay seller (at least the seller is from US)

Both chips show LMV324I label. It's a bit interesting that the TI logo is slightly different between the chips - on one the whole Texas outline is filled zone, on another one part of Texas is left unfilled. Weird that the logo does not match between different sources... But neither show 4.5 output and both show comparable 0.5v / 0.6v offset.
Very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions

Always looking for C/C++/Java/PHP developers! Please help us see https://rusefi.com/s/howtocontribute
puff
contributor
contributor
Posts: 2961
Joined: Mon Nov 11, 2013 11:28 am
Location: Moskau

Re: analog inputs: op-amp + divider - Russian - LMV324IDT

Post by puff »

etch it with acid, then use a microscope to check if its counterfeit… :D
but at least it's good to know that inputs and outputs of the opamp should have similar values.

may be your voltmeter is too cheapo and has low impedance? :?:
DaWaN
Posts: 51
Joined: Sat Sep 20, 2014 6:54 pm
Location: Benschop, Netherlands

Re: analog inputs: op-amp + divider - Russian - LMV324IDT

Post by DaWaN »

Do you have an oscilloscope ?
Although unlikely it might be a problem with the opamp oscillating, some opamps are not "unity-gain stable".
I expect the LMV324 to be unity-gain stable: the old National semiconductor datasheet says this:
The LMV321/358/324 can directly drive 200pF in unity-gain without oscillation.
If you have an oscilloscope it might not hurt to check.

Another check: do you have the unused inputs of the opamp connected to a fixed voltage ? Keeping unused inputs floating can also cause erratic behavior of the opamp. No other outputs connected to a lower impedance to ground than 3Kohms ?
User avatar
AndreyB
Site Admin
Posts: 14333
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Github Username: rusefillc
Slack: Andrey B

Re: analog inputs: op-amp + divider - Russian - LMV324IDT

Post by AndreyB »

DaWaN wrote:If you have an oscilloscope it might not hurt to check.

Another check: do you have the unused inputs of the opamp connected to a fixed voltage ? Keeping unused inputs floating can also cause erratic behavior of the opamp. No other outputs connected to a lower impedance to ground than 3Kohms ?
oscilloscope shows a boring straight line

all outputs are 3Kohm dividers. Two inputs are 500K pull-downs (these outputs show 0v), two outputs are 2.7K pull-ups - these two both show the same ~4.0v outout (0.5 below power supply which is 4.5v in case of my desktop USB for whatever reason)

Also checked with +12 power supply and Frankenso own 5v. This time I have perfect 5v power and same -0.6v offset on op-amp output.
Very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions

Always looking for C/C++/Java/PHP developers! Please help us see https://rusefi.com/s/howtocontribute
puff
contributor
contributor
Posts: 2961
Joined: Mon Nov 11, 2013 11:28 am
Location: Moskau

Re: analog inputs: op-amp + divider - Russian - LMV324IDT

Post by puff »

didn't get that thing about dividers on all and pull-ups on the two. any chance to see that piece of scheme? what else you expect to see with those pull-ups?
User avatar
AndreyB
Site Admin
Posts: 14333
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Github Username: rusefillc
Slack: Andrey B

Re: analog inputs: op-amp + divider - Russian - LMV324IDT

Post by AndreyB »

puff wrote:didn't get that thing about dividers on all and pull-ups on the two. any chance to see that piece of scheme? what else you expect to see with those pull-ups?
LMV324IDT has four channels. The question was if any of the channels were not soldered/floating. dividers are on the output and pull-ups/pull-downs are on the inputs.
Very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions

Always looking for C/C++/Java/PHP developers! Please help us see https://rusefi.com/s/howtocontribute
puff
contributor
contributor
Posts: 2961
Joined: Mon Nov 11, 2013 11:28 am
Location: Moskau

Re: analog inputs: op-amp + divider - Russian - LMV324IDT

Post by puff »

got it. you measured that 0.6v offset with dividers in place? could it be so that the divider is 'stronger' than the maximum output current of LMV324? have you tried measuring output without divider? or changing divider for, say, 10K?
User avatar
AndreyB
Site Admin
Posts: 14333
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Github Username: rusefillc
Slack: Andrey B

Re: analog inputs: op-amp + divider - Russian - now MCP6004

Post by AndreyB »

puff wrote:have you tried measuring output without divider? or changing divider for, say, 10K?
This from a person who has his own board to try? :)
Very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions

Always looking for C/C++/Java/PHP developers! Please help us see https://rusefi.com/s/howtocontribute
puff
contributor
contributor
Posts: 2961
Joined: Mon Nov 11, 2013 11:28 am
Location: Moskau

Re: analog inputs: op-amp + divider - Russian - LMV324IDT

Post by puff »

unfortunately, i left it at home at my home town till spring - didn't think I would need it earlier…
Gone_AWOL
Posts: 7
Joined: Mon Mar 23, 2015 12:15 pm

Re: analog inputs: op-amp + divider - Russian - LMV324IDT

Post by Gone_AWOL »

Is this not a little OTT? I've joined up a little late to make comments I know... but a PD combined with an emitted follower if you really want a buffer is simple too and pretty cheap. You may well want the high impedance input that an opamp allows, but remember common mode noise loves having on input with high impedance too :)

Also your filters can be much more aggressive, Coolant and mat sensors change incredibly slowly which means you can be really nasty with your filters for these at least.
aneox
Posts: 3
Joined: Wed Mar 25, 2015 6:48 am

Re: analog inputs: op-amp + divider - Russian - LMV324IDT

Post by aneox »

russian wrote: Also checked with +12 power supply and Frankenso own 5v. This time I have perfect 5v power and same -0.6v offset on op-amp output.

Did you find an answer? Issue resolved?
User avatar
AndreyB
Site Admin
Posts: 14333
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Github Username: rusefillc
Slack: Andrey B

Re: analog inputs: op-amp + divider - Russian - LMV324IDT

Post by AndreyB »

aneox wrote:Did you find an answer? Issue resolved?
Do not remember :( Probably not.
Very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions

Always looking for C/C++/Java/PHP developers! Please help us see https://rusefi.com/s/howtocontribute
User avatar
kb1gtt
contributor
contributor
Posts: 3758
Joined: Tue Sep 10, 2013 1:42 am
Location: ME of USA

Re: analog inputs: op-amp + divider - Russian - LMV324IDT

Post by kb1gtt »

Here are some measurements. I'm not sure why the op-amp is having trouble pushing to the rails, but this clearly shows it can't push to the rails. Now we need to figure out why it's failing.
op-amp_rails_problem.png
op-amp_rails_problem.png (13.31 KiB) Viewed 25266 times
Welcome to the friendlier side of internet crazy :)
User avatar
kb1gtt
contributor
contributor
Posts: 3758
Joined: Tue Sep 10, 2013 1:42 am
Location: ME of USA

Re: analog inputs: op-amp + divider - Russian - LMV324IDT

Post by kb1gtt »

I have added a 220pF between pin 14 and GND for cap Cl. I have also removed R214 to remove any potential loading issues. Still pin 13 measures 4.39V when it should read 5.00 V. The input amps are in the nA range and the op-amp can drive mA, so it's not getting loaded down.

Hmmm, it would appear that this type of rail to rail op-amp can't go to the rails. I see Vicr should limit the top end to between 4 and 4.2. So we are really lucky that it's going to 3.39v. From this datasheet http://www.ti.com/lit/ds/symlink/lmv324.pdf page 6
LMV324_Vicr.JPG
LMV324_Vicr.JPG (14.43 KiB) Viewed 25263 times
The solution for this has to be to get a rail to rail that will actually go to the rails, or live with the 4V max.
Welcome to the friendlier side of internet crazy :)
puff
contributor
contributor
Posts: 2961
Joined: Mon Nov 11, 2013 11:28 am
Location: Moskau

Re: analog inputs: op-amp + divider - Russian - LMV324IDT

Post by puff »

are they linear? does this mean, to stay with lmv324idt we would need to recalculate the voltage dividers?
User avatar
kb1gtt
contributor
contributor
Posts: 3758
Joined: Tue Sep 10, 2013 1:42 am
Location: ME of USA

Re: analog inputs: op-amp + divider - Russian - LMV324IDT

Post by kb1gtt »

The input can go for that range, the issue is the output. That ST chip is much better about actually being a rail to rail chip. Is .2V either rail close enough? See page 6 for VCC = 5V found in aneox's link. Snippet below.
ST_LMV324_rail.PNG
ST_LMV324_rail.PNG (23.2 KiB) Viewed 25258 times
Welcome to the friendlier side of internet crazy :)
Post Reply