Sensor Story Contest - Our Last Winner: Andreas Ginther with His Smart Mailbox and other Smart Home Projects

 Originally published on January 17, 2018 by Patrick Gebhardt
Last updated on March 03, 2022 • 14 minute read

We are very pleased to announce the last PRTG Sensor Contest winner: Andreas Ginther, who dealt with the topic of Smart Home and who has taken us by storm with his love of detail and excellent documentation.

For an overview of all projects of Andreas we recommend his project-based website. We had a look at all categories and were surprised and intrigued by the creative aspect of these Smart Home solutions. Now, for this short presentation on our blog, we had to choose an exemplary elaboration: We've decided to present the Smart Mailbox project, because here, his creative imagination meets an everyday problem and has been rounded off with a detailed project description.

With this clever system, it's possible to count one letter per second. No matter if a whole bunch of letters are sent on a certain day or if somebody posts a really small one - the Letter Count Sensor can't be tricked. There are two special light sensors that recognize even small letters and while the postbox is open, the sensors don't scan for letters in order. This prevents PRTG from producing inadvertent error reports.

» 

In addition to mail distribution and visual display, statistics are recorded with a network management monitor PRTG in the form of day, month and yearly graphs. The hardware is built in such a way that no radio technology is used and maximum robustness and quality is achieved.

1.png

Let's start with the hardware. As we will see, this is also the part that requires the most effort. Two light switches are used as letter insertion sensors. These emit a +12V high signal when the light beam is interrupted. The 2 sensors are still linked in the mailbox with an or-link consisting of 2 diodes in order to use only one signal line and to save an IO port. The light switches are supplied with 12V and can be adjusted. A light reflector inside the letterbox is necessary.

2.jpg 
A reed contact is used as the door sensor, which is switched by a magnet on the door lock.
3.jpg4.jpg
Digital inputs with a digital filter. The digital filter checks twice in intervals of 100ms whether the input is stable to signalize. Thus max. 10Hz signals can be acquired. The I/O computer has an http based API interface to interrogate/access the channels.
5.jpg6.jpg

For the light sensors a mono flop is necessary to stabilize a flicker / contact bruise or a too short signal through the letter slot. The mono flop generates a signal of 1 sec. during triggering. The µP driver adjusts the 12V signal for direct control of the CPU pins with 3.3V.
7.jpg
8.jpg9.jpg

In the 2nd version of the Smart Mailbox the mono flop (the µP driver) was constructed as a professional PCB. A small module to snap in to a DIN 35mm rail.
ginther111.jpg
ginther112.jpgginther113.jpg

And this is what the completed mailbox looks like: 12.jpg13.jpg

A Windows PowerShell script as system Windows task: PostBox. ps1
With the Command Invoke WebRequest The I/O controller is queried via the web interface every 500ms.
image020.png

A Windows PowerShell script as system Windows task: EMailAgent. ps1
The main program only writes registry keys whenever an e-mail should be sent.
The e-mail agent therefore runs independently of the main program and uses the registry as a queue.
This ensures that its delayed mail transmission does not interfere with the real-time query of the I/O controller.
image021.png

To bundle all resulting data and present them in a well-structured way, I set up PRTG Network Monitor using a Intel NUC Gen 5 Mini-PC, equipped with a Intel i5 CPU and SSD Storage. As the Intel NUC devices are Hyper-V ready, PRTG is running on Windows Server 2016 within a Hyper-V environment. To prevent the whole system from being shut down during power outages, everything is connected to an uninterruptible power supply.

image024.jpgThe PowerShell main program writes / increments the number of letters and door actions in the Windows registry (DoorCount and LetterCount).
image025.jpg

A PRTG Custom Sensor EXE/Script starts a VB-Script which receives the value for the number of letters and with which the graphs are generated. 

Set wshShell = CreateObject("WScript.Shell")
WScript.Echo wshShell.RegRead("HKLM\SOFTWARE\SOFTWARE64\GLAB\PostBox\LetterCount")&":OK"
 
image026.jpg 

As result:
image027.jpg

Fewer letters arrived between July and mid-August 2015:
image028.jpg

Of course, everything is always under control at any time via the PRTG Mobile App (available for Android and iOS):

image029.jpgimage030.jpg 

Because PRTG Maps are a cool visualizing part of PRTG, starting for the new year 2018, I created an overview map, where I can easily check the Letter Count and all the other annual energy usage data of the house:ginther114.png

«

 

For this project - as an example for all other PRTG Sensor projects on his website - Andreas receives a WOWOTO Mini Beamer. Enjoy it, Andreas! And because we were really overwhelmed by the numerous entries of the Sensor Story Contest, we will present you further exciting case studies of PRTG in the context of IoT. Soon on our blog and on social.