Tired of checking your mailbox every day? Upgrade it to the next level and get push notifications every time you have got a mail.

This is very simple demo, planed improvements:

  • Optimize power consumption
  • Send notification when someone open the mailbox so you don’t need to check it
  • Use NFC on SmartEverything to identify who collects the mails (wife, son, daughter, dog:) – NFC tag on keyring
  • Add Sketch for Akeru or other boards
  • Ideally create small Arduino based hw prototype to be build in into mailbox for years:)

Getting the parts

  • 1 SmartEverything board (http://www.smarteverything.it)
  • 1 Snap action switch (but you can use reed switch, tilt sensor, optical gate – depends on construction of your mailbox)
  • 1 100 Ω resistor
  • (Optional) 50g of InstaMorph/ShapePlast (same thing different names) to fix the switch in right position. My old plain mailbox is build in „wall of mailboxes“ for whole house and there is lack of options how to fix the switch without damaging the other ones. If you are lucky and have just your own, definitely choose some more robust way.

Wiring

#include <Wire.h>
#include <SmeSFX.h>
#include <Arduino.h>

#define BUTTON_PIN       13  // Button
#define DELAY            1000  


char helloMsg[4]= {'M','a', 'i', 'l'};
bool messageSent;

void setup() {
    
    SerialUSB.begin(115200);
    sfxAntenna.begin();
    int initFinish=1;

    pinMode(BUTTON_PIN, INPUT);

    SerialUSB.println("SFX in Command mode");
    sfxAntenna.setSfxConfigurationMode(); // enter in configuration Mode

    do {
        uint8_t answerReady = sfxAntenna.hasSfxAnswer();
        if (answerReady){
            switch (initFinish){
            case 1:                                
                SerialUSB.println("SFX in Data mode");
                sfxAntenna.setSfxDataMode();
                initFinish++;
                break;

            case 2:
                initFinish++; // exit
                break;
            }
        }
    } while (initFinish!=3);
}

void loop() {
  
    SerialUSB.println(digitalRead(BUTTON_PIN));
 
    if(digitalRead(BUTTON_PIN) == HIGH)
    {
     
      SerialUSB.println("You have a mail!");
      sfxAntenna.sfxSendData(helloMsg, strlen((char*)helloMsg));
  
      bool answerReady = sfxAntenna.hasSfxAnswer();
  
      if (answerReady) {
          if (sfxAntenna.getSfxMode() == sfxDataMode) {
  
              switch (sfxAntenna.sfxDataAcknoledge()) {
              case SFX_DATA_ACK_START:
                  SerialUSB.println("Waiting Answer");
                  break;
  
              case SFX_DATA_ACK_PROCESSING:
                  SerialUSB.print('.');
                  break;
  
              case SFX_DATA_ACK_OK:
                  ledGreenLight(HIGH);
                  SerialUSB.println(' ');
                  SerialUSB.println("Delivered");
                  break;
  
              case SFX_DATA_ACK_KO:
                  ledRedLight(HIGH);
                  SerialUSB.println(' ');
                  SerialUSB.println("Delivery failed");
                  break;
              }
          }
    }
      delay(DELAY); 
    }
}

Code:
https://github.com/hosek/SmailBox-Sigfox-mailbox