Clock based on Arduino and LED matrices. Clocks on LED matrices

Encyclopedia of Plants 30.10.2023
Encyclopedia of Plants

Many radio amateurs, beginners and others, love to “reinvent the wheel” - build their OWN electronic clocks. This fate did not spare me either. Today, of course, there are plenty of watch designs on the Internet, but for some reason there are only a few watches on LED matrices among them. On the Russian-speaking Internet I found only one completely finished design. At the same time, LED matrices have now become much cheaper, and their cost is no higher, or even lower, than seven-segment indicators of the same size. For example, the GNM23881AD I used with a size of 60x60 mm was purchased for 1.5 euros (3 indicators cost 4.5 euros) for this money you are unlikely to buy four seven-segment indicators of the same sizes). But much more information can be placed on the matrix indicator. In addition to numbers, you can display letters, symbols, and, using a creeping line, text. Based on this, there was a desire to build a clock on LED matrices, but so that the circuit would be no more complicated than on seven-segment ones. I also wanted it to be quite functional and not like others. Thus the following scheme was born.

The functionality of the watch is as follows:

  • Countdown, calendar, day of the week. (leap years are taken into account, the transition to summer/winter time is not carried out).
  • Preservation of the clock in the event of loss of external power (consumption is 15 microns).
  • Stroke correction + - 59.9 sec/day, in increments of 0.1 sec.
  • 9 alarms. 3 of which are “one-time”, and 6 “permanent”, individually customizable by day of the week.
  • Individually adjustable duration of the sound signal for each alarm (1-15 minutes).
  • Sound confirmation of button presses (can be disabled).
  • Hourly beep (can be disabled). From 00-00 to 08-00 there is no signal.
  • 1 or 2 temperature sensors (Street and home).
  • Customizable ticker, through which all information is displayed (except time)
  • The stroke correction value and the “running line” settings are saved even if the backup power is lost.

AtMega16A was chosen as the “heart” of the watch, due to its availability, cheapness and “legality”. I wanted to simplify the circuit as much as possible, so everything that was possible was assigned to the controller. As a result, we managed to get by with just two microcircuits, a controller and a register with powerful TPIC6B595 outputs. If TPIC6B595 is not available to someone, then you can replace it with 74HC595 + ULN2803. Both options have been tried. You can also try using TPIC6C595, it is a little weak and got a little warm, but overall it worked stably. Time is counted using asynchronous time - T2. The clock continues to tick even if there is a power failure. At this time, most of the circuit is de-energized, and only the controller receives power from a battery, accumulator, or ionistor. I was interested in “playing around” with the ionistor, so I used it. The current consumption for hours in standby mode is 15 microns. When powered by a 1F ionistor, the watch “lasted” for four days. This is quite enough to maintain speed during power outages. If you use a CR2032 battery, then theoretically, according to calculations, the charge should be enough for 1.5 years. The controller “listens” for the presence of mains voltage through pin RV.3. The supply voltage, through the divider R2-R3, is supplied to pin PB.3, and in the normal state is approximately 1.5 V. If the external voltage drops below 4.1 volts, then the voltage at pin RV.3 will become less than 1.23 volts, and an interrupt from the comparator will be generated, and in the interrupt handler all “extra” nodes of the controller will be turned off and the controller itself will be put to sleep. In this mode, only the T2 timer continues to operate. When external power appears, the voltage on RV.3 will again rise above 1.23V, the controller “seeing” this will put all nodes into working condition. If instead of an ionistor a CR2032 battery is used, then it must be connected through a diode (preferably a Schottky diode). The anode of the diode is connected to the + battery, and the cathode to the cathode VD1.

In normal mode, the screen displays the time in hours-minutes format. The ticker starts running at intervals of one minute. The running line displays the day of the week, date, year, temp. at home, and temp. on the street. The ticker is customizable, i.e. You can turn on/off the display of any of the elements. (for example, I always turn off the year display). When you turn off the display of all elements of the ticker, it does not start at all, and the clock constantly displays only the time.

9 alarm clocks are divided into 3 disposable and 6 reusable. When you turn on alarms 1-3, they only sound once. In order for them to work again, they must be turned on manually again. And alarm clocks 4-9 are reusable, i.e. they will operate daily at the set time. In addition, these alarms can be set to go off only on certain days of the week. This is convenient, for example, if you don’t want the alarm to wake you up on the weekend. Or for example, you need to wake up on weekdays at 7-00, and on Thursday at 8-00, and on weekends you don’t need an alarm clock. Then we set up one reusable one at 7-00 on Monday-Wednesday and Friday, and the second at 8-00 on Thursday..... In addition, all alarm clocks have a signal duration setting, and if you, in order to wake up, do not have enough signal for 1 minute , then you can increase it for a time from 1 to 15 minutes.

The course is corrected once a day, at 00-00. If the clock is fast, for example, by 5 seconds per day, then at 00-00-00 the time will be set to 23-59-55, but if the clock is behind by 5 seconds, then at 00-00-00 the time will be set to 00-00-05 . Correction step – 0.1 sec. Maximum correction – 59.9 sec/day. With a working quartz, you are unlikely to need more. Correction is also carried out in standby mode when powered by battery.

LED matrices can use any 8*8 LEDs with a common cathode. As already stated, I used the GNM23881AD. In principle, you can “assemble” a matrix from individual LEDs. The AtMega16a microcontroller can be replaced with the “old” AtMega16 with the letter L. At the same time, theoretically, the current consumption from the battery should increase slightly. Probably just AtMega16 will work, but problems may arise when running on a 3-volt battery. Diode D1 - preferably any Schottky diode. It also works with a regular rectifier, but in order to protect yourself from various glitches related to the fact that part of the circuit is powered by voltage “before the diode”, and part “after the diode”, it is better to look for Schottky voltage. Transistor VT1 – any n-p-n.

The clock is controlled by two buttons. Their number could be increased to 8 pieces without adding any more components except the buttons themselves, but I wanted to try to “get out” with just two. The buttons are conventionally named “OK” and “STEP”. The “STEP” button usually moves to the next menu item, and the “OK” button changes the parameters of the current menu. The signal of a triggered alarm can also be turned off using the “OK” or “STEP” buttons. Pressing any button while the alarm is ringing turns it off. The control scheme turned out like this:

Structurally, the watch is made on one PCB. The size of the PP corresponds to the size of the indicators. The minimum width of PP roads is 0.4 mm, the distance between them is 0.4 mm. So LUT lovers can easily make the board themselves.

All elements are in SMD design and are located on one side of the board. And the indicators are on the other. The result is a miniature monolithic block that can be easily integrated into any small flat housing.

The body is soldered from fiberglass, puttied and painted in “ripe cherry” color. The front panel glass is regular tinted glass.

The final result.

Added brightness adjustment. The scheme does not change. Brightness adjustment is made either by time or depending on the illumination. The type of adjustment is selected automatically. If a photoresistor is connected, then the brightness of the indicators changes depending on the illumination, and if the photoresistor is not connected, then we manually set the time when to reduce the screen brightness and when to restore it back.

The time setting is done like this. In the “SETTINGS” menu, after redefining the temperature sensors (if there is only one sensor, or not at all, then after setting the line speed), we find ourselves in a menu where we set the brightness reduction time, recovery time, as well as the desired level of brightness reduction.

If a photo sensor (photoresistor) is connected, then after redefining the temperature sensors we will be taken to the “photoresistor calibration” menu. At this time, the result of measuring the voltage on the photoresistor is displayed on the screen. You need to illuminate the sensor with something very bright and press the “OK” button. The program will remember this value. This is done in order to cut off the “dead zone”.

The photoresistor is connected to pin RA.7. Any photoresistor whose light and dark resistance changes by a factor of 50 or more is suitable (for modern photoresistors, as a rule, 500-2000). Resistor R4 should be approximately 10 times greater than the light resistance of the photoresistor. If your photoresistor has a light resistance of less than 0.5 kΩ, you need to connect a regular resistor in series with it so that the total resistance becomes 0.5 kΩ.

PHOTORESISTOR CONNECTION DIAGRAM.

Removed glitches in the operation of ds18b20 sensors. periodically one or even two sensors “disappeared” (not everyone had this)

On the topic of homemade watches, I promised to continue, so here you go. Clock on homemade LED matrices.

These LEDs were ordered BEFORE I decided to make watches on matrices
I ordered three different colors of LEDs from one seller: , and
This was done in order to try to make segment clocks, at the rate of three LEDs per segment 7*4*3=84+2=86 pieces
It's roughly like this:

I wanted to try different colors and definitely bright ones (how could it be otherwise?)
For this reason, batches of 100 pieces suited me quite well, especially since the price is quite reasonable, and I also ordered from the same store to have the numbers made in different colors so that I could compare the colors on one display - which one would be more beautiful, and so on - just kidding ... :)

The product was ordered and paid for August 20, 2016, and arrived September 15, 2016, by our standards, quite quickly. BUT! Red LEDs - did not arrive! At the end of the buyer's protection period, a dispute was opened and the seller returned the money. It was just a shame to waste my time...

The product arrived in a standard yellow bubble mailing envelope, the LEDs themselves were packed in a separate plastic bag, the number of blue and green pieces was a little more than 100 (I don’t remember exactly now, but I remember that there were 4-5 pieces more)
All working (i.e. glowing)
Those that were multi-colored were packaged in separate bags, on which the color R G B W Y was marked with a marker - the color matched everywhere, and also 2-3 extra - the impression was created that this was probably the case for everyone, but later I was convinced that this was not always the case it happens the other way around...

If it weren’t for the red jamb, the seller could have been given a fat A+ for generosity.

On the other hand, the money was returned - the problem is simply wasted time and disappointed expectations
And he also sent a letter where he wrote that he was returning HIS money to me, and if the goods arrived, he asked me to return this amount to him
Verbatim:

Hi, my friend, I am now a refund, when you receive a package, please return my money, Please give me a five-star high praise.
To which he had to dash off a letter that this was not HIS money, but he simply returns it to me as a result of a dispute MY money, because I never received his goods and at the same time I lost a lot of time waiting for his goods

By the way, when all the other orders from him arrived, 10 days later, I wrote to him saying that I was worried because... it’s strange - everyone came, but one of the orders did not arrive
To which he answered dryly, without any “hello friend”, “60 days have not passed yet”
And then suddenly he became a “friend” and seemed to have taken HIS money...

But in general - the seller fulfills his duties, responds to letters, the sent goods have only positive emotions, he returned the money for what was not sent - everything is according to the RULES

Well, now about why it was purchased

Clock + radio+meteo+remote control

I have long wanted to make a clock using RGB matrices. GMT2088 matrices were found and ordered. But as they say, appetite comes with eating. Since even just a colored clock is boring, it was decided to plug in an FM tuner, an equalizer, humidity, temperature and pressure sensors. It is also possible to operate from batteries in case of loss of the main mains voltage.

The result was a clock like this:




In the red LEDs you can see 4 luminous dots, it’s not a quadruple in your eyes and it’s not a camera glitch; it’s just that two films are inserted in front of the matrices, which are placed in front of the LCD matrix of the monitor and the glow of the diode is divided into 4 parts. If you play with the location of the films relative to each other, you can get many different displays. The photo quality is poor, but the basics are visible.

Clock setting options:

1. Display color of the received radio station. You can set your own color for the integer and fractional values ​​of the station.

2. Setting the color of the creeping line.

3. Changing the speed of the ticker.

4. Customize the clock display color. You can set each symbol to its own color.

5. Radio range 65MHz to 108MHz. Stores up to 20 radio stations in memory.

6. The sound for each station is saved separately as well as the equalizer settings.

7. Alarm clocks 7. You can configure the on time, off time, sound volume, days on, whether the sound increases or not, and the radio station or buzzer to turn on.

8. Adjustment of low and high frequencies.

9. Select the font for displaying the clock up to 8 fonts, you can upload your own fonts.

10. Automatic or manual adjustment of matrix brightness.

A) Fully automatic depending on the light level

B) Manually using the keys on the remote control or the watch itself

B) At a set time. Sets the turn-on time for minimum and maximum brightness.

11. Monitoring the charge of the watch's backup battery.

12. Control of the clock using the remote control. Made it possible to learn remote control (NEC, RC5, SAMSUNG formats)

13. Made 6 options for replacing a symbol when changing time. (more options will be added later)

