In this instructable we will make a bi-color digital clock which can display the time ,temperature and date
This PIC project uses an I2C (or IIC) Real Time Clock IC (DS1307) and a four digit seven segment display to create a standard digital clock and eight small seven segment to display the date.
we will use :
-ds1307 as a real time clock.
-a lot of leds .
-small 7 segments.
Step 1: Making the Big 7 Segments
we start making the big 7 segments using our favorite color leds and glue gun
first :we start by connecting the leds as wanted (common anode/common cathode).
second:we connect all the 7 segments in parallel so finally we will have 7 wires for 7 segments and four wires for the four commons.
third :we test the new 7 segments.
finally :using the glue gun to make it look like real 7 segment .
Step 2: Connecting the Small 7 Segments
In this step we will connect all the 8 small 7 segments in parallel and finally we wil have 7 wires for the 7 segments and 8 wires for the 8 commons
don't forget to make small leds as a separation between day,month and year
Step 3: Connecting the Rtc (real Time Clock)
Making A Real Time Clock (RTC) is simple if you use a helper chip such as a DS1307 because you do not need to keep track of the length of each month or account for leap years. It is all done for you, plus you get the benefit of a battery back up system that means it won't lose the data or time when you turn off main power.
This PIC project uses an I2C (or IIC) Real Time Clock IC (DS1307).
Step 4: Attaching the Temperature Sensor
some concepts you need to Know:
ADC is an internal module used to read analog voltages in the form of a digital representation, in this project I've used 16F877a which includes a 10Bit resolution ADC module having 8 channels A0-A5 and E0-E2.
One important parameter of the ADC module is it's reference voltage (Vref), which is the maximum voltage an ADC can read, in our case Vref = 5V which is the supply voltage.
Another important parameter is the ADC resolution, which determines the minimum value of analog voltage can read (ADC Step size).
For example, our ADC is 10Bit resolution with a 5V reference, the range of voltages starting at 0V and ended by 5V is to be divided into equal steps starting at 000 and ended by 1023 (2^10 -1).
i.e. if the input voltage is 5V which is the max value, the ADC will read it as 1023, if the input was 2.5V, the reading would be 512 and so on.
The ADC step is simply calculated using the equation : Step = Vref/1024 , in our case its 4.883 mV, that's the minimum voltage our ADC can read, so:
an input of 4.883mV would give us a reading of 001
an input of 9.766mV would give us a reading of 002, and so on.LM35 Temperature Sensor:LM35 is a Three-Pins (Vcc,Output,GND) high precision temperature sensor having a resolution of 10mV/C starting at 0V (i.e. an output of 0V represents a temperature of 0C).So,10mV ---> 1C20mV ---> 2C370mV ---> 37.0C and so on.
Converting ADC Reading to Celsius degrees:
Knowing that our ADC has a step size of 4.883mV, converting our digital reading back to voltage is simply done by multiplying the digital reading by the step size:Vin (in Volts) = DigitalReading * 0.004883Now, knowing our sensor's sensitivity is 10mV/C, converting this voltage to Celsius is simply done by dividing the input voltage by 0.01, So:Temperature (C) = Vin/0.01 = DigitalReading * 0.4883
Step 5: Final Step
This is the final step where we will assemble the clock in it's final form