multiplexer recommending
Moderators: grovkillen, Stuntteam, TD-er
multiplexer recommending
Hello,
can anyone recommend a multiplexer? I have 16 IOs with active pull-up and 16 IOs with active pull-down. I would like to connect them to an ESPeasy.
Can anyone recommend a hardware module that is supported by ESPeasy?
Thanks a lot!
can anyone recommend a multiplexer? I have 16 IOs with active pull-up and 16 IOs with active pull-down. I would like to connect them to an ESPeasy.
Can anyone recommend a hardware module that is supported by ESPeasy?
Thanks a lot!
Re: multiplexer recommending
It's of only little concern, but are those input or output pins? (or both)
There are several IO extenders supported by ESPEasy, a few even in core-commands like monitor, to name most: PCF8574 (8 I/Os), PCF8575 (16 I/Os, no internal pull-up), PCA9685 (16 I/Os, on/off and PWM support) and MCP23017 (16 I/Os) all using I2C and allowing multiple boards connected, and also some shift-registers for input (74HC165, up to 128 inputs, 8 inputs per chip, daisy-chainable) and output (74HC595, up to 128 outputs, 8 outputs per chip, daisy-chainable).
The full list of plugins is here
So it mainly depends on what you want to use it for
There are several IO extenders supported by ESPEasy, a few even in core-commands like monitor, to name most: PCF8574 (8 I/Os), PCF8575 (16 I/Os, no internal pull-up), PCA9685 (16 I/Os, on/off and PWM support) and MCP23017 (16 I/Os) all using I2C and allowing multiple boards connected, and also some shift-registers for input (74HC165, up to 128 inputs, 8 inputs per chip, daisy-chainable) and output (74HC595, up to 128 outputs, 8 outputs per chip, daisy-chainable).
The full list of plugins is here
So it mainly depends on what you want to use it for

/Ton (PayPal.me)
Re: multiplexer recommending
Thank you.
I will work through the suggested list and pick out the best fit for me.
Regarding your question, pure input status messages are either high or low active.
THX EDSTOBI
I will work through the suggested list and pick out the best fit for me.
Regarding your question, pure input status messages are either high or low active.
THX EDSTOBI
Re: multiplexer recommending
So, having something as simple as either a pair of MCP23017 or a few 74HC165 chips would suffice here.
/Ton (PayPal.me)
Re: multiplexer recommending
Hello!
My PCF8574s arrived today. Now I have a question for understanding. Do I need to query each port (P0 to P7) individually? If so, I can't use two modules with an ESP8266 since I only have 12 query possibilities. I thought the 8 pin states would be combined and transmitted as a binary, hexadecimal, or decimal number?
Is ther a function lik read all.
My PCF8574s arrived today. Now I have a question for understanding. Do I need to query each port (P0 to P7) individually? If so, I can't use two modules with an ESP8266 since I only have 12 query possibilities. I thought the 8 pin states would be combined and transmitted as a binary, hexadecimal, or decimal number?

