Wemos D1 mini pin reacting to touch only; correct and how 2?
Posted: Tue Apr 21, 2020 1:19 pm
Hi,
I am having a problem that I do not know if is for the esp8266 forum, or if it is for the newbie corner. If not, please advise and I will move it to where it belong.
I am programming a Wemos D1 mini, got it off amazon UK where it is no longer available, but its full name is IZOKEE D1 Mini NodeMcu Lua 4M Bytes WLAN WIFI Internet Development Board Base on ESP8266 ESP-12F for Arduino, 100% Compatible with WeMos D1 Mini (Pack), most likely the same as this: https://amzn.to/2SKRAvK
Now, I want to use it to control an H-bridge relay and want to connect it to push buttons as per this drawing:
The drawing is from https://drzzs.com/diy-window-shades-mot ... automated/, Thanks to Dr. Zzs for that, and do let me know if I am not allowed to use the drawing.
Now, connecting the buttons to plus and minus /ground something weird, in my opinion happens: there is no reaction when I press the buttons. But, and here it comes, if I disconnect ground, and touch the other wire (the green ones in the drawing above), ie in reality simply touching the pin I get a reaction, ie it is triggered. Without it being connected to ground.
I do not understand how that can happen, and I am not sure I like it as I would not know how to trigger the pins with a button - at least they do not work with the push buttons. And touching it, it easily fires several touches (perhaps that can be dealt with in some programming though?), but I would also need a button for that kind of connection). The code I am using, if that is relevant, is this (for hassio):
binary_sensor:
- platform: gpio
pin:
number: D5
inverted: true
id: button_close
on_press:
then:
- lambda: |
if (id(my_stuegardin).current_operation == COVER_OPERATION_IDLE) {
id(my_stuegardin).close();
} else {
id(my_stuegardin).stop();
}
cover:
- platform: time_based
name: "stuegardin"
id: my_stuegardin
open_action:
- switch.turn_on: open_stuegardin
open_duration: 7s
close_action:
- switch.turn_on: close_stuegardin
close_duration: 7s
stop_action:
- switch.turn_off: open_stuegardin
- switch.turn_off: close_stuegardin
And then I have a similar code for D6.
So my questions are:
Is this really how the pins on the Wemos D1 can/should work, without ground connection? If not, what is wrong?
If it is correct, how can one connect a button to use to fire it? And what kind of code would be needed to have a delay between the touches?
I hope somebody can help.
I am having a problem that I do not know if is for the esp8266 forum, or if it is for the newbie corner. If not, please advise and I will move it to where it belong.
I am programming a Wemos D1 mini, got it off amazon UK where it is no longer available, but its full name is IZOKEE D1 Mini NodeMcu Lua 4M Bytes WLAN WIFI Internet Development Board Base on ESP8266 ESP-12F for Arduino, 100% Compatible with WeMos D1 Mini (Pack), most likely the same as this: https://amzn.to/2SKRAvK
Now, I want to use it to control an H-bridge relay and want to connect it to push buttons as per this drawing:
The drawing is from https://drzzs.com/diy-window-shades-mot ... automated/, Thanks to Dr. Zzs for that, and do let me know if I am not allowed to use the drawing.
Now, connecting the buttons to plus and minus /ground something weird, in my opinion happens: there is no reaction when I press the buttons. But, and here it comes, if I disconnect ground, and touch the other wire (the green ones in the drawing above), ie in reality simply touching the pin I get a reaction, ie it is triggered. Without it being connected to ground.
I do not understand how that can happen, and I am not sure I like it as I would not know how to trigger the pins with a button - at least they do not work with the push buttons. And touching it, it easily fires several touches (perhaps that can be dealt with in some programming though?), but I would also need a button for that kind of connection). The code I am using, if that is relevant, is this (for hassio):
binary_sensor:
- platform: gpio
pin:
number: D5
inverted: true
id: button_close
on_press:
then:
- lambda: |
if (id(my_stuegardin).current_operation == COVER_OPERATION_IDLE) {
id(my_stuegardin).close();
} else {
id(my_stuegardin).stop();
}
cover:
- platform: time_based
name: "stuegardin"
id: my_stuegardin
open_action:
- switch.turn_on: open_stuegardin
open_duration: 7s
close_action:
- switch.turn_on: close_stuegardin
close_duration: 7s
stop_action:
- switch.turn_off: open_stuegardin
- switch.turn_off: close_stuegardin
And then I have a similar code for D6.
So my questions are:
Is this really how the pins on the Wemos D1 can/should work, without ground connection? If not, what is wrong?
If it is correct, how can one connect a button to use to fire it? And what kind of code would be needed to have a delay between the touches?
I hope somebody can help.