How to increase Analog I/O pins of Attiny85
How we all know the Attiny85 has only one port, the PORTB with 6 pins. But only 5 pins are used because the first pin, the number 0, is used for reset feature and you could use it for general IO only by fuse bits.
Anyway we can increase the analogic pins with a cmos IC or multiplexer like the CD4051. It very easy use it, and we add 8 pin for analogic or digital operations.
It has 18 pins and it uses 3 pins for parallel comunications (DA, DB and DC) and 1 pin for IO. Just you connect 3 pins to attiny85 and 1 pin to A0 like this scheme
The code of our sketch is very easy, in the first step we set the pins
In the next step we set the pins on multiplexer and we read the voltage by ADC
Everytime we need read a sensor connect by multiplexer we set before the relative pin and than wwe read the voltage on the multiplexer by the pin number 3. We can use the 4051 multiplexer also with only digital valuses, it is capable