Lighting control via WiFi – prototype

The project was created as a manifestation of total laziness, there is nothing worse than give up from the writing program to switch on light, or turn off in the morning. The target are simple, the possibility of switching on and off the lighting, and adjusting the brightness. In addition, the system must be invisible from the point of view of everyday use, i.e. the wall switch of light is to work without change. And the whole system must consume little energy.

Light source

The lighting for the control is four halogens powered by 12V, where each bulb is of the power 10W. The first step was to replace the light source. To do this, I have purchased LED bulbs with a suitable 2W (G4) Mount Power. After one substitution it turned out that the light has a very similar color to the original lighting and even is a little stronger. Thanks to this solution, I have reduced energy consumption by 80% without losing the quality of lighting.

Another advantage of changing the light source is to simplify the control system. Just a small bipolar transistor (in the tests applied BC337), and the current limiting resistor.

Wall switch

Initially, I don’t wont to destroy the wall to get into the electricity box. I decided to detect the state of the switch by checking whether the switch gives the phase or not. For this purpose, I made a simple phase detection system. After checking several solutions, I obtained a satisfactory result and the output of the system receives 5V or 0V depending on the position of the switch.

Eventually I destroy small pice of the wall and got into the electricity box, so in the final solution it would be doing the simpler way. The switch will give information only open or not open.


As a control system in the prototype, I applied the Raspberry Pi 3, because I was have it on the desk, and has everything you need (WiFi, and GPIO ports with PWM).


The Program was created using the QT5 library with the Qt MQTT module, and the WiringPi library. And I wrote the whole in the environment Qt Creator.

I used the protocol MQTT to communicate with the world. In this way, it was easier to control the application, because it could be any device supporting communication using the MQTT protocol, for example, a smartphone with the appropriate application installed.

The test program code can be download from the address .Although it is not a pattern as it should be programmed. There are a lot of test solutions that are better performed in other ways.

Mobile control

For mobile control from the phone I used a ready-made application that does exactly what I need. After checking out a few of the available apps, I found that it is best for me to use the Iot MQTT Panel which I recommend most.


The prototype performs very well, applied solutions to meet the initial assumptions. However, the target system bring several changes. The first one I mentioned, that is, modify the electrical installation accordingly to the light switch only gave information compact/obtuse. Another big change will be ESP8266 as a controller. This will reduce energy consumption and the cost of the system.

In addition, bring metering of energy consumption by lighting, in total only as a curiosity. By the way, join the system temperature and humidity sensor and maybe something will come to mind. In the future I also think about the feature of lighting switching along with the alarm clock, but having lighting connected to the world (Internet) I think I will come to mind yet other more or less practical ideas.

Facebook Comments

Leave a Reply

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

Time limit is exhausted. Please reload CAPTCHA.

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