14. Control of the main supply voltage. When it disappears, it switches to the backup battery, and when it appears, it turns off the battery.

15. Shutdown timer with a maximum interval of 99 minutes. Turns off the radio sound.

16. Setting the minimum and maximum brightness limits.

17. Forced display of a creeping line with information about the temperature indoors and outdoors

The software is written entirely in assembly language in AVR Studio. Maybe somewhere the program was not written very competently, because I have been studying assembler for a little over a year and then only in my free time, but the main thing is that it works stably and quickly.

The heart of the device is the AVR Atmega32 at a frequency of 16 MHz. The clock is made on two boards. On one matrix with strapping. On the second everything else.

Control of matrices by columns is given to STP16CP05 registers in the TSSOP-24 package. These registers have 16 outputs and the load on each output is up to 80mA. String management decoder 74HC138. Field-effect transistors IRF7314 are installed at the output of the decoder.The RGB modules were not soldered into the board, but were installed in the connectors.

This watch uses a DS3231 real-time clock chip. The choice fell on it due to the fact that it does not need external quartz because it has a fairly accurate quartz resonator with temperature compensation built in and a temperature sensor is also built in.

FM radio is implemented on the RDA5807 chip. This microcircuit has quite good sensitivity.

The AM2321 ready-made module is used as a humidity sensor. A ready-made BMP180 module is used as a pressure sensor. These sensors also have a temperature sensor.

Sensor BMP180:

Module AM2321:


The TEA6330T chip is used as an equalizer. It is responsible for adjusting the volume and adjusting the bass and treble frequencies.

The power amplifier is made using PAM8403. The chip is small but produces enough power. 8 Ohm 2W speakers are connected to the output. You can also connect 4 ohm speakers. At 8 ohms the output power is approximately 1.6 W. At 4 Ohm speaker 3 W.

The watch is designed to operate autonomously from a battery. A battery brand L12T1P31 3.7V 3700 mAh was installed.

When the mains voltage fails, the brightness of the matrices is automatically adjusted to a minimum. If there was an automatic brightness adjustment mode, it is replaced with a manual one. The ability to adjust brightness in the absence of mains voltage is retained. You can also turn on auto mode. When the mains voltage is restored, the brightness will return to the level that was set before the mains voltage failed.

The operating time from the battery in clock mode with reduced brightness is approximately 15 hours. Operating time with maximum brightness, wide font, average radio volume is about 5 hours.

Implemented battery voltage control. Because the internal battery controller turns it off when the voltage is below 2.5 V, and when the voltage drops below 3.2 V, the converter starts to work incorrectly and its output is only 5V. The clock goes into an endless reset. Therefore, a voltage threshold of 3.2V was chosen so as not to drop to the minimum voltage for the converter. If the voltage drops below 3.2V, the clock will be de-energized.

The board provides the ability to install a specialized voltage control chip of the BU48xx type. In this circuit, BU4832 controls 3.2 V.

Battery charge monitoring is assembled on MS TP4056. The voltage converter from 3.7V to 12V is assembled on LM3488.

It is possible to install both 3- and 2-pin batteries. If you don’t need battery temperature control, then we don’t install some of the elements (see the diagram for details). All board diagrams and firmware are at the end of the article.

A divider is assembled on elements R13 R14 to control the voltage of the backup battery.

A divider is assembled on elements R1 R10 R11 R12 to control illumination in automatic mode.

A level matcher is assembled on elements Q1 Q2 R19-R22 because some ms are powered by a voltage of 3V, and some by 5V.

To start with the diagram of the main module, RGB matrix module and external temperature sensor module

Several photos of the finished RGB matrix board. Boards made of double-sided fiberglass. Some improvements were made during the debugging process. Therefore, some photos are slightly different from the boards in the archive. All changes are taken into account in the archive.

Bottom side of the board:


On the bottom side, the 2.4 kOhm resistors are simply soldered to the pins.

Top side without installed dies:


Side view:


View from above:


Effects of changing numbers (not all effects are shown in the video)

Clock management


When you turn on your watch for the first time, you can only control it using buttons. To be able to control the remote control, you need to teach the watch signals from the remote control. To do this, hold down any of the control buttons and press the “Reset” button.The scrolling line “Setting the remote control” will run and we will see the display of the first format of the remote control - NEC. By default, the first NEC protocol is displayed on the matrices. Enumerate protocols by pressing any of the buttons on the back of the watch. The protocols change in a circle NEC - Samsung - RC5.




As I wrote above, the NEC protocol is set by default. Take the remote control and press any button on it. If the selected protocol and the remote control protocol match, the inscription will turn green and then the device will go into the remote control learning mode. If the protocols do not match, then there will be no changes on the matrices and the inscription will remain blue. We switch to the next protocol and press again any button on the remote control.
The protocol definition should work from the first press of the remote control button. If it works on the second press of the remote control button or more, then the protocols do not match and you need to select a different protocol.
Since the NEC and Samsung protocols are a little similar, the NEC format remote control can be trained in the Samsung protocol mode, but you will need to press the same button twice. In the future I will try to adjust the pulse measurement intervals and perhaps this will be removed.

The RC5 protocol is the simplest. In this mode, you can train any remote control, but it will not work normally. In this mode, only the RC5 protocol remote control will work normally.
A lot of articles have been written about the difference between remote control protocols and I won’t describe it all here.

After defining the protocol, the program will go into the remote control button learning mode. The matrices will display which button should be pressed. In standby mode, the color of the symbol will be blue.


Press the button on the remote control. If the data is received successfully, the color of the symbol will turn green:


If the data is received with an error, the color will turn red for a couple of seconds, and then the device will wait for the button to be pressed again.


After the last requested button is pressed. The watch will go into main operating mode. If no sensor or real-time chip is installed, the running line “No sensor found” will be constantly displayed. If you do not install the DS3231 and install any of the sensors, then only flashing dots will be displayed on the matrices.

The following description will be for the remote control. There will be a separate description for controlling the buttons, because using the remote control you can go directly to the desired menu, but using the buttons you can only move sequentially from the beginning to one menu, then to another, and so on in a circle.

After setting up the remote we will see the time displayed. From this mode you can go to different menus. The program provides control of installed TEA6330 and RDA5807 microcircuits. If any microcircuit is not installed, it will not be possible to go to its settings menu and the corresponding creeping line will be entered, either “Equalizer not found” or “Radio not found”.

