Circuit Complete

I skipped a great deal in the process, but now I will outline the circuit construction. The entire circuit has been soldered and works quite well. A link to pictures is posted below [1]_.

Main clock timer The clock consists of multiple parts that perform different functions. A 1Hz pulse is generated by a 555 IC [2]. This frequency is obtained with resistor values of R1 = 10k and R2 is approximately 680k and a capacitor of C1 = 10 microfarads [3]. Resistor R2 contains a variable resistor, allowing fine tuning of the 1Hz pulse. It was quickly noticed that using this oscillator, as well as the microcontroller oscillator, causes instability in the main power supply. Therefore, a decoupling capacitor of 5 microfarads was placed between Vcc and ground for both the 555 and the microcontroller. In parallel with the decoupling capacitor is a blue LED in series with a 4.7k resistor. Aside from discharging the capacitor when power is removed, this provides for a "Power On" indicator. A red LED in series with a 4.7k resistor is connected to the output of the 555, providing a flashing second light.

Microcontroller The 1Hz pulse is connected to TIMER0 on the microcontroller. Here a Microchip 16F870 microcontroller(uC) is used [4]. Since neither processor speed nor timing accuracy (in terms of the uC) is an issue in this application, an RC oscillator is used for the uC's timing. In this case, the RC frequency is 2MHz. A reset button is connected to the reset pin of the uC. Also, a switch is connected to PORTA<0>, toggling the use of Hexadecimal or Octal with the 7-Seg display. This switch and the reset button are connected to the circuit with a connector so that they may be permanently connected to the project box. The remaining PORTA pins are connected to a header at the bottom of the circuit board. PORTC pins drive the LED and 7-Seg displays, see below. PORTB is connected to a set of dip switches, acting as input for the uC. For a list of commands, see the software description [5].

TIMER0 interrupts after counting 60 pulses. During every interrupt, the minutes are incremented. The minutes, hours, date and alarm time are stored in RAM. If necessary hours are incremented, as well as date when applicable. The number of days in each month is found with a lookup table. Year is not handled. An alarm time may be set, upon which the 5th bit on PORTA is set to high until the next minute occurs. A separate circuit could be connected to this at the header at the bottom of the circuit. The EEPROM is currently unused.

Display LED and 7-Seg displays are run in parallel. The LED display always indicates the time in binary, with the hour on top. Each column of LED's is connected to one of the lower 6 pins of PORTC. With the use of transistors as switches, the row is selected based on the logic value of PORTC<7>. The entire LED display is turned on or off with PORTC<6>. PORTC<6> acts as an inhibit for the 7-seg display.

The 7-seg display consists of two dual 7-seg displays. Each corresponding segment in the pair is connected to the same transistor emitter in a set of NPN transistor switches. The base of each transistor is connected to the output of a 4514 Multiplexer, with the collector pulled up to Vcc. The lower 4 pins of PORTC act as an input (or address) for the multiplexer, with PORTC<6> connected to inhibit. The entire display is then multiplexed with the left (hour) and right (minute) display using pins PORTC<7> and PORTC<5>, respectively, as a current sink. Since the duty cycle of each segment is quite low, a decent amount of current is allowed to flow through each segment. For this current, a 100ohm resistor connects the cathode of each display to the corresponding uC pin. This is not a problem since the uC can sink or source 25mA. Adequate current is necessary for good visibility.

Power Supply and Output The entire circuit is made to run on 5VDC. Power is connected with a 4 pin header. One pin is +5V and two middle pins are ground. The other pin and other row of the header is unused. This method was chosen so that a 4-pin computer power supply cable could be used, with the +12V connection unused. Now the clock can be connected to either a computer power supply, or a custom cable which was made with a power supply connector and a USB-A connector. As the circuit runs on 5VDC, logic levels on the header at the bottom of the circuit board are 1 = +5V and 0 = Ground. These pins are directly connected to the uC; therefore proper resistance and/or circuit protection should be used when connecting to the header, as the uC can only sink or source 25mA. This includes the 1Hz clock pulse connected to one pin of the header. Though the 555 IC can source more current than the uC, it has limits as well.


Return to Categories