Extension for electronic name badge

In my last Blog in which I presented a name plate with its own scroll text, a possible application is a letterbox sign. However, I find that our display with an display of the name and the scroll text alone as a letterbox sign is somewhat underwhelmed in the possibilities.  So how about our display also displaying if the letterbox was opened by the messenger beforehand? So we can see directly "at a glance" whether it is worth opening the letterbox or not.

To do this, we just need to expand our code a little and make a small change or extension in the circuit. In addition, we need a microswitch as a contact.

Principle:

We add a microtaster, which is pushed down by the letterbox flap in the normal state and thus closes the contact. If the letterbox flap is opened, the push button also opens briefly and gives an impulse to our microcontroller, which interprets this signal as "A letter has been thrown in".

Drawing letterbox with switch

This letter icon is then displayed on the display for 12 hours:

Symbol for letter

This symbol can be used to identify you immediately when a letter has been thrown in.

The circuit is to be extended by a button (closer).


Here is the required or extended schematic:

Extended schematic

We upload the following code to our Arduino:

 

#include <LiquidCrystal.H>
#include <Avr/Sleep.H>

port 10 Normally open contact

Constants & Definitions
Const Float Warning voltage = 4.0;
Const Float Sleepvoltage = 3.2;
Const Int Scrollspeed = 700;
Const Long interval = 1000;    Definition of a Second in Milliseconds

const byte VoltTestPin = 0;  Test analog input 0
Const Byte VoltTestPin = 2; Productive Alalog input 2

Real Time Clock
Long previousMillis = 0;       will store last time was measured
Byte Seconds = 0;
Byte Minute = 0;
Byte Hour = 0;

String Defitions
String LetterBoxOwner = " Tobias Kuch ";  Please change in your own name !
String StandardScolltext = "Please don't throw in any ads or free newspapers. Thank you! -   ";
String LetterArrivedScolltext = "Thank you for delivering the mail. The recipient is notified.   ";
String BattInfo;

Program logic
Byte CharPointers[200];
Float Value;
Int Voltage;
Boolean BatteryEmpty = False;
Boolean IsSensorActive = False; In a reset, a detected high signal (open switch Ignored) is displayed if no switch is displayed from the beginning ! exized (permanent high level)
Byte Displaymode = 0;
Byte oldDisplaymode = 0;
Boolean MailAlreadyDelivered = False;
Int Switchstate = 1;
Byte DispLATextOneTime = 0;
Byte DispLATextOneTimeWASDisp = 0;
Int cmpMsgWith = 0;
Int MAMsgDC = 0;
Byte MatC = 0;     12 hours display of the "New Message" icon

Byte newChar[8] = {   0b11111,   0b10011,   0b10101,   0b11001,   0b11001,   0b10101,   0b10011,   0b11111
};

LiquidCrystal(rs, enable, d4, d5, d6, d7);
LiquidCrystal Lcd(8, 9, 4, 5, 6, 7);

Void InitLcdScreen ()
{   Lcd.Clear();   Lcd.setCursor(0, 0);   Lcd.Print("++ Letterbox ++ ");   Lcd.setCursor(0, 1);   Lcd.Print(" tobias.kuch at");   Delay(2000);   Lcd.setCursor(0, 0);   Lcd.Print(LetterBoxOwner);   Lcd.setCursor(0, 1);   Lcd.Print(" googlemail.com ");   Delay(3000);
}

Void Setup()
{   for (Int A = 0; A < 200; A++)   {     CharPointers[A] = A;   }   Lcd.createChar(0, newChar);   Lcd.Begin(16, 2);              start the library   pinMode(10, INPUT_PULLUP);             for new Mail arrival Detection LOW: Flap to HIGH: flap open   Switchstate = digitalRead(10);   InitLcdScreen();   analogReference(Default);   If (!Switchstate) {     IsSensorActive = True;   }
}



Void NormalScrolltext ()
{   Int cmpMsgWith = StandardScolltext.length() - 2;   Displaymode = 0;   delay (Scrollspeed);   lcd.setCursor(0, 1);   for (int a = 0; a < 17; a++)   {     lcd.print(StandardScolltext[CharPointers[a]]);   }   for (int a = 0; a < cmpMsgWith; a++)   {     CharPointers[a] = CharPointers[a] + 1;     if (CharPointers[a] > cmpMsgWith) {       CharPointers[a] = 0;     }   }
}

void BatteryWarningScrolltext ()
{   BattInfo = "- Achtung! Batteriespannung: " + String(Voltage * 3) + " Volt. Bitte Akku aufladen. - " + StandardScolltext + "  ";   int cmpMsgWith = BattInfo.length() - 2;   Displaymode = 2;   delay (Scrollspeed / 2 );   lcd.setCursor(0, 1);   for (int a = 0; a < 17; a++)   {     lcd.print(BattInfo[CharPointers[a]]);   }   for (int a = 0; a < cmpMsgWith; a++)   {     CharPointers[a] = CharPointers[a] + 1;     if (CharPointers[a] > cmpMsgWith) {       CharPointers[a] = 0;     }   }
}


