School Bell Ring

Introduction: School Bell Ring

About: IT Teacher (Andalucía, Spain)

This instructable shows you and easy way to automate a process using a WiFi ESP8266 microcontroller and a relay from a mobile phone using Blynk.

In this case, I have implemented a school bell ring.

The main features could be the following:

  • Access to a network wifi to control the device from a Blynk app
  • Access to Blynk servers to ensure the time of the device was always on time
  • Timers to sound the bell ring each change of class
  • Button to manually activate the ring bell from your mobile phone
  • Schedule holidays and weekends to prevent the ring bell from ringing
  • It doesn´t use batteries to maintain the configuration

I hope you like.


  • ESP8266 + relay module
  • 100-240 VAC to 5 VDC module

Step 1: The Blynk App

Blynk is a IoT platform to connect your devices to the cloud.

To use it you have to do the following:

  • Download and install Blynk app for Android or iOS.
  • Create a new project and choose the ESP8266 device.
  • You will receive by email an Auth Token for every device you have to include in the ESP8266 sketch later.

The steps I have followed to create this Blynk app has been the following:


Add a timer for each change of class.

On each timer you specify the time when the ring bell must begin to sound and the time when it must stop.

I have associated the virtual pins V0, V1, V2 ... to each timer.


Add a push button to manually activate the ring bell.

I have associated the virtual pin V8 to this button.


Add a real-time clock to get time from server and control the days the ring bell have to work.

Step 2: The ESP8266 Sketch

The sketch uses the following libraries:

  • Blynk libraries. Go to library manager, search for Blynk and install it.
  • TimeLib library. Go to the following link and download the zip version. Go to Sketch -> Include Library -> Add .zip library, and select the previous zip file.

In the sketch we can highlight the following:

  • The credentials to connect to Blynk server
#define BLYNK_PRINT Serial
#include <esp8266wifi.h>
#include <blynksimpleesp8266.h>
#include <timelib.h>

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "your device Auth Token";
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "your wifi ssid";
char pass[] = "your wifi passwd";

SimpleTimer timer;
WidgetRTC rtc;
  • The virtual pins (V0 to V8) associated to each change of class
	if (param.asInt() == 1) SoundRingBell(1);
  	else SoundRingBell(0);
  	if (param.asInt() == 1) SoundRingBell(1);
  	else SoundRingBell(0);
  • The procedure "SoundRingBell" where I have implemented the days where the ring bell must not work: the weekends and during July and August. The IO0 has been associated to control the ring bell.
void SoundRingBell(int value) {
	// 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);

Step 3: How to Upload the Sketch to the ESP8266 Module

The steps to program the ESP8266 module using the ARDUINO IDE are the following:


Open the preferences window from the ARDUINO IDE. Go to File->Preferences and enter


into Additional Board Manager URLs field.


Go to Tools -> Board -> Boards Manager ...

Select the ESP8266 board menu and install “esp8266”


Choose Tools > Board > Generic ESP8266 Module.


To upload a sketch to the ESP8266, I have used an ARDUINO MEGA 2560 module, although you can use an ARDUINO NANO or an ARDUINO UNO module.

Make the following connections between the ESP8266 and the ARDUINO MEGA 2560 modules:

  • Connect the "3V3" pin to the "3V" pin in the ARDUINO MEGA 2560 module
  • Connect the "RX" pin to the "RX/0" pin
  • Connect the "EN" pin to the "3V" pin
  • Connect the "IO0" pin to the "GND" pin
  • Connect the "GND" pin to the "GND" pin
  • Connect the "TX" pin to the "TX/1" pin

The last connection is the following: connect the "RESET" pin to the "GND" pin in the ARDUINO MEGA 2560. In that way, it will act as a communications gateway.


Select the communications port where the ARDUINO MEGA is connected and upload the sketch

Step 4: The Device

The device is formed by a ESP-01 module and a relay everything integrated in a board. The ESP-01 module has two digitals I/O pins: IO0 and IO2 to activate the relay.

The board need 5V to work, as you can see in the image, so it need an 100-240 VAC to 5 VDC module

To control the ring bell, I have used the normally open (NO) pin of the relay

Automation Contest

Participated in the
Automation Contest

Be the First to Share


    • Make it Glow Contest

      Make it Glow Contest
    • Clocks Contest

      Clocks Contest
    • Game Design: Student Design Challenge

      Game Design: Student Design Challenge