Welcome to this instructable. Have you ever invited a friend or family member to your house on their birthday and wanted to wish them in a new way??? This instructable is about building an Arduino based system which plays happy birthday to you song and displays a message on an LCD. It is very easy and it took only an hour to build it.
Step 1: Materials
The list of materials are:
1x Arduino board
1x 20x4 LCD(you can use other LCD's also)
1x HC-SR-04 ultrasonic sensor
1x Piezo buzzer
And a lot of wires
Once you have all of these,
Lets get started
Step 2: Connect the HC-SR-04
I used the ultrasonic rangefinder to detect whether the door is open or not. A lot of info is available about this device on the internet. Connect the Vcc and Gnd of the sensor to 5v and Gnd. Wire up the Trigger to A0 and Echo to A1. Then download the library(borrowed from another instructable by Ardumotive_com. A special thanks to him.) and test the code below.
Step 3: Test the HC-SR04
Once you are done connecting burn the sketch into your Arduino and open the Serial Monitor. The readings are in cm. You will notice that the readings are unstable. This MAY be because the sound waves from the sensor spread out and detect different objects in many places giving an unstable reading( It is just a theory of mine and i am not sure whether it is true). Try to keep your hand above the sensor. If you keep your hand 10 cm above it, it may show readings between 8 to 12. It is not an issue to worry about in this Instructable.
Step 4: Connect the Piezo Buzzer
Wire up the positive terminal of the buzzer to pin 9 of Arduino and the other wire to Gnd. Simple.
Step 5: Test the Buzzer
, copy the program and burn it to the arduino. You must hear the happy birthday song if working.
(A huge thanks to onglityit)
Step 6: Connect the LCD
Here comes the most painstaking step (only if you don't have an LCD shield), wiring up the LCD. I used a 20x4 lcd(you can use others like the popular 16x2 but will have to change the code) and 2 dozen male-male and female-female breadboard wires. I also had to use a breadboard for the positive and negative terminals
RS to pin 12
E to pin 11
D7 to pin 4
D6 to pin 5
D5 to pin 6 and
D4 to pin 7
If you are a beginner to LCD's read the datasheet before starting.
Step 7: Test the LCD
In the Arduino IDE go to File>Examples>LiquidCrystal>Autoscroll.
When the sketch opens, change LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
to LiquidCrystal lcd(12, 11, 7, 6, 5, 4); and hit upload. If the LCD works, go to the next step.
Step 8: How Do We Do It??
The ultrasonic sensor is mounted in a place near the door so that when the door is open, it's distance to the sensor is less than 20 cm. So when the door is opened, the Arduino gets the distance as less than 20 cm and it prints a message of your choice and plays the song.
Step 9: Finishing Touches
Burn the program into your Arduino
Keep the system in a place such the one in the photo above. In the program the number of characters in the message(including spaces)must be equal or less than 20 in 20x4 LCD and less than or equal to 16 in 16x2 LCD.
There is also a full circuit diagram.