Homemade electronic clock with large numbers. Homemade clock on LED matrices. Schematic diagram of the clock

Homemade wrist watches vacuum indicator made in steampunk style. Material taken from www.johngineer.com. This wristwatch is assembled on the basis of the IVL-2 display. I originally bought several of these indicators to create a standard table clock, but after some thought I realized that I could build a stylish wristwatch too. The indicator has a number of features that make it more suitable for this purpose than most other Soviet displays. Here are the parameters:

  • The rated filament current is 60mA 2.4V, but works with 35mA 1.2V.
  • Small size- only 1.25 x 2.25"
  • Can work with relatively low voltage grids 12V (up to 24)
  • Consumes only 2.5 mA/segment at 12.5V

All photos can be made larger by clicking on them. The biggest obstacle to the successful completion of the project was food. Since this watch was intended to be part of a costume, it doesn’t matter that the battery only lasts 10 hours. I settled on AA and AAA.

The scheme is quite simple. Microcontroller Atmel AVR ATMega88, and real time clock - DS3231. But there are other chips, much cheaper, that will work just as well in a generator.

The VFD display is driven by the MAX6920 - a 12-bit shift register with high voltage (up to 70V) outputs. It is easy to use, very reliable and compact. It was also possible for the display driver to solder a bunch of discrete components, but this was impractical due to space constraints.

The battery voltage also powers a 5V boost converter (MCP1640 SOT23-6), which is required for normal operation of the AVR, DS3231, and MAX6920, and also acts as the input voltage for a second boost converter (NCP1403 SOT23-5), which produces 13V for vacuum indicator grid voltage.

The watch has three sensors: one analog and two digital. The analog sensor is a phototransistor and is used to detect the light level (Q2). Digital sensors: BMP180 - pressure and temperature, and MMA8653 - accelerometer for motion detection. Both digital sensors are connected via an I2C bus to the DS3231.

Brass tubes are soldered for beauty and protection of the glass display wristwatch, and 2 mm thick copper wires - for attaching a leather strap. The full circuit diagram is not given in the original article - see the connection on the datasheets to the indicated microcircuits.

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

The glow of the gas-discharge indicators seemed warmer. After a few minutes I was wondering if these old lamps would work and wanted to do something with them. Now it’s very easy to make such a watch. All you need is a microcontroller...

Since at that time I was interested in programming microcontrollers in languages high level, I decided to play a little. I tried to construct a simple clock using digital gas discharge indicators.

Purpose of design

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

Gas discharge indicators require high voltage to operate. But I didn’t want to deal with dangerous mains voltage. The watch was supposed to be powered by a harmless 12 V voltage.

Since my main goal was the game, you will not find any description of the mechanical design or body drawings here. If you wish, you can change the watch yourself in accordance with your tastes and experience.

Here's what I got:

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

Clock diagram

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

