Internet Of Mailbox

IMG_20160620_122928b

Abstract.

This post summaries the test I made to produce a mail presence sensor. It is aimed to be wireless, connected to the Pilogger logging station. It is interesting to use a load cell in order to know the weight of the object in the mailbox. But we will discuss the difficulties to implement a reliable solution.

The sensor.

IMG_20160508_174323

Figure 1 – NTC inserted in the load cell

It could be found very cheap load cell on Ebay, with a small board featuring a 24-bits ADC. The ones I used for this test is a 10Kg cell with a HX711 board.

As the principle of sensing is based on the physical deformation of the metallic rod, the system is affected by temperature change. So I decide to use a thermistor (NTC), placed directly within the metallic rod, by placing it in a small drilled hole. (Figure 1, on the left)

The electronic

The HX711 is an interesting chip for its price range. It is design to measure very tiny resistance change using a Winston bridge. It have two channels, one with two gains (64 and 128) and another with a fixe 32 gain. While the first channel is connected to the load cell, the second one is perfectly usable for measuring the thermistor. To do so we have to do another Winston bridge including this thermistor. (Figure 2, on the right)

schematics01

Figure 2 – Wireless mailbox probe schematics

I chose to use the same micro-controller and RF link as the previous wireless temperature probe. In other words, a PIC16F1825 and a nRF24l01+. The difference is the HX711 module and a voltage regulator. The HX711 needs a stable 3.3V, and then I use an analog input of the PIC to have a battery voltage information.

Code.

The micro-controller code is rather simple as well, it sleeps for around 8 seconds, then sequentially get 8 values of HX711 channel ‘A’ and average them, the same for channel ‘B’, then get the ADC value of the battery, and finally send the data with the nRF24l01.

The XC8 C compiler file for the PIC16F1825 is here in Github.

Installation.

I fixed one end of the load cell directly to the mailbox bottom, and the other end to an aluminium plate of approximately the surface of the box. For the tests, I just fixed the proto board on a side with tape, and the battery below.

Tests and data.

The system is surprisingly sensible, a letter is clearly visible on the weight data.

But sensitivity is not precision. And things start to be more complex when I try to figure out how to calibrate the system. There is a link between temperature and weight data, but not only. The entire mechanical system plays a role.

mailbox01b

Figue 8 – One month of data

Figure 8 shows a complete month of temperature and weight data, with arbitrary units (ADC output). While points marked with ‘1’ are the time where a letter was on the plate, the others are interesting. Point ‘3’ shows that a heavy parcel was kindly placed in the box by the postman. But after that, the weight base line did not recover to the same value. Apparently a mechanical bias appeared, it could be a permanent distortion of the load cell.

I could not fully understood the events marked as ‘2’. These drops should reflect a resistance change, so I imagine it could be linked with humidity and water condensation. It seems it disappeared once I cover the HX711 pins and copper tracks with varnish.

I tried to establish a correlation between the temperature values and the weight values in order to compensate the changes. As the event ‘3’ put an offset I have two data groups. I agree the data looks funny, and it is hard to see a true correlation. (Figure 9&10) We could barely see a kind of exponential curve such as Weight = a + b. Temp², but not enough to compensate correctly.

Conclusion.

MB_battery

Figure 11 – Battery discharge in volts

To summarize, the concept is clearly working. I first though the battery would not last so long, but event not fully charged, the 4000mAh li-ion is still alive after a month. (Figure 11).

The HX711 used strait out of the box without shielding gives quite good results. On the 24bit resolution, around 19 to 20 are out of noise, which is remarkable for such a draft system.

As it is, I have at least an idea if there is something present (and roughly how big) in the mailbox, and this everywhere I could have an internet access. To be continued !

Creative Commons License

