Have many sensors, but use few inputs

I have a need for a bunch of Hall sensors (digital / binary), but I want to use only few Arduino inputs. Is there a device / shield / multiplexer that "encodes" the input from multiple binary sensors, so that it can be "read" by just 1-2 inputs on the Arduino?

I know that some LED strips have "controller" circuit so that an Arduino can address the LED lights individually, using just 1-2 outputs. I'm looking for the "reverse" of this: read many binary sensors with just a few Arduino inputs.

Why do you need to use only a few inputs? Are the analog pins being used?

There are I2C expanders like the MCP23008 (8 bits) and MCP23017 (16 bits) that give you 8 or 16 GPIO pins while using only the 2 I2C pins. You can attach up to 8 of each of those devices to the I2C bus giving you 64 to 128 GPIO pins while using 2 pins.

The expander pins can be input or output (or a mix). Each pin has an internal pullup that can be enabled (handy with switches). And they have pin change interrupts.

Both chips also come in SPI variants so use 3 pins plus a chip select for each chip.

1 Like

Thanks, looks like I can get it here:

Digikey has them cheaper.
About half the Adafruit price.

1 Like

Great, thanks.

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