Featured on the blog
Featured on the blog

Update 4.6.2015

The code was unfortunately missing again due to some server problems.

I put everything up on github instead.

you can see the Arduino code there !

Update march 2014

Fixed a broken link for the download of the code. also wrote about the Valentineduino project in february.

Check it out here

Update December 2013: featured this little gift in after i published it on my blog in february 2011.

Just want to tell that i updated the box just after that with a Realtime clock module so the box didnt have to go online to get the NTP clock all the time.

The box still sits in the corner of our bedroom and everything is still running perfect. I even bought a spare battery and stuffed it in there so i have a spare, when the RTC runs out.

Every aniversary-day it flashes a hidden textmessage to my wife (yes, we got married).

I also fixed the code so when the days goes past 9999 (the maximum digits on the display) it starts showing weeks we have been together instead.

The code i used is now shared in its full on the bottom of this page in a packed rar file.

Disclaimer, i have not cleaned up the code, or explained very good every function but i hope you can use some of it anyways.

The code also contains some reporting of sensordata from the DS18B20 Temperature sensor and the light sensor on the back side of the box to my logging system via RF.

You can just remove those parts of the code..

Here is the url to Hackaday post about the box.

-End update

februar 2011 056

February 14, 2011

So valentines day came up sooner than I managed to plan something special, and before i knew it I needed a little something for my girlfriend.

One of my favourite things to do is make gizmos and so i looked around my workbench after something to make and found a sparkfun serial 7 segment display (red), a sure electronics radio module, and a wooden chest box i bought some time ago.

I decided to make her a little box with a display that reads out the number of days we have been together and so the quest begun.

valentines dag gift - The day counter
arduino valentines day

check out the rest of the photos of the project here.

I started this project saturday night and valentines day was on monday 14. so i had a hurry.

I opened up another arduino pro mini 5v from Sparkfun, soldered on some headers to connect the ftdi basic usb chip and started programming and learning the arduino time library to get it to do what i wanted. After some brilliant support from the forum i got a little code snippet working that checked the unixtime i set manually at the setup section (since i was missing a rtc time clock module) using a command from the time library.

Bill of materials :

wooden box  10 $ at some store

arduino pro mini 5v  19$

power barrel jack conector 1.25$

a little veroboard to make some power connections to everything 4$  at random hardware store

ftdi basic breakout usb 15$ to program the arduino

7 segment serial display red  13$

2 pcs of rf module of some sort  30$ if you want it to go wireless to a ethernet shield or something

if i had the part i woud probably just insert a rtc time clock module instead to make the project easier, so you might want to consider that.

so about a 100$ worth of gizmos will get you there…

youll also need some paint, some random tools to make things easier for you like a and solder station and maybe a dremel tool to cut out the wooden box and such.

check this link for a working code snippet test that i refer to here,52102.msg371666.html#msg371666

(thanks for the help robtillaart on the forum! ) .

I’ll try explaining a bit of the code i wrote here.

adjustTime(1297641590); //sets the time library unix time to that spesific startup time to test

and used a online unixtime calculator to get the time we got together.

unsigned long theDateWeGotTogether = 1194220800    ; //unixtime

unsigned long days ;

and did a calculation i loop.

days = ((now() – theDateWeGotTogether) / 86400); //magic number 86400 is the number of seconds in a day

Then i used serial.print to display the number of days


//code example end

So at this point i knew it was working properly but i had a problem. Since i was missing a realtime clock module to let the arduino know the excact time i took it a bit further. I was allready having another arduino with a ethernet shield connected to the network at home and it was also connected to a radio module and could both broadcast and recieve commands via rf. So i quickly decided that i would make this box a part of that network and installed the sure electronics rf module in the box.

Next problem was getting the ethernet shield to get the network time protocoll time from a time server online and broadcasting it to the valentines gift box.

Luckily i had allready set that up for my other projects (arduino weather station sensor system ill write about later).

To get the ethernet shield working with ntp time you can check this thread.,51417.0.html

