In this instructable, I am going to show you how to make a Star Wars clock with temperature display.
This is my first ever arduino project, so I am not quite familiair with it yet.
I am going to make a Star Wars Darth Vader clock, that will also display the temperature. I want the display to be off, untill you swipe your hand in front of it. After swiping, I want the display light up and show the time, temperature and date.
For this I am using the following:
- Arduino UNO
- Infrared motion sensor
- Lcd display 16x2
- DHT11 temperature senso
- A lot of wires(male and female)
- Resistor 3.3 Kilo Ohm (10K Ohm is better, but I only had 3.3K and it works)
- 50k Ohm lineair potentiometer
- 2N3904 transistor
- DS-3231 (A cheap but accurate real time clock)
- Arduino USB cable
- 9V battery
- 9V battery cable to arduino
Step 1: Laser Cutting Darth Vader Helmet
I am going to use a lasercutter to cut out the black image of darth vader. The outer lines will be cut, and everything on the inside will be engraved in the wood plate. The black image is the image I used. It is a .png file, so was very easy to work with. I used Adobe Illustrator to put the lines on the picture. After that I lasercutted it and you can see the result in the picture. It looks better than I had expected.
My first plan was to place the LCD display in one of the eyeholes of the mask, however after lasercutting the plate I changed my plan. I am going to make a wooden box, which i will also laserprint, to put the LCD display and the IR sensor in. After that i can put the breadboard, all the wires, the Arduino, etc. in the box. I will then put the darth vader mask on top of the box to make the box look better and still have a star wars look.
Step 2: Make a Case
I used www.makercase.com to make a case for my parts and the clock. I made it big enough to fit the breadboard in. In the picture you can see the measurements. I took 0,5 cm to much on the inside dimensions to make sure that it would fit.
Step 3: Setting the Date and Time on DS-3231
The best way to keep the date and time is by using an external device. I used the DS-3231 time module. It has a battery so when you take the power source away from the clock it will save the time. It is like a watch with a battery. You only have to set the time on it once.
First you have to download and install the DS3231 library.
The DS3231 has six pins.
Connect them as shown below:
SCL ---> A5
SDA ---> A4
Vcc ---> 5V
GND ---> GND
Ignore 32K and SQW, they are not going to be plugged in this case.
No resistor is needed.
Setting date and time
Now, download the file ds3231.ino and then double click on it. Arduino IDE will ask you to save the new sketch into a folder whose name will be the same used for the .ino file. Save the file where you prefer.
Go to the line 19 and uncomment it by deleting the two slashes at the beginning of the function. //setDS3231time(30,12,21,6,1,05,15);
Replace the numbers into the brackets with "seconds, minutes, hours, day, date, month, year" respectively.
Remember: The day 1 corresponds to Sunday and 7 to Saturday
The 24-hour clock is the convention used by DS3231 Upload the code.
Now, open the system monitor, you should see an output with a time, date and day.
Well done, date and time have been set!
The time you set it to will now keep counting on like a digital watch.
Step 4: Connecting Everything and Checking If It Works
Now we are going to connect the LCD display, the DS-3231 time module and the DHT11 temperature sensor to the Arduino. You can see in the Fritzing picture how I connected everything. The code I used it called Temperatuurklok. It is dutch for Temperature clock. When the IR sensor has a low output, the backlight will be off. When the IR sensor measures something, in other words something in front of the sensor moves, then it will have a high output. If the output is high the backlight of the LCD display will go on.
I will use a 9V battery as power source. I will replace this with a adapter for in the socket later on.
Everything is connected as shown in the image, I made it myself with Fritzing. My apology, it looks a bit unorganized, but it displays exactly how i put everything together.
The left pin on the LCD display is pin 16 and it counts down to 1 when you go to the right.
Step 5: Fitting the LCD Display and the IR Sensor in the Box
As you can see I measured the IR sensor and the LCD display. After that i removed the measured pieces with a wood chisel and glued them into place using a glue gun with hot glue. Connecting the wires was easy after that, the same as on the breadboard, but a few more female cables.
I have glued the Darth vader helmet to the box using an triangular piece of wood.
Step 6: Testing