Use this forum to chat about hardware specific topics for the ESP8266 (peripherals, memory, clocks, JTAG, programming)

User avatar
By molahs
#61372 Hi,
I want to have esp8266-12e setup with 4 or 5 buttons.
each button press will trigger a mqtt action.
The mqtt action isn't an issue.
I would like to inquire whether the esp8266 can have 5 inputs (toggle switch) without using a multiplexer?

Thank you very much for your assistance.
User avatar
By rudy
#61392 You can have each switch connected individual IO pins. If you do not have enough IO pins available then you will need to use a different approach. I don't know what you consider to be a multiplexer. The term by it's self is not descriptive enough. It could mean that you don't want to use external chips or it could mean that you do not want to do other tricks in order to combine the switch signals that would take less IO pins.

I will throw out one option that I consider is multiplexing but maybe it could be acceptable to you. Use the analog input to measure a resistor string with the switches shorting out different resistors to produce a variable input voltage that you can then use to determine the closed switch.

Below are two ways to accomplish the same thing. Values and voltages should be adjusted to meet your needs.

Image

Image
User avatar
By molahs
#61402 @rudy, that is the best idea ever and exactly what I was hoping to hear.

I'll most probably go down the route of the first image, using a resistor for each button.

Thank you very much for the pointers.