So i was allready broadcasting unix time to every rf module in my house once a day and could use that for the project.

For those of you that would try to build this project it would probably be easier to just use something like this.

So now i had the unix time shipped out to the valentines box and just needed to parse the unix time string i got laying in my char [] cmdBuffer ;  down to a integer.

unsigned long unixTime;

sscanf( cmdBuffer, “%lu”, &unixTime );

then i did     adjustTime(unixTime);

So now i just hooked up the serial 7 segment display to 5v+ and gnd and the rx to an digital output (output 5) on the arduino pro mini and stuffed in the newsoftserial library to use a extra set of serial rx tx.


NewSoftSerial nss(4,5);

then to display the information stored in days i did

nss.print(“w”); // to remove all dots on display

nss.print(“v”);  // to blank out the display

if (days<=9999 && days>=1000)





if (days<=999 && days>=100)






if (days<=99 && days>=10)






if (days<=9 && days>=0)






The reason for doing that is that the sparkfun serial display expects having 4 and 4 digits written to it to show them of at  the right place in the display.

if you send 1 digit, wait and send 3 more, the 3 last digits will just show after the first one in the same display and that sucks a bit if youre planning to get something readable out of it.

So after getting the code quickly working i started working with my dremel on the little wooden box and made some holes for the display, a power plug, and the rf module antenna. Then i painted it and inserted all electronics and used a bit of hotglue to mount it firmly to the box. I used some white plastelina to fill in the horible gaps next to the display i made in the top when i carved it out and painted it again. put some hearts on with some red paint and tested it out. Works like a charm.

Yes i know this project will only tell the days about 27.3 years ahead because of the 4 digits and maximum of 9999 days but i thought it might be cute and when the need is there for a bigger counter in 27 years ill make a bigger one🙂

By the way. This thingie also tells me the temperature where it is up to my weather station php sensorproject so it actually doubles as both a valentines day gift and another temp sensor in my sensor network.

i know i might be rushing through this project right now but ill post the full code, more pictures and schematics as soon as i get some more time to do it. Right now i need to go eat some desert with my girlfriend. Its still valentines day!

A big thanks to Thomas T1, Plumbo, the people at arduino forums and all the other inspirations out there !

— Here is the entire code, it also uploads temperature and light sensordata via a radiomodule. You probably dont need that part.>/A>Download the rar file here

Right click and save as..

Its stuffed into a RAR file, you can use winrar (its free), to unpack it. Link to the Winrar software here.

link to winrar here (right click and save as).

Unpack the project into your Arduino projects folder. Make sure you have the dallas temp sensor library if you want to use that part.

