RemoteLight – step 2 – from theory to practice

Step 2 of our project RemoteLight:

We want to build up our home automation with these requirement.

What kind of controller can we use?
We have 2 possible choices to have a low cost controller:
Raspberry PI/Banana PI/Orange PI board: from 15$ to 50$
A full operative system, with all programming languages available, lots of tools to debug all problems, may be too much powerful and complex for our small scope, but with all its debug tools, it can be very useful to make experiments.


ESP8266 Nodemcu board: 3$
Simple, able to do only few task, only Lua and C programming languages, small memory so only small code can run. But it is has anything we need.
Pay attention it is not so powerful, so for example the WIFI must have a good signal otherwise this micro board can suffer trying to connect to your wifi.

As we will see later, the work to do around these boards is quite the same, so you can use our suggestions for both boards. With a RasberryPI or similar board you can probably control more switches and lights with one board but, due to cabling constraint, it is not simple to manage all lights from a centralized location (this means having all cables starting from the same point and make them arriving to the finel position all around the house, that is usually not very simple) . This is one of the reason why at the end, as you will see, our choice was multiple Nodemcu boards spread around the house near the switches and lights it needs to control.

Let’s see how these boards work for our purpose.

All these boards are provided with a GPIO (General Purpose Input/Output) connection, made of multiple pins. Some of these pins can be read by a simple code inside the board, to ask if the pin is connected or not to the “ground” (specific pin marked as GRD). This way of using pins is called input mode.
So you can take a switch, even a big wall switch normally used with 125v or 220v, connect one wire to the pin, one to the ground, and with a simple code you can understand if the switch is opened (circuit interrupted, no current passing through the switch) or closed (circuit closed, the current pass through the switch).
Great!!! we achieved the first functionality of our controller. This is the way we can read if a switch is off or on.

Then you can use another pin in output mode, so you can send out a signal and this signal can, for example,  turn on a led as it can turn on a relay, making the high voltage electricity reach your light.
And this is the second part of our controller. We can pilot a switch to turn on/off a real 125/220v lamp.

Here you can see a simple experiment, where a normal wall switch, in this case, a Bticino switch, is connected to the GPIO of a OrangePI, then a led was connected to a different pin and with a very simple python script every second a check is done to the switch, if the status of the switch is changed, the led status is inverted.

Is everything clear? Ready to implement this theory in your home automation?

Unluckily things are not always so simple. The pin of the GPIO of your board generates a very low tension, 3.3v or 5v depending on the model of the board you choose. Perfect if the distance between your board and the switch is a few centimeters (as in the previous video) or a few meters, but in real life, the cable between the controller and the switch can be longer, maybe  10-15 meters long or more. Due to this the resistance of the cable can influence the circuit, reducing the ability for the current to return to the board to show the switch is closed. The signal gets lost or is unstable, so it is not very clear if the circuit is open or closed. If you have a very very long distance from the switch to the board, it is better to build a parallel circuit with a higher voltage, at least 12v or 24v, so the effect of the resistance of the long cable is compensated. For the same reason to move electrical power from production plants to towns, 125v or 220v are not enough, the voltage is transformed to 30.000v (small lines) or 1.000.000v and then back to 220v at the end of the journey.
But such high voltages (12v or 24v) can not arrive in contact with our board, they would burn your board designed to work with 5v maximum.
How to solve the problem?!!? The magic optoisolator
Let’s go to the next page

2 Replies to “RemoteLight – step 2 – from theory to practice”

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.