Control Wireless Relays (Lights) Using NodeMCU, Arduino Uno and Blynk Legacy Platform

by dentita in Circuits > Arduino

646 Views, 0 Favorites, 0 Comments

Control Wireless Relays (Lights) Using NodeMCU, Arduino Uno and Blynk Legacy Platform

MainSketch-3.jpg

In order to reduce the electricity costs in the Parking-Garden area of a building, I have created a device that sends wireless signal to switch off lights at specific defined time. You can monitor the status of the lights, change the time of the switching-off event and also manually send and trigger commands remotely using your mobile application.

Project Idea. Switch Off Garden Lights at Selected Time in Order to Reduce Electricity Costs.

GroundFloor.jpg

In the ground floor of a building , lights are been turned on automatically through a sun detection sensor. So when it's getting dark the lights are turned on and at dawn the lights are automatically turned off.

The total number of lights are 15, scattered in the area.

In order to reduce the electricity costs in the Parking-Garden area of a building, I have created a device that sends wireless signal to switch off lights at specific defined time. You can monitor the status of the lights, change the time of the switching-off event and also manually send and trigger commands remotely using your mobile application.

Since it would not be a good approach to switch off the same lights every night, I've spitted the area into 4 sections, altering the lights that are turned off each day.

There sections are presented in the below lines.


A-Section : Lights that will not be implemented by the application.(Always ON during the night.)

B-Section : Lights that will be switch off at even days.

C-Section : Lights that will be switch off at odd days.

D-Section : Lights that will be switch off irrespective even/odd days.

Diagram Simple Flow Chart...

Untitled Diagram.jpg

Since the application is distributed over 2 boards (ESP8266 and Arduino Uno), a simple flow chart is available in order to fully understand how the application is powered on, what is happening when it's connected to WIFI, and when and how the ESP8566 module is triggering the Arduino Uno in order to send signal to individual relays.

A short description of the flow chart, presents that the main board is the ESP8266 in which the sections of the garden is programmed and using the Blynk application user can monitor and control the lights. Commands created automatically by the ESP8266 are been transferred to Arduino Uno which is responsible to distribute the signal to individual relays, exists at each spot light.

Components Needed

Components-3.jpg
  1. Esp8266
  2. NodeMcu (1 item)
  3. Arduino Uno (1 item)
  4. 433M Arduino RF Kit UART RS232 (1 item)
  5. 9 Relays from the below web link (9 items)
  6. Led (1 item)
  7. 12V transformer from 220V AC to 12V DC (10 items)
  8. Some wires in order to connect the components

For components like (4,5) please visit the below link
https://www.ebay.com/itm/272899374549?mkevt=1&mkpi...

Of course solder wire with a soldering iron are needed for implementing the connections.

Blynk Mobile Application - User Interface.

Blynk.png
Screenshot_2022-03-14-13-45-29-913_cc.blynk.jpg
Screenshot_2022-03-14-13-45-44-474_cc.blynk.jpg

In order to monitor the process that takes effect every night, user can view, check and alter conditions using the Blynk Application. The total functions , information and status updates are the ones bellow.

  • User can select if the application will be executed when the system will be triggered , meaning that will gain power. (In this first version the user selection (Active or not) will not be stored in ESP memory for use in following days, meaning that deactivating the system in one day will not be applied the next day). Every time the system is up and running the selection will be always true (ON).
  • In order to understand which lights will be switched off according the system functions, i have created led bullets light in the Blynk form, presenting the real position of the lights in the building as descripted in Section1. These led lights (as shown in the picture) can be enabled or disabled following the conditions.
  • User will be updated of the live date-time, since system is using gr,pool.ntp.org to get updated values.
  • User can also change the selected time when the lights will be turned off. This time selection is been saved to SPIFFS memory and will be used to trigger the system and execute the automate procedure.
  • Also related information about Wifi Access point such as wifi signal and Name are been displayed in the terminal screen.
  • Terminal screen is displaying also information about system procedure such as reading internal memory, executing commands and display results.
  • From the terminal, user can manually turn on or off any light or batch of lights by simply executing the following commands like ON,1,3,6 meaning that lights 1,3,6 will be turned on and also same commands OFF,1,2,8 will turn off the light at position 1,2,8.
  • When an automated or manually process is taking effect the led lights in the form are been turned on or off, providing user visual information.

Transformer 12V and Channel Relays

433M_Channels_relay_switch.jpg
LightAdapter-3.png
LightAdapter-4.png

A new setup of 12V Transformer plus the channel relay should be 'added' into each led light connection (Except lights 8&9) in order to get commands from the Arduino Antenna.

The story behinds the photos is the following .

  1. The sun relay is been triggered when it's getting dark and its powering each light with 220V power. At this state all 15 lights are turned ON, also ESP8266 is turned ON, is been connected through Wifi and checking the conditions in order to execute commands.
  2. On each single garden light, the transformer is powering with 12Volts DC the Channel Relay which waits the command from the Arduino. At this state the light is turned ON.
  3. As photos present, the power line (220V) comes at the channel Relay in which is connected to NC and Com. When the antenna will trigger the channel, the relay will be switched on , turning the light OFF.
  4. If the transformer or the RF Channel fail, the lights will remain ON during the night, providing the necessity of keeping the lights on during the night.

Code for Uno and ESP32

Downloads

Draft Video of Switching Off Lights