DIY electronic LED wall clock. DIY electronic watch

Clock with LED backlight and pulsating minute hand on an Arduino microcontroller
This unique watch with LED backlight and pulsating minute hand was made using the TLC5940 PWM controller chip. Its main task is to expand the number of PWM modulation contacts. Another feature of this watch is that it has converted an analog voltmeter into a device that measures minutes. To do this, a new scale was printed on a standard printer and pasted on top of the old one. As such, the 5th minute is not counted, it’s just that during the fifth minute the time counter shows the arrow pointing to the end of the scale (off scale). The main control is implemented on the Arduino Uno microcontroller.

To ensure that the clock backlight did not glow too brightly in a dark room, a circuit was implemented to automatically adjust the brightness depending on the illumination (a photoresistor was used).

Step 1: Required Components



Here's what you'll need:

  • 5V DC analog voltmeter module;
  • Arduino UNO microcontroller or other suitable Arduino;
  • Arduino circuit board (proto board);
  • DS1307 Real Time Clock (RTC) module;
  • Module with PWM controller TLC5940;
  • Petal LED backlights – 12 pcs.;
  • Components for assembling an automatic brightness control (LDR) circuit.

Also, for the production of some other components of the project, it is desirable to have access to a 3D printer and a laser cutting machine. It is assumed that you have this access, so the instructions will include manufacturing drawings at the appropriate stages.

Step 2: Dial




The dial consists of three parts (layers) cut on a laser cutting machine from 3 mm MDF sheet, which are fastened together with bolts. A plate without slots (bottom right in the picture) is placed under another plate to position the LEDs (bottom left). Then, individual LEDs are placed in the appropriate slots, and the front panel is put on top (top in the figure). Four holes are drilled along the edge of the dial, through which all three parts are bolted together.

  • To test the performance of the LEDs at this stage, a CR2032 coin cell battery was used;
  • To secure the LEDs, small strips of adhesive tape were used, which were glued to the back of the LEDs;
  • All LED legs were pre-bent accordingly;
  • The holes along the edges were re-drilled, through which the bolting was carried out. It turned out that this was much more convenient.

Technical drawing of the dial parts is available at:

Step 3: Design the circuit



At this stage, the electrical circuit was developed. Various textbooks and guides were used for this. We won’t delve too deeply into this process; the two files below show the finished electrical circuit that was used in this project.

Step 4: Connecting the Arduino Circuit Board





  1. The first step is to unsolder all the needle contacts on the circuit boards and section boards;
  2. Further, due to the fact that 5V and GND power are used by so many boards and peripheral devices, for reliability, two wires for 5V and GND were soldered on the circuit board;
  3. Next, a TLC5940 PWM controller was installed next to the used contacts;
  4. Then the TLC5940 controller is connected according to the connection diagram;
  5. In order to be able to use the battery, an RTC module was installed on the edge of the circuit board. If you solder it in the middle of the board, the pin markings will not be visible;
  6. The RTC module has been connected according to the connection diagram;
  7. An automatic brightness control (LDR) circuit has been assembled, you can view it at the link
  8. The wires for the voltmeter are connected by connecting the wires to pin 6 and GND.
  9. At the end, 13 wires for the LEDs were soldered (In practice, it turned out that it was better to do this before proceeding to step 3).

Step 5: Code

The code below was compiled from various pieces of clock components found on the Internet. It has been fully debugged and is now fully functional, and some pretty detailed comments have been added. But before loading into the microcontroller, consider the following points:

  • Before flashing the Arduino firmware, you need to uncomment the line that sets the time:
    rtc.adjust(DateTime(__DATE__, __TIME__))
    After flashing the controller with this line (the time is set), you need to comment it out again and flash the controller again. This allows the RTC module to use the battery to remember the time if the main power is lost.
  • Every time you use "Tlc.set()" you need to use "Tlc.update"

Step 6: Outer Ring

The outer watch ring was 3D printed using a Replicator Z18 printer. It attaches to the watch using screws on the face of the watch. Below is a file with a 3D model of the ring for printing on a 3D printer.

