DIY digital outdoor clock. Multifunctional LED wristwatch

I propose for repetition the circuit of a simple electronic clock with an alarm clock, made on the PIC16F628A type. A big advantage of this watch is the ALS type LED indicator for displaying the time. Personally, I’m pretty tired of all kinds of LCDs and I want to be able to see the time from anywhere in the room, including in the dark, and not just directly with good lighting. The circuit contains a minimum of parts and has excellent repeatability. The watch was tested for a month, which showed its reliability and performance. I think of all the schemes on the Internet, this one is the easiest to assemble and run.

Schematic diagram of an electronic clock with an alarm clock on a microcontroller:


As can be seen from the clock diagram, it is the only microcircuit used in this device. A 4 MHz quartz resonator is used to set the clock frequency. To display the time, red indicators with a common anode are used; each indicator consists of two digits with decimal points. In the case of using a piezo emitter, capacitor C1 - 100 μF can be omitted.

You can use any indicators with a common anode, as long as each digit has its own anode. To ensure that the electronic watch is clearly visible in the dark and from a great distance, try to choose a larger ALS.


The clock display is dynamic. At a given time, only one digit is displayed, which allows you to significantly reduce current consumption. The anodes of each digit are controlled by a PIC16F628A microcontroller. The segments of all four digits are connected together and, through current-limiting resistors R1 ... R8, connected to the terminals of the MK port. Since the indicator lights up very quickly, the flickering of the numbers becomes unnoticeable.


Momentary buttons are used to set minutes, hours and alarm clock. Pin 10 is used as an output for the alarm signal, and a cascade of transistors VT1,2 is used as an amplifier. The sound emitter is a piezoelectric element of the ZP type. To improve the volume, you can replace it with a small speaker.


The clock is powered from a stabilized 5V source. It can also be powered by batteries. The watch has 9 display modes. Switching between modes is carried out using the “+” and “-” buttons. Before the readings themselves are displayed, a short hint about the name of the mode is displayed on the indicators. The duration of the hint display is one second.


Using the "Correction" button, the alarm clock is switched to settings mode. In this case, a short-term prompt is displayed for half a second, after which the adjusted value begins to blink. Correction of readings is carried out using the “+” and “-” buttons. When you press the button for a long time, the auto-repeat mode is activated at the specified frequency. All values, except hours, minutes and seconds, are written to EEPROM and restored after power cycle.


If no button is pressed within a few seconds, the electronic clock switches to time display mode. By pressing the "On/Off" button the alarm clock turns on or off, this action is confirmed by a short sound. When the alarm clock is on, the dot in the low-order digit of the indicator lights up. I was thinking about where to put the clock in the kitchen, and decided to mount it directly into the gas stove :) The material was sent by in_sane.


Discuss the article ELECTRONIC ALARM CLOCK

Homemade wristwatch with a 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 grid voltage 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 of the wristwatch, and 2 mm thick copper wires are used for attaching the leather strap. The full circuit diagram is not provided in the original article - see the connection on the datasheets to the indicated microcircuits.

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

1. Clock - calendar:

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

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

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

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

  • Leap years are taken into account

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

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

Schematic diagram of the clock

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

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

Printed circuit board

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

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

Design, parts and their possible replacement

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

Programming, firmware, fuses

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

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

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

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

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

Cell address

Purpose

Parameter

Note

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

260 ($104) (2.6V)

coefficient for correcting the value of the measured battery voltage

time interval for switching to sleep mode

1 unit = 1 sec

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

1 unit = 1 sec

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

1 unit = 1 sec

IButton key numbers are stored here

Small explanations on points:

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

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

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

In points 4 and 5 the same.

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

Setup, operating features

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

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

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

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

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

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

List of radioelements

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

ATmega168PA

1 PA-AU To notepad
U2 temperature sensor

DS18B20

1 To notepad
Q1 MOSFET transistor

2N7002

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

100 Ohm

9 To notepad
R9 Resistor

10 kOhm

1 To notepad
R10 Resistor

8.2 Ohm

1 To notepad
R11 Resistor

300 Ohm

1 To notepad
R12 Resistor

2 MOhm

1 To notepad
R13 Resistor

220 kOhm

1 To notepad
R14 Resistor

30 kOhm

1 To notepad
R15, R19 Resistor

4.7 kOhm

2 To notepad
R16 Resistor

20 kOhm

