These electronic clocks are the simplest. They were assembled in a few hours. The basis of the PIC16F628A microcontroller, in addition to it, the clock contains several simple and cheap elements, information is displayed on a 4-digit (hour) LED indicator. The circuit is powered from the mains, and also has a backup power supply. This construction can be recommended to beginners, I specially provided the source program with detailed comments to make it easier to understand what and how it works here.
The scheme is very simple, simple and the algorithm of their work (see comments in the source). Buttons kn1 and kn2 are used to correct the time - hours and minutes, respectively. The clock has a 24 hour display format. In the 1st digit of the clock, the blanking of an insignificant zero is done. The accuracy of the clock depends entirely on the frequency of the quartz resonator. But even without special selections of quartz and capacitors in the clock generator, the clock is very accurate.
The clock is assembled on 2 printed circuit boards, docked one to one at an angle of 90 degrees. The whole indicator is placed on one board, and everything else on the other. The backup battery is broken from a Chinese lighter with an LED flashlight. We remove the LED, and install the battery holder on the board. The photo shows that the trimmed resistor leads are connected to the batteries - they then hold the whole structure. Of course, the capacity of such batteries is small, but when the watch is powered by the mains, no current is consumed from the batteries. They feed the circuit only when there is no mains power. In this case, only the microcontroller is powered, the indicator is not powered by batteries, so it goes out, and the clock continues to run. The control buttons are moved from the board to any convenient place in the case. The design of the buttons can be any. For mains power, a Chinese PSU adapter was used, to which a board with a 7805 microcircuit (5-volt stabilizer) was added. Just do any power supply, with an output voltage of 5V and a current of 150mA.
The program is written in such a way that it can be used for the initial study of the PIC microcontroller, the action of almost every command is commented. If desired, you can easily add additional functions to it, such as a calendar, timer, stopwatch, etc.
|
This version of the clock is made in such a way as to simplify the circuit as much as possible, reduce power consumption, and ultimately get a device that fits easily in your pocket. Having chosen miniature batteries to power the circuit, SMD - mounting and a miniature speaker (for example, from a non-working mobile phone), you can get a design that is slightly larger than a matchbox.
The use of a super-bright indicator allows you to reduce the current consumed by the circuit. Reducing the current consumption is also achieved in the "LoFF" mode - the indicator is off, while only the blinking dot of the least significant bit of the clock is on.
Indication
Adjustable brightness of the indicators allows you to choose the most comfortable display of readings (and again reduce power consumption).
The watch has 9 display modes. The transition through the modes is carried out using the "plus" and "minus" buttons. Before displaying the indications themselves, a short hint of the mode name is displayed on the indicators. The duration of the hint output is one second. The use of short-term hints made it possible to achieve good ergonomics of the watch. When switching between display modes (which turned out to be quite a lot for such a simple device as an ordinary watch), there is no confusion, and it is always clear which readings are displayed on the indicator.
This device is a conventional electronic clock with an alarm clock, but they are controlled by an IR remote control. The clock is implemented in software, the display is dynamic. The circuit provides backup power in case of a power outage. The alarm clock is implemented on a simple "beeper" with a built-in generator - buzzer.
The control panel is implemented on the PIC12F629 microcontroller. The remote control is powered by a conventional battery for motherboard computers. If none of the buttons is pressed, the microcontroller is in SLEEP mode and practically does not consume current. As soon as the button is pressed, the microcontroller "wakes up" and generates a code message for the IR LED.
When the power is turned on, the display shows the current time, the colon flashes. If you press the CLOCK button, the display will show the time for which the alarm is set (the colon does not blink), or --:-- if the alarm is off. Pressing the CLOCK button again, or after 6 seconds, the device will again display the current time. Pressing the COR button puts the device into the clock correction mode if the clock is currently displayed; or to the alarm setting mode if the alarm is shown on the display. The first press - the hours are flashing, the hours are set with the +1 button, the second press of the COR button - the minutes are flashing - the minutes are set with the +1 button, the third press is the exit from the clock correction mode (or alarm clock). If the alarm time is corrected, it will automatically turn on.
When the display indicates the alarm setting time (turned on by the CLOCK button) - pressing the +1 button turns on, and pressing again turns off the alarm, the display, respectively, shows the alarm setting time or --:-- (the colon does not blink). If the alarm is turned off, then its setting time is not reset.
In the clock indication mode (the colon blinks) - pressing the +1 button - switches the clock to the "night" mode - in this mode, the indicator goes out completely and only the colon blinks, which reduces power consumption and does not create unnecessary night illumination. At the same time, pressing any button on the remote control, as well as triggering, takes the clock out of night mode.
If the alarm goes off, an audible signal sounds for one minute, all the numbers on the display flash. Pressing any button on the remote control turns off the alarm (without resetting its setting time).
For backup power of the watch, as well as in the control panel, a battery from the computer motherboard is used. Its voltage is 3V, so the microcontroller in the clock needs to be used low-voltage - PIC16LF628A. If you use a battery with a voltage of more than 3.6V, then the usual PIC16F628A will do. Well, a completely ideal option is to use a microcontroller with NANOWATT technology - PIC16F819 (Attention! a different firmware is used for this microcontroller).
Here is another sample of laboratory equipment - LC meter. This measurement mode, especially the L measurement, is almost impossible to find in cheap factory multimeters.
Diagram of this LC meter on the microcontroller was taken from www.sites.google.com/site/vk3bhr/home/index2-html. The device is based on a 16F628A PIC microcontroller, and since I recently purchased a PIC programmer, I decided to test it with this project.
I removed the 7805 regulator because I decided to use a 5 volt cell phone charger.
The circuit has a 5 kΩ trimmer resistor, but in fact I put 10 kΩ, according to the datasheet for the purchased LCD module.
All three capacitors are 10uF tantalum. It should be noted that the capacitor C7 - 100uF is actually 1000uF.
Two 1000pF styroflex capacitors with 1% tolerance, 82uH inductive coil.
The total current consumption with backlight is about 30mA.
Resistor R11 limits the backlight current and must be sized according to the LCD module actually used.
I used the original PCB drawing as a starting point and modified it to match the components I have.
Here is the result:
The last two photos show the LC meter in action. On the first of them, the measurement of the capacitance of a 1nF capacitor with a deviation of 1%, and on the second, the inductance of 22 μH with a deviation of 10%. The device is very sensitive - that is, with an unconnected capacitor, it shows a capacitance of the order of 3-5 pF, but this is eliminated by calibration.
Clock with a small 4-digit indicator. The dot between hours and minutes flashes at a frequency of 0.5 seconds. It can be built into any object: a desk calendar, a radio, a car. Estimated error - 0.00002%. In practice, for six months there has never been a need for correction.
Power supply 4.5 - 5 volts, current up to 70mA. The voltage stabilizer is located in the plug - adapter. It is assembled on a 3 watt transformer and a high-frequency converter - stabilizer according to the standard scheme. For a car, of course, a transformer is not needed. The microcircuit without a radiator, practically does not heat up. Connector for power supply 3.5mm. Quartz 4 MHz. Transistors n-p-n any low-power.
Any buttons . The length of the button pusher is selected based on the requirements of the design. You can solder the buttons on the side of the conductors. Each time the button is pressed, one is added. When held, the score accelerates to a reasonable speed.
MLT resistors - 0.25. R7 - R14 300 - 360 ohms. R3 - R6 1-3 kOhm.
Batteries: 4 pieces from GP-170 or similar. When the mains voltage is turned off, they feed only the microcontroller. 8 days stand exactly, checked.
Diodes with the lowest forward voltage drop.
The boards are made of one-sided foil fiberglass.
Before installing the microcontroller into the panel of the manufactured board, turn on the power and measure the voltage on the 14th leg of the panel. Should be 4.5 - 4.8 volts. Pin 5 has 0 volts. If you are not sure about the quality of the manufactured board or the serviceability of the parts, check the device without a microcontroller. This is done very simply:
If something doesn't work, fix it. If everything is correct, program the microcontroller and insert, with the power off, into the socket.
HEX file is attached.
Turn on the power and get your watch ready.
If you buy all the details, including resistors, then, in accordance with my scheme, the device will cost about 400 rubles:
Literature:
Below you can download firmware and PCB in LAY format
Designation | Type of | Denomination | Score | ||
---|---|---|---|---|---|
MK PIC 8-bit | PIC16F628A | 1 | Store search | ||
VR2 | DC/DC switching converter | LM2575 | 1 | 5V | Store search |
VT1-VT4 | bipolar transistor | KT315A | 4 | Store search | |
VD1, VD3, VD4 | Diode | D310 | 3 | Store search | |
VD2 | Schottky diode | 1N5819 | 1 | Store search | |
VD5 | Diode bridge | DB157 | 1 | Store search | |
C1, C2 | Capacitor | 20 pF | 2 | Store search | |
C3 | Capacitor | 0.1uF | 1 | Store search | |
C4 | 330uF 16V | 1 | Store search | ||
C5 | electrolytic capacitor | 100uF 35V | 1 | Store search | |
R1, R2 | Resistor | 10 kOhm | 2 | Store search | |
R3-R6 | Resistor | 1.5 kOhm | 4 | Store search | |
R7-R9, R11-R14 | Resistor | 300 ohm | 7 | Store search | |
R10 | Resistor | 360 ohm | 1 |