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.
Adafruit.com also wrote about the Valentineduino project in february.
Check it out here
Update December 2013:
Hackaday.com 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.
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.
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 arduino.cc 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$ http://www.sparkfun.com/products/9218
power barrel jack conector 1.25$ http://www.sparkfun.com/products/119
a little veroboard to make some power connections to everything 4$ at random hardware store
ftdi basic breakout usb 15$ http://www.sparkfun.com/products/9716 to program the arduino
7 segment serial display red 13$ http://www.sparkfun.com/products/9766
2 pcs of rf module of some sort 30$ if you want it to go wireless to a ethernet shield or something http://www.sureelectronics.net/goods.php?id=1053
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
(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.
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. http://www.sparkfun.com/products/10160
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.
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.
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.