3
\$\begingroup\$

I have a requirement to read an analogue value from 20 sources. I am using a PIC microcontroller that has 11 available ADC inputs. I have a number spare IO ports, I am thinking of using an analogue multiplexer/demultiplexer 74HC4051; 74HCT4051 they cost 55p each. What are people experiences with these devices? Would you just add an additional PIC and not bother with the additional logic?

edited to make it a little more clear. I am trying to read the values from a large group of potentiometers inside rc servos. I will take readings from all of the pots maybe once a second.

\$\endgroup\$
4
  • \$\begingroup\$ Yes, that would work. It may be useful to know what kind of signals/sensors you're talking about so that any additional precautions that are relevant can be pointed out. \$\endgroup\$ Feb 1, 2013 at 10:00
  • 1
    \$\begingroup\$ Either way is fine, it's simply a cost/functionality trade off. Another option is an external multi-channel ADC. \$\endgroup\$
    – kenny
    Feb 1, 2013 at 10:01
  • \$\begingroup\$ What is the expected rate of change of the potentiometer wiper values? \$\endgroup\$ Feb 1, 2013 at 10:18
  • \$\begingroup\$ well, its an rc servo, the spec says .2seconds I assume thats a full sweep. I imagine I will take the readings when the servo is stationary. \$\endgroup\$
    – user18539
    Feb 1, 2013 at 10:36

3 Answers 3

2
\$\begingroup\$

To read a pot, you don't need an ADC. All you need is a capacitor and a timer. Here's one way you might do it:

schematic

Begin with the input low. Leave it this way for several RC time constants so all the capacitors discharge. Now bring the input high and start a timer. Configure your microcontroller to interrupt on input change. As each capacitior charges and crosses the high threshold of your inputs, you get an interrupt. Read the timer. The number corresponds to how long the capacitor takes to charge, which is a function of the RC time constant of R1*C1, and since you know C1, you can calculate R1. When all the inputs have changed, bring the input low. Repeat.

There are hundreds of variations on this. You might put a buffer at the input if your microcontroller can't source enough current to charge all the capacitiors. You might time charging and discharging the capacitiors to double your sample rate. There are many other ways you might connect the capacitiors.

\$\endgroup\$
2
\$\begingroup\$

Given the slow sample rate I would look at I2C or SPI (serial) ADC chips with multiple channels, that way you only need 2 or 3 wires to read lots of ADC's, and can chain/expand the design. Analogue switches / multiplexers may introduce inaccuracies.

\$\endgroup\$
1
\$\begingroup\$

In my company, we use this multiplexer to bring slow-moving analog signals to a PSoC1 device with limited ADC input channels with great success.

My advice is to make sure none of the analog inputs can exceed the supply voltage to the mux or 'weird things' may happen. Also be sure to allow some settling time after changing the mux setting.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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