Core Electronics Forum

Reading 30~ analog inputs, controlling 10~ analog outputs

I’m currently starting a new project which will require me to read 30-40 analog inputs (0v-5v), and control 10 odd outputs (either on or off).

As the RPI only has digital GPIO, I’m unable to read anything off of them, and have only come up with the below two options.

  1. Stack multiple ADC shields (AB Electronics ADC has 8 channels, so need to stack 4 to achieve 32 inputs) which isn’t desired as this would make it a bit bulky.

  2. Pair it with an Arduino, communicating via USB with all analog inputs coming from the Arduino.

Does anyone have any better options/ideas on the best way to go about this?

Ideally, I’d like some redundancy when it comes to input pins (output will be max 10), and I’d like to keep the size down. I’ll be 3d printing a case to house all this, so might also cut some of the length off pins to reduce the distance between boards/shields.

1 Like

An analog multiplexor allows you to select one of multiple analog channels using digital control signals. This would dramatically reduce the number of ADC that you need. 4 multiplexors plus a 1-of-4 decoder would mean that 5 digital control lines could select 1 from 32 analog channels.

3 Likes

Good solution Jeff.

One thing to be aware of is the series resistance of the individual switches. Somewhere in the region of 100Ω or so. If inputting into the very high impedance of an Arduino analog input this can be ignored. I don’t know but probably most ADC devices are the same, very high impedance.

If not and the load is low Z then you would probably need a rail to rail OP amp interface configured as a unity gain voltage follower. Note these chips do not get right down to 0V (pretty close) so if this is important you will need the V- supply to be a couple of volts negative.
Cheers Bob

2 Likes

Hi Scott, Jeff.
Never had anything to do with these but just had a closer look.
With 9 of these boards you could in theory have an array of 64 inputs selectable to input into 1 ADC or indeed have a system cycling through all 64 points.

How is as follows.
Connect 8 boards together. S0, S1, S2 and Z in parallel. Z goes to the ADC device.
Connect 3 digital output pins to S0-S2.
Connect the Y0 to Y7 of the 9th board to enable pin of each of the other 8 boards.
Connect 3 digital output pins to S0-S2 of the 9th board.
Connect Z of the 9th board to ground.

Result: 64 inputs selectable with 6 digital pins. Achieved by selecting 1 of 8 inputs with 1st set of 3 pins and 1 of 8 boards with 2nd set of 3 pins. This is possible because according to the spec sheet only one of the switches on the selected board is on at any one time.
Cheers Bob

3 Likes