The purpose of most elements of the block diagram (Figure 1) is clear without comment. To a certain extent, a non-standard task was to create a TTL level converter into high-voltage indicator control signals. The anode drivers are made using high-voltage NPN and PNP transistors. The diagram 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. (Although I don't know if anyone makes them anymore). But if you find gas-discharge indicators, 74141 may be somewhere nearby :-). At the time of TTL logic, there was practically no alternative to the 74141 chip. So try to find one 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 IC34063. The converter circuit is almost completely copied from technical description MC34063. A T13 power switch has only been added to it. Internal key for this high voltage doesn't fit. I used a choke as 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 the output voltage is relatively safe. With a load current of 5 mA, the output voltage drops to 60 V. R32 acts as a current-sensing resistor.

To power the logic, linear regulator U4 is used. There is space on the circuit and board for a backup battery. (3.6 V - NiMH or NiCd). D7 and D8 are Schottky diodes, and resistor R37 is designed to limit the charging current according to the characteristics of the battery. If you are building watches just for fun, you won't need the battery, D7, D8 and 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 a logical “1” at the corresponding output. As a bonus feature, a piezo emitter is connected to the microcontroller output. To shut up that nasty squeak, use a small switch. A hammer would be quite suitable for this, but this is a last resort :-).

A list of circuit components, a printed circuit board drawing, and a layout diagram can be found in the “Downloads” section.

CPU

Almost any microcontroller with a sufficient number of pins, the minimum required number of which is indicated in Table 1, can control this simple device.

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

Each manufacturer develops its own families and types of microcontrollers. The location of the pins 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 jumper wires 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 the appropriate programmer and software tools. There may be problems with microcontrollers from other manufacturers, so I gave you the opportunity to choose a processor from your favorite family.

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

Table 2.
Freescale
Type 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 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 ATtiny2313
Quartz resonator 12 MHz
Capacitors C1, C2 15 pF
Program attiny.zip
(see "Downloads" section)
Settings Sq. 8 MHz oscillator, RESET ON

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

Table 5.
Atmel
Type AT89C2051
Quartz resonator 12 MHz
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 via 3.3 kOhm SMD resistors.

When you compare the codes for different microcontrollers, you will see that they are very similar. There are differences in access to ports and definition of interrupt functions, as well as in what depends on the hardware components.

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

The second part is a subroutine for handling timer interrupts. A subroutine that is called every millisecond (depending on the timer's capabilities) increments the time variables and controls the display digits. In addition, the status of the buttons is checked.

Running the circuit

When installing components and setting up, start with the power source. Solder the U4 regulator and surrounding components. Check for 5 V voltage for U2 and 4.6 V for U1. The next step is to assemble the high voltage converter. Use trimmer resistor R36 to set the voltage to 170 V. If the trim range is not enough, slightly change the resistance of resistor R33. Now install the U2 chip, transistors and resistors of the anode and digital 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. The indicator numbers should light up in the corresponding positions. At the last stage of checking the circuit, connect pin 19 of the U1 microcircuit to ground - the piezo emitter should beep.

You will find the source codes and compiled programs in the corresponding ZIP file in the “Downloads” section. After flashing the program into the microcontroller, carefully check each pin in position U1 and install the necessary wire and solder jumpers. Refer to the microcontroller images above. If the microcontroller is programmed and connected correctly, its generator should start working. You can set the time and alarm. Attention! There is space on the board for one more button - this is a spare button for future expansions :-).

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

Conclusion

Small 8-bit processors are quite suitable for high-level languages. C was not originally intended for small microcontrollers, but for simple applications you can use it just fine. Assembly language is better suited for complex tasks, requiring compliance with critical times or maximum processor load. For most radio amateurs, both free and shareware limited versions of the C compiler are suitable.

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

Are you done? Then tune in to contemplate the vacuum tubes and watch...

...the old days are back... :-)

Editor's note

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

You can find many on sale various models and options for electronic digital clocks, but most of them are designed for indoor use, since the numbers are small. However, sometimes it is necessary to place a clock on the street - for example, on the wall of a house, or in a stadium, square, that is, where it will be visible from a great distance by many people. For this purpose, this circuit of a large LED clock was developed and successfully assembled, to which you can connect (via internal transistor switches) LED indicators of any size. You can enlarge the schematic diagram by clicking on it:

Description of the clock

  1. Watch. In this mode there is a standard type of time display. There is a digital correction of the clock accuracy.
  2. Thermometer. In this case, the device measures the temperature of the room or air outside from one sensor. Range from -55 to +125 degrees.
  3. Power supply control is provided.
  4. Displays information on the indicator alternately - a clock and a thermometer.
  5. To save settings and settings when 220V is lost, non-volatile memory is used.


The basis of the device is the ATMega8 MK, which is flashed by setting fuses according to the table:

Operation and clock management

