Sonoff Basic + wall push button with pilot light
Moderators: grovkillen, Stuntteam, TD-er
Sonoff Basic + wall push button with pilot light
Hello, I am running an installation of multiple espeasy sonoff basics. To toggle them I use wall push-button switches, which trigger GPIO14 on sonoff basics.
Wall push-button switches have blue pilot light led inside, which is intended to make them visible at night. But I can't figure out a way to make them light up with sonoff. There is no separate power connection to light up this led, I guess it feeds itself magically on 220v installation even with one wire, connected to switch. In switch data sheet is stated that blue led is 0.15 mA. Sonoff uses 3.3v on it's gpio, which is probably not enough to drive the led. Here is a link to my push-button switch
https://www.schneider-electric.com/en/p ... 8682-unica
Currently as a work around I connect push-button and sonoff to impulse relay, but that is not a good solution, I can't get state of the button and impulse relay is fairly expensive.
So my question is how to enable pilot light on a push-button switch with direct connection to sonoff gpio?
Wall push-button switches have blue pilot light led inside, which is intended to make them visible at night. But I can't figure out a way to make them light up with sonoff. There is no separate power connection to light up this led, I guess it feeds itself magically on 220v installation even with one wire, connected to switch. In switch data sheet is stated that blue led is 0.15 mA. Sonoff uses 3.3v on it's gpio, which is probably not enough to drive the led. Here is a link to my push-button switch
https://www.schneider-electric.com/en/p ... 8682-unica
Currently as a work around I connect push-button and sonoff to impulse relay, but that is not a good solution, I can't get state of the button and impulse relay is fairly expensive.
So my question is how to enable pilot light on a push-button switch with direct connection to sonoff gpio?
Re: Sonoff Basic + wall push button with pilot light
I think your pilot light is a glow lamp rather than a LED. You will need at least 100v to light them up. Replacing them with a led driven by the son off seems like an option.
Domoticz on Raspi 2 -- 14 ESP units (hacked Sonoff,NodeMCUs, Wemos, self-built units) running with RC140- Mega 2.0.0 dev8
Re: Sonoff Basic + wall push button with pilot light
It is LED with circuit to allow 230 V.
Try bypass this circuit or change by normal LED
https://www.shopelektro.cz/vypinace-a-z ... e-led-lamp
Try bypass this circuit or change by normal LED
https://www.shopelektro.cz/vypinace-a-z ... e-led-lamp
Re: Sonoff Basic + wall push button with pilot light
Ok, so I took apart one switch. I found inside led with some components, should I bypass all of them and shunt + and - directly to legs of led?
here is a photo

here is a photo

