Sonoff Basic + wall push button with pilot light

Moderators: Voyager, BertB, rtenklooster, Stuntteam, Martinus, grovkillen, TD-er

Post Reply
Message
Author
kirkokuev
Normal user
Posts: 9
Joined: 24 Feb 2018, 21:23

Sonoff Basic + wall push button with pilot light

#1 Post by kirkokuev » 24 Feb 2018, 21:38

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?

User avatar
toffel969
Normal user
Posts: 462
Joined: 03 Jan 2017, 10:58
Location: Germany

Re: Sonoff Basic + wall push button with pilot light

#2 Post by toffel969 » 25 Feb 2018, 10:31

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

kimot
Normal user
Posts: 66
Joined: 12 Oct 2017, 20:46

Re: Sonoff Basic + wall push button with pilot light

#3 Post by kimot » 25 Feb 2018, 14:31

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

kirkokuev
Normal user
Posts: 9
Joined: 24 Feb 2018, 21:23

Re: Sonoff Basic + wall push button with pilot light

#4 Post by kirkokuev » 25 Feb 2018, 20:09

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
Image

kimot
Normal user
Posts: 66
Joined: 12 Oct 2017, 20:46

Re: Sonoff Basic + wall push button with pilot light

#5 Post by kimot » 26 Feb 2018, 15:17

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...

kirkokuev
Normal user
Posts: 9
Joined: 24 Feb 2018, 21:23

Re: Sonoff Basic + wall push button with pilot light

#6 Post by kirkokuev » 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?

User avatar
toffel969
Normal user
Posts: 462
Joined: 03 Jan 2017, 10:58
Location: Germany

Re: Sonoff Basic + wall push button with pilot light

#7 Post by toffel969 » 27 Feb 2018, 13:12

kirkokuev 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?
Hi

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

kirkokuev
Normal user
Posts: 9
Joined: 24 Feb 2018, 21:23

Re: Sonoff Basic + wall push button with pilot light

#8 Post by kirkokuev » 28 Feb 2018, 13:16

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.
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.
Controlling of LED wasn't a part of my plan, but having that as option is also useful.

kimot
Normal user
Posts: 66
Joined: 12 Oct 2017, 20:46

Re: Sonoff Basic + wall push button with pilot light

#9 Post by kimot » 28 Feb 2018, 23:32

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 )

kirkokuev
Normal user
Posts: 9
Joined: 24 Feb 2018, 21:23

Re: Sonoff Basic + wall push button with pilot light

#10 Post by kirkokuev » 04 Mar 2018, 14:43

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?

Domosapiens
Normal user
Posts: 126
Joined: 06 Nov 2016, 13:45

Re: Sonoff Basic + wall push button with pilot light

#11 Post by Domosapiens » 04 Mar 2018, 20:28

Use the internal pull-up for GPIO14 ?
Or
Use a pull-up resistor of 100K for GPIO14 to 3V3?
18+ ESP units for production and test. Ranging from production control of heating equipment, floor sensing, floor thermostat to a "fun box" for my grandson. Mainly using Wemos D1.

kirkokuev
Normal user
Posts: 9
Joined: 24 Feb 2018, 21:23

Re: Sonoff Basic + wall push button with pilot light

#12 Post by kirkokuev » 05 Mar 2018, 12:54

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?
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.
Would you elaborate on connecting resistor? Where exactly should I put it?

User avatar
toffel969
Normal user
Posts: 462
Joined: 03 Jan 2017, 10:58
Location: Germany

Re: Sonoff Basic + wall push button with pilot light

#13 Post by toffel969 » 05 Mar 2018, 13:51

kirkokuev wrote:
05 Mar 2018, 12:54
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?
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.
Would you elaborate on connecting resistor? Where exactly should I put it?
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.
Domoticz on Raspi 2 -- 14 ESP units (hacked Sonoff,NodeMCUs, Wemos, self-built units) running with RC140- Mega 2.0.0 dev8

kimot
Normal user
Posts: 66
Joined: 12 Oct 2017, 20:46

Re: Sonoff Basic + wall push button with pilot light

#14 Post by kimot » 05 Mar 2018, 14:56

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.

kirkokuev
Normal user
Posts: 9
Joined: 24 Feb 2018, 21:23

Re: Sonoff Basic + wall push button with pilot light

#15 Post by kirkokuev » 06 Mar 2018, 10:06

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.

kirkokuev
Normal user
Posts: 9
Joined: 24 Feb 2018, 21:23

Re: Sonoff Basic + wall push button with pilot light

#16 Post by kirkokuev » 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?

User avatar
toffel969
Normal user
Posts: 462
Joined: 03 Jan 2017, 10:58
Location: Germany

Re: Sonoff Basic + wall push button with pilot light

#17 Post by toffel969 » 08 Mar 2018, 13:52

kirkokuev 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?
Either put a resistor in series or drive it of the other gpio, then you can set b rightness by means of pwm
Domoticz on Raspi 2 -- 14 ESP units (hacked Sonoff,NodeMCUs, Wemos, self-built units) running with RC140- Mega 2.0.0 dev8

kirkokuev
Normal user
Posts: 9
Joined: 24 Feb 2018, 21:23

Re: Sonoff Basic + wall push button with pilot light

#18 Post by kirkokuev » 09 Mar 2018, 12:45

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.
Image

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.

Post Reply

Who is online

Users browsing this forum: No registered users and 6 guests