Newbie: I want to create a switchboard with 30 switches and read the status of it

Hi everyone,

I recently aquired an old electric board with 30 (depricated) automatic fuses:

Just for fun: I want to use those fuses as “sensors” by integrating their status (open/closed) in my Home Assistant.
So I want to read the “state” of a fuse: on/off.

Main idea:

  • use an ESP8266 or ESP32
  • MCP23017 as IO expander
  • I want to have 30 physical attached control leds
  • I want to get the status of each fuse in Home Assistant
  • PlatformIO as software?

Can this be done with an ESP8266/ESP32 and PlatformIO?

This is all very new to me as -till now- I was only “consuming” PlatformIO for some out-of-the box functionality…
So any kind help in baby steps is appreciated :slight_smile:

kind regards,

Bart Plessers

Hi! Sweet project :slight_smile: You can definitely use platformio to build your firmware for an ESP8266, or ESP32, in fact that’s what I’d do myself.

You could use the arduino framework (within platformio) to do this, as this might ease any programming you need to do, and for example, you could use MQTT libraries available for arduino to send data to home assistant.

As for the port expander that looks quite nice for 16 channels, per expander. It uses I2C which is nice and simple for connecting it, and there is a module available, if you haven’t come across this already on PiHut.

You can connect multiple of these to the same I2C bus for your 30 channels input and output.

There is an arduino library available in the platformio registry:

May I suggest an alternative, if you would like to control these LEDs, but with individual brightness (for extra fanciness)? If this sounds interesting, the PCA9635 is a nice chip and available very cheaply on easy-to-connect modules, too. Basically the same as the MCP23017, but you get brightness control, too, although you’d still need to handle the inputs to read the fuses, for which the MCP would be a good option.

1 Like

As far as baby steps go, to start your platformio project, you can make a folder, run platformio init inside the folder, and edit platformio.ini with the following, to get you started for ESP development, for example with a D1 mini board, for example:

platform = espressif8266
framework = arduino
board = d1_mini

Hope this helps!

1 Like

This question doesn’t depend on PlatformIO. It’s just the build system that gives you a development enviornment for the ESP32 and e.g. the Arduino framework. It’s all about the capabilities of the ESP32. The same could be done in other build environments, like the Arduino IDE.

This will be next step. My MCP23017’s are already on their way…