How to save pins for photoresistor

Hi I'm using 4 photoresistors.
It actually grabs 4 pin analog on the board, is there a way to reduce the amount of pins?

1 Like

Use an analog multiplexer, such as 74hc4051 or 74hc4067.

Use an external ADC chip, such as ads1115.

1 Like

Need both 74hc4051 and ads1115?
Or is one of them enough?

You don't need both.

By the way, your schematic above is incorrect. Wired like that, all analog inputs would read zero.

1 Like

Ok thank you...
I did not understand why she is wrong ...
Can you please show how the right way?


Ignore the led in the above schematic, it is wired incorrectly (no series resistor).

1 Like

I'm really grateful.
I tested the 74hc4051, to use it I need to connect it to 3 digital pins and one analog pin, so I did not spare anything, I still need to use 4 pins ...

You could have been more specific in your original question. You seemed to be concerned about saving analog pins.

If you only want to use 4 analog inputs, you can connect the A2 input of the multiplexer to ground and only use 2 digital pins to select the channel, plus one analog pin, saving one pin.

The ads1115 would use only 2 pins in total. But on many types of Arduino, they are A4 & A5, so you lose 2 analog pins. But the advantage of this chip is that it uses the i2c bus. That means you can connect many other types of devices (sensors, RTC, I/O extenders, LCD/oled displays...) to those same 2 pins, all at the same time.

1 Like

Wow, thank you for the explanation, I really thank you ...
How is this sketch? correctly?

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.