void LetterArrScrolltext ()
{   int cmpMsgWith = LetterArrivedScolltext.length() - 2;   Displaymode = 3;   delay (Scrollspeed - 50 );   lcd.setCursor(0, 1);   for (int a = 0; a < 17; a++)   {     lcd.print(LetterArrivedScolltext[CharPointers[a]]);   }   for (int a = 0; a < cmpMsgWith; a++)   {     CharPointers[a] = CharPointers[a] + 1;     if (CharPointers[a] > cmpMsgWith)     {       CharPointers[a] = 0;       DispLATextOneTimeWASDisp = 1;     }   }
}

void Powerdown ()  // Toggle Powerdown, if critical Voltage is reached.
{   lcd.setCursor(0, 1);   lcd.print("                  ");   lcd.setCursor(0, 1);   lcd.print("Sys in SleepMode ");   set_sleep_mode(SLEEP_MODE_PWR_DOWN);   cli();   sleep_enable();   sei();   sleep_cpu();   //restart
}

boolean BattWarning ()
{   value = analogRead(VoltTestPin);    // read the input pin   value = value  * 0.00488;   if (value <= Sleepvoltage) {     Voltage = value;     Powerdown();   }   if (value <= Warnvoltage) {     Voltage = value;     return true;   }   {     return false;   }
}

void runrealTimeClock()
{   // Real Time Clock & Countdown   unsigned long currentMillis = millis();   if (currentMillis - previousMillis > interval)   {     previousMillis = currentMillis;     // Countdown     // Countup 24 St Hr.     seconds = seconds + 1;     if (seconds > 59)     {       seconds = 0;       minute = minute + 1;       BatteryEmpty = BattWarning ();       if (minute > 59)       {         minute = 0;         if (MatC > 1) {           MatC --; //Anzeige der des Nachricht Symbols         }         hour = hour + 1;       }       if (hour > 23)       {         hour = 0;       }     }   }
}

void ChangeDisplayMode()
{   if ( Displaymode > oldDisplaymode )   {     oldDisplaymode = Displaymode;     for (int a = 0; a < 200; a++)     {       CharPointers[a] = a;     }   }   if ( Displaymode < oldDisplaymode )   {     oldDisplaymode = Displaymode;     for (int a = 0; a < 200; a++)     {       CharPointers[a] = a;     }   }
}

void DisplayMailArrivedSig(boolean trzstat)
{   byte custHeartChar = 0;   if (trzstat)   {     lcd.setCursor(15, 0);     lcd.write(custHeartChar);   } else   {     lcd.setCursor(15, 0);     lcd.write(" ");   }
}

void NewLetterArrivedCheck()
{   int inPin = 10;   Switchstate = digitalRead(inPin);   // if (Switchstate && ! MailAlreadyDelivered)   if (Switchstate == true )   {     MailAlreadyDelivered = true;     DisplayMailArrivedSig(true);     MatC = 11;  // Mail Arrived Zeitanzeiger (Vorladung)     // MAMsgDC = LetterArrivedScolltext.length();     DispLATextOneTime = 1;   }   if (MatC == 1)   {     DisplayMailArrivedSig(false);     MailAlreadyDelivered = false;     MatC = 0;     DispLATextOneTime = 0;     DispLATextOneTimeWASDisp = 0;   }
}

void loop()
{   runrealTimeClock();   if (!BatteryEmpty)   {     if ( DispLATextOneTime == 1 && DispLATextOneTimeWASDisp == 0)     {       LetterArrScrolltext ();     }     else     {       NormalScrolltext ();     }   }   if (BatteryEmpty)   {     BatteryWarningScrolltext ();   }   ChangeDisplayMode();   if  (IsSensorActive) {     NewLetterArrivedCheck();  // test if a new letter was arrived if so, mark //it in Display for next 12 Hours   }
}


 

Dieses und andere Projekte von mir findest du auch auf meiner neuen GitHub Seite.

Viel Spaß beim Nachbauen und bis zum nächsten Mal.

DisplaysFor arduinoProjects for advanced

3 comments

KoPP

KoPP

Nette Menschen könnten auch noch ein “Danke lieber Briefträger” ausgeben.

Flo

Flo

Gute Idee, aber ich werde das noch etwas erweitern:
Wenn wir noch einen zweiten Mikroschalter einsetzen um die “Entnahmeklappe/Briefkastentür” zu überwachen, kann man damit das Briefsymbol wieder löschen und es öffnen nicht alle Bewohner den Kasten, wenn sie nach Hause kommen. Wir vermeiden so die “Enttäuschung” der zweiten und dritten Heimkehrer…
Viele Grüße Flo

Arnold Schommer

Arnold Schommer

Den Brief einfach fix für 12 Stunden anzuzeigen ist eine pragmatische, einfache und damit wenig fehlerträchtige Lösung.
Ich hätte vielleicht einen Taster eingeplant, mit dem die Anzeige dann gelöscht wird. Sei es, dass man den zweiten Taster beim Entnehmen des Briefes drückt oder dass er – wenn das “baulich” geht – das Öffnen des Briefkastens “erkennt”. Aber dabei kann halt einiges “schief gehen”.

Leave a comment

All comments are moderated before being published

Recommended blog posts

  1. Install ESP32 now from the board manager
  2. Lüftersteuerung Raspberry Pi
  3. Arduino IDE - Programmieren für Einsteiger - Teil 1
  4. ESP32 - das Multitalent
  5. OTA - Over the Air - ESP programming via WLAN