8 thoughts on “Internet Of Mailbox

  1. Pingback: The ‘Internet Of Mailbox’ Knows When You’ve Got Mail #IoT #IoTuesday « Adafruit Industries – Makers, hackers, artists, designers and engineers!

  2. Richard

    I was wondering how your project went. I have been trying to do the same thing, detect mail presence. I was not interested in detecting just delivery (or opening of the mail box). I wanted to have a stateful tracking on the mailbox without the need for manual intervention, I.e. resetting after emptying the mail box. BTW, I am in France and have the same “boîte aux lettres” as you.

    I tried distance measurement, and light reflectivity and neither gave me the resolution I needed. My next step was to ret photo recognition, but that seemed complex so I decided to use the same approach you have used. I used a 5kg shear load cell (similar to yours) and a Phidgets Wheatstone Bridge. The resulting sensitivity was fine, well 4 grams (Though I could end up changing that after some real world experience). Any increase in weight > 4g is assumed to be the arrival of something in the box. Likewise, any drop >4g is assumed to be an emptying of the box. I could also make the “empty” threshold dynamic by having it be equal to the first increase event.

    I also tried to make this a bit more flexible and rather than attaching the load cell directly to the mailbox floor, I attached it to a ceramic tile (approx 34cm x 20cm). That allows me to reposition the load cell easily. I also used a thin, rigid plastic panel, I think it was Forex, instead of aluminum. Since my load cell was only 5kg, I didn’t want to bias it too much with the weight of the platform. Also, the forex was easier to work with. However, I can easily change to aluminum if I want to do so later on. BTW, like you, I also positioned the load cell at the back of the mailbox and let the front of the platform rest on the floor at the front of the mailbox.

    Thank for your notes. They were quite helpful in encouraging me to give this a try.

    Reply
    1. pierremuth Post author

      Hi Richard,
      Thanks a lot for your nice words !
      I’m still using it as it is at the end of the post. I didn’t spend a lot of time to make a base-line rejection code to get rid of the temperature drifts. So I’m looking at the curve itself and can deduce if there is something light or heavy in the box if I see a transition.
      You had a good idea, it is very wise to use a ceramic tile and a plastic plate, you then mechanically decouple the load cell from the box, which I see moving a lot with the temperature, wind, rain etc…
      The battery is still holding around 5 months, I’m relieved to not had to put a wire to the box.
      I’m happy these humble notes helped you a bit !
      All the best for your project and have a nice day!
      Pierre

      Reply
      1. Richard

        I have an update. After 2 months of use, because of the temperature instability I was unable to completely rely on the system to determine when the mailbox was empty. I could easily detect the arrival of something, even a postcard, by the sudden increase in weight. However, without a reliable zero reference, determining empty was harder. Also, I was getting bounce when mail was removed that caused a spike up, and then down again.

        But, I found a solution. I bought one of these: https://www.ebay.fr/itm/Stamps-com-5lb-USB-Model-510-Postal-Scale-BRAND-NEW-IN-BOX/303137517165?hash=item4694676e6d:g:pYUAAOSwpXZcxKik This scale is just $10 if you sign up for stamps.com (only in the US). Even if you quit their service, you can keep the scale. So, there are a lot of them available. OTOH, they are fairly hard to find in France, and more expensive because they have to be shipped from the US.

        This scale comes with a wheatstone bridge and no display. But, there is a USB interface, which also provides power. Then, using software I found online: https://github.com/erjiang/usbscale I just run a loop and check the reading once a minute. If sit is >0, I have mail. = 0, the mailbox is empty. So far, no issues with temperature instability. The only real issue is granularity. the smallest weight it will measure is 0.2 oz (about 5.6 grams). So, it may miss a single postcard.

        BTW, I discarded the scale’s case and mounted my own platform directly to the load cell in the scale. It might be possible to make this wireless, but it would take some work.

  3. Richard Perlman

    After 2 months my hacked Stamps.com scale continues to work quite well. However, I have now found what may well be a better way – and tested this with a scale built to measure the level of butane in a tank. Instead of using a single load-cell, I used 4 half-bridge load cells. For the butane tank project I used 50kg cells (overkill). But, for mail I think 3kg cells would be more sensitive. Like these from amazon.com: https://www.amazon.com/dp/B07NR7KVB2/ref=cm_sw_em_r_mt_dp_U_2ldtDb2SCY8XV Note, amazon.fr only seems to have the 50kg version. The 4 cells are wired together and then the whole set is connected to the bridge (HX711, etc,). I can provide the wiring diagram if needed. I think these simple load cells would be more temperature stable and using 4 would make a better platform as well.

    BTW, I have found one, minor, problem with my mailbox system: Sometimes the newspaper delivery person leaves the paper hanging in the entry slot so it doesn’t touch the floor. I may add a microswitch or maybe just a pair of contacts to detect an open entry slot.

    Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s