Step 7: Assembling the Clock


The Arduino microcontroller with all the other electronics was secured to the back of the clock using screws and nuts as spacers. Then I connected all the LEDs, analog voltmeter and LDR to the wires that were previously soldered to the circuit board. All LEDs are interconnected by one leg and connected to the VCC pin on the TLC5940 controller (a piece of wire is simply soldered in a circle).

So far, all this is not very well insulated from short circuits, but work on this will continue in future versions.

Clock with seven-segment LED indicator on K145IK1911 chip

The history of these clocks appearing on the site is slightly different from other diagrams on the site.

It’s a normal day off, I go to the post office, rummage around, and our reader comes across Fedorenko Evgeniy, sent a diagram of the clock, with a description and all the photographs.

Briefly about the scheme. This electronic clock circuit their hands completed on the K145IK1911 chip, and the time is displayed on seven-segment LED indicators. And so is his article. Let’s look at everything.

Clock diagram:


To enlarge a picture, simply click on it to enlarge it. And save the computer.

Not long ago I was faced with the task of either buying a new watch or assembling a new one myself. The requirements for the watch were simple - the display should display hours and minutes, there should be an alarm clock, and seven-segment LED indicators should be used as a display device. I didn’t want to pile up a bunch of logic chips, and I didn’t want to get involved with programming controllers. The choice was made on the development of the Soviet electronics industry - chip K145IK1901.

It wasn’t in the store at that time, but there was an analogue, in a 40-pin package - K145IK1911. The name of the pins of this microcircuit is no different from the previous one, the difference is in the numbering.



The downside of these microcircuits is that they only work with vacuum fluorescent indicators. To ensure docking with the LED indicator, it was necessary to build a matching circuit using semiconductor switches.

As string drivers – J1-J7 transistors can be used KT3107 with the letter index I, A, B. For drivers for selecting segments D1-D4, KT3102I, or KT3117A, KT660A, as well as any others with a maximum collector-emitter voltage of at least 35 V and a collector current of at least 100 mA will be used. The current of the indicator segments is regulated by resistors in the collector circuits of the row drivers.



A dot flashing at a frequency of 1 Hz is used to separate the hour and minute digits.

This frequency is present at the Y4 pin after the timing has started. This scheme also provides the ability to display on the display instead of hours and minutes - minutes and seconds, respectively. The transition to this mode is carried out by pressing the “Sec.” button. Returning to the hour and minute time display is carried out after pressing the “Return” button. This chip provides the ability to set two alarm clocks simultaneously, but in this scheme the second alarm clock is not used as unnecessary. A piezo tweeter with a built-in generator, with a supply voltage of 12V, is used as a sound emitter. The alarm clock signal is removed from pin Y5 of the microcircuit. To provide intermittent sound, the signal is modulated at a frequency of 1 Hz, used to indicate the second rhythm (dot). For a more detailed study of the functionality of the K145IK1901(11) microcircuit, you can refer to the documentation, which recently can be easily found on the Internet. The microcircuit must be powered with a negative voltage of -27V±10%. According to the experiments carried out, the microcircuit remains operational even at a voltage of -19V, and the accuracy of the clock is not affected at all.

The clock diagram is shown in the figure above. Chip resistors of standard size 1206 were used in the circuit, which makes it possible to significantly reduce the dimensions of the device. Any seven-segment indicators with a common anode are suitable as seven-segment indicators.

Well, that’s the end of the story for now. It will be further developed and replenished. And I express my gratitude to its author, Evgeniy Fedorenko, for all questions and also give his email. Write to This email address is being protected from spambots. You must have JavaScript enabled to view it.

With dynamic display. There are no complaints about the operation of the watch: precise movement, convenient settings. But one big disadvantage is that the LED indicators are hard to see in the daytime. To solve the problem, I switched to static display and brighter LEDs. As always with software, many thanks to Soir. In general, I bring to your attention a large outdoor clock with a static display; the settings functions remain the same as in the previous clocks.