1

Large LED clock

Introduction.

It all started like this. At my dacha I had an old mechanical alarm clock (made in USSR), which had mechanical problems. I decided to build an electronic watch. The first problem is which indicator to choose. VLI and GRI are not suitable due to large temperature differences at the dacha. The LCD is no longer needed for the same reason. The LED indicator remains. I'm tired of looking at small numbers on indicators, and large seven-segment indicators are rare and expensive. It was decided to make an indicator with a digit height of 50mm from individual green LEDs.

We figured out the indicator, but it needs to be managed somehow. In this case, the clock should run even if there is no power for a long time. We will do it on an ATTiny2313 MK and an RTC DS1307 chip, which also has a built-in power controller and allows you to connect a battery.

1. Indicator.

We will make it, as I already said, from individual green LEDs with a diameter of 5mm. Here is the indicator diagram:

There's not much to explain here. Current-limiting resistors, diodes are needed for beautiful drawing of numbers. Each rectangle in the diagram should have one digit (the diagram is the same for everyone), with a separating colon in the middle.

2. Main part.

The circuit, as I already said, is based on ATTiny2313 and DS1307. Here she is:

This requires some explanation. On the right are two double seven-segment lights and two LEDs - the internal circuit of a small indicator with OA. Why two indicators? At night, a large indicator with a bright glow can interfere with sleep (the clock will be near the bed), so the indication can be switched to a small indicator using switch SW1. In the "Night" position A small indicator works in the "Day" position. - big. I took this small indicator out of the washing machine; the pinout is on the stove. 3V battery, CR2032. Transistors Q1-Q4 can be replaced with any other low-power PNP transistors, for example KT315. Q6-Q9 - on PNP with a CE current of at least 1A, Q5 - on NPN with a collector current of at least 0.4A. The power supply can be any with a voltage of 9-20V, the polarity is not important, you can even use alternating voltage. Current not less than 1A. The U4 stabilizer must be installed on the radiator. By the way, the lower the input voltage, the easier life is for the stabilizer. My BP is like this:

Now let's move on to assembly.

3. Assembly.

Let's go to the store and buy parts.

We make boards and start soldering. Soldering 88 LEDs, the same number of resistors and 44 diodes is not easy, but it's worth it.

Now we connect everything with wires. I use PLS/PBS cables and connectors. These pictures will help you:

Now we are flashing the MK. Here are the fuses:

And turn on:

The buttons and connectors I used were:

4. Body.

I made the body from plywood and a 20*40 block, sanded it and varnished it. I installed two fasteners on the back for wall mounting.

By the way, to seal the indicator windows I used film from green bottles, it looks beautiful and protects from sun exposure.

Now some photos:

A simple LED clock can be made using a cheap PIC16F628A controller. Of course, the stores are full of various electronic watches, but their functions may either lack a thermometer or an alarm clock, or they may not glow in the dark. And in general, sometimes you just want to solder something yourself, rather than buy ready-made ones. Click to enlarge the diagram.

The offered watches have a calendar. It has two options for displaying the date - the month as a number or a syllable, all this is configured after entering the date by switching further with the button S1 while the desired parameter is displayed, thermometer. There are firmwares for different sensors. See the device inside the case:


Everyone knows that quartz resonators are not ideal in accuracy, and within a few weeks the error accumulates. To combat this issue, the watch has a rate correction, which is set by parameters SH And SL. More details:

SH=42 and SL=40 are forward by 5 minutes per day;
SH=46 and SL=40 are backward by 3 minutes per day;
SH=40 and SL=40 are forward by 2 minutes per day;
SH=45 and SL=40 are backward by 1 minute per day;
SH=44 and SL=С0 - this is forward by 1 minute per day;
SH=45 and SL=00 - this correction is disabled.

This way you can achieve perfect accuracy. Although you will have to adjust the correction several times until it is set perfectly. And now the operation of an electronic clock is clearly shown:

temperature 29 degrees Celsius

As indicators, you can use either LED dial assemblies, which are indicated in the diagram itself, or replace them with ordinary round super-bright LEDs - then these clocks will be visible from afar and can be hung even on the street.


A single transistor mobile phone charger is a method for increasing reliability. There are many designs and circuits of chargers for mobile phones. Today we will talk about the characteristics and circuits of chargers made on two transistors. Most often, the output voltage of chargers is limited to 7.8 volts.