When you turn on the watch for the first time, an advertising splash screen will appear on the screen, after which it will switch to displaying the time. Pressing a button SET_TIME the indicator will go in a circle from the main mode:

  • minutes and seconds display mode. If in this mode you simultaneously press the button PLUS And MINUS, then the seconds will be reset;
  • setting the minutes of the current time;
  • setting the current time clock;
  • symbol t. Setting the duration of the clock display;
  • symbol o. Display time of external temperature indication symbols (out);
  • the amount of daily correction of the clock accuracy. Symbol c and correction value. Setting limits from -25 to 25 sec. The selected value will be added or subtracted from the current time every day at 0 hours 0 minutes and 30 seconds. For more details, read the instructions that are in the archive with the firmware and printed circuit board files.

Setting the clock

While holding down the buttons PLUS/MINUS We do accelerated setting of values. After changing any settings, after 10 seconds the new values ​​will be written to non-volatile memory and will be read from there when the power is turned on again. New settings take effect during installation. The microcontroller monitors the presence of main power. When it is turned off, the device is powered from internal source. The redundant power module diagram is shown below:


To reduce current consumption, the indicator, sensors and buttons are turned off, but the clock itself continues to count time. As soon as the 220V mains voltage appears, all indication functions are restored.


Since the device was conceived as large led clock, they have two displays: a large LED - for the street, and a small LCD - for easy setup of the main display. The large display is located at a distance of several meters from the control unit and is connected by two cables of 8 wires. To control the anodes of the external indicator indicator, transistor switches are used according to the diagram given in the archive. Project authors: Alexandrovich & SOIR.

The photo shows a prototype that I assembled to debug the program that will manage this entire facility. The second arduino nano in the upper right corner of the breadboard does not belong to the project and sticks out there just like that, you don’t have to pay attention to it.

A little about the principle of operation: Arduino takes data from the DS323 timer, processes it, determines the light level using a photoresistor, then sends everything to the MAX7219, and it, in turn, lights up the required segments with the required brightness. Also, using three buttons, you can set the year, month, day, and time as desired. In the photo, the indicators display time and temperature, which is taken from a digital temperature sensor

The main difficulty in my case is that the 2.7-inch indicators have a common anode, and they had to, firstly, somehow make friends with the max7219, which is designed for indicators with a common cathode, and secondly, solve the problem with their power supply, since they need 7.2 volts for glow, which max7219 alone cannot provide. Having asked for help on one forum, I received an answer.

Solution in the screenshot:


A microcircuit is attached to the outputs of the segments from max7219, which inverts the signal, and a circuit of three transistors is attached to each output, which should be connected to the common cathode of the display, which also invert its signal and increase the voltage. Thus, we get the opportunity to connect displays with a common anode and a supply voltage of more than 5 volts to the max7219

I connected one indicator for the test, everything works, nothing smokes

Let's start collecting.

I decided to divide the circuit into 2 parts due to the huge number of jumpers in the version that was separated by my crooked paws, where everything was on one board. The clock will consist of a display unit and a power and control unit. It was decided to collect the latter first. I ask aesthetes and experienced radio amateurs not to faint because of the cruel treatment of parts. I have no desire to buy a printer for the sake of LUT, so I do it the old fashioned way - I practice on a piece of paper, drill holes according to the template, draw paths with a marker, then etch.

The principle of attaching indicators remained the same as on.

We mark the position of the indicators and components using a plexiglass template made for convenience.

Markup process







Then using a template we drill holes in in the right places and try on all the components. Everything fit perfectly.

We draw paths and etch.




bathing in ferric chloride

Ready!
control board:


indication board:


The control board turned out great, the track on the display board was not critically eaten up, it can be fixed, it’s time to solder. This time I lost my SMD virginity and included 0805 components in the circuit. At the very least, the first resistors and capacitors were soldered into place. I think I'll get better at it, it will be easier.
For soldering I used flux that I bought. Soldering with it is a pleasure; now I use alcohol rosin only for tinning.

