0
\$\begingroup\$

I'm trying to build an interface that can take the readings from level sensors and provide a small enough voltage that a 3.3V microcontroller can read.

I've done this successfully using the following circuit, which will give me a reading in a fixed range of voltage inputs. The circuit is simply a voltage divider -> rail-to-rail buffer -> RC filter.

schematic

simulate this circuit – Schematic created using CircuitLab

BUT, I want to be able to interface with sensors with different voltage-output-ranges, without sacrificing resolution on my ADC. That is, I want different sensors to be compatible such that interfacing a different sensor only requires you to specify what the sensor's output range is in the microcontroller's software.

For example, some of the sensors I'm looking at have output ranges of:

  • 0-2.5VDC
  • 0-3.3VDC
  • 0-5VDC
  • 0-10VDC
  • 0-12VDC
  • 0-24VDC
  • 4-20mA

My immediate thoughts were to replace one of the resistors in the voltage-divider network with a digi-pot, but high accuracy (low resistive tolerance) digi-pots are expensive. Are there any cheap ways to achieve this? (I'm not too concerned about circuit complexity, just cost.)

\$\endgroup\$
  • \$\begingroup\$ As soon as you start precision voltage-division, the components will be expensive. How precise are your expectations? \$\endgroup\$ – analogsystemsrf Sep 18 '18 at 4:11
  • \$\begingroup\$ Maybe an analog mux will be more appropriate since you don't need the resolution of the digital pot. \$\endgroup\$ – Mike Sep 18 '18 at 4:17
  • 1
    \$\begingroup\$ @Mike How about MUX on input sending it to different dividers and then DEMUX to bring it to same DAC pin? Having said that, I feel there is XY problem lurking nearby \$\endgroup\$ – Maple Sep 18 '18 at 7:17
  • \$\begingroup\$ As @Maple said, there's an XY issue. How would you feel about using an external ADC? \$\endgroup\$ – awjlogan Sep 19 '18 at 9:37
  • \$\begingroup\$ Hi everyone and sorry for the late reply, been dealing with a lot of stuff these past few days. The mux and demux idea is certainly an option. I'm not opposed to using an external ADC as long as the cost isn't high. As far as precision goes, I believe +/- 0.5% in the output range would be acceptable. \$\endgroup\$ – Joe Sep 22 '18 at 8:02
1
\$\begingroup\$

You could build a programmable resistive divider with a fixed "top" resistor and several "bottom" resistors connected to GND via FETs. The MCU would control the FETs. Of course you will need to protect the circuit if the voltage gets too high, or the wrong configuration is selected.

schematic

simulate this circuit – Schematic created using CircuitLab

\$\endgroup\$
  • \$\begingroup\$ Thank you for your answer, time, and effort. I don't believe that method will benefit me as I would need several FETs to accomplish all the different voltage divider configurations I would want, which would drive up cost. I also don't want to use to many GPIO pins to do this, and I believe a shift register / IO expander would drive up the cost too much as well. \$\endgroup\$ – Joe Sep 22 '18 at 8:07

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.