74HC4051 Input to MQTT

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
kodak
New user
Posts: 2
Joined: 11 Dec 2021, 02:17

74HC4051 Input to MQTT

#1 Post by kodak » 11 Dec 2021, 02:38

Hi

i have an 74HC4051 connected to my ESP,
on that one i have 8 Resistors connected.

R1 (100 ohm) = Name_1, R2 (200 ohm) = Name_2, R3 (300) Name_3, ... R8 (800) = Name_8

for each input of the 74HC4051 i want to check for one of thees resistors.

so if for an exempel:
Input 6 = 300 ohm and Input 3 = 700 ohm

i want it to send 'Name_3 = TRUE' and 'Input_6 = Name_3' and 'Name_7 = TRUE' and 'Input_3 = Name_7' on MQTT

And send a state of each Resistor state, like:
'Input_1 = FALSE'
'Input_2 = FALSE'
'Input_3 = Name_7'
'Input_4 = FALSE'
'Input_5 = FALSE'
'Input_6 = Name_3'
'Input_7 = FALSE'
'Input_8 = FALSE'

'Name_1 = FALSE'
'Name_2 = FALSE'
'Name_3 = TRUE'
'Name_4 = FALSE'
'Name_5 = FALSE'
'Name_6 = FALSE'
'Name_7 = TRUE'
'Name_8 = FALSE'

I want check for who/witch resistors is pressent.

How do i do this?

Hope some one can help me.

User avatar
ThomasB
Normal user
Posts: 1064
Joined: 17 Jun 2018, 20:41
Location: USA

Re: 74HC4051 Input to MQTT

#2 Post by ThomasB » 11 Dec 2021, 03:28

You could setup each 74HC4051 mux input with a resistor divider. Like this (8 places):
Image

Assuming your ESP8266 device has a built-in voltage divider on the Analog input (a common feature of Dev boards and NodeMCU), apply 3.3V to Vin shown on the drawing. Install a 1.5K ohm Z1 sourcing resistor on each divider. The Name_x resistor (100 - 800 ohms) is installed at Z2.

The ESP can read the voltage at each MUX input on the 74HC4051. Voltages for 100 to 800 ohms will range from 200mV to 1.15V. In other words, the measured voltage will allow you to determine the Z2 resistor value. Then you can create ESPEasy rules to do what you need (send values to controller or show messages on local text display).

- Thomas

kodak
New user
Posts: 2
Joined: 11 Dec 2021, 02:17

Re: 74HC4051 Input to MQTT

#3 Post by kodak » 11 Dec 2021, 12:43

ThomasB wrote: 11 Dec 2021, 03:28 You could setup each 74HC4051 mux input with a resistor divider. Like this (8 places):
Image

Assuming your ESP8266 device has a built-in voltage divider on the Analog input (a common feature of Dev boards and NodeMCU), apply 3.3V to Vin shown on the drawing. Install a 1.5K ohm Z1 sourcing resistor on each divider. The Name_x resistor (100 - 800 ohms) is installed at Z2.

The ESP can read the voltage at each MUX input on the 74HC4051. Voltages for 100 to 800 ohms will range from 200mV to 1.15V. In other words, the measured voltage will allow you to determine the Z2 resistor value. Then you can create ESPEasy rules to do what you need (send values to controller or show messages on local text display).

- Thomas
Something like that yes.

But how can i mape the ESP comunicate with the 74HC4051 i know how to connect it but where to set it up.
And how do i make the rouls?
Top

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: 74HC4051 Input to MQTT

#4 Post by TD-er » 11 Dec 2021, 13:33

Please have a look at the various GPIO commands available: https://espeasy.readthedocs.io/en/lates ... al-pcfgpio

The external GPIO chips we support may be a better way to interface to this analog multiplexer compared to the internal GPIO pins of the ESP.
The reason for this is that right now you cannot set all needed pin states at once for the internal GPIO pins.
But you can for the PCF or MCP chips we support.
The reason why you might need all GPIO pins to be set in 1 atomic operation is that you could otherwise switch some inputs you don't want to.

For example switching from Y0 to Y7 you need to toggle 3 GPIO pins from 0 to 1 and thus in the process you might first enable Y1, then Y3 and then Y7.

Also the rules may become a bit more elaborate when you want to switch the internal GPIO pins.
The MCPGPIOrange (and PCF counterpart) commands are quite useful to make switching these kinds of chips quite easy to handle.

Post Reply

Who is online

Users browsing this forum: No registered users and 13 guests