They have two displays - the main one (outside on the street) and the auxiliary one on indicators - indoors, on the device body. High brightness is achieved by using ultra-bright LEDs, with an operating current of 50mA, and driver chips.

Circuit diagram of an outdoor electronic clock with bright LEDs

To flash the controller firmware with files and use the following fuse settings:

Printed circuit boards of the clock, control unit and external module, in LAY format, .


Features of this clock circuit:

- 24-hour time display format.
- Digital correction of stroke accuracy.
- Built-in control of the main power supply.
- Non-volatile microcontroller memory.
- There is a thermometer that measures temperature in the range of -55 - 125 degrees.
- It is possible to alternately display information about time and temperature on the indicator.


Pressing the SET_TIME button moves the indicator in a circle from the main clock mode (displaying the current time). In all modes, holding the PLUS/MINUS buttons performs an accelerated installation. Changes in settings 10 seconds after the last value change will be written to non-volatile memory (EEPROM) and will be read from there when the power is turned on again.


Another big plus of the proposed option is that the brightness has changed, now in sunny weather the brightness is excellent. The number of wires has decreased from 14 to 5. The length of the wire to the main (outdoor) display is 20 meters. I am satisfied with the performance of the electronic watch; it turned out to be a fully functional watch - both day and night. Sincerely, Soir-Alexandrovich.

As the name suggests, the main purpose of this device is to find out the current time and date. But it has many other useful features. The idea for its creation appeared after I came across a half-broken watch with a relatively large (for a wrist) metal case. I thought that I could insert a homemade clock there, the possibilities of which are limited only by my own imagination and skill. The result was a device with the following functions:

1. Clock - calendar:

    Counting and displaying hours, minutes, seconds, day of the week, day, month, year.

    Availability of automatic adjustment of the current time, which is performed every hour (maximum values ​​+/-9999 units, 1 unit = 3.90625 ms.)

    Calculating the day of the week from a date (for the current century)

    Automatic transition between summer and winter time (can be switched off)

  • Leap years are taken into account

2. Two independent alarm clocks (a melody sounds when triggered)
3. Timer with 1 second increments. (Maximum counting time 99h 59m 59s)
4. Two-channel stopwatch with counting resolution of 0.01 sec. (maximum counting time 99h 59m 59s)
5. Stopwatch with counting resolution of 1 second. (maximum counting time 99 days)
6. Thermometer in the range from -5°C. up to 55°C (limited by the temperature range of normal operation of the device) in increments of 0.1°C.
7. Reader and emulator of electronic keys - tablets of the DS1990 type using the Dallas 1-Wire protocol (memory for 50 pieces, which already contains several universal “all-terrain keys”) with the ability to view the key code byte by byte.
8. IR remote control (only the “Take a picture” command is implemented) for digital cameras “Pentax”, “Nikon”, “Canon”
9. LED flashlight
10. 7 melodies
11. Sound signal at the beginning of every hour (can be switched off)
12. Sound confirmation of button presses (can be switched off)
13. Battery voltage monitoring with calibration function
14. Digital indicator brightness adjustment

Maybe such functionality is redundant, but I like universal things, and plus the moral satisfaction that this watch will be made with my own hands.

Schematic diagram of the clock

The device is built on the ATmega168PA-AU microcontroller. The clock ticks according to timer T2, operating in asynchronous mode from a clock quartz at 32768 Hz. The microcontroller is in sleep mode almost all the time (the indicator is off), waking up once a second to add this very second to the current time and falls asleep again. In active mode, the MK is clocked from the internal RC oscillator at 8 MHz, but the internal prescaler divides it by 2, as a result, the core is clocked at 4 MHz. For indication, four single-digit LED digital seven-segment indicators with a common anode and a decimal point are used. There are also 7 status LEDs, the purpose of which is as follows:
D1- Negative value sign (minus)
D2- Sign of a running stopwatch (flashing)
D3- Sign of the first alarm being turned on
D4- Sign of the second alarm being turned on
D5- Sign of sound signal at the beginning of every hour
D6- Sign of a running timer (flashing)
D7- Low battery voltage indicator