Description of the operation of the remote control buttons:

On/Off button - turn on - turn off the matrix

Up arrow and down arrow buttons - adjust matrix brightness or change data in setup mode. The brightness of this button is adjusted in all menus.

Left arrow or right arrow button - changes the font in the time display mode, and in the alarm setting mode, moves through the alarm submenu

Button "1" - "Clock" menu

Button "2" - menu "Radio"

Button "3" - "Alarms" menu

Button "4" - "Equalizer" menu

Button "5" - display a creeping line

A) one click displays information from all sensors

B) two presses within 3 seconds display only the outside temperature.

Button "6" - menu "Off timer"

Button "8" - set/reset minimum and maximum brightness

Button "9" - reset seconds and correct time via the Internet

Button "0" - automatic or manual brightness adjustment

CH+ and CH button - scrolling through radio stations in FM mode

Sound + and sound button - volume control

Sound On/Off button - turn on/off sound

"MENU" button - go to basic settings in time mode, go to radio settings in radio mode and alarm settings in alarm mode

"ESC" button - exit from the submenu

The transition depends on what mode the device is in. If you are in the "Time" mode, then the transition will be to the main settings. If in "Radio" mode, then go to the radio settings. If in the "Alarms" mode, then in the alarm settings

"OK" button - confirming changes in setup modes

The watch has 8 fonts to display the time. Switch between fonts using the "Left" or "Right" buttons of the remote control or S6 on the clock board.

Wide font example:


Narrow font example:


Adding your own fonts

Fonts are stored in EEprom. A maximum of 8 fonts can be downloaded.

The font was created using PixelFontEdit-2.7
The font itself and Eprom source for Atmel studuo6.2 are in the archive at the end of the page.
We add fonts from the label eeFront1:
The number of fonts is no more than 8; more will not fit. The program itself will determine the number of downloaded fonts.
There must be a line at the end of the fonts .db "E","N","D" signifying the end of fonts.
Letters END may be large or small but Latin.
We compile the EEprom file and flash it. You can immediately enter all your values ​​into EEprom, with detailed comments for each line.
The font also specifies what dots will be separating hours and minutes. This is set only in the first character of each font.
In the first character, if bit0 of the first byte is set, it will be double, if it is cleared, then it will be single.

Settings in time display mode

In this menu, change parameters using the "Up" and "Down" buttons and confirm the changes with the "OK" button. You can exit the settings at any time by pressing the "ESC" button.

Press the "Menu" button and the "Basic Settings" scrolling line will run, followed by the "Radio Color" line. The whole part of the FM band will flash, use the “Up” or “Down” buttons to set the desired color and press the “OK” button. The fractional part of the FM band will begin to blink. Also set the desired color and click "OK".



If installed color option for the creeping line as in the photo:


Then, when the creeping line is displayed, its color will be new each time.

Next, the line “Setting the clock” will appear. The hour value will start flashing. Use the "Up" or "Down" buttons to set the current hour and press "OK". The minutes will start flashing. Use the "Up" or "Down" buttons to set the current minutes and press "OK".


Next, the line “Clock color” will appear. In this menu, you can set a different color for each clock symbol. Select a color using the "Up" or "Down" buttons. There are 7 color options in total. The eighth option is a multi-colored symbol with alternating colors. Once you have selected the desired color, click the "OK" button. Next, set the color for the following characters and click "OK".


Use the "Up" or "Down" buttons to set the current date and click "OK".




Next, the line “Setting the day of the week” will appear. The days of the week are displayed in the abbreviation Sun - Sunday, Sat - Saturday, Fri - Friday, etc. Use the "Up" or "Down" buttons to set the current day of the week and click "OK". This completes the basic setup.


Next, a creeping line will run with the current day of the week, date, year, pressure, temperature and humidity. The device will switch to time display mode. In this mode, a creeping line displaying information about temperature, pressure and humidity in the room will be displayed after about 4 minutes. Displaying information from all sensors, button "5" on the remote control. A line about temperature and humidity outside is displayed once every 15 minutes (you can set the desired interval yourself, more on that below.) If for some reason a sensor is not installed, then the information from this sensor will not be displayed in the running line. Since there is a temperature sensor in all three sensors, the data will be read from the sensor that is installed. By default the temperature is read from the DS3221.

Radio mode.

The transition to this mode is carried out by pressing the button “2” of the remote control. Radio range 65MHz - 108MHz.

In this mode, the ticker also runs after about 4 minutes.

The following menu is displayed:


The first four digits are the frequency of the received station. The letter "M" or "C" means the received signal is mono or stereo. Under the letter in red is the level of the received signal. The volume is displayed at the very bottom. Scroll through the configured stations using the "CH+" and "CH-" buttons, and adjust the volume using the "Gr+" and "Gr-" buttons. The volume value is saved for each station separately. Also, the HF and LF equalizer settings are saved separately for each station. To switch to the equalizer mode, press the “4” button on the remote control (the setting is described below).

To switch to the radio setup mode, press the “Menu” button on the remote control. The "Radio Settings" ticker will be displayed.

The letter indicating Stereo or Mono will turn red. In playback mode it is blue. If no button is pressed within 15 seconds, the device will go into radio playback mode.


Changing the station frequency is carried out using the "CH+" and "CH-" buttons and the "Left" "Right" buttons on the remote control.

In the range of 76-108 MHz, the “Left” and “Right” keys change the range by 1 MHz, and the “CH-” and “CH+” keys on the remote control change the range by 0.1 MHz.
In the range of 65-76 MHz, the “Left” and “Right” keys change the range by 0.1 MHz, and the “CH-” and “CH+” keys on the remote control change the range by 0.01 MHz.

Adjust the volume using the "Gr+" and "Gr-" buttons. After selecting the desired frequency and volume level, press the "OK" button. The cell for recording the current station will be displayed. If the cell already has a recorded station, its number will be in red.



If the cell is free, it will be green


Select the desired cell using the "CH+" and "CH-" buttons. A total of 20 cells are available for recording. After selecting the desired cell, click the "OK" button. The station frequency and volume level will be recorded in the cell. The device will return to setup mode. To exit the setup mode, press the "ESC" button or do not press anything for 15 seconds. The device will enter radio playback mode.

