Clock with LED display. How to make a luminous digital wall clock on arduino with large numbers

Not long ago, there was a need to have a clock in the house, but only electronic, since I don’t like analog clocks, because they tick. I have quite a bit of experience in soldering and etching circuits. After scouring the Internet and reading some literature, I decided to choose the most a simple circuit because I don't need an alarm clock.

I chose this scheme because it is easy make a watch with your own hands

Let's get started, so what do we need in order to make ourselves a clock with our own hands? Well, of course, hands, the ability (not even great) to read circuits, a soldering iron and details. Here is a complete list of what I used:

Quartz at 10 MHz - 1 pc, ATtiny 2313 microcontroller, 100 Ohm resistors - 8 pcs, 3 pcs. 10 kOhm, 2 x 22 pF capacitors, 4 transistors, 2 buttons, LED indicator 4-bit KEM-5641-ASR (RL-F5610SBAW/D15). I performed the installation on a one-sided textolite.

But there is a flaw in this scheme.: the outputs of the microcontroller (hereinafter MK), which are responsible for managing the discharges, receive a pretty decent load. The current in the total amount is much higher than the maximum current of the port, but with a dynamic indication, the MK does not have time to overheat. In order for the MK not to fail, we add 100 Ohm resistors to the discharge circuits.

In this scheme, the indicator is controlled according to the principle of dynamic indication, according to which the indicator segments are controlled by signals from the corresponding outputs of the MC. The repetition frequency of these signals is more than 25 Hz and because of this, the glow of the indicator numbers seems to be continuous.

Electronic clock, made according to the above scheme, can only show time (hours and minutes), while seconds are shown by a dot between segments which is blinking. To control the operating mode of the clock, its structure provides push-button switches that control the setting of hours and minutes. This circuit is powered by a 5V power supply. In the manufacture printed circuit board A 5V zener diode was included in the circuit.

Since I have a 5V power supply, I excluded the zener diode from the circuit.

To make a board, a circuit was applied using an iron. That is, the printed circuit was printed on an inkjet printer using glossy paper, it can be taken from modern glossy magazines. After that, the textolite of the required dimensions was cut out. I got the size 36 * 26 mm. Such a small size due to the fact that all the parts are selected in the SMD package.

The board was etched using ferric chloride (FeCl 3 ). In terms of time, the etching took about an hour, since the bath with a fee was on the fireplace, heat affects the etching time, not used copper in the board. But do not overdo it with the temperature.

While the process of etching was going on, in order not to rack my brains and not write the firmware for the clock, I went to the Internet and found a firmware for this scheme. How to flash MK can also be found on the Internet. I used a programmer that only flashes MK from ATMEGA.

And finally, our board is ready and we can start soldering our clock. For soldering, you need a 25 W soldering iron with a thin tip in order not to burn the MK and other parts. We carry out soldering carefully and preferably from the first time we solder all the legs of the MK, but only separately. For those who are not in the know, know that the parts made in the SMD package have tin on their terminals for fast soldering.

And this is what the board looks like with soldered parts.

Hours from LED backlight and a pulsing minute hand on the Arduino microcontroller
This unique LED-lit clock with a pulsing minute hand was made using the TLC5940 PWM controller IC. Its main task is to expand the number of contacts with PWM modulation. Another feature of this watch is a converted analog voltmeter into a device that measures minutes. To do this, a new scale was printed on a standard printer and pasted over the old one. As such, the 5th minute is not counted, just during the fifth minute the time counter shows an arrow resting on the end of the scale (goes off scale). The main control is implemented on the Arduino Uno microcontroller.

In order for the backlight of the clock not to glow too brightly in a dark room, a circuit for automatically adjusting the brightness depending on the illumination was implemented (a photoresistor was used).

Step 1: Required Components



Here's what's required:

  • Analog voltmeter module for 5V DC;
  • Arduino UNO microcontroller or other suitable Arduino;
  • Arduino circuit board (proto board);
  • Real time clock module DS1307 (RTC);
  • Module with PWM controller TLC5940;
  • Petal backlight LEDs - 12 pcs.;
  • Components for assembling an automatic brightness control (LDR) circuit.

