DIY

School bell automation

School bell automation  School bell automation In this article, the wizard will tell us how to automate the school bell so that it rings on schedule. In principle, on the basis of this scheme, it is possible to automate the operation of any device – turning on/off the light in the chicken coop, the operation of the watering pump in the country, even turning on the kettle for morning awakening. Moreover, the schedule is very easy to change through the application on the phone. You can also manually control the devices of your phone, computer, any gadget.
The peculiarity of this particular scheme:
Access to the Wi-Fi network to control the device from the Blynk application
Access to the Blynk servers
Call at each end and the beginning of the lesson
Button for manual activation of a call from a mobile phone
Call planning according to school days (except weekends)
Mains power supply
Tools and materials: -ESP8266 + relay module; -Mounting board;
-Voltage converter 220 V AC – 5 V DC;
-Wires;
Step one: circuit
Simple circuit.
The device consists of an ESP-01 module and a relay built into the board. The ESP-01 module has two digital I/O pins and IO0 and IO2 for relay activation.
The board needs 5V to power, and the wizard installed a voltage converter from 100-240VAC to 5VDC. To activate the call, the circuit has a relay with normally open contacts.
School bell automation School bell automation  School call automation Step Two: Blynk App
Blynk is an IoT platform for connecting and managing devices to the cloud.
For to use the service, you need to do the following:
Download and install the Blynk app for Android or iOS.
Create a new project and select your ESP8266 device.
Next, you will receive an authentication token by email for each device that needs to be included in the ESP8266 sketch.
To create a schedule the wizard added a timer for each lesson. On each timer I set the time when the bell should ring and the time when it should turn off.
Connected virtual contacts V0, V1, V2 … with each timer. Added a button to manually activate the call. Associated a V8 virtual contact with this button.
Added a real time clock to receive time from the server and control the days on which the call should work.
 School call automation School bell automation  School bell automation Step three: sketch ESP8266
The sketch uses the following libraries:
Blynk Libraries. Go to Library Manager, find Blynk and install it.
TimeLib library. Follow the link and download the zip version. Go to Sketch – & gt; Include Library – & gt; Add and select the previous zip file.
In the sketch, you need to replace the credentials to connect to the Blynk server with your credentials.
Parts of the sketch below.
Credentials to connect to the Blynk server:

 #define BLYNK_PRINT Serial #include & lt; esp8266wifi.h & gt; #include & lt; blynksimpleesp8266.h & gt; #include & lt; timelib.h & gt; //You should get Auth Token in the Blynk App. //Go to the Project Settings (nut icon). char auth & # 91; & # 93; = & # 34; your device Auth Token & # 34 ;; //Your WiFi credentials. //Set password to & # 34; & # 34; for open networks. char ssid & # 91; & # 93; = & # 34; your wifi ssid & # 34 ;; char pass & # 91; & # 93; = & # 34; your wifi passwd & # 34 ;; SimpleTimer timer; WidgetRTC rtc;  

Virtual contacts (V0 to V8) related to call schedule:

 BLYNK_WRITE (V0) & # 123; if (param.asInt () == 1) SoundRingBell (1); else SoundRingBell (0); } BLYNK_WRITE (V1) & # 123; if (param.asInt () == 1) SoundRingBell (1); else SoundRingBell (0); } & lt; br & gt;  

The part of “SoundRingBell” where the wizard implemented the days when the bell should not work: weekends and holidays in July and August.

 void SoundRingBell (int value) & # 123; //Not work on Sunday or Saturday if ((weekday () == 1) or (weekday () == 7)) return; //Not work on July and August if ((month () == 7) or (month () == 8)) return; if (value == 0) digitalWrite (0, LOW); else digitalWrite (0, HIGH); }  

RingBell.ino
School bell automation Step four: code download
The steps to program the ESP8266 module using ARDUINO IDE are as follows:
Open the settings window in ARDUINO IDE. Go to File- & gt; Preferences and enter http://arduino.esp8266.com/stable/package_esp8266com_index.json in Additional Board Manager URL
Then go to Tools – & gt; Board – & gt; Boards Manager
Select the ESP8266 board menu and install “esp8266”.
Select Tools & gt; Board & gt; Generic ESP8266 Module.
To upload the sketch to the ESP8266, the wizard used the ARDUINO MEGA 2560 module, although the ARDUINO NANO or ARDUINO UNO module can be used.
Make the following connections between the ESP8266 and ARDUINO MEGA 2560 modules:
Connect the 3V3 pin to the 3V pin of the ARDUINO MEGA 2560 module.
Connect the RX pin to the RX/0 pin.
Connect the pin “EN” to pin “3V”.
Connect pin “IO0” to pin “GND”.
Connect pin “GND” to pin “GND”.
Connect pin “TX” to pin “TX/1 “.
Connect the” RESET “contact to the” GND “contact. It will act as a communication gateway.
Select the communication port to which the ARDUINO MEGA is connected and upload the sketch.
School bell automation  School bell automation Automation school call  School call automation Everything is ready. The call will now work as scheduled.

Source:

usamodelkina.ru

Show More

Related Articles

Leave a Reply

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

Check Also
Close
Back to top button