R1-R8 - current-limiting resistors of segments of digital indicators HG1-HG4 and LEDs D1-D7. R12,R13 – divider for monitoring battery voltage. Since the clock supply voltage is 3V, and the white LED D9 requires about 3.4-3.8V at rated current consumption, it does not glow at full strength (but it is enough to avoid stumbling in the dark) and is therefore connected without a current-limiting resistor. Elements R14, Q1, R10 are designed to control the infrared LED D8 (remote control implementation for digital cameras). R19, ​​R20, R21 are used for pairing when communicating with devices that have a 1-Wire interface. Control is carried out by three buttons, which I conventionally called: MODE (mode), UP (up), DOWN (down). The first of them is also designed to wake up the MK by an external interrupt (in this case the indication turns on), so it is connected separately to the PD3 input. The pressing of the remaining buttons is determined using an ADC and resistors R16, R18. If the buttons are not pressed within 16 seconds, the MK goes to sleep and the indicator goes off. When in mode “Remote control for cameras” this interval is 32 seconds, and with the flashlight on - 1 minute. MK can also be put to sleep manually using the control buttons. When the stopwatch is running with a count resolution of 0.01 sec. The device does not go into sleep mode.

Printed circuit board

The device is assembled on a double-sided printed circuit board of a circular shape to the size of the inner diameter of the wristwatch case. But in production I used two single-sided boards with a thickness of 0.35 mm. This thickness was again obtained by peeling it off from double-sided fiberglass laminate with a thickness of 1.5 mm. The boards were then glued together. All this was done because I did not have thin double-sided fiberglass, and every millimeter of thickness saved in the limited internal space of the watch case is very valuable, and there was no need for alignment in the manufacture of printed conductors using the LUT method. The printed circuit board drawing and parts location are in the attached files. On one side there are indicators and current-limiting resistors R1-R8. On the back are all the other details. There are two through holes for white and infrared LEDs.

The button contacts and battery holder are made of flexible spring sheet steel with a thickness of 0.2...0.3 mm. and tinned. Below are photos of the board from both sides:

Design, parts and their possible replacement

The ATmega168PA-AU microcontroller can be replaced with ATmega168P-AU, ATmega168V-10AU ATmega168-20AU. Digital indicators - 4 pieces KPSA02-105 super-bright red glow with a digit height of 5.08 mm. Can be supplied from the same series KPSA02-xxx or KCSA02-xxx. (just not green ones - they will glow faintly) I am not aware of other analogues of similar sizes with decent brightness. In HG1, HG3, the connection of the cathode segments is different from HG2, HG4, because it was more convenient for me for wiring the printed circuit board. In this regard, a different character generator table is used for them in the program. Used resistors and capacitors SMD for surface mounting of standard sizes 0805 and 1206, LEDs D1-D7 of standard size 0805. White and infrared LEDs with a diameter of 3 mm. The board has 13 through holes into which jumpers must be installed. A DS18B20 with a 1-Wire interface is used as a temperature sensor. LS1 is a regular piezoelectric tweeter, inserted into the lid. With one contact it is connected to the board using a spring installed on it, with the other it is connected to the watch body by the cover itself. Quartz resonator from a wristwatch.

Programming, firmware, fuses

For in-circuit programming, the board has only 6 round contact spots (J1), since a full connector does not fit in height. I connected them to the programmer using a contact device made from a PLD2x3 pin plug and springs soldered onto them, pressing them with one hand to the spots. Below is a photo of the device.

I used it because during the debugging process I had to reflash the MK many times. With a one-time firmware, it is easier to solder thin wires connected to the programmer to the patches, and then unsolder them again. It is more convenient to flash the MK without a battery, but so that the power comes either from an external +3V source or from a programmer with the same supply voltage. The program is written in assembler in the VMLAB 3.15 environment. Source codes, firmware for FLASH and EEPROM in the application.

