which gpio for push buttons on wemos d1 and multiple push questions

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
_Cyber_
Normal user
Posts: 115
Joined: 20 Oct 2019, 09:46

which gpio for push buttons on wemos d1 and multiple push questions

#1 Post by _Cyber_ » 28 Dec 2020, 17:11

hi,

I am on playing with shutters, I want to completely control it with espeasy devices.
while the shutter motor control is located in the electrical main distributor (wit relay-shields and ESP32) and is clear how I do it, I am not sure with the buttons in the room.

I want to use the already existing push buttons (of course disconnect the mains from it), so I have 4 push buttons in one switch position where I need therefore 4 different GPIOs on the wemos D1.

which GPIOs should I use there, in which config? do I need to add additional resistors, I read that it has only 2 GPIOs connected with pulldown.
as the used button (it is a "berker 503404" - https://www.berker.com/en/e-catalogue/s ... 305396.htm) has one common line for the 4 switched outputs I need to have 4 GPIOs which are configured in the same way, as they have one common contact.

Also, what I have not found yet: is there a possibility to have more than "doubleclick"? I can see in configuration the "EVENT=3" - will it count up to EVENT=9 (as EVENT=10 is used as longpress)?
I want to realize:
hold button (also two buttons at the same time): close / open shutter as long as the button is pressed
push button twice: close / open this shutter
push button 3 times: close / open this shutter group (group will be defined at the ESP32)
push button 4 times: close / open all shutter
if there is already a push button action ongoing and another push is registered: stop the current action.

So, the push buttons will not have any hardware connectivity to the shutters any more (they have currently), they only are monitored by the wemos devices and will send the action to the ESP32 which controls the shutters by relays.

Is this a doable setup or not?

Thanks!

Best regards
Alois

User avatar
Ath
Normal user
Posts: 3488
Joined: 10 Jun 2018, 12:06
Location: NL

Re: which gpio for push buttons on wemos d1 and multiple push questions

#2 Post by Ath » 30 Dec 2020, 14:08

A few thoughts on this:

- Connecting switches/buttons to an ESP is best done using pull-up resistors, and connecting that input to ground when pushed, so your switches should have the common connection to gnd.
- For short wiring, ~3m or less, a pull-up of 10k will be fine, for longer cables up to ~10m 4k7 should be fine, and on longer cables you may need to go as low as 2k2. These pull-ups are to be mounted (very) close to the ESP unit.
- You should avoid using GPIO's 0, 2 and 15 (12 on ESP32) to connect buttons, as their state during power-up or reset may get the ESP in the wrong mode/state and stuff won't work as expected. Links: ESP8266 and ESP32 GPIO pins to avoid.
- GPIO's 3 and 4 are used for serial connection/log output, and they can be used as both input or output (just disable the serial port in the Tools/Advanced settings), but expect some 'noise' to come out of there during boot (before ESPEasy can turn it off), and you wouldn't want to connect a relay to these either, as they will be high during boot, which could cause dangerous situations if something started moving, just because the ESP is rebooting...

- Having to depend on 1 push, 2 pushes, 3 pushes, etc. on a (single) button isn't very user friendly. Uninformed users (think: the mother in law-type) just want a button for 'All the way up', 'All the way down', 'Go down while I hold a button' and 'Go up while I hold a button'. At most they can be taught to double-click for all up/all down but that seems about it. (I'm using a couple of Z-Wave dimmers with a single push-button that have short press = on/off, long press=dim (up/down by release and hold), and double-click=max on, that's about the most complex for the WAF (wife acceptance factor) ;), but that's all built-in to the Z-Wave dimmer)

I'm not very familiar with the double-click behavior of ESPEasy, so I can't really give advise on that. And the same goes for long-press (no triple or quad click available). This, for me, mostly has to do with the mediocre (mechanical) quality of the buttons on my Sonoff S20's, it can sometimes be hard to press it once without getting it stuck, especially after a couple of years of use, so pressing it twice or more can be quite a challenge :D
Using existing buttons, of undisputed quality, I might expect, can give the desired results, though some experimentation with settings will probably be needed to get it just right.
/Ton (PayPal.me)

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 35 guests