24 thoughts on “Valentineduino

    […] Valentineduino Building a UV photoresist box → […]

    […] Paulsen] dug deep down to the romantic geek at his core and built this box that counts the days he’s spent together with his Valentine. As you can see, it uses a four-digit seven segment display installed in the lid of a wooden box. […]

    […] Paulsen] dug deep down to the romantic geek at his core and built this box that counts the days he’s spent together with his Valentine. As you can see, it uses a four-digit seven segment display installed in the lid of a wooden box. […]

    Andrew said:
    February 18, 2011 at 9:50 pm

    Very nice. It is a little unfortunate it requires the external power and antenna.
    Perhaps a simpler battery powered version with discreet buttons for manually setting the date when required.

      Edwin said:
      February 22, 2011 at 6:09 pm

      I agree with Andrew, i would not mind one without the power supply or antenna. Something i could just input manually when i change the battery. Great idea though.

    paul said:
    February 19, 2011 at 3:43 am

    My name is Paul and I am the admin of a site called HackHut. You obviously have a lot of skill, and I just wanted to let you know about HackHut because it seems like a perfect fit for you. We are a hosting service somewhat like wordpress, blogspot, or Instructables accept run by and geared toward the hacker/DIYer. We offer or are working on features that people like you want and can use. I hope you check us out and feel free to contact me there if you have any requests for features or questions about the site.

    […] Paulsen] dug deep down to the romantic geek at his core and built this box that counts the days he’s spent together with his Valentine. As you can see, it uses a four-digit seven segment display installed in the lid of a wooden box. […]

    Edwin said:
    February 22, 2011 at 6:37 pm

    I just want to say that after spending another hour looking into this, how are you the only person who has this concept. There is a food counter that counts up to 99 but thats no good. Gonna have to bookmark this for future build.

    nilsontag said:
    November 6, 2011 at 4:04 am

    What is this site?

      vegardpaulsen responded:
      November 7, 2011 at 3:11 pm

      This is a blog about making stuff and some about new technology. Updates from time to time.

    Tracy said:
    January 27, 2012 at 6:39 am

    Hi there! I wanna make something like this for my boyfriend for Valentine’s Day but I’m still very new at Arduinos. I was thinking of using battery power and an rtc time clock to update it a bit since I have the luxury of time and have to order bits anyway. Do you have any tips for a newbie? (like really new?)

      vegardpaulsen responded:
      January 27, 2012 at 8:52 am

      Hi Tracy.
      The last version of this box actually uses a RTC real time clock module from sparkfun.
      If i get some time to spare soon, i will put out some new information on the blog so you could build one easily.
      I would still recommend using a power adapter, as this box likes being on all the time🙂

      You can start buy buying these products.
      DeadOn RTC – DS3234 Breakout
      Arduino Pro Micro – 5V/16MHz
      (this is different from the pro mini i used, as they now have a small arduino with FTDI chip on it instead)
      Coding is still the same.
      7 segment serial display (choose the colour yourself! )

      You will need to solder some cables, and be comfortable with uploading code with the arduino IDE software.
      I will publish the code that works and hopefully a working shcematic later so you can wire it up easilly!
      Ill let you know!

        Chris said:
        January 25, 2013 at 9:06 pm

        Hi! Don’t know how I came here, but it’s a nice thing you hacked together. I also think, that the external power supply is the best way.
        BUT – if someone needs it, he should sit down and think how to get it😀

        If I would build one of these, I’d think about a lock mechanism, that opens the box on this cerain day…. with a servo or so🙂


    […] Een uitgebreide beschrijving met arduino-code vind je op het blog van Vegard Paulsen. […]

    […] a really sweet project from Vegard Paulson featuring all the code you’ll need to make this […]

    Stefan said:
    March 17, 2014 at 12:57 am

    hi i think the rar file was deleted. is it avialable somewhere onlie?

      vegardpaulsen responded:
      March 20, 2014 at 12:55 pm

      I will upload it to a ftp now and relink it!

    jayuk said:
    July 8, 2014 at 8:53 pm

    Hey! I just wanted to say thanks for the inspiration! I built my own ValentineDuino earlier this year for my wife and I’m just writing up the project now over at

    It’s still private, as it isn’t finished but it will be visible here soon:

    Thanks Again!

    Mike said:
    February 5, 2015 at 1:52 pm

    Love this project! Did you ever upload the updated code that uses the Ds3234? I am having a hard time getting this to work😉


      vegardpaulsen responded:
      February 6, 2015 at 9:20 am

      Hi Mike, yes i did upload the latest code some time ago. Let me know if you cant get it working

        Mike said:
        February 7, 2015 at 11:56 pm

        Hey. Thanks for the reply. I guess I’m having a problem with the newsoftserial stuff. It doesn’t seem to be compatible with the new arduino ide. I’m still fairly new to arduinos I am trying to piece it all together. I’m using a ds3234 a 5v pro micro and the 7 segment display.

    […] your relationship keep getting better with years? Well, this interactive box will help count the days you’ve spent with your special someone. The project itself uses a […]

    Kani Poly said:
    February 15, 2015 at 2:23 am

    I love this project so much. I hope I can make it.

    […] your relationship keep getting better with years? Well, this interactive box will help count the days you’ve spent with your special someone. The project itself uses a […]

Leave a Reply

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

You are commenting using your 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 )

Google+ photo

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

Connecting to %s