The FUSE bits of the DD1 microcontroller must be programmed as follows:
CKSEL3...0 = 0010 - clocking from internal RC oscillator 8 MHz;
SUT1...0 =10 - Start-up time: 6 CK + 64 ms;
CKDIV8 = 1 - frequency divider by 8 is disabled;
CKOUT = 1 - Output Clock on CKOUT disabled;
BODLEVEL2…0 = 111 - supply voltage control is disabled;
EESAVE = 0 - erasing EEPROM when programming the crystal is prohibited;
WDTON = 1 - Watchdog Timer is not always on;
The remaining FUSE bits are best left untouched. The FUSE bit is programmed if set to “0”.

Flashing the EEPROM with the dump included in the archive is required.

The first cells of the EEPROM contain the initial parameters of the device. The table below describes the purpose of some of them, which can be changed within reasonable limits.

Cell address

Purpose

Parameter

Note

The amount of battery voltage at which a low level signal occurs

260 ($104) (2.6V)

coefficient for correcting the value of the measured battery voltage

time interval for switching to sleep mode

1 unit = 1 sec

time interval for switching to sleep mode when the flashlight is on

1 unit = 1 sec

time interval for switching to sleep mode when in remote control mode for cameras

1 unit = 1 sec

IButton key numbers are stored here

Small explanations on points:

1 point. This indicates the voltage level on the battery at which the LED will light up, signaling its low value. I set it to 2.6V (parameter - 260). If you need something else, for example 2.4V, then you need to write 240 ($00F0). The low byte is stored in the cell at address $0000, and the high byte is stored in $0001.

2 point. Since I did not install a variable resistor on the board to adjust the accuracy of the battery voltage measurement due to lack of space, I introduced software calibration. The calibration procedure for accurate measurement is as follows: initially, the coefficient 1024 ($400) is written in this EEPROM cell, you need to switch the device to active mode and look at the voltage on the indicator, and then measure the real voltage on the battery with a voltmeter. The correction factor (K), which must be set, is calculated by the formula: K=Uр/Ui*1024 where Uр is the real voltage measured by the voltmeter, Ui is the voltage that was measured by the device itself. After calculating the “K” coefficient, it is entered into the device (as stated in the operating instructions). After calibration, my error did not exceed 3%.

3 point. Here you can set the time after which the device will go into sleep mode if no buttons are pressed. Mine costs 16 seconds. If, for example, you need to fall asleep in 30 seconds, then you need to write down 30 ($26).

In points 4 and 5 the same.

6 point. At address $0030 the zero key family code (Dallas 1-Wire) is stored, then its 48-bit number and CRC. And so 50 keys in sequence.

Setup, operating features

Setting up the device comes down to calibrating the battery voltage measurement, as described above. It is also necessary to detect the deviation of the clock rate for 1 hour, calculate and enter the appropriate correction value (the procedure is described in the operating instructions).

The device is powered by a CR2032 (3V) lithium battery and consumes approximately 4 µA in sleep mode, and 5...20 mA in active mode, depending on the brightness of the indicator. With daily five-minute use of the active mode, the battery should last approximately 2....8 months depending on the brightness. The watch case is connected to the battery negative.

Key reading was tested on the DS1990. Emulation has been tested on METAKOM intercoms. Under serial numbers from 46 to 49 (last 4) universal keys for intercoms are flashed (all keys are stored in EEPROM, they can be changed before flashing). The key registered under number 49 opened all the METAKOM intercoms that I came across, I did not have a chance to test the rest of the universal keys, I took their codes from the network.

Remote control for cameras was tested on Pentax optio L20 and Nikon D3000 models. Canon could not be obtained for review.

The user manual takes up 13 pages, so I did not include it in the article, but included it in an appendix in PDF format.

The archive contains:
Scheme in and GIF;
Printed circuit board drawing and arrangement of elements in the format;
Firmware and source code in assembler;

List of radioelements

Designation Type Denomination Quantity NoteShopMy notepad
DD1 MK AVR 8-bit