Also, for the manufacture 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 drawings for manufacturing will be attached to the instructions at the appropriate stages.

Step 2: The dial




The dial consists of three parts (layers) cut on a laser cutting machine from a 3 mm MDF sheet, which are fastened together with bolts. An unslotted plate (lower right in the picture) is placed under another LED positioning plate (lower left). Then, individual LEDs are placed in the corresponding 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 fastened together with bolts.

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

The technical drawing of the details for the dial is available at:

Step 3: Schematic Design



At this stage, it was developed circuit diagram. For this, various textbooks and manuals were used. We will not 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 solder all the needle contacts on the circuit boards and breakout boards;
  2. Further, due to the fact that a lot of boards and peripherals use 5V and GND power, 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 contacts used;
  4. After that, 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, then the designation of the contacts 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 find it at the link
  8. The wiring for the voltmeter is done 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 has been assembled from various pieces of watch components found on the internet. It has been fully debugged and is now fully functional, and quite detailed comments have been added. But before downloading to the microcontroller, consider the following points:

  • Before flashing the Arduino, 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 fails.
  • Every time you use "Tlc.set()" you need to use "Tlc.update"

Step 6: Outer Ring

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

Step 7: Clock Assembly


The Arduino microcontroller with all the other electronics was fixed to the back of the clock using self-tapping screws and nuts as spacers. Then I connected all the LEDs, the analog voltmeter and the LDR to the wires that were previously soldered to the circuit board. All LEDs are interconnected with 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 isolated from short circuits, but work on this will continue in future versions.

In this step by step instructions I will tell you how to make a wall clock with your own hands.

Watch features:

  • Large numbers (each number is approximately the size of an A4 sheet).
  • Thin walls (can be inserted into a picture frame).
  • Automatic adjustment depending on the brightness of the lighting in the room.
  • Dedicated daylight savings time button.

Step 1: Required Materials


What I used for wall electronic clock with large numbers.

