|
Arduino MKR 1200 Fox |
x 1 | |
|
AAA/AA Battery Box |
x 1 | |
|
AAA/AA Batteries |
x 1 | |
|
Laser Module |
x 1 | |
|
Photoresistor |
x 1 | |
|
Jumper Wires |
x 1 | |
|
Resistor (1KΩ) |
x 1 |
|
Arduino Web Editor |
|
|
Sigfox |
|
|
Soldering iron |
SmartPostBox
Abstract
Figure 1: Post box powered by SmartPostBox
Figure 1: Post box powered by SmartPostBox
SmartPostBox is a smart post box implementation that allows you to turn a regular post box into an intelligent post box that notifies you via email whenever you get mail. This way, you will be able to open that letter you were waiting for exactly when it arrives.
Mail has been around for hundreds of years. The idea of getting letters and parcels delivered to your home is part of our long histories. The US Postal service was launched in 1775 as a means to allow individuals and organisations to send letters and packages to a central location to then be distributed to the receiver’s location.
But mail was around for much longer than that, the system was first implemented by ancient Egyptians around 2,000BCE. Letters would be placed in secure boxes and guarded by employees as they were transported on the River Nile and then on camel backs across the country.
Receiving a letter in the mail always gives you that bit of excitement, of wonder about what is in it, could it be that postcard from your friend in France you were waiting for or another over-inflated electricity bill. It happens to me that I would get an email telling me that a letter will arrive today that I have been expecting for a while. This would get me very excited and sometimes, I may even lose focus and daydream about getting it.
In my case, I can’t look out the window to see when the post man arrives and so I’d need to go out and check to see if there’s something in the post box. This is quite stressful and makes me lose productivity. I would love to be notified when mail arrives, whether I’m at home or at work. Knowing that I’ll be notified when the post arrives would prevent me from stressing over its delivery.
Figure 2: A letter being placed into a post box powered by SmartPostBox
I designed SmartPostBox to tackle this issue. This project consists of a device that is placed within the post box that detects if a letter has been placed in the box. The device will check for the presence of a letter at intervals of time and send an email to the user when a letter was detected. The device is designed to slide into a post box, sitting on the bottom of it.
The device uses a laser and a photoresistor arranged at opposite sides of the post box. When a letter is inserted in the post box, the beam shining at the photoresistor will be blocked hence the device can detect that a letter was placed in the box.
The device will then connect to the backend and send the command to send an email to the user saying that they received mail. The user will hence receive a notification right after they got mail allowing them to know when to go out to get the mail.
SmartPostBox brings IoT connectivity to post boxes allowing any existing post box to be enhanced using the implementation. This allows people to get notified when their mail arrives so they can pick it up right away. SmartPostBox can be implemented on a personal or wide scale with ease. Figure 3 shows the email the user receives when they received mail.
Figure 3: Email alerting to mail arrival
Project In-Depth
This section will dissect the project and talk about the specifics of it.
Microcontroller – Arduino MKR FOX
Figure 4: Arduino MKR Fox
The Arduino MKR Fox is the microcontroller used in the project, shown in figure 4. The device is an Arduino board from the MKR family. These boards focus on a small form factor and great battery life while maintaining the same performance available on other boards. The device operates at 3.3v as opposed to 5 volts which reduces power consumption. The processor is also equipped with a low power mode that allows it to hibernate for set periods of time. This also improves the battery life significantly.
The Arduino MKR Fox has Sigfox connectivity built in. This allows the device to connect to the Sigfox network and send small data parcels to the backend. Sigfox defines a communication protocol that allows devices to send very small data packets over the Sigfox radio infrastructure. This reduces battery consumption drastically as the packets sent are under 12 bytes and communication is unidirectional meaning that energy can be conserved through this means as well.
Finally, the device is issued by Arduino and can be easily programmed through the Arduino Ide using the c++ language.
Detecting Mail
The device has a beam breaking system in place which enables it to identify if a letter has been placed in the post box. This implementation consists of a small laser module and a photoresistor placed on opposite sides of the post box. This is illustrated in figure 5 by the line.
Figure 5: Elevation of Enclosure
The laser is perfectly aligned with the photoresistor. This causes a beam of light to be transmitted from the laser to the photoresistor. If a letter is placed in the post box, it will come between the laser and the photoresistor, this would cause the beam to break and the light would no longer reach the photoresistor.
The Arduino MKR Fox reads the analogue value outputted by the photoresistor to see if the light beam is broken. If it is, the MKR Fox will send a message to the backend informing that a letter has arrived.
This process is repeated every time the device is woken up from sleep.
Enclosure
I designed an enclosure for the project so it can easily be placed in a post box. The dimensions of the enclosure depend on the post box in which the device is to be placed. I designed it for my post box, which is a standard issue UK post box.
I am aware that a lot of people, in the US for example, would have different dimensions and styles of post boxes. It’s up to you to design the enclosure and make it so that it can fit in the post box and the letter inputted would block the light beam appropriately.
Figure 6: Isometric view of the enclosure
Figure 6 is a render of the enclosure I built. The enclosure is composed of an M shaped outline. This would be placed on the bottom of the post box. The V shape at the top allows for the letter to slide into the bottom of the enclosure. This ensures that the letter obstructs the light beam and triggers the system. The letter is also easy to extract from the post box thereafter.
I chose to build it out of hard cardboard as it was easy to model it. If intended for prolonged use, it would be ideal to build it out of plastic. The enclosure could be 3D printed or cut by hand and assembled thereafter.
I would personally recommend rounding off as many corners as possible to ensure that the letter cannot get stuck in any edges leading to it not being detected by the system. The enclosure design files are available open source on the project’s GitHub page.
Sigfox Connectivity
The Arduino MKR Fox has built-in Sigfox connectivity through an onboard Sigfox module. This enables the device to connect to the backend with ease. Sigfox is a communications company that aims to create infrastructure that helps low power IoT devices send small packets of data through the infrastructure and then link custom web apps to perform actions with the data in the backend.
I chose to use Sigfox connectivity because it is a low power protocol and small packet sizes are perfect for the project. The device does not need to send any data to the backend but only a notification that there is post. Using other protocols such as GSM or WiFi would require more power and are better suited for devices sending more data.
Messages sent by devices through the Sigfox network are centralised in their server. This data is accessible through the online portal. Sigfox allows for callbacks to be implemented, these essentially allow other applications such as a mailing service or a cloud service provider such as AWS to be integrated in the backend.
Sigfox Backend and Email
When a message arrives in the backend, a callback can act on this message. This project uses the built-in email callback to send an email to the user whenever a message is received from the device. The email is sent within seconds from the device detecting the post.
Security and Privacy
Security and data protection is very important when dealing with IoT devices. The device does not send any sensitive data across the network. The device does not need to get its location or other sensitive data and is unaware of this information. Hence, if an attack were to take place, no sensitive data would be available on the device.
All backend solutions are provided by Sigfox. The email callback is also issued by Sigfox hence the message sent by the device does not exit the Sigfox ecosystem in the backend. This ensures that the message sent by the device is safe and attackers cannot get notified when you get post.
Deep Sleep and Battery Life
The device was constructed with longevity and extended battery life in mind. This is important with a project like this as it would not be convenient to constantly have to change the batteries. The Arduino MKR Fox runs on 2, AA batteries. These batteries are placed in a battery holder which is connected to the device via the terminals.
The MKR Fox can last for about 2 to 3 weeks on the batteries before they would need to be replaced. A combination of features allows for the extended battery life. The chip will check if the light beam is obstructed and then go to sleep for 10 minutes. This sleep mode exponentially increases the battery life of the implementation.
The Sigfox communication protocol also increases the battery life significantly because it requires minimal data exchange meaning that the device does not need to send or receive large data packets. The battery life could be extended by powering the device with a power bank if desired.
Project Architecture
This section will delve into the project’s architecture. The project is split into 2 sections: the frontend and the backend. The frontend refers to the IoT device checking for mail in the post box and the backend is the Sigfox server and emailing service.
Figure 7: Frontend Architecture Diagram
Figure 7 shows the architecture of the frontend. The MKR Fox will wake up from sleep mode and immediately get the light intensity value from the photoresistor. This will allow it to check if the laser’s beam was obstructed by a letter.
If this is the case, the device will send an empty message to Sigfox and return to sleep. If not, the device will go to sleep without sending a message. The process is repeated when the device wakes up every 10 minutes.
The device will remember if an email was sent and will not send another until the mail is removed and new mail is received.
Figure 8: Backend Architecture Diagram
Figure 8 shows the backend architecture diagram. The message sent by the device is relayed to the backend via Sigfox telecommunication towers. Once it arrives in the Sigfox backend, a callback is immediately executed which triggers an email being sent to the user. The email is event based triggered, hence the email to the user will be sent immediately as the message reaches the backend.
Market Research
This section will talk about the product in the marketplace and costs of deploying the project.
The Product in the Market
SmartPostBox can be mass produced and implemented in post boxes sold on a wide scale. A company may choose to create a range of smart post boxes and incorporate the project to modernise their existing stock and sell it for a premium.
This would allow the company to use existing post boxes already constructed and add the feature to get an email whenever you get mail for an extra cost for interested buyers. All thy would have to do is place an SmartPostBox device inside a pre-existing post box.
Target Market
The product is targeted at a wide audience. The target audience consists of middle and upper class individuals that are interested in home automation solutions. The product is limited to the countries where Sigfox can operate as the project is reliant on the technology.
User Persona
John is a man living with his wife in a house in a suburb in Dublin. He is invested in home automation and hears about a company providing smart post boxes that can send him an email whenever he gets mail delivered. He is very interested in this solution and opts in to purchase an upgraded post box with this feature.
Open Source and Scalability
The project has been designed to be 100% open source. All the code and design files are available on GitHub for free. This enables anyone around the world to use the design files and code to help them launch their own version of the product. Free software can also speed production as there are no legal hurdles in the way.
Sigfox Coverage
Sigfox is available in regions in over 80 countries worldwide including North America and most of Europe. Sigfox relies on infrastructure constructed specifically for this protocol to be implemented for the system to work.
Most major cities around the world are covered by Sigfox and some countries are covered nearly in entirety. Before starting to build the project, you should check out if the country you live in supports Sigfox by checking out their coverage map.
Cost of Deployment
This section will delve into the cost of deploying the product as well as maintenance costs on a monthly basis.
Table 1: Project Deployment Costs
Table 1 shows an approximation of costs for developing one device. The cost analysis includes the MKR Fox retailing for about €40.00 depending on the region as well as the cost of other components used in the project.
The cost analysis also includes the cost of designing and constructing the enclosure together with the estimated cost of labour required to manufacture one product in a supply chain. All components used in the project are off the shelf and hence the price per unit drops as quantity produced increases.
Table 2: Project Maintenance Costs
Table 2 shows the recurring costs for deploying one unit. There are two main costs summarised on a monthly basis. Batteries are required for the project. The project will run out of power every 2 to 3 weeks. The cost of one and a half battery replacements is included in the cost (3 AA batteries). Using rechargeable batteries is more cost-efficient and environmentally friendly.
The project also needs Sigfox backend costs to be paid. Sigfox has very flexible plans that allow device connectivity on a yearly basis for a set fee. The plan is paid yearly and the cost averages out to just 50 cent a month. This operation cost is very cheap. The MKR Fox also comes with a 2-year Sigfox connectivity certificate so this cost would only incur afterwards.
Overall, the cost of operation is estimated at €3.50 a month.
Making the Project
This section will talk about the steps needed to construct the project from start to finish and everything needed to construct it.
Please note that before starting to order components and built the project, it is essential to check if your country is currently covered by Sigfox on their coverage map.
Step 1: Required Apparatus
This project requires a small amount of electronics, the BOM can be seen above. The components are shown in figure 9.
Figure 9: All components needed for the project
Step 2: Connecting the Circuit
The schematics for the project is below, there is no breadboard in the project so the schematics are a bit jumbled up. Use a soldering iron to solder the components as shown in figure 10.
Figure 10: The schematics for the project
You can place the batteries in the battery holder now and connect the antenna to the MKR Fox via the onboard connector. Don’t connect the batteries yet, we will do this after the program on the device is ready to go.
Step 3: Setting Up Sigfox
Before continuing with this guide, you will need to follow the Arduino getting started tutorial for the MKR Fox. This explains creating your Sigfox account and connecting the MKR Fox to the backend. After you finished going through the guide, you can continue here.
- To get started, visit backend.sigfox.com and sign in
- From the Sigfox portal, click on “Device Type” from the menu at the top of the screen
- You should see the list of your devices now, click on the device you are working with
- From the next window, select the “Callbacks” option from the menu on the left of the screen
- Click on the “New” button in the top right of the screen to create the email callback
- Select “Custom Callback” from the list provided
- Now configure the callback as shown in figure 11
- Click Ok and you are ready to go!
Figure 11: Setup of Sigfox Email Callback parameters
The {device} keyword is a variable representing the device's ID, it is a built in variable, there are many more of these like {lat}, {lng}, {time} and others, you can insert them in the email's subject or body by just pasting them in from the menu above.
You can customise the content of the email if you wish.
Step 4: Acknowledging the Code
There are two main functions in the project's code:
- Read and Analyse Photoresistor
- Send Packet
These sections are explained below. Please clone the code from the GitHub repo to follow along.
Read and Analyse Photoresistor
lightIntensity = analogRead(A1);
if(lightIntensity < 800)
{
if(pos == 0)
{
pos = 1;
…
The first line of the section reads the photoresistor's analogue value which is connected to pin A1, if the value is smaller than 800 (out of 1024), and if the value dropped now and was not previously below 800, it will run the Send Packet function. If the value is above 800, the Arduino will reset the Boolean variable pos (which stores if the previous value was below 800), if the previous value was smaller than 800 (Indicates presence of letter), the Arduino will wait until the letter is removed.
Send Packet
SigFox.beginPacket();
if(proDebug)
{
Serial.println(" Parsing Packet");
}
SigFox.print(" ");
int ret = SigFox.endPacket(true);
This section of code will send a packet to Sigfox if mail is detected, the Arduino will start the parsing procedure and will print " " (space) to Sigfox, it will then wait for confirmation that Sigfox received the message and will then wait for the letter to be removed. It will then start the algorithm again.
Step 5: Setting Up the Variables
There is a single variable that the user has to set, proDebug, if it is enabled, the Arduino requires connection through USB to a computer and the Serial Monitor must be open, the Arduino prints to the Serial Monitor in this mode, it is ideal for troubleshooting. proDebug defaults to 0 for operating on the field.
Step 6: Debugging and Calibrating
The next thing to do now that the code is ready to go is upload it to the MKR Fox. Ensure the device is plugged into your computer and the right board and connection are selected through the IDE. You can now compile and upload the code to the device.
Run the device with proDebug set to true the first time to see if you get any errors. There is a chance the code may seem to crash after the parcel was sent to Sigfox, this is a quirk with the serial monitor and the device should work perfectly on the field with proDebug set to 0. Before debugging, I would comment out the last line that instructs the device to go into sleep mode and add a 5 second delay
delay(5000);
I would align the laser and the photoresistor such that the light from the laser shines directly on the photoresistor a few centimetres apart. I would then check the reading of the photoresistor in the serial monitor (it could be anywhere up to 1024). Ideally, the reading should be above 800 or so when the laser is shining on it and lower when it is not. This may not be the case in a light room, but don’t worry, the post box should be dark enough.
If the values differ a lot, you may want to check the wiring. For example, if the laser is shining on the photoresistor but the value is too low, it may indicate that there is an error with the wiring. If the value of the photoresistor when the laser is shining on it is close to 800 but not always greater than it, I would reduce the threshold. This can be done by altering line 80 in the code.
You can also check if the MKR Fox is sending messages to Sigfox successfully. First of all, if all the setup went well, you should be getting an email every time the photoresistor breaks contact with the laser.
You can also monitor the device by going into your Sigfox portal and then selecting device -> choose the device -> statistics. You should see a graph with the data sent by the device to the backend like the one below. This proves that the MKR Fox is sending data to the backend. Figure 12 shows an example of this populated graph.
Figure 12: Data received by Sigfox displayed on a graph
After all this is done, ensure to set proDebug to 0 and upload the final version of the code. Nearly there!
Step 7: Constructing the Enclosure
The last thing to do is create an enclosure to place the components in and then place inside the post box. I chose to create the enclosure out of cardboard to test it out as it was easy to bend it in order to fit inside the post box.
I would personally recommend either cutting the pieces needed to construct the enclosure out or 3D printing it out of a plastic such as acrylic. All design files are on the GitHub page as previously mentioned. Ensure you measure the dimensions of your post box and adjust the enclosure to fit them.
You will need to drill two holes into the enclosure directly opposite each other and glue the photoresistor and laser aligned. You can keep the device on while doing this, so that you have a visual representation of where the laser is shining and if it is aligned with the photoresistor. Figure 13 is a drawing of the enclosure.
Figure 13: Drawing of enclosure schematics
And that’s it, you’re done! All the components can go within the M shaped enclosure, they should be hidden in the post box.
Conclusion
I created SmartPostBox because I wanted to expand the idea of home automation to things that are outside the home such as the post box. I always found it a pain to have to go outside just to check the mail and see if I got anything. I hope that other people with this problem can implement SmartPostBox in their own lives.
I wanted to modernise the post box and empower it with IoT connectivity. I decided to create a project powered by the Arduino MKR Fox that would identify if mail was placed in the post box. I started off by brainstorming ways the device would detect the post in the post box. After a bit of thinking, I decided to use a laser and photoresistor to create a beam. The mail would come in between the laser and the photoresistor changing its reading, hence identifying the mail.
SmartPostBox
*PCBWay community is a sharing platform. We are not responsible for any design issues and parameter issues (board thickness, surface finish, etc.) you choose.
- Comments(0)
- Likes(1)
- Sebastian Mackowiak Mar 21,2023
- 0 USER VOTES
- YOUR VOTE 0.00 0.00
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
More by Andrei Florian
- PhoneLocator AbstractFigure 1: PhoneLocator’s instant responseHave you ever forgotten your phone in your friend's...
- SmartWristband Abstract Figure 1: The SmartWristband device being worn Monitor patients sent to self-isolate with t...
- Senso (Identification of Ilegal Logging) AbstractFigure 1: The Senso device attached to a treePeople are always told to recycle and turn off ...
- SmartWay (Geolocation Monitoring) AbstractFigure 1: The SmartWay device attached to the child's bag is glowing orange (meaning they ha...
- FlowerPot Monitor Abstract Growing and maintaining a flower or plant can be difficult. It takes time, dedication and c...
- Monitemp (Monitor Temperature And Humidity) AbstractFigure 1: A Monitemp device Not everyone has a thermostat in their home, and even if they do...
- SmartPostBox AbstractFigure 1: Post box powered by SmartPostBox Figure 1: Post box powered by SmartPostBox SmartP...
- MyPulse (Heart Rate and SpO2 Sensor) Abstract Now-a-days so many of us wear an array of sensors on our wrist all the time, keeping track ...
- CityGuide (Digital Tour Guide) AbstractCityGuide is a digital tour guide application which allows people to sightsee throughout a c...
- IntlAir (Air Quality Monitoring and Automatic Purification) Project Overview People spend most of their day at home, they wake up, go to work, then come back an...
- UnifiedWater AbstractFigure 1: UnifiedWater device being held above canal Yearly, over 8 billion tonnes of plasti...
-
-
-
kmMiniSchield MIDI I/O - IN/OUT/THROUGH MIDI extension for kmMidiMini
114 0 0 -
DIY Laser Power Meter with Arduino
164 0 2 -
-
-
Box & Bolt, 3D Printed Cardboard Crafting Tools
156 0 2 -
-
A DIY Soldering Station Perfect for Learning (Floppy Soldering Station 3.0)
568 0 3