Re: Sonoff Basic + wall push button with pilot light
I think you cannot use it this simply way = modify LED circuit and connect switch contacts to sonoff
Color LEDs need 2.5 - 3.5V and sonoff GPIO is 3.3V
I can imagine this circuit:
+3.3V ----- R1 ------ R2 -------- LED ---------- GND
GPIO connect between R1 and R2.
R1 + R2 must be that value, to limit current for LED to correct level.
And
U(R2) + U(led) must be greater or equal min U (logH) for ESP2866.
I(led)*R2 + U (led ) >= min U (logH) ( cca 2,458 V )
(R1+R2) = ( 3.3 - U(led) ) / I(led)
U(led) depends mostly on LED color and technology - 2.5 - 3.5 V
So R2 not needed and R1 very small or nothing.
BUT !!! then, if you press switch, you will short +3.3V and GND !!!!
So, it is not possible this easy way...
Color LEDs need 2.5 - 3.5V and sonoff GPIO is 3.3V
I can imagine this circuit:
+3.3V ----- R1 ------ R2 -------- LED ---------- GND
GPIO connect between R1 and R2.
R1 + R2 must be that value, to limit current for LED to correct level.
And
U(R2) + U(led) must be greater or equal min U (logH) for ESP2866.
I(led)*R2 + U (led ) >= min U (logH) ( cca 2,458 V )
(R1+R2) = ( 3.3 - U(led) ) / I(led)
U(led) depends mostly on LED color and technology - 2.5 - 3.5 V
So R2 not needed and R1 very small or nothing.
BUT !!! then, if you press switch, you will short +3.3V and GND !!!!
So, it is not possible this easy way...
Re: Sonoff Basic + wall push button with pilot light
I have touched legs of led with wires, coming from sonoff and led surprisingly worked, so maybe there is no need to attach additional resistors. However, I wonder if connected led will somehow affect how espeasy reads signal from push-button, wouldn't it think that button is always pressed?
Re: Sonoff Basic + wall push button with pilot light
Hikirkokuev wrote: ↑27 Feb 2018, 11:32 I have touched legs of led with wires, coming from sonoff and led surprisingly worked, so maybe there is no need to attach additional resistors. However, I wonder if connected led will somehow affect how espeasy reads signal from push-button, wouldn't it think that button is always pressed?
What exactly are you trying to do though?
If I understand correctly you want to :
1. Use the Switch as push button for the Sonoff
2. Have the LED lit up to improve visibility at night
For
1. Connect the Switch between GPIO14 and GND
2. Does not need to be attached to GPIO, but only to 3,3v and GND.
So interference with GPIO wouldnt be a problem
If you want to control the LED as well (you could also control brightness using pwm command) , I suggest different approaches:
- switch of serial (in advanced tab) and use RX/TX (GPIO 1/3) to drive the LED. One of the two could give you problems with the unit not booting (not sure which one it was).
- Solder two cables parallel to the orignial Sonoff push-button (GPIO 0) and you that for the switch input. GPIO 14 would then remain free to drive the LED.
Domoticz on Raspi 2 -- 14 ESP units (hacked Sonoff,NodeMCUs, Wemos, self-built units) running with RC140- Mega 2.0.0 dev8
Re: Sonoff Basic + wall push button with pilot light
Thank you, that is clear explanation, exactly what I needed. Fortunately, I have three-wire cables going to all switches, so I can use two wires as GPIO and GND, and third one to connect with 3.3v. Ground will be common both for GPIO and 3,3v. I will have to modify switch, currently it uses spring contacts for led, so I will replace those with wires. If that will work I will get rid of impulse relays.If I understand correctly you want to :
1. Use the Switch as push button for the Sonoff
2. Have the LED lit up to improve visibility at night
For
1. Connect the Switch between GPIO14 and GND
2. Does not need to be attached to GPIO, but only to 3,3v and GND.
Controlling of LED wasn't a part of my plan, but having that as option is also useful.
Re: Sonoff Basic + wall push button with pilot light
If led lights, when connected directly to gpio, it means, that current flow through internal pullup is enough for this.
I think, you can use it this way - sonoff will read 1 when switch not pressed and 0 for pressed switch ( and LED will switch off for this moment )
I think, you can use it this way - sonoff will read 1 when switch not pressed and 0 for pressed switch ( and LED will switch off for this moment )
Re: Sonoff Basic + wall push button with pilot light
Ok, so I followed suggestion from kimot, connected LED straight to gpio and ground and LED lights up allright on two switches. But, strangely, while one of sonoff is working perfectly, the other one is giving false positives (switch turns on and off on itself, as if I pushed the button). Both configs of espeasy are the same. Looks like the LED gives some noise. Is there any way to filter it out?
-
- Normal user
- Posts: 307
- Joined: 06 Nov 2016, 13:45
Re: Sonoff Basic + wall push button with pilot light
Use the internal pull-up for GPIO14 ?
Or
Use a pull-up resistor of 100K for GPIO14 to 3V3?
Or
Use a pull-up resistor of 100K for GPIO14 to 3V3?
30+ ESP units for production and test. Ranging from control of heating equipment, flow sensing, floor temp sensing, energy calculation, floor thermostat, water usage, to an interactive "fun box" for my grandson. Mainly Wemos D1.
Re: Sonoff Basic + wall push button with pilot light
I enabled internal pull-up, it won't help, however without it things are much worse, switch goes off randomly even when wires are not connected to led and I touch them with bare hand.Domosapiens wrote: ↑04 Mar 2018, 20:28 Use the internal pull-up for GPIO14 ?
Or
Use a pull-up resistor of 100K for GPIO14 to 3V3?
Would you elaborate on connecting resistor? Where exactly should I put it?
Re: Sonoff Basic + wall push button with pilot light
I really think it's a bad idea to drive the LED via the same GPIO that you are trying to use as input. Just don't and you dont have a problem.kirkokuev wrote: ↑05 Mar 2018, 12:54I enabled internal pull-up, it won't help, however without it things are much worse, switch goes off randomly even when wires are not connected to led and I touch them with bare hand.Domosapiens wrote: ↑04 Mar 2018, 20:28 Use the internal pull-up for GPIO14 ?
Or
Use a pull-up resistor of 100K for GPIO14 to 3V3?
Would you elaborate on connecting resistor? Where exactly should I put it?
Domoticz on Raspi 2 -- 14 ESP units (hacked Sonoff,NodeMCUs, Wemos, self-built units) running with RC140- Mega 2.0.0 dev8
Re: Sonoff Basic + wall push button with pilot light
Try some serial resistor with LED.
LED will light less, but log 1 on GPIO will be better defined.
Will be good measure voltage on GPIO and compare with specification for log1 on ESP2866.
LED will light less, but log 1 on GPIO will be better defined.
Will be good measure voltage on GPIO and compare with specification for log1 on ESP2866.
Re: Sonoff Basic + wall push button with pilot light
Something is wrong with the forum today.
Ok, I think I should revert to first suggestion and connect led separately, will try to do this on a weekend.
Ok, I think I should revert to first suggestion and connect led separately, will try to do this on a weekend.
Re: Sonoff Basic + wall push button with pilot light
Reporting progress, I connected led separately as per toffel969 suggestion, good news that interference is gone. But led now is very bright, like two or three times brighter than on other switches, even those connected to 220v. I will see how well it works in the night, but I am not sure if it is appropriate for bedroom. Also is there any way to control 3.3v output on sonoff?
Re: Sonoff Basic + wall push button with pilot light
Either put a resistor in series or drive it of the other gpio, then you can set b rightness by means of pwmkirkokuev wrote: ↑08 Mar 2018, 12:28 Reporting progress, I connected led separately as per toffel969 suggestion, good news that interference is gone. But led now is very bright, like two or three times brighter than on other switches, even those connected to 220v. I will see how well it works in the night, but I am not sure if it is appropriate for bedroom. Also is there any way to control 3.3v output on sonoff?
Domoticz on Raspi 2 -- 14 ESP units (hacked Sonoff,NodeMCUs, Wemos, self-built units) running with RC140- Mega 2.0.0 dev8
Re: Sonoff Basic + wall push button with pilot light
So I reconnected led to the pin next to 3.3v, I can see that led is glowing, but much less than on 3.3v, it glows as much as on gpio14, but without interference. So far so good.
I disabled serial port and tried to control it via GPIO1 but with no effect ,it won't turn off or on, just stays glowing all the time.

