Hi,
chiming in here because I'm about to build my first circuit that uses ADCs
on BBB...
My standard advice
> would be to run the analog voltage through a non-inverting op amp
> configured as a gain stage. You run the op-amp (and have to pick one
> that does rail to rail and also runs from 1.8 volts) from the 1.8 volt
> supply.
>
Yes, that's what I do. There are quite a few very low power op-amps
suitable for running from the 1.8 volt rail on the BBB. If OP is
interested I can look up the device, it's from TI if I remember.
In my somewhat amateurish approach to this I was planning to use a DC-DC
converter to provide 1.8 VCC for my sensors. I'm still learning about
op-amps and anything more advanced than a transistor, so I wonder whether
there are any advantages to using an op-amp compared to providing 1.8 V
from a switching DC-DC converter?
Let's see. Firstly, the goal is to make sure that the voltage to the
analog terminal does not go negative at all, and does not go more
positive than 1.8 volts, ever.
So firstly, let's feed all the sensors from 1.8 volts. Now this
works, and can work well. The question is how to get the 1.8 volts. A
switching converter, while efficient, generates noise, is relatively
complex, and is moderately large. An easier way to get 1.8 volts is
to use a simple 3 terminal regulator. There are some very small ones
available. They generate little electrical noise. A typical current
limit is about 100 ma, which should power a number of sensors.
Now, failing that we can (and often we cannot) power the sensors from
only 1.8 volts, we still need a method of reducing the input voltage.
Some will say to put a resistor in series, thinking that it's the
current you get with an overvoltage. This is not necessarily true,
often it is simply the voltage itself, and the damage is done by the
way that the processor is constructed.
Others would say that the best way is to add two diodes (back biased)
to 1.8 volts and ground, and then add a protective resistor. The
problem with this is that the diodes must conduct before they limit,
and that means that your voltage range is -.7 to 2.5 volts to the pin,
which violates the limits.
Another approach would be a zener diode. One problem is that the
zener needs roughly 0.001 amp to work, and that the sensor must supply
that voltage. Another is that if you are trying to drop 12 volts down
to 1.8, you can, but by a fixed amount. Go to 13 volts and you still
drop the 13 down to 2.8, and exceed the chip limits. Zeners are
standard diodes in reverse, so you have no protection below -0.7 volts
at the input.
Yet another way would be to use a voltage divider. This reduces the
input voltage by a fixed amount, and can be a decent solution IF and
ONLY IF the voltage does not go negative (and can NEVER go negative),
and the maximum voltage you can ever see is reduced down to 1.8
volts). As a specific cure, it can work, but as a general cure, it
isn't recommended because you can still go over 1.8 volts and less
than 0. For those who consider it important, the impedance of the
divider can also be an issue, too little and nothing drives it, too
high and the chip characteristics override the divider resistors.
Putting an op amp in allows several possibilities. Op amps can be
inverting or non-inverting. By running the op-amp from 1.8 volts and
ground, the maximum output voltage that the op-amp can put out is
limited to these values. You will need a chip that outputs rail to
rail (ground to positive power supply voltage).
Inverting: the voltage has to be offset to keep the opamp from going
negative (and it will try, even when powered from 1.8 volts and
ground). This also inverts the voltage so that as the voltage at the
input increases, the output decreases.
Non-inverting: the voltage increases and the output increases. Non
inverting unity gain (buffer) may have output voltage limits, so that
must be checked. It will have an extremely high impedance, though. If
gain is needed, then the non-inverting configuration with gain can be
used.
I'd personally recommend the op-amp for the most general solution, and
the resistive divider ONLY if the application can be guaranteed to
never exceed the voltage limits of the chip under any reasonable
conditions.
Level converters are digital devices, and not suitable for use on
analog circuits.
Good design is frequently paranoid design.
Harvey