Here are the finished boards. The control board has a seat for an Arduino nano, a clock, as well as outputs for connecting to the display board and sensors (a photoresistor for auto-brightness and a digital thermometer ds18s20) and a power supply with adjustable output voltage (for large seven-segment devices) and for powering the clock and Arduino, on the display board there are mounting sockets for displays, sockets for max2719 and uln2003a, a solution for powering four large seven-segment devices and a bunch of jumpers.




rear control board

Rear display board:

Terrible smd installation:


Launch

After soldering all the cables, buttons and sensors, it's time to turn it all on. The first launch revealed several problems. The last large indicator did not light up, and the rest glowed dimly. I dealt with the first problem by soldering the leg of the SMD transistor, and with the second - by adjusting the voltage produced by lm317.
IT'S ALIVE!

Clock concept with big numbers

Structurally, the device will consist of two boards - one above the other. The first board is a matrix of LEDs that form the hours and minutes, the second is the power part (LED control), logic and power supply. This design will make the watch more compact (without the case, approximately 22cm x 9cm, 4-5 centimeters thick) + will make it possible to screw the matrix to another project if something goes wrong.

The power part will be built on the basis of a UL2003 driver and transistor switches. Logical - on Atmega8 and DS1307. Power supply: 220V - transformer; logic 5V (via 7805), power part - 12V (via LM2576ADJ). There will be a separate compartment for a 3V battery for autonomous power supply of the real time clock - DS1307.

I’m thinking of using Atmega8 and DS1307 (I plan to hang the clock from the ceiling, so that in case of a power outage I don’t have to fumble around for settings every time), however, the board layout will imply the possibility of operating the device without DS1307 (for the first time, and maybe forever - how it will work).

Thus, depending on the configuration, the operating algorithm of the clock program will be as follows:

Atmega8– time counter by timer. Work in a cycle without pauses: polling the keyboard, adjusting the time (if necessary), displaying 4 digits and a separator.

Atmega8+DS1307. Work in a cycle without pauses: polling the keyboard, adjusting the DS1307 time (if necessary), reading the time from the DS1307, displaying 4 digits and a separator. Or another option - reading from DS1307 on a timer, the rest in a loop (I don’t know how best yet).

The segment consists of 4 red LEDs connected in series. One digit – 7 segments with a common anode. I do not plan to separate the segments using the figure-of-eight pattern, as is done in conventional indicators.

Power part of the clock

The power part of the clock is built on a UL2003 driver and transistor switches VT1 and VT2.

UL2003 is responsible for controlling the indicator segments, the keys are for controlling the digits.

The hour and minute separator is controlled separately (signal K8).

The segments, bits and separator are controlled by the microcontroller by applying a positive potential (i.e. applying +5V) to K1-K8, Z1-Z4.

Signals to segments and bits must be supplied synchronously and with a certain frequency in order to ensure dynamic output of information (hours and minutes).

Transistor BCP52 can be used as transistor VT1 (BCP53).

Schematic of the power part of the clock with large numbers

Printed circuit board of a seven-segment indicator for a clock with large numbers

As I said earlier, the clock will consist of two printed circuit boards - an indicator board + logic and a power part.

Let's start with the design and manufacture of the indicator circuit board.

Development of a printed circuit board for a seven-segment indicator for a clock with large numbers

The printed circuit board of a seven-segment indicator for a clock with large numbers in the "lay" format is located at the end of the article, in the attached files. You can read about the technology of manufacturing printed circuit boards using the LUT method.

If you did everything correctly, the finished PCB will look something like this.

Finished printed circuit board of a seven-segment indicator for a clock with large numbers

Assembly of a seven-segment indicator

Since the indicator board is double-sided, the first thing to do is to make interlayer transitions. I do this using the legs of unnecessary parts - I thread them through the holes and solder them on both sides. When all the transitions are completed, I clean them with a flat, fine file - it turns out very neat and nice.

