Simple home automation project with Blynk, Sonoff and NodeMCU power strips

I’m going to have a live and neutral going to the sonoff input, connecting to the light on the output. Then connect the ground pin on the header used for programming (or 3.3v, haven’t decided) to one side of the wall switch, then the other side to the gpio pin.

If you have live and neutral in your socket, not just switch broken live wires, then just follow Sonoff schematics, you will have no trouble. You can even use it as a parallel switch to existing wall switch and keep wall switch functionality. And again, there is no need to make something that’s already on-board feature - there is a button which sets GPIO0 high when pressed.

I am currently looking on my phone but I can’t see a mention anywhere of a place to connect an external switch/button. It will need to be installed in the ceiling as the switch just breaks the ac connection to the globe. One of the lights I want to do also has 2 switches connected. And I cant connect it in parallel if I want to use both independently. If they are parallel and I switch the physical switch on then I can’t turn it off with the sonoff.

:slight_smile:

Are you talking about the tiny little push button that is only accessible when the Sonoff unit is exposed? The one you use for setup and putting into firmware flash mode?

Yes, that button can be programmes as a physical on/off toggle switch to use alongside Blynk if you wish.
If you want an easily accessible way of connecting a remote switch into the Sonoff then don’t use the Sonoff Basic, use the Sonoff TH10 or TH16 instead. They have port to plug a temperature/humidity sensor into, which connects to GPIO14 no can be used to interface with external devices.

If you’re wanting to retain your existing mains lighting wiring, and you only have the Line available in the wall switches, then I don’t think that the Sonoff is the best solution.
I live in the UK, where standard lighting wiring just switches the Line voltage and the only place that both Line and Neutral are available are in the ceiling rose. In this situation, adding a Sonoff behind the ceiling rose would allow you to put live power to the lightbulb via the Sonoff and Blynk, but switching the lights off at the wall will have no effect, because it’s the Sonoff not the light switch that’s controlling the power. In a similar way, if you switch the light off using the Sonoff then they light may or may not go off, it depends on the state of the wall switch.
You could disconnect the line from the switch to the ceiling rose and connect it (via a 3.3v ac/dc step down board) to GPIO14 on the Sonoff TH10 and use this to sense the state of the wall switch, but you’d need quite a bit of work to ensure that the physical wall switch still worked if Blynk was down. If the Sonoff fails (not unheard of) then you won’t have any way to turn the lights on short of restoring the wiring to its original state.
Whatever type of device you decide to butt in your ceiling, make sure you include OTA updates in your code so that you can re-flash it remotely.

Pete.

Yea, that button is useless as the unit will be installed in the ceiling, I could solder wires to the pads of the switch to use the same input, but that’s not really any different than my solution.

Unfortunately the Sonoff failing isn’t something that can be worked around, the other solutions I was going to use have the exact same issue. The normal light switch is just an input to the device and it will switch the light on and off.

I hadn’t considered Blynk being down, but I should be able to code around that.
I’m running my own Blynk server on a VM, so that will hopefully never happen :stuck_out_tongue:

Yea, am definitely looking at OTA updates :slight_smile:

It’s obvious that Sonoff basic was advertised as TH10 when I bought it, but I’m takling about the model from pictures I attached, sorry for the mess. But on both photos you can see the position of the button, and it is accessible when enclosure is on, it sticks out of it, just next to LED.

So that means that if the light is switched on at the wall switch then the Sonoff will be able to turn the light on, and off again, using Blynk. However, if the wall switch is off then the Sonoff won’t be able to turn the light on because the wall switch is interrupting the supply.

Pete.

@Zodiac - The Sonoff will be installed into the ceiling, so won’t be accessible. I could solder onto the pads of the button to use the same input, but that doesn’t actually change anything with what I’m doing, except that I might mess up the PCB.
Using the header is much safer.

@PeteKnight - No, the wall switch will not switch power to the Sonoff, it will be switching a signal to the GPIO pin that is accessible on the header of the device that you use to reflash it. That will tell the unit when the wall switch changes state and therefore turn the light on/off.

Which is quite similar to what I said earlier…

Pete.

if you’re going to do that, then it’s actually what I posted in my first post in this thread

use the spare pin on the header to act as a switch input so you can still use the normal switches to switch it on/off (obviously I will connect them to ground/3.3v instead of the AC power :stuck_out_tongue: ) but then do it over wifi.

Ok, now I get it. If you don’t ruin Sonoff pcb soldering 5-pin header, I can’t see what damage you can possibly do soldering two more points for your switch. I suppose that you already know that there is no header present in Sonoff, you have to solder one yourself.

Yea, I know that. Soldering onto empty pads is a little different than trying to solder onto pads that are already occupied with a push button :stuck_out_tongue:
I’ll need to solder the header anyway, might as well just use that.

BTW PeteKnight- forgot to say, thanks for the suggestion with the TH10. I’ve already ordered 2 of the Basics, but will look at the TH10 for other rooms if these two work out

zodiac, good afternoon. Great project. Tell me how did you add additional pictures to the Button Icons in Blynk before their name?

Don’t forget the search function in this forum :wink:

They are basic phone emoticons…

1 Like

Thank you. )))

I almost forgot about this topic, my home setup looks completely different now. All devices now have OTA, wifi manager, Time inputs, old chart is replaced with Super chart and so on… Some screenshots will give you an idea::

2 Likes