4
\$\begingroup\$

I have a BeagleBone (BB) and want to connect the analog output of a motor controller to it. The motor controller creates an output in the range of -4V to +4V and the BB anlog inputs only accept voltages between 0V to 1.8V (digital pins run at 3.3V). I only have a comparably small limited space of perfboard available, but 4 motors to monitor. I can provide 5V and 3.3V supply and 1.8V ref Voltage. Here are the options I found so far:

  1. Make an op-Amp circuit to convert [-4..4] to [0..1.8]. Probably a nice way, because I could use directly the BB-ADCs, but I am not to confident with these circuits (I found this example) and I would need one for every input which seems to be to many parts/space.
  2. Use an ADC and connect it via I2C: The Max127 seems to provide exactly what I want. Single 5V supply, analog input range between [-5..+5] and I2C interface. I would really like to use this one, the only problem I have is that according to the data sheet digital high is seen as 0.7*Vdd = 3.5V. I do not now if 3.3V would be detected correctly (anyone has experience with that?). Pulling up to 5V is not possible as the BB is not 5V tolerable.
  3. The Max1270 is basically the same as the Max127 but with SPI-interface. There the data sheet states the digit high threshold is 2.4V. I know that the I2C slave only pulls down. How does it work with spi, because the data sheet mentions digital outputs voltages (which are Vdd)?
  4. Lose some resolution and only use the output range from [0..4]V. That gives a larger variety of possible unipolar ADCs, but most of them have the same limitation with 0.7*Vdd for digital high signals.
  5. As in 4. But use ADCs with 3.3V supply voltage which have a range of [0..5], but I could not find any with 4+ channels.

I believe that I somehow going in circles. Does someone know a viable solutions or how to address the mentioned problems of (at least) one of the above described? I would generally prefer through hole parts (as it's perfboard) but I could probably get some small breakout boards for SMD-devices as well.

\$\endgroup\$
3
\$\begingroup\$
  1. Although a passive solution is possible, often depending on your source impedance and ADC input impedance, it's usually a good idea to use an opamp for the level/gain shift. One option is an inverting circuit such as this:

    Inverting Shift

    Simulation:

    Inverting Shift Simulation

    The benefit is a very low output impedance to drive the ADC (many ADCs require a minimum signal impedance of <10kΩ)
    The input impedance is just R3 (133.2kΩ in this circuit) To prevent loading effects, you want your signal impedance to be less than 10kΩ or so. If it's higher, you can increase R3 and R2 to increase the input impedance (as long as the ratio remains the same, so does the gain)
    Some opamps don't like a gain less than 1, so you need to check the datasheet to make sure it will be stable in this configuration. Also a small capacitor across R2 is usually a good idea to control bandwidth appropriately.

    The readings will be inverted, but it's easy to correct for this in firmware.

    A quad opamp with a decent voltage reference IC and divider to provide the 735mV reference for all non-inverting inputs could be used. The opamp must be able to swing its output down to ground; some op-amps cannot do this, so check the datasheet.

  2. For the I2C and MAX127 (which looks fine) option, you could use a level shifter IC to convert between the 3.3V and 5V levels needed. There are quite a few such ICs designed for use with I2C. Have a look on Farnell, or Mouser, Digikey, etc. The PCA9306 is one example.

  3. SPI uses "standard" outputs which are driven high/low (as opposed to I2Cs open drain) You can also easily level convert this, since each line is only one direction. A couple of transistors can be used.

\$\endgroup\$
1
  • \$\begingroup\$ Thank you. I use the the proto cape for the BB which has a small soic8 socket (perfect for the pca9306). I think I will use this one together with the Max127. This also gives me the freedom to add some more channels later. \$\endgroup\$ – the_summer Apr 26 '13 at 20:29
6
\$\begingroup\$

This can be done with three resistors!

schematic

simulate this circuit – Schematic created using CircuitLab

No active components needed. Shifts -4 to 4V to 0-1.8V, perfectly linearly. V2 is your input voltage (-4 to 4V). V1 is just your 1.8V rail.

The input impedance is 22K, which won't load your motors to any significant degree, and the output impedance is about 5K, more than low enough to drive any ADC.

\$\endgroup\$
2
  • 1
    \$\begingroup\$ After some remembering I could reproduce the calculations. That actually looks pretty need and simple, especially as I can test that on a breadboard before soldering it to something. Thank you very much. \$\endgroup\$ – the_summer Apr 26 '13 at 20:25
  • \$\begingroup\$ +1 for an elegant solution I learnt in school but had forgotten about entirely. \$\endgroup\$ – Anindo Ghosh Apr 26 '13 at 20:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.