Thursday, February 29, 2024

Multifunction Rechargeable Digital Clock

Abhishek Kumar is B.Tech in electronics and instrumentation. His interests include embedded systems, software programming and instrumentation

- Advertisement -

You need to declare subroutines to clear 7-segment displays, read RTC chip, display value setting, etc. After this, configure the ADC to run in single-mode with auto prescaler and internal 2.56V reference. Configure the directions of input-output ports and initialise them. Then configure I2C pins and initialise them.

Next, initialise timer0 for multiplexing the 7-segment display, timer1 for handling the alarm duration and timer2 for blinking the segments while the clock is in ‘Settings’ mode. After this, declare and initialise certain variables for ADC calculations, time seeking, etc. Then initialise I2C pins, read EEPROM contents for alarm values and initiate an infinite super-loop where the RTC chip registers are read and displays are updated continuously. Also in the same loop, the user inputs are acknowledged and associated events like setting alarm on/off and displaying date-time are initiated. Also, the current time is compared against the alarm variables and alarm is initiated when the time is matched.

Download source folder

Note that while burning the hex file solarclock.hex to the microcontroller, the EEPROM file solarclock.eep must also be programmed. At EFY Lab, PROGISP programmer was used to program solarclock.hex and solarclock.eep. Fuse bits should be D9=high and E1=low as shown in Fig. 7.

- Advertisement -
Fuse bits
Fig. 7: Fuse bits

The Digital clock


As mentioned earlier, the digital clock can be charged from solar power as well as AC mains power. Install a 10-12V, 7W solar panel on the rooftop such that it receives sufficient sunlight throughout the day. Route connections from the solar panel (SP1) carefully to the clock’s charging terminals, keeping in mind the correct polarity.

Solar power is more than enough to provide continuous power to the digital clock forever, and the digital clock can work for more than 60 hours on a single charge. But when solar power is not available on cloudy days or at night, users can charge the digital clock using 230V AC mains power. The solar panel rail is automatically cut off while charging through AC mains power. This way the digital clock never runs out of power. Switch S1 can be used to cut off all the load from the battery.

The two 3×1-watt LED modules can be individually switched on as required. Using the USB jack, you can charge all possible USB applications. Thus the project also functions as a solar-powered USB charger. The charging status is indicated by LED1 in the power unit, where a glowing LED means the battery is charging. The power unit circuit can automatically shut off the load when the battery voltage reaches the state of discharge.


The digital clock automatically turns on when the mains load switch (S1) is closed. The user-interface of the digital clock is designed such that only three buttons (S4 through S6) are required to set the various parameters like current time, hours and date-time, and to display the current date-time, set alarm and room temperature.

The Plus button can be used to increment the values in ‘Settings’ mode. Pressing it once during normal time display mode, first displays the room temperature and then the set alarm values. Thereafter, it reverts to normal time display with an acknowledgement beep.
Similarly, the Minus button can be used to decrement the values in ‘Settings’ mode. Pressing it once during normal time display mode first displays the current date on the left and the current month on the right, and then the current year. Thereafter, it reverts to normal time display with an acknowledgement beep.

To switch on/off the alarm, simply press and hold the Minus button for more than one second. If the display indicates AL-0, the alarm is turned off. AL-1 indicates the alarm is turned on.

To set the various parameters of the digital clock, press SET button once to bring it to ‘Settings’ menu. In ‘Settings’ menu, use Plus and Minus keys to increment and decrement the current values, respectively. The corresponding pair of 7-segment displays starts blinking. Pressing Set button again brings the digital clock into the next parameter setting mode and so on until the normal time is displayed. On pressing Set button once, the following seven settings are displayed:

1. Set current hours

2. Set current minutes: After setting the current hours and minutes, SET is displayed on the display

3. Set month

4. Set date

5. Set year. After setting month, date and year SET is displayed on the display

6. Set alarm hours

7. Set alarm minutes. After setting alarm hours and minutes SET is displayed on the display

To switch off the running alarm, press any of the three buttons once. Green colour on the RGB1 LED indicates AM, blue indicates PM and red indicates that date is displayed.

Construction and testing

An actual-size PCB layout of the power unit (in Fig. 3) is shown in Fig. 8 and its components layout in Fig. 9. After assembling the circuit on the PCB, connect CON1 to the secondary of transformer X1, and CON2 to 10-12V, 7W solar panel. Extend CON3 through CON5 to other sections using proper connectors. Enclose the PCB in a suitable cabinet.

PCB layout of power unit
Fig. 8: PCB layout of power unit
Fig. 9: Components layout for the PCB in Fig. 8


Electronics News

Truly Innovative Tech

MOst Popular Videos

Electronics Components