Electronics:

  • Arduino nano V3.0 (unfortunately, since I can't afford the original arduino, I used a Chinese clone) - 150 rubles.
  • Digital module for measuring light intensity Photoresistor for Arduino - 60 rubles.
  • DS3231 AT24C32 IIC-memory module for precise time for Arduino - 60 rubles.
  • DC-DC converter LM2596, Output power 1.23V-30V - 50 rubles.
  • 4 meters of WS2811 LED strip 30 diodes / m - 700 rubles. (one WS2811 controls 3 led chips)

The total cost of electronics: 900 rubles.

Other materials:

  • Heat shrink tube - 400 rubles (33m in stock)
  • 20 pcs. 5 x 7 cm printed circuit board - 200 rubles.
  • 3 pcs. Microswitch - 60 rubles.
  • Solder - 50 rubles
  • Flux - 50 rubles.
  • UTP (Unshielded Twisted Pair) cable
  • LCD font (http://www.dafont.com/lcd-lcd-mono.font) - free.
  • Cardboard - free of charge in the supermarket.
  • Polystyrene panel - 100 rubles.

As well as various tools.

Step 2: Preparation - Number Templates


  1. Download and install clock font
  2. Open Word or another program and create a template like in the first photo.
  • Font size ~ 800,
  • Font white color with black outline
  • Gray stripes where the LED strips will be

Print the template and cut out the stripes with a clerical knife (as in the second photo)

Step 3: Preparation - cut cardboard and LED strip

Using the digital template, cut the cardboard to size (remember to leave space for the dots between the hours and minutes)

If your LED strips come with connectors on each end (like mine), unplug the connector and cut them into 3 pieces.

Step 4: Attaching the LED Strip


Paste using the template led strip on cardboard.

This is not required, but I used a pencil to mark where the LED strips should be placed.

It is much more convenient to glue them when you see the final shape. Thanks to this, I noticed that I left too much space for dots between the numbers and corrected it in time.

Step 5: Soldering the LED Strip


Now the long soldering process begins.

Solder the LED strip to form a continuous strip. Pay attention to the order of soldering the strips in the photo. For the dots, I used one piece of tape, which I sealed with tape in the middle.

Colors I chose:

  • Blue for earth
  • Green for data
  • Red for +12V

Step 6: Mounting the Arduino on the PCB


I tried sketching in Fritzing but couldn't find all the details 🙁

So, in the first photo, the wiring diagram, and in the second, how it looks for me.

Step 7: Checking the LED


Before uploading the code (which I have nothing to do with), don't forget to install the FastLED library.

If everything works fine, the LEDs should cycle through colors. If you're having problems, check your solder joint first.

Files

Step 8: Program your watch

After some time, I managed to make a watch that suits me completely. However, everyone will find for themselves what can be improved.

The code is well commented, so there shouldn't be any problems with it.

All debug messages are also commented out.

To change the color used, you must change the variable on line 22 (int ledColor = 0x0000FF; // Color used (in hex)). You can find the list of colors at the bottom of this page.

I remember... Thirty years ago, six indicators were a small treasure. Anyone who could then make a clock on TTL logic with such indicators was considered a sophisticated expert in his field.

The glow of gas-discharge indicators seemed warmer. After a few minutes, I was wondering if these old lamps would work, and I wanted to do something with them. Now it is very easy to make such a clock. It is enough to take a microcontroller ...

Since at the same time I was fond of programming microcontrollers in languages high level I decided to play a little. I tried to design a simple digital gas discharge clock.

Purpose of design

I decided that the clock should have six digits, and the time should be set with a minimum number of buttons. Also, I wanted to try and use a few of the most common families of microcontrollers from different manufacturers. I intended to write the program in C.

Discharge indicators require high voltage to operate. But I did not want to deal with dangerous mains voltage. The clock had to be powered by harmless 12V.

Since my main goal was to play, you will not find descriptions of the mechanical design and drawings of the case here. If you wish, you yourself can change the clock in accordance with your tastes and experience.

That's what I did:

  • Time indication: HH MM SS
  • Alarm indication: HH MM --
  • Time display mode: 24 hours
  • Accuracy ±1 second per day (depending on the quartz resonator)
  • Supply voltage: 12V
  • Current consumption: 100 mA

Clock scheme

For a device with a six-digit digital display, the multiplex mode was the natural solution.

The purpose of most of the elements of the flowchart (Figure 1) is clear without comment. To a certain extent, a non-standard task was the creation of a TTL level converter into high-voltage indicator control signals. Anode drivers are made on high voltage NPN and PNP transistors. The scheme is borrowed from Stefan Kneller (http://www.stefankneller.de).

The 74141 TTL chip contains a BCD decoder and a high voltage driver for each digit. It may be difficult to order one chip. (Though I don't know if they're actually being made by anyone now.) But if you find gas-discharge indicators, 74141 may be somewhere nearby :-). In the days of TTL logic, there was practically no alternative to the 74141 chip. So try to find one thing somewhere.

The indicators require a voltage of about 170 V. It makes no sense to develop a special circuit for a voltage converter, since there are a huge number of boost converter chips. I chose the inexpensive and widely available MC34063 chip. The converter circuit is almost completely copied from technical description MC34063. Only the T13 power key has been added to it. The internal key for this high voltage does not fit. I used a choke as an inductance for the converter. It is shown in Figure 2; its diameter is 8 mm and its length is 10 mm.

The efficiency of the converter is quite good, and output voltage relatively safe. At a load current of 5 mA, the output voltage drops to 60 V. R32 acts as a current sense resistor.

The linear regulator U4 is used to power the logic. There is a place for a backup battery on the diagram and on the board. (3.6 V - NiMH or NiCd). D7 and D8 are Schottky diodes, and resistor R37 is for limiting the charging current according to the characteristics of the battery. If you're building a watch just for fun, you won't need a battery, D7, D8, or R37.

The final circuit is shown in Figure 3.

Figure 3

The time setting buttons are connected via diodes. The state of the buttons is checked by setting the logical "1" at the corresponding output. As a bonus feature, a piezo emitter is connected to the output of the microcontroller. To stop this nasty squeak, use a small switch. A hammer would be quite suitable for this, but this is an extreme case :-).

Schematic component list, PCB drawing and component layout can be found in the Downloads section.

CPU

Almost any microcontroller with a sufficient number of pins, a minimum of required amount which are listed in Table 1.

Table 1.
Function conclusions
Food 2
Quartz resonator 2
Anode management 6
Driver 74141 4
Button input 1
Piezo buzzer 1
Total 16

Each manufacturer develops its own families and types of microcontrollers. The location of the conclusions is individual for each type. I tried to design a universal board for several types of microcontrollers. The board has a 20-pin socket. With a few wire jumpers, you can adapt it to different microcontrollers.

The microcontrollers tested in this circuit are listed below. You can experiment with other types. The advantage of the scheme is the ability to use different processors. Radio amateurs, as a rule, use one family of microcontrollers and have an appropriate programmer and software tools. Microcontrollers from other manufacturers can cause problems, so I gave you the opportunity to choose a processor from your favorite family.

All the specifics of the inclusion of various microcontrollers are reflected in Tables 2 ... 5 and in Figures 4 ... 7.

Table 2.
Freescale
Type of MC68HC908QY1
Quartz resonator 12 MHz
Capacitors C1, C2 22 pF
Program freescale.zip
(See Downloads section)
Settings

Note: A 10 MΩ resistor is connected in parallel with the quartz resonator.

Table 3
Microchip
Type of PIC16F628A
Quartz resonator 32.768 kHz
Capacitors C1, C2 22 pF
Program pic628.zip
(See Downloads section)
Settings Int. 4 MHz generator - I/O RA6,
MCLR OFF, WDT OFF, LVP OFF,
BROUT OFF, CP OFF, PWRUP OFF

Note: The microcircuit must be rotated 180° in the socket.

Table 4
Atmel
Type of ATtiny2313
Quartz resonator 12 MHz
Capacitors C1, C2 15 pF
Program attiny.zip
(See Downloads section)
Settings sq. oscillator 8 MHz, RESET ON

Note: Add SMD components R and C to the RESET pin (10 kΩ and 100 nF).

Table 5
Atmel
Type of AT89C2051
Quartz resonator 12MHz
Capacitors C1, C2 22 pF
Program at2051.zip
(See Downloads section)
Settings --

Note: Add SMD components R and C to the RESET pin (10 kΩ and 100 nF); connect the pins marked with asterisks to the +Ub power bus through 3.3 kΩ SMD resistors.

By comparing the codes for different microcontrollers, you will see that they are very similar. Differences exist in access to ports and the definition of interrupt functions, as well as in what depends on the components of the harness.

The source code consists of two sections. Function main() configures ports and starts a timer that generates interrupt signals. After that, the program scans the pressed buttons and sets the corresponding time and alarm values. In the same place, in the main loop, the current time is compared with the alarm clock and the piezo emitter is turned on.

The second part is the timer interrupt routine. A subroutine that is called every millisecond (depending on the capabilities of the timer) increments the time variables and manipulates the display digits. In addition, the state of the buttons is checked.

Running the circuit

Component installation and setup begin with the power supply. Solder the U4 regulator and surrounding components. Check for 5V for U2 and 4.6V for U1. The next step is to assemble the high voltage converter. Set the voltage to 170 V with the trimmer resistor R36. If the tuning range is not enough, slightly change the resistance of the resistor R33. Now install the U2 chip, transistors and resistors of the anode and digit driver circuit. Connect the U2 inputs to the GND bus and connect one of the resistors R25 - R30 in series to the +Ub power bus. In the corresponding positions, the indicator numbers should light up. At the last stage of testing the circuit, connect pin 19 of the U1 chip to ground - the piezo emitter should beep.

Source codes and compiled programs can be found in the corresponding ZIP file in the "Downloads" section. After flashing the program to the microcontroller, carefully check each pin in position U1 and install the necessary wire and solder jumpers. Please refer to the microcontroller images above. If the microcontroller is programmed and connected correctly, its generator should work. You can set the time and alarm. Attention! There is a place on the board for one more button - this is a spare button for future extensions :-).

Check generator frequency accuracy. If it is not within the expected range, slightly change the value of capacitors C1 and C2. (Solder small capacitors in parallel or replace them with others). Clock accuracy should improve.

Conclusion

Small 8-bit processors are quite suitable for high-level languages. The C language was not originally intended for small microcontrollers, but for simple applications you can perfectly use it. assembler better fit for complex tasks that require compliance with critical times or maximum processor load. For most hams, both freeware and shareware limited versions of the C compiler will do.

C programming is the same for all microcontrollers. You must know the functions of the hardware (registers and peripherals) of the selected type of microcontroller. Be careful with bit operations - the C language is not adapted to the manipulation of individual bits, which can be seen in the example of the original when for ATtiny.

Finished? Then tune in to the contemplation of vacuum tubes and see ...

…the old days are coming back… :-)

