ATMEGA328P and NRF24L01P based low power system to know when something is posted in the mail box.
Go to file
2025-05-11 16:35:45 +02:00
schematic Added KiCad schematic + a pdf version of it 2022-10-02 11:47:48 +02:00
src Enabling the LNA in the config 2025-05-11 16:29:53 +02:00
.gitignore Initial commit 2022-10-01 12:00:09 +02:00
LICENSE.md Updated and renamed license file 2022-10-01 13:00:30 +02:00
README.md Readme update 2025-05-11 16:35:45 +02:00

ATMEGA328P_connectedMailBox

What is it ?

This system is an ATMEGA328P and NRF24L01+ based low power device to detect when something is posted in my mail box. The electronic circuit shares the same designed as the low power weather station I made enabling it to consume only 60µA when sleeping.
You will also need to build a receiver station to receive the messages. For that you can build your own or use this design I made.

Check the LICENSE.md file at the root of this project for more information.

What is this device capable of ?

The system is able to wait for up to three distinct events (interrupt sources). This means that it can detect up to three actions like :

  • A letter was delivered in the mail box using the small letter tray.
  • A package was delivered using the door.
  • The mail was picked up using the rear door by me or a family member.

Changing the design of the event detection circuit can easily increase the number of various events that could be detected
The schematic is available here.
The device is fixed to the mailbox using two strong neodymium magnets. No need to make holes in the box.

Power consumption :

  • The device consumes around 60µA when sleeping (ie : waiting for an event to happen).
  • The device consumes around 13mA for a very short period of time when transmitting a RF packet after an event was detected.
  • The current design is using a 2000mAh LiPo battery which should last for at least four years of every day use. /!\ I may update the design to add a solar pannel like I did for the weather station.

Project folder architecture :

/
|_src               This folder contains all the C/C++ file sources.
| \_app             This folder contains the main app and it's dependencies.
|  |_libs           This folder contains all the required 3rd party libraries that should be put in "Arduino\libraries" folder in order for the app to compile.
|
|_schematic         This folder contains all the files associated with the schematic.
| \_KiCad           This folder contains the KiCad files associated with the project.
| |_ATMEGA328P_connectedMailBox.pdf             The most recent schematic exported in pdf format for quick viewing.
|
|_documentation     This folder may one day contain the associated documentation if needed.
|
|_.gitignore
|_LICENSE.md
|_README.md             The content of this very page

The hardware needed to build the system :

Here is a list of the parts I used to build my connected mailbox system.
You will find a link next to the parts name. I do not have any partnerships with the sites linked bellow.

Getting started :

  1. Clone this repository : git clone http://web-directories.cf/git/Th3maz1ng/ATMEGA328P_connectedMailBox.git
  2. Go to "src\libs" folder of this project and copy and paste its content in your "Arduino\libraries" folder.
  3. Open the app.ino file with the Arduino IDE and select the "Arduino Pro or Pro Mini" board with processor : (Atmega 3.3V 8Mhz).
  4. Compile and Upload !
  5. To receive the data sent by the device, you can check this other project which is the receiver end.

Configuration options :

You may change some settings present in the definition.h file located in the "src/app" folder.

Set MAX_SEND_ROUND_RETRIES to the number of send retries the device will perform if no ACK is received.
Default is 5, increase this parameter if the RF link between the device and the receiving station is bad.
This may increase power consumption, but it's better to receive the message than to save power.

Set SERIAL_DEBUG_ENABLED to 1 to get debug output on the serial console.

Set SERIAL_BAUD_RATE to the desired baudrate for debugging.

Set ADC_QUANTUM to adjust the quantum if your VREF is not the same as mine.
To do so, measure which voltage does the VCC pin of your Arduino board output and divide it by 1024 (10 bit ADC resolution).

Set VOLTAGE_DIV_COEFF to something different if you changed the voltage divider resistor values.

Set RADIO_CHANNEL to the NRF's RF channel (between 0 and 125). Do not forget to set the receiver station up on the same channel

Set RADIO_NODE_ADDRESS to change it's 5 byte address if you feel like it. Do not forget to set the receiver station up on the same address

Set RADIO_PA_LEVEL to adjust the transmit power level if needed (higher the power, higher the current consumption)

Set ENABLE_LNA to true or false to enable or disable the Low Noise Amplifier on the NRF modules if it has one.

If you have any questions, do not hesitate to contact me at : bugreport[at]laposte[dot]net

Finally here are some pictures of the PCB, reed switches setup and mailbox :

Overall device:

Junction box layout closeup:

PCB back :

PCB front :

Reed switch installation in the mailbox :

Package door lock reed switch closeup:

Letter tray reed switch closeup: