Are you tired of checking your postbox everyday for letters? Then you are in the correct place to learn how to make your own postbox alert module. Then you can wait for a notification on your phone, when you will have a letter in your postbox. It is an easy and fun project for you and your family.
This module as a microcontroller is using ESP8266 or ESP32. ESP8266 and ESP32 provide WiFi; ESP8266 does not have Bluetooth. This project sends messages over WiFi through a third-party service to Signal.
The microcontroller is connected to the KY-033 tracking sensor. The sensor module detects whether there is a light-reflecting or light-absorbing surface in front of the sensor. So when a letter or paper is in front of the sensor. It will sense it and you will receive a message on your phone. This module is powered by a 18650 battery and it will be charged with a mini solar panel — current range; check compatibility to recharge it when sufficient sunlight is available. Check cell protection, charging voltage and power-path/load-sharing support; solar operation does not guarantee uninterrupted service.
Now lets have fun with the building part :D
Required Components
The full list of the components for this Project.
| ESP8266 or ESP32 | 1 |
| KY-033 TRACKING SENSOR | 1 |
| 18650 battery holder with charger | 1 |
| 18650 battery | 1 |
| 6W Solar cell with USB port — current range; check compatibility | 1 |
| Female to Female dupont cables | 3 |
| Micro USB to USB Cable | 2 |
| Case for the module made by cardboard | 1 |
The sizes of the case needs to be: 16x3x4cm(LxWxH)


Guide
You will need to install Arduino IDE from this link. With this you can program your ESP8266, ESP32 and more other microcontrollers.
Setting up the ESP8266 or ESP32 on Arduino IDE
First you need to set up your microcontroller on Arduino IDE, you can check this Link for ESP8266 set up or this Link to set up the ESP32 until step six.
Cable Diagram ESP8266 and KY-033 Sensor

Setting up the KY-033 Sensor and testing
To test the KY-033 Sensor you can use the code from this Link.


SETTING UP WIFI ON ESP8266
Setting up wifi on ESP8266 is quite simple and there are many guides.
Use your own WiFi name and password in the code. Keep credentials private; any credentials visible in historical screenshots are examples and must not be reused. 
Here you can see the start of the code. The function above is called void setup (). Here is where we are starting the serial communication, so we can read there whether a fob connection has been created. We are doing this to ensure that the ESP can connect to the WIFI.
NOTE: If the postbox is too far from your home the ESP may not have WIFI connection. Therefore, to be sure you can take the ESP where the postbox is, you can check if it has a WIFI connection. It may be required to use a WiFi range extender or change the place of the router.
Setting up the Signal App Bot
First step, install the Signal App to your phone. Google Play App store
About Signal App Bot
Signal offers messages, groups, stickers, photos, files and voice calls with end-to-end encryption between participants. This project uses the third-party CallMeBot service, not an official Signal bot API. The service receives the message text and phone number in your HTTPS request and therefore sits outside the privacy assumptions of a direct Signal conversation. Check current service availability, onboarding and privacy terms before proceeding.
ESP8266 will monitor WiFi connection, and based on that it will send a message if you get a letter to your postbox.
Guide
Use only the current bot contact listed in CallMeBot’s official Signal documentation. The contact shown in the original screenshots is historical and must not be assumed valid. Give the verified contact a name such as Postbox or Signal Bot.
Then send the following message to that contact:
“I allow callmebot to send me messages” (historical onboarding text; confirm the current procedure with the service)
You should get a reply “New user registered”, followed by an API key, then you can send messages to your phone with the received link.
https://api.callmebot.com/signal/send.php?phone=<yourphonenumber>&apikey=YOUR_API_KEY&text=This+is+a+test
In this part of the code you need to change the credentials to your phone number with the country code and write the apikey that you received from the message. Then you can change the text that you want to send as a message to your phone.
Understanding Signal Message API
Below is the API format to send a text message to the Signal app.
https://api.callmebot.com/signal/send.php?phone=[phone_number]&apikey=[apiKey ]&text=[message]
[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]: Message text to send. URL-encode query parameters correctly; spaces may use + and a literal + in the phone country code should be encoded as %2B.
Example:
https://api.callmebot.com/signal/send.php?phone=YOUR_PHONE&apikey=YOUR_API_KEY&text=Hello+from+eBits
If the service is available and your credentials are valid, requesting the example URL with your own URL-encoded values sends “Hello from eBits” to Signal. Do not share a URL containing your real API key.
Final test
You can have access to the full code from this Link. After you change the needed things in the code and you wire up the sensor to the ESP8266 or ESP32 and test it.
When an object is in front of the sensor it will start the communication with the Signal App and it will send the message to your phone. Then until you pick up the items in front of the sensor it will not send anymore messages to your phone. Later you can pick them up and the ESP will make a reset and it will be ready for incoming letters in your postbox to send a message again.
This is an example photo of how you will get messages on your phone.

Here you can see an example of how it needs to be placed in the postbox. You have to put it in such a way so when the paper is in the postbox it will be in front of the sensor for the best results.

The solar panel — current range; check compatibility can be put where the light shines the most on it and the cable placement depends on your postbox.