Want to know when your child has arrived safely at home or school? Now you have the chance to build a tag for your child, just with two components. Yes, it is possible to make it at home, and be able to receive notifications about events via your smartphone. How cool is that!
To be able to do this project, you need the following components. They are all to be found at ebits.
|1||1800mAh LiPo batteri med beskyttelseskredsløb||Link|
|1||ESP32 LOLIN32 V1||Link|
Table of Contents
From a user perspective, the experience of using Signal is just like WhatsApp, Facebook Messenger, and other popular chat apps. It is a messaging app with features like one-to-one messages, groups, stickers, photos, file transfers, voice calls. Your conversations in Signal are start-to-end encrypted, which means that not even the owners of Signal can monitor them. Only the people in the conversation can see them. Besides this, the Signal app allows us to use a bot to send messages automatically for them. You can interact with the bot, and the bot will interact with the signal app using a specific API, by sending HTTPS requests. ESP32 will monitor WiFi connection, and based on that it will send a message about the arrival of your child, depending on which WiFi is connected.
The bot that we will use in this project is known as Callmebot. Steps to add bot to your Signal app are as followed:
- Add this exact phone number +34 603 21 25 97 into your Phone Contacts (You can name it as you like). Therefore we have saved this number as “Ebits Bot.”
- From the Signal app, you have to send this exact message “I allow callmebot to send me messages” to the contact number you saved in step one.
After that, the bot will immediately reply with your API key(which is unique per user) marked in the red circle. We will use that number in our ESP32 code.
According to these two simple steps, Signal Bot is ready to interact with our ESP32, it’s that simple.
Setup on ESP32
To program ESP32 using Arduino IDE, we have to install the ESP32 board to Arduino IDE first. This assumes that you have the Arduino IDE installed on your computer. If you do not have it, the following guide is available: Setting up ESP32 for Arduino and Platform IO. Follow the guide up to step 4, including it, then download this driver so that your computer can recognize the ESP module.
How to install the USB driver:
- Click on the download icon in the right corner
- Unzip the file
- Run the installer which you unzipped, depending on which operating system you have 32 bit or 64 bit
- In the Arduino IDE when the CH340 is connected you will see a COM Port in the Tools > Serial Port menu, the COM number for your device may vary depending on your system.
Before selecting your specific board you have to download a library. You can do that by selecting Tools -> Board -> Boards Manager… -> write “esp32” in the search section -> press “Install button”.
To select the ESP32 board , first make sure you have connected it to your computer. Then select Tools -> Board -> ESP32 Arduino -> WEMOS LOLIN32 Lite, as shown in image below.
We will require you to copy the code from GitHub and paste it into our Arduino IDE.
Understanding Signal Message API
Below is the API format to send a text message to the Signal app.
[phone_number]: Your Phone number, including the country code. Ex. +4512345678
[apiKey]: Your API key that you received in the “Bot Setup” section, second step.
[message]: Text message you want to send ( all space ‘ ‘ need to be converter to ‘+’)
Calling the above URL in any browser search bar, you will get “Hello from eBits” as a message in the Signal app if your phone number and API key are correct.
Sending Message to Signal App
The following code will send your message to the Signal app, once your child gets home or school. Therefore you will receive a message from “Ebits bot” about the event and level of the ESP32 battery.
Before we build and compile, there is information that must be entered in the code for the ESP32 to connect to your internet and also to the Signal Bot. Now enter your unique information, but keep "".
After that, you have to add your registered Signal app mobile number with country code, to the phone section and add your API key to you to apikey section. (Same API key that you received by bot).
Do the same thing in the “void School()” section.
In the end just upload the code.
If all the information that is specified above has been changed correctly, the Tag from the start should connect to your home WiFi and go to deep sleep mode. Therefore, it will wake up every 5 minutes checking for the WiFi connection.
Once the connection is lost(child is on his way to school), Tag is trying to reconnect to available WiFi(in our case it is school) until it gets connected successfully, by sending a message about the event. You will receive a message in your Signal app depending on which WiFi it will be connected to.
To supply our ESP32, we need such a type of battery, which has the advantage of being small in size and large in capacity. In order to be able to connect the battery to the ESP32 port, you need to cut the connector wings with a knife.
Note: The LED on the board will light up(blue) once the usb charger is connected. Therefore, after the battery is fully charged the LED will turn off itself automatically.
ESP32 Module (Voltage Divider)
The WEMOS ESP32 Lite is the ideal board when it comes to low power consumption projects, such this one.
Last but not least, a cool feature is that you are able to get the level of the battery transmitted by the message to your phone, just by using theory of rule of voltage divider and soldering 2 resistors on the board. Isn't it amazing?
Below its shown the mini circuit that you have to solder and then attach to the esp board as in follow image:
After you are done with setting up step by step, you are free to plug the battery with the respective polarity marked on the board. The black cable - minus and the red - plus. From the pictures below, it can be seen that a 3D-printed box has been designed, which is small and it won't take up much space in your child's bag.
The battery of the device can last about 1-2 days, depending on how big it is distance from home to school. Because in that time ESP is consuming more power than usual by trying to reconnect to available WiFi.
You can also receive a message about “This Bot is full” by sending “I allow callmebot to send me messages”. But don't worry, just follow the same procedure from the first step (Bot Setup), to add the phone number that is mentioned in the message by the bot.(marked in the red circle)
If you accidentally deleted the message from the conversation, don't worry! You can rewrite "I allow callmebot to send me messages" and receive information about the same API key.