OK, I tinkered a little bit more, so this is not a GPIO1, but GPIO3, and I am actually able to control it via commands. Seems like problem is solved, thank you all for help.
I disabled serial port and tried to control it via GPIO1 but with no effect ,it won't turn off or on, just stays glowing all the time.

OK, I tinkered a little bit more, so this is not a GPIO1, but GPIO3, and I am actually able to control it via commands. Seems like problem is solved, thank you all for help.
Re: Sonoff Basic + wall push button with pilot light
This setup was done on a Sonoff Basic Rev 1, isn't it? I need to run a similar setup on some Sonoffs Basic R2 but since GPIO14 was removed, I was wondering if I can hook up a Pulse Switch to GPIO0 without having any problems. In hand with a small short cord it works, but I was wondering if I use long cables if it causes any problems relating to high resistance.
Re: Sonoff Basic + wall push button with pilot light
Sonoff units always have their button (or at least one button for those with more than one) connected to GPIO-0.
By default it is pulled up and closing the button will pull it to GND.
This way you can use the button to enter flash mode during boot.
So if you plan to add something to GPIO-0, make sure it is not pulled down for a long enough time during boot.
e.g. a sensor which may send data is enough to make a reboot randomly fail when connected to GPIO-0.
By default it is pulled up and closing the button will pull it to GND.
This way you can use the button to enter flash mode during boot.
So if you plan to add something to GPIO-0, make sure it is not pulled down for a long enough time during boot.
e.g. a sensor which may send data is enough to make a reboot randomly fail when connected to GPIO-0.
Re: Sonoff Basic + wall push button with pilot light
Yes exactly. It will only be a return back pulse switch so it will give me the option to leave Basics on all the time while anyone else at home can use the wall switches as normal use. PS I have a Gewiss Playbus Pulse switching system at home. Eventually, I will remove the relays and use the switches as a Simple Rocker Switch. But my main concern is the protection of the CPU since probably ELV switching will run in parallel with 220v cables in the same piping. Any ideas, please??
Re: Sonoff Basic + wall push button with pilot light
Never assume these Sonoff units will be galvanic isolated.
The ones with power meters are obviously not isolated but the 'basic' ones are IMHO also not safe.
For example the older versions had a big trace on the PCB to carry the mains voltage to the connected appliance, but to handle more current, those were made thicker with tin and thus not isolated at all.
Also the distance between traces is not according to European safety rules so in humid environments you may still get sparks and/or shocks.
When switching something, please use optocouplers and make sure to use wires with proper isolation as thin wires should also not be placed near high voltage wiring with the kind of mediocre isolation you often see in these modules.
The ones with power meters are obviously not isolated but the 'basic' ones are IMHO also not safe.
For example the older versions had a big trace on the PCB to carry the mains voltage to the connected appliance, but to handle more current, those were made thicker with tin and thus not isolated at all.
Also the distance between traces is not according to European safety rules so in humid environments you may still get sparks and/or shocks.
When switching something, please use optocouplers and make sure to use wires with proper isolation as thin wires should also not be placed near high voltage wiring with the kind of mediocre isolation you often see in these modules.
Who is online
Users browsing this forum: Ahrefs [Bot] and 12 guests