[HELP] Controlling more analog/digital pins.

So Im working on a project that will have a lot of sensors (more than the number of pins available on the arduino uno).
I will need about 20 Analog In pins and about the same for 15 Digital In/Out and 15 Analog Out.

I looked up some tutorials and found out that this can be done using shift registers but my question is which shift register would i need for Analog IN, for Analog OUT, and for Digital IN/OUT. Also if you have a tutorial that explains how to use them (with code examples) for newbies i would appreciate it.


Digital shift-in : 74HC165
This tutorial uses the CD4021 : http://arduino.cc/en/Tutorial/ShiftIn
Digital shift-out : 74HC595

This is a step-by-step tutorial for shifting out digital pins, Overview | Arduino Lesson 4. Eight LEDs and a Shift Register | Adafruit Learning System

Digital shift-in and shift-out registers can be cascaded. You can get many digital inputs and outputs that way.
With 2 shift-in and 2 shift-out ic's you have 16 inputs and 16 outputs.

For analog inputs, you need either a mux or ADC chips.
A mux (multiplexer) is like a switch that selects one of the analog signals.
Nick Gammon wrote a page about the mux : Gammon Forum : Electronics : Microprocessors : 74HC4051 multiplexer / demultiplexer

The Arduino Mega 2560 has 16 analog inputs.
But if you use 3 mux ic's with 3 analog inputs, you can select 24 analog signals.

If you need high accuracy, you should use an external ADC chip.

What do you mean with analog out ?

Thank you very much, explained everything :slight_smile:

EDIT: And by Analog Out I meant PWM Pins (it was my mistake).

You can't easily get extra PWM outputs. You have to use something like a TLC5940 ad that takes a bit of driving. Fortunately there is a library for that.