Interlayer vials on the indicator board

The next step, in fact, is assembling the indicator. Why do we need a pack of red (green, white, blue) LEDs. For example, I took these.

Preparing to assemble the indicator

When installing diodes, do not forget that we are making an indicator with a common anode - i.e. The "+" diodes must be connected together. Common anodes on a PCB are large pieces of copper. Be sure to pay attention to the dividing point anode.

Location of anodes on the indicator printed circuit board

As a result, after 2 hours of painstaking work you should get this:

Seven segment indicator

Digital part of the clock

We will assemble the digital part of the clock with large numbers according to the following scheme:

Clock diagram with large numbers

The clock circuit is quite transparent, so I don’t see any point in explaining how it works. The printed circuit board in *.lay format can be downloaded at the end of the article. Note that the printed circuit board is mainly designed for surface-mount parts.

So, the element base that I used:

1. Diode bridge DFA028 (any compact surface mount will do);
2. Voltage regulators LM2576ADJ in D2PAK housing, 78M05 in HSOP3-P-2.30A housing;
3. Transistor switches BCP53 (SOT223 housing) and BC847 (SOT23 housing);
4. Atmega8 microcontroller (TQFP);
5. Real time clock DS1307 (SO8);
6. Power supply 14V 1.2A from some old device;
7. The remaining parts are of any type, suitable in size for installation on printed circuit board.

Of course, if you want to use other parts packages, you will need to make some changes to the PCB.

Pay attention to the resistance values ​​R3 and R4 - they must be exactly as indicated on the diagram - no more, no less. This is done in order to provide exactly 12V at the output of the LM2576ADJ voltage regulator. If you still cannot find such resistor values, then the value of resistance R4 can be calculated using the formula:

R4=R3(12/1.23-1) or R4=8.76R3

Assembling the digital part. Version 1, without DS1307

If, when making a printed circuit board for a watch, you followed the recommendations set out in, then is it unnecessary to remind you that before assembly, the printed circuit board must be drilled, all visible short circuits on it must be eliminated, and the board must be covered with liquid rosin? Then we start assembling the watch.

I recommend starting with assembling the power supply and only then installing the digital part. This general recommendation By self-assembly devices. Why? Simply because if the power supply is assembled with an error, you can burn all the low-voltage electronics that should be powered by this power supply.

If everything is done correctly, the power supply should work immediately. We check the assembly of the power supply - measure the voltage at the control points.

The figure shows the test points at which the supply voltage should be checked. If the voltage corresponds to the declared one, you can begin assembling the digital part of the watch. Otherwise, we check the installation and functionality of the power supply elements.

Test points and voltage values ​​for the clock power supply

After checking the power supply, we proceed to assembling the digital part of the clock - installing all other elements on the printed circuit board. We check for short circuits, especially in the legs of the Atmega microcontroller and the UL2003 driver.

Installation of the digital part of the clock

Please note that we are assembling the clock WITHOUT installing the DS1307 real-time clock, however, all wiring of this chip must be completed. In the future, if the need arises, this will save us time on modifying the clock for the second version, where a separate, independent real-time clock on the DS1307 will still be used.

Preliminary testing of the ATMEGA8 microcontroller

In order to check the correctness and functionality of the microcontroller, we need:

1. Programmer, for example.
2. for in-circuit programming of the microcontroller.
3. AVRDUDESHELL program.

We connect the clock board to the data cable. We connect the data cable to the programmer. Programmer for a computer on which the AVRDUDESHELL program is installed. The clock board should not be connected to a 220V power supply.

Successful reading of data from the microcontroller by the AVRDUDESHELL program

If problems arise when reading fuses, check the installation - there may be a short circuit or a “missing connection” somewhere. Another tip - perhaps the microcontroller is in low-speed programming mode, then just switch the programmer to this mode (