Setting alarms

Switch to the alarm setting mode using the “3” button on the remote control. The "Alarms" ticker will be displayed. If no button is pressed within 15 seconds, the device will go into time display mode.

After going to the alarm menu, we will see the following:


B1 means alarm number. There are seven of them in total. Dashes after the number mean that the alarm is not turned on. Use the "Left" and "Right" buttons to change the alarm number. If the alarm clock is turned off, it will not be possible to view its settings. To turn on the alarm clock, press the "OK" button. The LED will turn on, indicating that there are alarms turned on, and a bell will appear.


Now if you can view the alarm settings. The menu for each alarm clock is divided into four parts. In the first part, the on time and volume are adjusted. In the second part, the shutdown time and the sound mode are configured: linear or increasing. In the third part, the station to be switched on is configured or the buzzer is selected. In the fourth part, you select the days to turn on the alarm. Press the "Right" button and the first part will appear in front of us.


The alarm time is displayed here. In the lower right corner is the turn-on volume. To change the settings, click the "OK" button. The on clock will start flashing. Use the "Left" and "Right" buttons to change the value and press the "OK" button. This is how we configure all four parameters.

After adjusting the volume level, click "OK". This completes the setup in the first part of the alarm clock.

In this part, you can set the shutdown time and the volume, which increases when the alarm goes off or linearly.

Linear volume is displayed on the right as a rectangle:


Growing GrossThe capacity is displayed as a triangle:


All setup steps are the same as in the first part.

A little about volume settings. In the first menu we adjusted the volume level. If linear volume is set in the second part, then when the alarm goes off, the maximum volume will be the one that was set in the first part. If the volume was set to increasing, then when the alarm goes off, the volume from the minimum value will gradually increase to the value set in the first part.

After setting up the second part, press the “Right” button and get to the third part of the alarm clock settings.


In this part, we configure the radio station to be switched on or select the buzzer by scrolling to the inscription BEEP.


Settings using the same buttons as in the previous parts. Stations are selected only from those that were tuned in the "Radio" mode.

After setting up the third part, press the “Right” button and get to the fourth part of the alarm clock settings.

Here we set the days for the alarm to turn on.


The days of the week are indicated in numbers. 1 - Monday, 2 - Tuesday, 3 - Wednesday, etc.

Press "OK" and the remote control will start flashing the first character. Use the "Left" or "Right" buttons on the remote control to turn on or off the day of the week. Green color is used for the day, red is not used. Below, under the activated day, the LED lights up. Made for those who assembled watches on ordinary LEDs to see which day of the week is used.

After setting, press the "Right" button on the remote control and go to the next alarm clock or press "ESC" and exit to the time display mode.

When the alarm goes off, the LED will flash. If you press the “Off” button while the alarm clock is running, the remote control LED will stop blinking and the alarm clock will not turn off when the turn off time is reached, i.e. the alarm clock is canceled.

Equalizer settings

Go to the equalizer settings menu by pressing the “4” button on the remote control. The “Equalizer” ticker will run. In this mode, low and high frequencies are adjusted. Equalizer settings are saved separately for each radio channel. If none of the buttons is pressed within 15 seconds, it will switch to time display mode.

To adjust the desired frequencies, press the “Left” or “Right” button on the remote control.

Adjusting bass and treble maximum:



To change the low-pass or high-pass filter, press the "OK" button. The bar on the left will start flashing. Use the "Left" and "Right" buttons to change the value. To save the set value, press “OK” on the remote control. Depending on the value, the color of the indicators and numbers indicating the level also changes. Closer to the maximum value they will be red. Closer to the minimum value are blue, and in the middle range are green.

Low frequency setting minimum:


Bass setting average value:


Setting/removing the minimum brightness threshold

By default, the brightness is adjusted from maximum to complete extinguishing of the indicators. But this is not very convenient in automatic mode. In complete darkness, the indicators will go out and nothing will be visible. This is why this mode was made so that the minimum brightness does not fall below or above the set one

Press button 8 on the remote control to get to the menu for setting brightness limits.

The first sets the minimum brightness limit.


Use the "Up" "Down" buttons on the remote control to set the desired brightness and press "OK" on the remote control. There will be a long signal buzzer and the minimum brightness threshold is recorded.


Use the "Up" "Down" buttons on the remote control to set the desired brightness and press "OK" on the remote control.

The buzzer will sound for a long time and the minimum brightness threshold will be recorded.

In the next section, you set the time for turning on the minimum brightness, and then the time for turning on the maximum brightness.

Exit their settings menu "ESC" remote control. Now, when adjusting the brightness, it will not be possible to make it darker or lighter than the set threshold, and in automatic mode the brightness will not be lower or higher than the set one.

To activate the automatic brightness adjustment mode on the remote control, press “0” to switch to automatic operating mode. The LED on the front of the watch will light up.

For real-time brightness adjustment to work depending on illumination, the turn-on times of the minimum and maximum brightness should be equal. Otherwise, the brightness will be set according to the selected time. The brightness changes from minimum to maximum level and vice versa smoothly.

To reset the brightness threshold, simply enter the brightness threshold settings menu again and all limits will be reset.

To set the threshold from the buttons, read paragraph 8 below.

Button control

On the back of the watch there are buttons S4-S9. Depending on which menu we are in, the function of the buttons changes.

S8 button switches to different menus. In order to go to the desired menu, press S8 and hold. After the required number of beeps, release the buzzer and get to the selected menu. The number of buzzer signals will correspond to the number of the remote control button. If there are 4 signals, then we will get to the “Equalizer” menu, if there is 1 signal, then the time display menu, etc.

1. Functions of the buttons in the watch menu:

S6 font change

S7 reset seconds and update time via Internet

S9 go to main settings.

When you press S9, we go to the settings menu. In this menu the buttons S4 and S5 change the parameter, button S6 moves to the next adjustable parameter. It is not possible to exit the menu, you will have to go through all the customizable parameters.

After setting the last parameter, a ticker will run and the device will return to time display mode.

2. Functions of buttons in the radio menu:

S4 and S5 sound adjustment "+" and "-"

S6 and S7 transition through configured channels "+" and "-"

S9 switch to radio setting mode

In the settings menu, the button actions are:

S4 and S5 sound adjustment "+" and "-"

S6 and S7 change the frequency of the radio station "+" and "-"

S9 goes to the menu for recording a station in memory. Use the S6 and S7 buttons to change the memory cell number, and the S9 button to confirm the recording.

Exiting the settings menu - do not press any buttons and the exit will be automatic after 15-20 seconds.

3. Functions of the buttons in the alarm settings menu:

S4 and S5 scrolling through alarms "+" and "-"

S6 and S7 are not used

S9 Turn the alarm on and off

If the alarm clock is turned on, press S4 to get into the main settings of the turned on alarm clock. Go through the alarm clock submenu S4 and S5. To configure the parameter, press S9 and S4 and S5 change the parameter. Next press S9 moves to the next adjustable parameter. The device will exit the alarm settings automatically if within 15 seconds. any button will not be pressed.

4. Functions of the buttons in the equalizer menu:

S4 and S5 scroll through customizable parameters.

S6 enters the mode for changing the selected parameter. In this mode, S4 and S5 change the parameter, and S6 confirms the change.

S7 is not used.

The mode exits automatically after 15 seconds if no buttons are pressed.

6. Functions of the buttons in the sleep timer menu:

S4 and S5 setting the shutdown time interval in 5 minute increments. An interval of 0 minutes means the timer is off

S6 exit to the time display menu.

7. Free. May be used in the future.

8. Functions of the buttons in the brightness limit setting menu:

S4 and S5 brightness change.

S6 confirmation of the selected brightness.

S7 exit from settings.

9. Free. May be used in the future.

A little about the parts used and their replacement and adjustment.

All SMD elements are of standard size 0805. The U1 LM317ADJ stabilizer can be replaced with any one with a stabilization voltage of 3 Volts, for example ASM1117-30. In this case, replace R18 with a jumper, and do not install R17. The 5V U8 LM2576-5 stabilizer can be replaced with LM2596-5. LEDs D6 D7 D11 D12 D13 size 2835. Resistor R24 ​​sets the volume of the buzzer. Do not forget to set the charge current for the battery used with resistors R44 R45 (see table in the diagram). If the charging current is high, I recommend installing a radiator on the TP4056. Resistors R38 and R49 can be used to limit the maximum volume or be replaced with jumpers. Install capacitors C28 C29 C42 C43 in the TEA6330T harness as indicated in the diagram. Moving away from the container in one direction or another will change the frequency adjustment range. C28 and C43 are responsible for LF, and C29 and C42 for HF. I tried to install 6.8nF C29 and C42 RF frequencies practically do not change. Resistors R28 R33 R31 can change the voltage at the output of the converter. At the ratings indicated in the diagram, the voltage is 11.86V.

The voltage is calculated using the formula:

Uout=1.26*(1+((R33+R28)/R31))

Schottky diodes D4 D5 D1 D8 D10 can be replaced with any for a current of 2A. Zener diode D3 can be stopped at any stabilization voltage of 4.3V, 4.7V or 5V.

It is better to start installation by installing all voltage stabilizers and checking them for functionality, so as not to be upset about burned controllers and sensors. Then it is better to mount the converter and test it by applying a voltage of 3.2-5V to the 8th leg of the LM3488. The output should be about 12V.

Next, we install elements for charging the battery and monitoring battery voltage and checking for functionality. For a 2-wire battery, we do not install R39, and replace R43 with a jumper. We do the same for 3-wire if battery temperature control is not needed. The middle terminal of the battery remains dangling. If temperature control is needed, then we install all the elements, although R43 may not be installed because it will be connected in parallel to the battery thermistor and will not greatly affect the operation.

The battery voltage controller is assembled on TL431 and LM358. A reference voltage source of 2.5 V is assembled on the TL431. This voltage is supplied to the 2nd pin of the LM358, and the voltage from the battery is supplied to the 3rd pin of the LM358 through the divider R58 R62 as soon as the voltage on the battery is below 3.2 at the 3rd pin the voltage will also become less than 2.5 volts and at Pin 1 will be 0 Q9 will close. Positive voltage will be supplied to the base of Q8 through R56 R51. Q8 will close and turn off transistor Q7.1, de-energizing the entire board. After disconnecting, starting the clock will only be possible when an external power supply is connected, since the LM358 is powered by an external power source.

If there is a BU4832 chip, then we do not install TL431 LM358, their harness and R56. If we assemble on TL431 and LM358, then we do not install R53 and may have to adjust the response threshold with the R58 R62 divider. If the main power is available, the battery should be charged, and there should be no voltage at the output of the converter. If the battery voltage is above 3.2 volts, then at the base of transistor Q9 it should be approximately 0.7-0.8V.

Now we check the operation of the backup power supply. First, we power the circuit from the main source. Then we unplug it from the network and 12V should appear at the output of the converter. If the converter does not start, then look at what is based on Q9. If the voltage there is less than 0.7V, and the battery is charged, then we measure the voltage at pin 2 of the LM358 should be 2.5V and at pin 3 more than 2.5V. If everything is normal, then the LM358 is faulty or power is not connected to it. The shutdown threshold can be adjusted R62. As its rating increases, the shutdown threshold increases, i.e. the device will be completely de-energized with a deeper discharge of the battery. As the denomination decreases, the threshold decreases.

Capacitors C6 C11 C21 C20 C37 are recommended for use with low ESR.

If everything works, then we mount the processor, flash it and mount all the other elements.. For ease of firmware, the board has contacts for the ISP connector. We solder the GND pin for the ISP in any convenient place.

LED indication

LED D11 lights up, which means the automatic brightness adjustment mode is set. Manual adjustment does not work. The mode is switched using the "0" button on the remote control.

LED D12 is lit, which means the alarms are on. If it blinks, the alarm has gone off.

LED D13 lights up, which means you need to replace the clock backup battery. Even if you remove the battery, the time will not be reset because due to the charging of the capacitors, the DS3231 will be powered for some time. So you have about 5 minutes to replace the battery.

LED D6 lights up, which means the battery is charging

LED D7 lights up, which means the battery is charged.

If both LEDs D6 and D7 do not light up, this means that the clock is running on the internal battery.

We manufacture printed circuit boards (PCBs)