Editorial note

A complete analogue of SN74141 is the K155ID1 microcircuit, produced by the Minsk software "Integral".
The chip can be easily found on the Internet.

Even in my youth, I wanted to build an electronic watch. It seemed to me that assembling a watch was the pinnacle of skill. As a result, I assembled a watch with a calendar and an alarm clock on the K176 series. Now they are already obsolete and I wanted to collect something more modern. After a long search on the Internet (never thought that I was so hard to please;)) I liked this scheme. The difference from the above scheme is that a rare chip is not used TRIC6B595, and its composite and more powerful analogue on microcircuits 74HC595 and ULN2003. Changes to the diagram are shown below.



Scheme electronic LED clock ticker

The author of the scheme is respected OLED, the firmware is also his. The clock displays the current time, year, month and day of the week, as well as the temperature outside and inside the house with a running line. They have 9 independent alarm clocks. It is possible to adjust (correct) the stroke + - minute per day, select the line speed, change the brightness of the LEDs, depending on the time of day.

In the event of a power outage, the watch is powered either by an ionistor (capacity of 1 Farad is enough for 4 days of travel), or by a battery. Whoever likes it, the board is designed to install both. They have a very convenient and understandable control menu (all controls are made with just two buttons). The following parts are used in the watch (all parts are in SMD cases):