Is ther a function lik read all.
Re: multiplexer recommending
Please have a look at the documentation: https://espeasy.readthedocs.io/en/lates ... al-pcfgpio
Here you can see how you can use those GPIO pins on this PCF chip using commands.
This way you don't need to setup tasks per GPIO.
N.B. the GPIO pin numbering is based on the used I2C address of the PCF chip.
The lowest possible address (0x20) refers to the pins starting at '1' ... '8'
The next one (I2C address 0x21) refers to pin nr. '9' ... ' 16', etc.
Here you can see how you can use those GPIO pins on this PCF chip using commands.
This way you don't need to setup tasks per GPIO.
N.B. the GPIO pin numbering is based on the used I2C address of the PCF chip.
The lowest possible address (0x20) refers to the pins starting at '1' ... '8'
The next one (I2C address 0x21) refers to pin nr. '9' ... ' 16', etc.
Re: multiplexer recommending
Thank you very much!
I have now created a rule where I wrote:
I can also see the changes for each pin in the ESPeasy log.
However, I can't manage to get the pins as a bitmask, nor can I publish them to MQTT to then combine them into a bitmask in Node-RED.
Could you give me a tip on how to proceed here?
THX EDSTOBI
I have now created a rule where I wrote:
Code: Select all
On System#Boot Do //When the ESP boots, do
PCFmodeRange,1,16,1
MonitorRange,PCF,1,16
Publish %sysname%/IP,%ip%
timerSet,2,30 //Set Timer 2 for the next event in 30 seconds
endon
On Rules#Timer=2 do //When Timer2 expires, do
Publish %sysname%/IP,%ip%
timerSet,2,30 //Resets the Timer21 for another 30 seconds
endon
On PCF#1 Do
let,1,%eventvalue%
timerSet,1,1
Endon
On PCF#2 Do
let,2,%eventvalue%
timerSet,1,1
Endon
On PCF#3 Do
let,3,%eventvalue%
timerSet,1,1
Endon
On PCF#4 Do
let,4,%eventvalue%
timerSet,1,1
Endon
On PCF#5 Do
let,5,%eventvalue%
timerSet,1,1
Endon
On PCF#6 Do
let,6,%eventvalue%
timerSet,1,1
Endon
On PCF#7 Do
let,7,%eventvalue%
timerSet,1,1
Endon
On PCF#8 Do
let,8,%eventvalue%
timerSet,1,1
Endon
On PCF#9 Do
let,9,%eventvalue%
timerSet,1,1
Endon
On PCF#10 Do
let,10,%eventvalue%
timerSet,1,1
Endon
On PCF#11 Do
let,11,%eventvalue%
timerSet,1,1
Endon
On PCF#12 Do
let,12,%eventvalue%
timerSet,1,1
Endon
On PCF#13 Do
let,13,%eventvalue%
timerSet,1,1
Endon
On PCF#14 Do
let,14,%eventvalue%
timerSet,1,1
Endon
On PCF#15 Do
let,15,%eventvalue%
timerSet,1,1
Endon
On PCF#16 Do
let,16,%eventvalue%
timerSet,1,1
Endon
On Rules#Timer=1 Do
let,20,(%v1%<<0)|(%v2%<<1)|(%v3%<<2)|(%v4%<<3)|(%v5%<<4)|(%v6%<<5)|(%v7%<<6)|(%v8%<<7)|(%v9%<<8)|(%v10%<<9)|(%v11%<<10)|(%v12%<<11)|(%v13%<<12)|(%v14%<<13)|(%v15%<<14)|(%v16%<<15)
Publish monitor/pcf8574/bitmask,[var#20]
Endon
I see the IP in mqtt341084: EVENT: PCF#12=1
341283: EVENT: PCF#13=0
341383: EVENT: PCF#13=1
343984: EVENT: PCF#15=0
367391: EVENT: PCF#2=-1
367398: EVENT: PCF#3=-1
However, I can't manage to get the pins as a bitmask, nor can I publish them to MQTT to then combine them into a bitmask in Node-RED.
Could you give me a tip on how to proceed here?
THX EDSTOBI
Re: multiplexer recommending
found my mistake
What I still don't understand is why the value ends with binary = 1111111111101111.04
Log:
609163: EVENT: Rules#Timer=1,1
609185: ACT : let,21,1111111111110111
609192: ACT : Publish ESP_pcf8574/binary,1111111111110111.04

Code: Select all
On System#Boot Do //When the ESP boots, do
PCFmodeRange,1,16,1
MonitorRange,PCF,1,16
Publish %sysname%/IP,%ip%
timerSet,2,30 //Set Timer 2 for the next event in 30 seconds
endon
On Rules#Timer=2 do //When Timer2 expires, do
Publish %sysname%/IP,%ip%
timerSet,2,30 //Resets the Timer21 for another 30 seconds
endon
On PCF#1 Do
let,1,%eventvalue%
timerSet,1,1
Endon
On PCF#2 Do
let,2,%eventvalue%
timerSet,1,1
Endon
On PCF#3 Do
let,3,%eventvalue%
timerSet,1,1
Endon
On PCF#4 Do
let,4,%eventvalue%
timerSet,1,1
Endon
On PCF#5 Do
let,5,%eventvalue%
timerSet,1,1
Endon
On PCF#6 Do
let,6,%eventvalue%
timerSet,1,1
Endon
On PCF#7 Do
let,7,%eventvalue%
timerSet,1,1
Endon
On PCF#8 Do
let,8,%eventvalue%
timerSet,1,1
Endon
On PCF#9 Do
let,9,%eventvalue%
timerSet,1,1
Endon
On PCF#10 Do
let,10,%eventvalue%
timerSet,1,1
Endon
On PCF#11 Do
let,11,%eventvalue%
timerSet,1,1
Endon
On PCF#12 Do
let,12,%eventvalue%
timerSet,1,1
Endon
On PCF#13 Do
let,13,%eventvalue%
timerSet,1,1
Endon
On PCF#14 Do
let,14,%eventvalue%
timerSet,1,1
Endon
On PCF#15 Do
let,15,%eventvalue%
timerSet,1,1
Endon
On PCF#16 Do
let,16,%eventvalue%
timerSet,1,1
Endon
On Rules#Timer=1 Do
// Binärstring bauen
let,21,%v16%%v15%%v14%%v13%%v12%%v11%%v10%%v9%%v8%%v7%%v6%%v5%%v4%%v3%%v2%%v1%
Publish ESP_pcf8574/binary,[var#21]
Endon

Log:
609163: EVENT: Rules#Timer=1,1
609185: ACT : let,21,1111111111110111
609192: ACT : Publish ESP_pcf8574/binary,1111111111110111.04
Re: multiplexer recommending
You're running out of number of decimals you can use as a double type.
Why set it to a variable and not directly publish those bits?
Why set it to a variable and not directly publish those bits?
Code: Select all
On Rules#Timer=1 Do
// Binärstring bauen
Publish ESP_pcf8574/binary,%v16%%v15%%v14%%v13%%v12%%v11%%v10%%v9%%v8%%v7%%v6%%v5%%v4%%v3%%v2%%v1%
Endon
Re: multiplexer recommending
When you set the timer on each pin state change, you also reset any current timer.
So if you change a pin (or multiple) with an interval of less than 1 sec, you will never see this publish happening.
Also may I hint you to this part of the docs
https://espeasy.readthedocs.io/en/lates ... obin-tohex
Especially the bitwrite and tobin functions
Edit:
Just some idea:
See:
https://espeasy.readthedocs.io/en/lates ... g-wildcard
https://espeasy.readthedocs.io/en/lates ... r-eventpar
https://espeasy.readthedocs.io/en/lates ... l#bitwrite
Not 100% sure the :16 for the toBin will work as the documentation only mentioned this optional parameter for toHex
So if you change a pin (or multiple) with an interval of less than 1 sec, you will never see this publish happening.
Also may I hint you to this part of the docs

https://espeasy.readthedocs.io/en/lates ... obin-tohex
Especially the bitwrite and tobin functions

Edit:
Just some idea:
Code: Select all
on system#boot do
PCFmodeRange,1,16,1
MonitorRange,PCF,1,16
Publish %sysname%/IP,%ip%
timerSet,2,30 //Set Timer 2 for the next event in 30 seconds
looptimerset,2,1 // publish changed every second
endon
on PCF* do
// %eventpar% is pin nr, starting from 1
// Thus need to subtract 1 to get the range 0...15
let,3,%eventpar%-1
let,4,[int#1] // For logging
let,1,{bitwrite:[int#3]:[int#1]:%eventvalue1%}
logentry,"%eventname%: Set bit [int#3] to %eventvalue1%: [int#4] -> [int#1]"
endon
on Rules#Timer=2 do
if [int#2] != [int#1]
let,2,[int#1]
publish, ESP_pcf8574/binary,{toBin:[int#1]:16}
endif
endon
https://espeasy.readthedocs.io/en/lates ... g-wildcard
https://espeasy.readthedocs.io/en/lates ... r-eventpar
https://espeasy.readthedocs.io/en/lates ... l#bitwrite
Not 100% sure the :16 for the toBin will work as the documentation only mentioned this optional parameter for toHex
Who is online
Users browsing this forum: No registered users and 18 guests