There's also an option to use an external negative bias circuit like LM7705 - it's not that expensive...kb1gtt wrote:there are some op-amps out there that have very small internal rail voltage generating circuits
analog inputs: op-amp + divider - Russian - now MCP6004
Re: analog inputs: op-amp + divider - Russian - now MCP6004
Re: analog inputs: op-amp + divider - Russian - now MCP6004
doubling the number of chips? plus I bet that would make configuring much more complicated.
Re: analog inputs: op-amp + divider - Russian - now MCP6004
That might actually work.andreika wrote:There's also an option to use an external negative bias circuit like LM7705 - it's not that expensive...kb1gtt wrote:there are some op-amps out there that have very small internal rail voltage generating circuits
Especially that you don't need one per channel.
Re: analog inputs: op-amp + divider - Russian - now MCP6004
rail-to-rail isn't usually needed because most sensors won't go that close to the rails, anything near to rail is generally flagged as short-circuit or open-circuit. For digital inputs you should really be using comparators, those are usually open-collector so the output can be pulled up whatever voltage is appropriate.
Re: analog inputs: op-amp + divider - Russian - now MCP6004
The LM7705 is interesting. I'd be concerned about creating a large virtual ground. I guess the first item that would need to be answered, is do we need complete rail to rail? Is someone having a problem with the rails?
Welcome to the friendlier side of internet crazy ![Smile :)](./images/smilies/icon_e_smile.gif)
![Smile :)](./images/smilies/icon_e_smile.gif)
Re: analog inputs: op-amp + divider - Russian - now MCP6004
Temperature sensors and Vbatt under even remotely normal conditions should not get close to the rails. The only "normal" sensors where I could see us getting close would be TPS, MAP and wideband EGO. So far I have not seen any evidence that getting close to the rails is an issue with standard frankenso hardware.
Re: analog inputs: op-amp + divider - Russian - now MCP6004
What about short and open circuit conditions as indicators of nasty connector or faulty sensor?
Some wideband o2 implementations seem to have those rail voltages as normal output..
Some wideband o2 implementations seem to have those rail voltages as normal output..
Re: analog inputs: op-amp + divider - Russian - now MCP6004
For WB EGO I would like to reject any extreme values anyway and default to turning off closed loop behavior if we get close to the edge (i.E lambda < 10 or >19).
Re: analog inputs: op-amp + divider - Russian - now MCP6004
Frankenso has pull down resistors which should pull to an extreme if a wire is broken, ect. This might technically not be 0 on the ADC reading, but it would be reasonably close and consistent. Then your normal operation ADC values are not likely to come close to this extreme value.
Welcome to the friendlier side of internet crazy ![Smile :)](./images/smilies/icon_e_smile.gif)
![Smile :)](./images/smilies/icon_e_smile.gif)
Re: analog inputs: op-amp + divider - Russian - now MCP6004
In my experience TPS is usually less than a 4V swing and MAP is 0.25V to 4.75V.stefanst wrote:Temperature sensors and Vbatt under even remotely normal conditions should not get close to the rails. The only "normal" sensors where I could see us getting close would be TPS, MAP and wideband EGO. So far I have not seen any evidence that getting close to the rails is an issue with standard frankenso hardware.
Re: analog inputs: op-amp + divider - Russian - LMV324IDT
I am wondering why you would need such a huge GBWP from the opamp. Most sensors are very slow and I would assume the GBWP of 1MHz of the MCP6004 would be sufficient here?mobyfab wrote:Using the same opamp on my design, I have the same behavior, about .2V.kb1gtt wrote: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.
Also using 10K resistors dividers driving the STM32 ADC on the output reduces the GBWP to around 100kHz.
MCP6294 seems a better choice but it's like 3 times the cost.
I think the current opamp will do fine. As already said by others: it is best to avoid using sensors near the rails. Most sensors which have some sort of logic / amplification internally rarely output voltages up/down to the rails.kb1gtt wrote:The LM7705 is interesting. I'd be concerned about creating a large virtual ground. I guess the first item that would need to be answered, is do we need complete rail to rail? Is someone having a problem with the rails?
Re: analog inputs: op-amp + divider - Russian - LMV324IDT
I need it for the knock sensor (sampling at 115kHz), but in this case the GBWP is more than sufficient indeed.DaWaN wrote:I am wondering why you would need such a huge GBWP from the opamp. Most sensors are very slow and I would assume the GBWP of 1MHz of the MCP6004 would be sufficient here?mobyfab wrote:Using the same opamp on my design, I have the same behavior, about .2V.kb1gtt wrote: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.
Also using 10K resistors dividers driving the STM32 ADC on the output reduces the GBWP to around 100kHz.
MCP6294 seems a better choice but it's like 3 times the cost.
I think the current opamp will do fine. As already said by others: it is best to avoid using sensors near the rails. Most sensors which have some sort of logic / amplification internally rarely output voltages up/down to the rails.kb1gtt wrote:The LM7705 is interesting. I'd be concerned about creating a large virtual ground. I guess the first item that would need to be answered, is do we need complete rail to rail? Is someone having a problem with the rails?
I agree, we should not care about values near the rails, as the sensors should not go anywhere near that, it should be used to detect open loops.
Re: analog inputs: op-amp + divider - Russian - LMV324IDT
I would not use the same topology for knock sensors as for the rest of the sensors.mobyfab wrote: I need it for the knock sensor (sampling at 115kHz), but in this case the GBWP is more than sufficient indeed.
I agree, we should not care about values near the rails, as the sensors should not go anywhere near that, it should be used to detect open loops.
You probably want to ditch DC and create some sort of band pass filter for the knock sensor: this already solves your rail-to-rail problem as you can bias this circuit at 2.5V.
I would also design the circuit to accept a differential input and not use the ground of the engine block as it would be electrically noisy.
Not sure what (OEM) application you are using: but if I would be building from scratch I would run a shielded wire with two conductors from the knock sensor to the ECU.
Re: analog inputs: op-amp + divider - Russian - LMV324IDT
What is the bandwidth of the ADC?mobyfab wrote:I need it for the knock sensor (sampling at 115kHz), but in this case the GBWP is more than sufficient indeed.
Re: analog inputs: op-amp + divider - Russian - LMV324IDT
I did most of that. There's a DC blocking cap, it's biased at 1.65v, there's no resistor on the output except the one inside the ADC (1k, 8pF sampling cap)DaWaN wrote:I would not use the same topology for knock sensors as for the rest of the sensors.mobyfab wrote: I need it for the knock sensor (sampling at 115kHz), but in this case the GBWP is more than sufficient indeed.
I agree, we should not care about values near the rails, as the sensors should not go anywhere near that, it should be used to detect open loops.
You probably want to ditch DC and create some sort of band pass filter for the knock sensor: this already solves your rail-to-rail problem as you can bias this circuit at 2.5V.
I would also design the circuit to accept a differential input and not use the ground of the engine block as it would be electrically noisy.
Not sure what (OEM) application you are using: but if I would be building from scratch I would run a shielded wire with two conductors from the knock sensor to the ECU.
I still use the chassis ground, maybe I'll change that.
I use the OEM knock sensor from a Honda bike, it has a shielded wire, ground and signal.
So far so good.
![Image](https://s10.postimg.org/tec6c2wzd/knock.png)
Not sure about the bandwidth since it probably depends on the opamp output, but the sampling rate it 5.14Mhz max on one ADC.Rhinoman wrote:What is the bandwidth of the ADC?mobyfab wrote:I need it for the knock sensor (sampling at 115kHz), but in this case the GBWP is more than sufficient indeed.
Re: analog inputs: op-amp + divider - Russian - now MCP6004
![Image](https://s3.postimg.org/uplrfdsu7/opamp1.png)
I'm not sure about which resistors you are using on output (if you are using any) but this might help.
Currently I have a 400mV headroom on my sensors output, using a 1/2k bridge (5v->3.33v)
Since the sampling is at only 1kHz I will try to increase those to 10/20k and see if it improves according to the graph.
http://www.microchip.com/stellent/groups/sitecomm_sg/documents/training_tutorials/en528065.pdf
Re: analog inputs: op-amp + divider - Russian - now MCP6004
Frankenso does not have any analog outputs. It has several analog inputs, but no outputs.
What is an application which would need an analog output?
What is an application which would need an analog output?
Welcome to the friendlier side of internet crazy ![Smile :)](./images/smilies/icon_e_smile.gif)
![Smile :)](./images/smilies/icon_e_smile.gif)
Re: analog inputs: op-amp + divider - Russian - now MCP6004
I don't know why you asked this but in the past when I've needed to generate an analogue signal then I've just feed a PWM signal into an integrator. One example was an ECU that needed variable thresholds for the peak-hold drivers to support different injectorskb1gtt wrote:Frankenso does not have any analog outputs. It has several analog inputs, but no outputs.
What is an application which would need an analog output?
Re: analog inputs: op-amp + divider - Russian - now MCP6004
I've done similar for analog outputs, but I generally follow it with an op-amp such that you have a controlled impedance for the low pass filter. I still don't know why an ECU needs an analog output.
Welcome to the friendlier side of internet crazy ![Smile :)](./images/smilies/icon_e_smile.gif)
![Smile :)](./images/smilies/icon_e_smile.gif)
Re: analog inputs: op-amp + divider - Russian - now MCP6004
By output I meant the opamp's which is connected to the ADC input.
Re: analog inputs: op-amp + divider - Russian - now MCP6004
I seem to recall the STM32's impedance varies from 1k to 10k depending mostly on the ADC's clock frequency. We are using 2x series 1.5k, so the op-amp is seeing something below 3k.
Welcome to the friendlier side of internet crazy ![Smile :)](./images/smilies/icon_e_smile.gif)
![Smile :)](./images/smilies/icon_e_smile.gif)
Re: analog inputs: op-amp + divider - Russian - now MCP6004
The ADC is always 1K/8pF as far as I know.
So increasing resistor values might help here.![Wink ;)](./images/smilies/icon_e_wink.gif)
Edit: it's up to 6k, at 1.8V. Gets lower as VDD increases. Sampling cap is 4pF for F405 devices.
It does not change with frequency. (maybe you are referring to "Rain" which is the max source impedance for a given frequency)
So increasing resistor values might help here.
![Wink ;)](./images/smilies/icon_e_wink.gif)
Edit: it's up to 6k, at 1.8V. Gets lower as VDD increases. Sampling cap is 4pF for F405 devices.
It does not change with frequency. (maybe you are referring to "Rain" which is the max source impedance for a given frequency)
Re: analog inputs: op-amp + divider - Russian - now MCP6004
See "Rain" and "Radc" in the below PDF's.
http://www.st.com/content/ccc/resource/technical/document/application_note/9d/56/66/74/4e/97/48/93/CD00004444.pdf/files/CD00004444.pdf/jcr:content/translations/en.CD00004444.pdf
http://www.st.com/content/ccc/resource/technical/document/application_note/group0/3f/4c/a4/82/bd/63/4e/92/CD00211314/files/CD00211314.pdf/jcr:content/translations/en.CD00211314.pdf
Also keep in mind that the clamping diode leakage and diode capacitance also skews the ADC readings. Theoretically you could post-warp your ADC readings to get a more accurate representation of what is happening in the real world.
For a different project, I did this QUCS simulation. I was looking to predict the readings that I would get from a particular current sensor, that is intergrate into a motor driving chip.
Source QUCS file found here https://sourceforge.net/p/daecu/code/HEAD/tree/Hardware/trunk/Stervo/misc/BTS7960_IS-toVis_simulation.sch?format=raw
http://www.st.com/content/ccc/resource/technical/document/application_note/9d/56/66/74/4e/97/48/93/CD00004444.pdf/files/CD00004444.pdf/jcr:content/translations/en.CD00004444.pdf
http://www.st.com/content/ccc/resource/technical/document/application_note/group0/3f/4c/a4/82/bd/63/4e/92/CD00211314/files/CD00211314.pdf/jcr:content/translations/en.CD00211314.pdf
Also keep in mind that the clamping diode leakage and diode capacitance also skews the ADC readings. Theoretically you could post-warp your ADC readings to get a more accurate representation of what is happening in the real world.
For a different project, I did this QUCS simulation. I was looking to predict the readings that I would get from a particular current sensor, that is intergrate into a motor driving chip.
![Image](https://sourceforge.net/p/daecu/code/HEAD/tree/Hardware/trunk/Stervo/misc/BTS7960_IS-toVis_simulation.png?format=raw)
Welcome to the friendlier side of internet crazy ![Smile :)](./images/smilies/icon_e_smile.gif)
![Smile :)](./images/smilies/icon_e_smile.gif)
Re: analog inputs: op-amp + divider - Russian - now MCP6004
I need some digital high-side-switched inputs. Is there any reason not to use a simple resistor/zener-diode arrangement?
Re: analog inputs: op-amp + divider - Russian - now MCP6004
Speed of the zener will be important. Keep in mind the STM32's inputs have fast rail clamping diodes, so if you exceed the rail voltage it will dump energy to one of the +V rails. I'm assuming that's the 5V rail, but it could be the 3V rail. If the zener doesn't kick in fast enough, then the STM's +V will dump the energy. This energy on your +V rail will likely skew your analog signals, and perhaps it would do other odd things.
How much heat will it make? Running 12V at 1mA which is clamped by a 5V zener will be 5V * 1mA = 5mW. Is 1mA enough current? Would the diode have good enough heat sinking to keep the temperature down with what ever it's dissipated watts are?
If the zener fails for some reason, you'll destroy the STM32, and who knows what will happen to the outputs if a port is blown. So keep in mind the failure modes. AKA does a failed port cause fuel injectors go to 100%, or does it cause the analog MAP to register as 100%?
Also keep in mind you'll probably need a 4.7V or perhaps lower zener to get 5V protection. I seem to recall that 4.7V is what you get at 10mA, and if you run 1mA, your voltage will be higher, perhaps close to 5V. Keep an eye on the diode's curve. Also keep in mind that curve changes with temperature. So bench top vs hot day of operation will change that curve. You might want to check the datasheet for the specific pin you plan to use. I believe most IO will trigger as a guaranteed digital 1 at like 2.7V. So you probably want a 4.1V zener. AKA if it gets hot and wanders lower you are still OK, and if wanders higher for some reason you still have head room before the STM32's ESD diodes kick in.
See figure 2 at the below. Notice how the voltage changes if you get warm.
http://datasheet.octopart.com/1N4728A%2C113-NXP-Semiconductors-datasheet-8749550.pdf
I would say you can probably get it to physically work, but you might be a bit weak on failure modes.
How much heat will it make? Running 12V at 1mA which is clamped by a 5V zener will be 5V * 1mA = 5mW. Is 1mA enough current? Would the diode have good enough heat sinking to keep the temperature down with what ever it's dissipated watts are?
If the zener fails for some reason, you'll destroy the STM32, and who knows what will happen to the outputs if a port is blown. So keep in mind the failure modes. AKA does a failed port cause fuel injectors go to 100%, or does it cause the analog MAP to register as 100%?
Also keep in mind you'll probably need a 4.7V or perhaps lower zener to get 5V protection. I seem to recall that 4.7V is what you get at 10mA, and if you run 1mA, your voltage will be higher, perhaps close to 5V. Keep an eye on the diode's curve. Also keep in mind that curve changes with temperature. So bench top vs hot day of operation will change that curve. You might want to check the datasheet for the specific pin you plan to use. I believe most IO will trigger as a guaranteed digital 1 at like 2.7V. So you probably want a 4.1V zener. AKA if it gets hot and wanders lower you are still OK, and if wanders higher for some reason you still have head room before the STM32's ESD diodes kick in.
See figure 2 at the below. Notice how the voltage changes if you get warm.
http://datasheet.octopart.com/1N4728A%2C113-NXP-Semiconductors-datasheet-8749550.pdf
I would say you can probably get it to physically work, but you might be a bit weak on failure modes.
Welcome to the friendlier side of internet crazy ![Smile :)](./images/smilies/icon_e_smile.gif)
![Smile :)](./images/smilies/icon_e_smile.gif)
Re: analog inputs: op-amp + divider - Russian - now MCP6004
So, what would a safer way to handle 12V digital inputs be?
Re: analog inputs: op-amp + divider - Russian - now MCP6004
I would suggest cutting and pasting from the op-amp circuit. See this marked up version which is based on the 12V battery sensing circuit. Basically it's 1mA resistor divider, followed by current limiting 10k resistor, rail dumping diodes, and low pass filter. Also note that if you do not have any thing connected to the circuit, it will pull to 0V. I'm not sure if this works for you, but it will probably get you started. I like the resistor divider as those have better temperature stability. I generally also try to make it such that a failed wire connection an be detected via analog MUX. However that's not likely to be implemented in software for this.
- Attachments
-
- Untitled.png (13.55 KiB) Viewed 23876 times
Welcome to the friendlier side of internet crazy ![Smile :)](./images/smilies/icon_e_smile.gif)
![Smile :)](./images/smilies/icon_e_smile.gif)
Re: analog inputs: op-amp + divider - Russian - now MCP6004
That makes perfect sense- thanks!
Re: analog inputs: op-amp + divider - Russian - now MCP6004
If its battery voltage then you need to ensure that the input pin voltage will be valid over the range of possible battery voltages. Also if you're not feeding into a schottky input then you will need to meet the minimum rise time requirement.
Re: analog inputs: op-amp + divider - Russian - now MCP6004
He has a digital 12V or 0V signal which needs to be captured, so he only cares about safely detecting a 1 or 0 state.
Welcome to the friendlier side of internet crazy ![Smile :)](./images/smilies/icon_e_smile.gif)
![Smile :)](./images/smilies/icon_e_smile.gif)