microcontroller AtMEGA 16A

-
shift register 74HC595

-
Chip ULN2803(eight keys of Darlington)

-
Temperature sensors DS18B20(installed on request)

-
25 75 ohm resistors (type 0805)

-
3 resistors 4.7kΩ

-
2 resistors 1.5 kΩ

-
1 resistor 3.6 kΩ

-
6 SMD capacitors with a capacity of 0.1uF

-
1 capacitor 220uF

-
Watch quartz at a frequency of 32768 hertz.

-
Matrices 3 pieces brand 23088-ASR 60x60 mm - common cathode

-
Boozer any 5 volts.



Printed board for electronic LED clock running line

For residents of Ukraine, I’ll tell you, there are matrices in the Lugansk radio market store. The advantages of watches over other similar devices are a minimum of details and high repeatability. The LED clock starts working immediately after the firmware, unless of course there are no jambs in the installation. The microcontroller is flashed in-circuit; for this, special conclusions are provided on the board. I flashed with PonyProg. Screenshots of fuses for programs ponyprog and AVR are given below, the firmware files in Ukrainian and Russian are also posted, to whom what is dearer.


If you do not need temperature sensors, then you can not install them. The clock automatically recognizes the connection of sensors, and if one or both sensors are missing, then the device simply stops displaying the temperature (if one sensor is missing, then the outside temperature is not displayed, if both, then the temperature is not displayed at all).

Homemade housing for LED watches

A video is provided to demonstrate the operation of the clock, it is not High Quality, because it was filmed with a camera, but what is it.

Watch video

Four copies of this watch have already been collected, I give each one to my relatives for their birthday. And everyone really liked them. If you also wanted to collect this watch and you have any questions, you are welcome to our forum. Sincerely, Sergey Voitovich ( Sergey-78 ).

Discuss the article LED ELECTRONIC CLOCK