The production method of LED electronic clock can be seen in many electronic newspapers and magazines, but most of them need to reset the time and other parameters after power failure, which brings a lot of inconvenience to use. There are also backup batteries as backup power sources, but they are often large in size. The LED electronic clock introduced in this article overcomes the previous disadvantages and uses an infrared remote control commonly used in home appliances for control, which is convenient to use. There is an alarm output, and the alarm time and permission can be set through the remote control.
Front of electronic clock
Back of electronic clock
1. Working Principle
DS1302 is a real-time clock chip from Dallas Corporation. Its main features are serial data transmission, programmable charging function for power-off protection power supply, and the ability to turn off the charging function. It uses a common 32768Hz crystal oscillator.
AT89C2051 is the main control chip. First, it recognizes the received infrared remote control code and performs corresponding processing. Second, it reads the time in the clock chip DS1302 regularly and displays the hour and fat in the 4-digit LED. Third, it compares the set alarm time with the real time. If the time is the same and the alarm is allowed, the buzzer will sound for one minute at a cycle of 1 second to remind the user. If you want to stop the alarm, just press the corresponding button on the remote control to turn off the alarm. The alarm time is saved in the RAM of DS1302, and no separate EEPROM is required.
2. Hardware Circuit
Figure 1 is the schematic diagram of the electronic clock. IC2 is DS1302. Electronics enthusiasts can ask MAXIM for free samples. Y2 is a 32768 Hz quartz crystal oscillator, which can be used in ordinary electronic watches. IC3 is a three-pin plastic-encapsulated integrated infrared receiver. LED1-4 is a high-brightness common-anode digital tube. If the crystal oscillator Y1 used in 89C2051 does not have 10MHz, it can be replaced by other 12M or less. Just modify the delay parameters of YS1 and YS2 in the program to keep the delay length unchanged. Adjusting R2 can change the brightness of the digital tube. P1 port connects to the eight-segment digital tube. The left two digits of the digital tube display hours, and the right two digits display minutes. When the alarm time is displayed, it flashes. The decimal points of the second and third digits flash as seconds. Note that the third digit of the digital tube should be rotated 180° when the printed version is arranged according to Figure 1, so that ":" appears between the hours and minutes. The last decimal point is used as the alarm switch mark. Lighting indicates that the alarm is turned on. Buzzer B2 uses a small built-in sound source.
Special mention should be made of the backup power supply B1, which can be a battery or a supercapacitor (more than 100,000uF). Although the DS1302 consumes very little power after the main power is lost, if you want to keep the clock normal for a long time, it is best to use a small rechargeable battery. You can use the 3.6V rechargeable battery on the motherboard of an old computer. If the power outage is short (a few hours or a few days), you can use an ordinary electrolytic capacitor with less leakage instead. 100uF can ensure normal timekeeping for 1 hour. After the DS1302 is powered on for the first time, it must be initialized. After initialization, you can adjust the time and alarm in the normal way.
3. Software
The software part focuses on the operation of DS1302 and the decoding of infrared remote control. For the decoding of single chip microcomputer, please refer to other articles. Here we mainly explain the setting part:
The remote controller uses the Changhong color TV K11F model remote controller, which sends the 16-bit address code, 8-bit data code and the inverse code of the 8-bit data code. Table 1 lists the codes of each button and the corresponding actions of this electronic clock. If other remote controllers are used, the codes of the corresponding parts of the program need to be modified.
In the operation method, any means that after the key is pressed for the first time, the state is entered, and after pressing it again, the state is exited.
Time setting: Press the "Menu" key to enter the setting state. The LED only displays the hours of normal time. Press the "↑↓" keys to adjust the value. Press the "←" and "→" keys to move between the alarm and normal time. Press the "Menu" key again at any time to exit the setting.
Alarm setting: The alarm time is set in the time setting. The alarm can be enabled or disabled by pressing the "Silence" button at any time.
Display switch: Press the "Display" key to turn the display on and off at any time.
Initialization: After pressing the "Menu" key to enter the setting state, press the "Calendar" key at any time, and the initialized time will be 2002/12/1/12:00:00
Previous article:Design Method of Interface between LCD Display and AT89S52 Single Chip Microcomputer
Next article:Design of a signal generator with adjustable amplitude based on DDS
- Popular Resources
- Popular amplifiers
- Learn ARM development(16)
- Learn ARM development(17)
- Learn ARM development(18)
- Embedded system debugging simulation tool
- A small question that has been bothering me recently has finally been solved~~
- Learn ARM development (1)
- Learn ARM development (2)
- Learn ARM development (4)
- Learn ARM development (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- Analysis of the application of several common contact parts in high-voltage connectors of new energy vehicles
- Wiring harness durability test and contact voltage drop test method
- From probes to power supplies, Tektronix is leading the way in comprehensive innovation in power electronics testing
- From probes to power supplies, Tektronix is leading the way in comprehensive innovation in power electronics testing
- Sn-doped CuO nanostructure-based ethanol gas sensor for real-time drunk driving detection in vehicles
- Design considerations for automotive battery wiring harness
- Do you know all the various motors commonly used in automotive electronics?
- What are the functions of the Internet of Vehicles? What are the uses and benefits of the Internet of Vehicles?
- Power Inverter - A critical safety system for electric vehicles
- Analysis of the information security mechanism of AUTOSAR, the automotive embedded software framework
- 【MSP430】Capture mode to measure signal duty cycle
- Short-range wireless positioning technology
- In addition to the cost of electronic components, what other costs are there in hardware product development?
- Demonstrate RTOS projects for ARM, DSP and IPU based on Windows system
- Integrated 2x output amplifier circuit, 12Bit four-channel digital-to-analog converter with power-down mode
- 【NUCLEO-L552ZE Review】- 0: First look at the STM32 NUCLEO-L552ZE-Q
- Questions about the power supply of the communication system
- [Shanghai Hangxin ACM32F070 development board] The second part lights up the LCD screen and operates the touch button functions, serial port, ADC.
- EEWORLD University ---- TE Smart City
- Develop IoT in 10 minutes - Smoke sensor monitoring (Wifi version)