Introduction: Creating a Digital Timer Using Blynk
In this post, we learn how to get started with Blynk - An IoT platform that is designed to simplify the whole process for us and which also works with several internet-enabled boards.
Step 1: Watch the Video
The video above goes over the entire process of creating a digital timer and we cover some additional information that is not present in this post. I'd recommend watching it first before proceeding.
Step 2: Set-Up the APP
Start by downloading the app from the Play Store or App Store, depending on your platform. Follow the onboarding process and make sure you enter an email address that you have access too as the authentication token will be sent to it.
Start by creating a new project. Give it a suitable name, select the correct board - which is WeMos D1 Mini in our case and then click the "Create Project" option. You will receive an email with the authentication token and we need to add that to the board next.
Step 3: Prepare the Board
Open up the Arduino IDE and then open up the library manager from the tools menu. Search for "Blynk" and install the library. Once done, open up the example template for your board - File->Examples->Blynk->Boards_WiFi->NodeMCU.
This is the template file and we need to copy/paste the authentication token from the email that was received. This token is unique for each project and it is used for identification purposes. Once done, be sure to add your WiFi network credentials and then upload the sketch to the board. You can open up the serial monitor to view the board status as it connects to your WiFi network and then connects to the Blynk server.
Connect an LED to the board at pin D1 by using a 330Ohm current limiting resistor as shown in the image.
Step 4: Create the Program
I'd recommend watching the video to get an idea of the flow of things, but here is a quick summary.
Tap the + icon to access the widgets and then add a Button, Value Display and Eventor widget. Configure the button to act as a switch and then assign pin D1 to it. For the value display widget, configure it to display the state of pin D1. This way, we can tap the button to manually control the LED and we can also view its status using the value display widget. The widgets can be moved around to suit your needs.
Finally, we need to configure the eventor widget which is where all the magic happens. Create a new even to switch ON the GPIO pin by selecting the appropriate time zone, time and days. Then, create another event to switch OFF the GPIO pin at your preferred time. You can keep adding events to trigger different actions based on your intentions.
Step 5: Test the Schedule
Click the play button within the app so that the program gets uploaded to the board. That's all you need to do now. The GPIO pin will automatically switch ON at the time you have set and it will then switch OFF at the OFF time that was set. You can even close the app or shut down the phone and it will all run as expected. Next, you can add a relay or configure multiple events to add to the functionality.
Do consider subscribing to our YouTube channel for more projects like these.