There were some minor miscalculations in attaching the speakers; I made more cutouts than necessary and had to be tricky with how to attach them. The archive takes into account all the changes made to the board.

Version of the board with WI-FI.



I make printed circuit boards using negative photoresist. I print a template on film using an Epson L800 inkjet printerin a negative way. I clean the workpiece using Pemolux powder. I apply film photoresist to the wet workpiece. Behind lack of I iron the laminator with an iron set to division 1. I apply the template and illuminate it with three UV lamps of 20W each for 1 minute 10 seconds. Next, iron again, then wash off the untanned areas and etch. I drill several holes in the outer contact pads and make punctures in the same places in the template. The board and template are combined using needles. The second side is etched. The first one is sealed with tape.

We drill holes. I usually drill transition holes with a diameter of 0.4 mm and solder wires into them. We solder the elements.

Photo of the finished board with WI-FI



We pay more attention to the installation so that we don’t have to look for why it doesn’t work later. Some output elements need to be soldered on both sides. The conclusions of these elements are like vias. You need to stick adhesive tape or electrical tape under the quartz on the board so that there is no contact with the tracks or solder it to the Atmega32 side.

The body was made of 4mm soft plastic. Cuts perfectly with a stationery knife. Since the LEDs are located deep, light guides are needed. The lid of a box from car lamps was used as light guides. The body was drawn in CorelDRAW, printed on plain paper and secured to plastic using double-sided tape and cut out. We hide everything in the case and screw on the antenna:


Sensors stick out from above:


So that it would look normal and the sensors wouldn’t just stick out from the case, a kit for attaching the license plate was bought at a car shop and reflective caps were glued on top of the case.

It turned out like this:


That seems to be all. We plan to add the ability to output information from RDS. Also make another option for encoders.

A program has been written for the ESP8266 module. The firmware for Atmega32 has also been changed, everything is updated in the archive. Changes were also made to the scheme. The TX RX signals from the Atmega to the ESP8266 were not connected correctly. All changes described here are taken into account in the diagram in the archive.

Minor modifications have been made to the circuit. Combined Atmega and ESP8266 Reset signals. But for this you need to match the voltage signals. Added a 9.1 kOhm resistor between Reset Atmega and GND. The 10kOhm resistor between the Reset ESP8266 and the 3V bus has been removed. The voltage at the Reset pin should be within 3V-3.3V.

Added TX RX level matching. Although you can do without it, I did it as it should be according to the rules.

To flash the ESP8266 module you need:

1.Download (if not installed) Arduino IDE from the off site (https://www.arduino.cc/en/Main/Software), install.

2.Launch Arduino IDE, thenFile - Settings- in field Additional Boards Manager URLspaste link to stable versionhttp://arduino.esp8266.com/package_esp8266com_index.json

4.B Boards Managerenter esp8266 in the filter field or manually scroll through the list and click on ESP8266 by ESP8266 Community Forum
Click Install and wait for the download to finish (about 130 Megabytes).
If the download is too fast, you may have already installed the Arduino IDE for ESP8266 and will need to clear the Boards Manager cache, otherwise you will still have the old version installed. You need to first uninstall the old version, and then you need to delete the cache files. For Win7 x64, delete the files from the folder C:UsersUserAppDataRoamingArduino15 and repeat everything starting from step 2
Close Boards Manager and from the Tools menu select Board - Generic ESP8266

Select the serial port to which the board is connected. Open the firmware file.

I used PL2303 to flash the module. The drivers for it below in the archive work on Win 8.1. We install the driver manually.

You can use any USB-COM adapter.

We solder the ESP 8266 module onto the board. We connect the module with a USB-COM adapterTX RX signal connectionscross i.e. TX ESP8266 to RX USB-COM and RX ESP8266 to TX USB-COM. We install the jumper on XP10 and remove the jumpers XP11 and XP12. Click Reset.

A change needs to be made in the firmware for the module in the watch.

In the firmware we enter the name of our WI-FI network and the password for it.

Click the "Right Arrow" icon and the module's firmware will begin.

After completing the firmware, remove the XP10 jumper and install back XP11 and XP12.

I recommend checking that ports 123 are open on your PC and router.
It’s easier to do this on a PC, in the time settings, tab Internet Time - Change settings. We drive into the fieldtime.nist.govand click "Update now". If it says that the time was successfully updated, then your ports are open. If there is an error, then open the ports in the router.
At my home on an ASUS RT16 router with Tomato firmware, everything worked fine by default.
At work on the Zuxel Keenetic Giga II router with native firmware, I had to open the ports, although the time in the router itself was updated from the Internet.

The time is updated by pressing the "9" button on the remote control. The only thing that needs to be taken into account when updating the time is that if there is no access to the Internet, then the seconds will all be reset to zero.
After turning on the clock or pressing the Reset button, to update the time via the Internet, you must wait 30 seconds. This time is necessary for the module to connect to the network or to return an error if there is no connection. If you press the “9” button on the remote control earlier, nothing will happen. During time synchronization, the matrices will be blanked out for 1-2 seconds.
If there is no access to the Internet, the line will be displayed"Oops No network".
If there is access to the network but there is no access to the exact time server, then the line will be displayed"No access to time server"

A new network will also appear with the name “Datchik”. You can also change its name to any in Arduino and change the password for it. A second module with street sensors will be connected to this network.

PS. I decided to abandon automatic synchronization because the DS3231 has very little time maintenance and synchronization is needed no more than once a month, and then maintenance is only a few seconds. So it's easier to do it manually.

A matrix test program was written. Fuses as for the main firmware.
Everything is controlled visually.

The LEDs for backup battery status, alarm on and auto brightness adjustment should be lit. The buzzer must be silent.

1.The first test turns on all the matrix LEDs. The test runs on all colors. Visually you can determine which LEDs do not light up or their color is different from others, which means it’s not lost somewhere. The test begins with completely extinguished matrices.

2. The second part of the test lights up only one LED and runs it across all lines in each of the three colors R G and B. Only one LED should light up. If two LEDs are on, it means there is a short circuit somewhere at the outputs of the matrix registers.

The power supply must provide a current of at least 2A in test mode since there is no brightness adjustment and the consumption is quite large (especially when the color is white). If the unit cannot provide such a current, the test will not start, i.e. there will be attempts to start and then a reset will occur.

Outside temperature sensor module.

The external temperature sensor module is also made on ESP8266 and AM2321 is used as a sensor. This module also contains a room temperature sensor. This was done so that if several identical clocks are collected, then they can receive data from one module. The outdoor module has built-in USB charging for the battery, as well as battery voltage monitoring. When the battery voltage drops below 3.2 volts, the LED will light up.

Visual error control has also been added.

1. No sensor AM2321 green LED is on

2. No sensor BME280 red LED is on

3. Unsuccessful connection to the WI-FI network, the blue LED lights up



The firmware is done in the same way as for the module in the watch. The only thing is that some lines need to be changed in the program.

Set the temperature sensor polling time. Default is 900 sec = 15 min
Change the values ​​in the line:

ESP.deepSleep(900*1000000,WAKE_RFCAL);// time 900 seconds = 15 minutes
Change it to your value. Save and flash.

My module is powered by a 1000mA battery.


Clocks on LED matrices (description and assembly)
The original article is located at: http://radiokot.ru/circuit/digital/home/103/
Author of O-LED development, equipment
The device diagram was slightly changed and began to look like this:

The heart of the device is microcontroller IC1, it contains a control program that keeps track of time, interrogates temperature sensors D1, D2, light sensor R35, sends sound signals to SP1 and displays information on LED matrices H1-H3.
The D3 chip is used to coordinate the microcontroller with the matrices. This is a register with a powerful output that can withstand higher currents than an MK and allows you to “save” its outputs.
Chip D4 is a PWM controller. Its task is to lower the input voltage from +7...+24 Volts to a stable 5 volts. Resistors R32, R33 set the value of the output voltage. A very clear description of this microcircuit can be read at this link (http://mysku.ru/blog/aliexpress/39481.html). Digital sensors D1 and D2 serve as temperature meters, one of which is installed outside, the other remains at home, on the board. Capacitors C1-C4, C6, C7, C10 are used to smooth out power supply noise. A high-capacity capacitor C5 (ionistor) is necessary to maintain power to the microcontroller when the general voltage in the circuit disappears. This allows the clock to not be reset if there is a power outage. Its charge is enough for 3 - 4 days of continuous operation of IC1. At the same time, diode VD1 does not allow it to discharge through other elements of the circuit.
The light sensor is a photoresistor R35. It reacts to external lighting and “tells” the microcontroller what it is necessary to set the brightness of the LED matrices. In the absence of R35, the brightness of the light at night and during the day can be set programmatically.
The quartz resonator XT1 sets the clock frequency of the time count. The accuracy of the watch depends on its operation. The author of the device prudently made a software correction of accuracy.
Configuration, installation and control of the device is carried out with just two buttons “OK” and “STEP” (translated as STEP). The device is reset using the “RESET” button (SW3). The “STEP” button usually moves to the next menu item, and the “OK” button changes the parameters of the current menu. The signal of a triggered alarm can also be turned off using the “OK” or “STEP” buttons. Pressing any button while the alarm is ringing turns it off.
The control scheme turned out like this:



In normal mode, the screen displays the time in hours-minutes format. At intervals of one minute (customizable by the user), the ticker starts. It displays the day of the week, date, year, temp. at home, and temp. outdoors (if appropriate sensors are installed). The ticker is customizable, i.e. You can turn on/off the display of any of the elements. (many users, for example, always turn off the year display). When you turn off the display of all elements of the ticker, it does not start at all, and the clock constantly displays only the time.
9 alarm clocks are divided into 3 disposable and 6 reusable. When you turn on alarms 1-3, they only sound once. In order for them to work again, they must be turned on manually again. And alarm clocks 4-9 are reusable, i.e. they will operate daily at the set time. In addition, these alarms can be set to go off only on certain days of the week. This is convenient, for example, if you don’t want the alarm to wake you up on the weekend. Or, for example, you need to wake up on weekdays at 7-00, and on Thursday at 8-00, and on weekends you don’t need an alarm clock. Then we set up one reusable one at 7-00 on Monday-Wednesday and Friday, and the second at 8-00 on Thursday..... In addition, all alarm clocks have a signal duration setting, and if you, in order to wake up, do not have enough signal for 1 minute , then you can increase it for a time from 1 to 15 minutes.
The course is corrected once a day, at 00-00. If the clock is fast, for example, by 5 seconds per day, then at 00-00-00 the time will be set to 23-59-55, but if the clock is behind by 5 seconds, then at 00-00-00 the time will be set to 00-00-05 . Correction step – 0.1 sec. Maximum correction – 59.9 sec/day. With a working quartz, you are unlikely to need more. Correction is also carried out in standby mode when powered by an ionistor (capacitor C5).

Watch assembly.


So, the kit has arrived, let's start assembling!
First of all, we install the PWM controller on the D4 chip, as well as its wiring elements C1, C8, C9, R32 - R34, L1 and VD2. Please note that the kit mainly uses resistors and capacitors of size 1206, and only the elements of the PWM controller (listed above) have a smaller size - 0805.

After successful installation, we supply power to the circuit with more than 7 volts and check that there is a voltage of approximately 5 volts at the positive terminal of C1. If everything is in order, we continue assembling the device in any order, soldering the smallest parts first, then the larger ones, etc.
If you plan to power the board from a five-volt current source, you can not assemble the PWM controller circuit, but supply voltage directly to C1, observing the polarity.
The board provides three options for installing the R35 light sensor. Where exactly to solder it is your choice; it will not affect the operation of the circuit in any way. The same goes for the “OK” and “STEP” control buttons. They can be hidden on the back side of the board, and the excess seal can be cut off along the white line - to get a miniature monolithic block that can be easily built into any small flat case.




After assembly, the clock will work immediately. The control program is already WIRED into the microcontroller. By pressing the “RESET” button, the watch will highlight the firmware version (in our case it is v.1_09) and after a couple of seconds it will begin to show the time, with a second dot looming from left to right. You need to remove the protective film from the matrices and you can use it for hours.
Well, the final result should look something like this:


For those who like to tinker with the firmware to change the font, add new functionality, and just for self-education, I am attaching the original source code of the program, and for convenience, there are areas for programming the microcontroller on the board.
High-resolution diagram of the clock, photographs of the device, list of elements.

We recommend reading

Top