ATmega168PA

1 PA-AU To notepad
U2 temperature sensor

DS18B20

1 To notepad
Q1 MOSFET transistor

2N7002

1 To notepad
C1, C2 Capacitor30 pF2 To notepad
C3, C4 Capacitor0.1 µF2 To notepad
C5 Electrolytic capacitor47 µF1 To notepad
R1-R8, R17 Resistor

100 Ohm

9 To notepad
R9 Resistor

10 kOhm

1 To notepad
R10 Resistor

8.2 Ohm

1 To notepad
R11 Resistor

300 Ohm

1 To notepad
R12 Resistor

2 MOhm

1 To notepad
R13 Resistor

220 kOhm

1 To notepad
R14 Resistor

30 kOhm

1 To notepad
R15, R19 Resistor

4.7 kOhm

2 To notepad
R16 Resistor

20 kOhm

1

Clock with audible alarm timer for controlling household appliances.

A timer is a device that turns equipment on or off at a set time with its switching contacts. Real-time timers allow you to set the trigger time at a set time of day. The simplest example of such a timer would be an alarm clock.

The scope of application of the timer is extensive:
- lighting control;
- watering management of home and garden plants;
- ventilation control;
- aquarium management;
- control of electric heaters and so on.

The proposed timer can be made quickly and inexpensively even by a novice radio amateur.
I made it based on the clock designer. ()

I needed to use a timer to control the watering of plants at the dacha.

Watch the entire manufacturing process in the video:


List of tools and materials
- any electronic watch with an alarm sound;
-screwdriver;
- scissors;
- soldering iron;
-cambric;
- two 12V relays;
-12V power supply from adapter;
- connecting wires;
- foil PCB for a printed circuit board or breadboard;
-industrial or homemade time relay;
-resistor;
- transistors KT815 (or analogues);
-diode.

Step one. Timer board wiring.
Timer circuit
All that is needed is to solder the components according to the diagram onto a breadboard and solder two wires from the piezo emitter of the clock. Let's assemble a simple circuit with an intermediate relay and a transistor switch. When the first pulse of a sound signal is sent from the clock, relay P1 is turned on, the normally open contact closes and turns on the load, and at the same time, through the second normally open contact of relay P1 and the normally closed contact of the time relay, relay P1 self-locks. Together with the load, the time relay PB is turned on - the countdown of the specified load operating time begins. At the end of this time, RV opens the contact and relay P1 is de-energized, the load is turned off. The circuit is ready for the next cycle. The diode serves to prevent a reverse pulse into the clock circuit (any low-power diode can be used). LED to indicate load activation. In this circuit, you need an intermediate relay with two normally open contacts, but I didn’t have one - I used two Chinese relays (the coils are connected in parallel). If the load is more powerful, then accordingly you need to use a relay with more powerful contacts. I had a 12V adapter and installed its circuit directly on the breadboard. In principle, any low-power 12V power source can be used.


In short, the clock turns on the load and the time relay is turned off after the delay has expired.
If you do not have an industrial time relay, you can make it yourself using a simple scheme. As the capacitance of capacitor C1 increases, the operating time of the relay increases.


Step two. Checking the timer operation.
My circuit worked the first time I turned it on.
All that remains is to set the alarm time. My watch has two alarm time settings. For my case, it’s enough to turn on watering, for example, in the morning at 7 o’clock for one hour, and in the evening at 20 o’clock, water again. When you press the clock buttons, sound signals are emitted, so when setting, the timer circuit must be de-energized to prevent false alarms. My watch has a “chime” function - every hour from 8 to 20 o’clock, that is, in addition to the alarm clock, you can use these signals if necessary. If not necessary, then the “chimes” function is disabled.

This is how the weekend design turned out. It was interesting to test out the new scheme, so everything was done quickly. In the future, it will be necessary to make a case and place a board and a time relay there. A beginner can make such a timer on his own without spending a lot of time and money. And where to use them is up to you to decide.

All the work took a couple of weekend evenings and 75 rubles (