Interactive Valentine's Day Mailbox Counter

Stand out at work or at school with an electronically embedded box for valentines.

Favorited Favorite 0

Remember when you were a kid and every Valentine’s Day at school you would decorate shoe boxes to receive cards from your classmates? We do too, which is why we took this simple idea and stuffed it with electronics. It’s what we do. This is a fun e-crafting project that will make you stand out at work or at school!

This box is special because it keeps track of how many valentines you have received and displays that number on the box. It also celebrates each time you get a new valentine with animated LEDs.

alt text

This is possible by placing an IR transmitter and receiver on either side of the slot in your box. I made a ramp inside to guide my valentines past the IR transmitter and receiver, ensuring every note or candy is accounted for.

alt text

alt text

If you are interested in making your own Valentine’s Mailbox Counter, use the following circuit diagram to build your circuit.

alt text

Having a hard time seeing the circuit? Click on the image for a closer look.

Parts included in the Valentine’s Day Mailbox Counter

Upload the code below to your Arduino Uno once the circuit has been built.

//Language: C
//Melissa Felderman for SparkFun Electronics 
//January 31, 2018
//This program leverages code from Serial 7-Segment Display Example Code
//   I2C Mode Stopwatch
//   by: Jim Lindblom for SparkFun Electronics

#include <Wire.h> // Include the Arduino SPI library

const byte s7sAddress = 0x71;
//unsigned int counter = 9900; 
char tempString[10];  // Will be used with sprintf to create strings

int detect = 9;
int emit = 10;
int LED= 8;

int counter = 1; 
int startMillis = 0;

void setup() {

  pinMode(detect, INPUT_PULLUP);
  pinMode(LED, OUTPUT);
  pinMode(emit, OUTPUT);
  digitalWrite(LED, LOW); 
  digitalWrite(emit, HIGH);


void loop() {
  int motion = digitalRead(detect); 
  sprintf(tempString, "%4d", counter);
  if(motion == HIGH) {

    counter = counter +1;

for(int i = 0; i < 10; i++ ){
    digitalWrite(LED, HIGH); 
    digitalWrite(LED, LOW);



  else {
    digitalWrite(LED, LOW);


void s7sSendStringI2C(String toSend)
  for (int i=0; i<4; i++)

// Send the clear display command (0x76)
//  This will clear the display and reset the cursor
void clearDisplayI2C()
  Wire.write(0x76);  // Clear display command

// Set the displays brightness. Should receive byte with the value
//  to set the brightness to
//  dimmest------------->brightest
//     0--------127--------255
void setBrightnessI2C(byte value)
  Wire.write(0x7A);  // Set brightness command byte
  Wire.write(value);  // brightness data byte

// Turn on any, none, or all of the decimals.
//  The six lowest bits in the decimals parameter sets a decimal 
//  (or colon, or apostrophe) on or off. A 1 indicates on, 0 off.
//  [MSB] (X)(X)(Apos)(Colon)(Digit 4)(Digit 3)(Digit2)(Digit1)
void setDecimalsI2C(byte decimals)

Comments 8 comments

  • Thats a great project! It would have made a great sparkfun live build. Will those ever come back? I really enjoyed making the cheesy pickup lines one a few years ago.

  • A parts list would be fantastic. Thinking about making one with my niece and nephews.

  • Hi Feldi!

    Nice project!

    But thinking back to when I was in elementary school, lasers had not yet been invented, so no laser cutters. I remember getting my first transistor radio about then. (It was AM only.) Computers filled rooms. I suspect that maybe some labs were experimenting with LEDs, but they were nowhere near being ready for the masses. If I recall correctly, we didn’t decorate shoe boxes, we put our names on brown paper bags. That was back in the early 1960s…

    How far we’ve come! You youngsters would be wise to think about it sometimes. ;-) I wonder how much things will have changed when you’re more than 50 years from grade school…

    • Thanks! Glad you enjoyed it :) I suppose that’s the nature of technology, always changing! I can’t begin to fathom where we will be in ~50 years!

      • Well, Moore’s Law suggests that chips will have roughly 8.5 BILLION times as many transistors as they do today, and given that CPU chip speeds are roughly 1000 times where they were 30 years ago, we might see speeds in the terahertz region…

        I think that there will be even more stunning progress in medical fields, as long as the “Religious Wrong” (and greed on the part of drug makers) don’t get in the road. I’m suggesting that anyone who is alive (and not “on death’s doorstep”) in the year 2040 will have at least a 50% chance, no matter what their age, of seeing the 22nd century, and at least a 30% chance of seeing the 23rd century. (BTW, back in about 1995, I began predicting that sometime between 2010 and 2020, we’d be able to buy a car off the showroom floor that could drive itself. Back then, people would just roll their eyes, but with my experience in computers and electronics, I had a good idea of both the size of the problem and the rate at which computer capacity was growing. Of course today we’re on the verge of seeing autonomous cars.)

Related Posts

Why do we collaborate?

Recent Posts

Why do we collaborate?


All Tags