• DIY electronic clock with LED hands. Multifunctional LED wristwatch

    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 a 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 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, with the second by adjusting the voltage produced by lm317.
    IT'S ALIVE!

    Hello geektimes! The first part of the article discussed the principles of obtaining accurate time on a homemade watch. Let's go further and consider how and on what it is better to display this time.

    1. Output devices

    So, we have a certain platform (Arduino, Raspberry, PIC/AVR/STM controller, etc), and the task is to connect some kind of indication to it. There are many options that we will consider.

    Segment display

    Everything is simple here. The segment indicator consists of ordinary LEDs, which are simply connected to the microcontroller through quenching resistors.

    Beware of traffic!

    Pros: simplicity of design, good angles review, low price.
    Cons: The amount of information displayed is limited.
    There are two types of indicator designs, with a common cathode and a common anode; inside it looks something like this (diagram from the manufacturer’s website).

    There are 1001 articles on how to connect an LED to a microcontroller, Google can help. Difficulties begin when we want to do big watch- after all, looking at a small indicator is not particularly convenient. Then we need the following indicators (photo from eBay):

    They are powered by 12V, and they simply won’t work directly from the microcontroller. This is where the microcircuit comes to our aid. CD4511, designed just for this purpose. It not only converts data from a 4-bit line into the desired numbers, but also contains a built-in transistor switch to supply voltage to the indicator. Thus, in the circuit we will need to have a “power” voltage of 9-12V, and a separate step-down converter (for example L7805) to power the “logic” of the circuit.

    Matrix indicators

    Essentially, these are the same LEDs, only in the form of an 8x8 matrix. Photo from eBay:

    They are sold on eBay in the form of single modules or ready-made blocks, for example 4 pieces. Managing them is very simple - a microcircuit is already soldered onto the modules MAX7219, ensuring their operation and connection to the microcontroller using only 5 wires. There are many libraries for Arduino, anyone can look at the code.
    Pros: low price, good viewing angles and brightness.
    Cons: low resolution. But for the inference task, the time is quite enough.

    LCD indicators

    LCD indicators can be graphic or text.

    Graphic ones are more expensive, but they allow you to display more varied information (for example, a graph of atmospheric pressure). Text ones are cheaper and easier to work with, they also allow you to display pseudo-graphics - it is possible to load custom symbols into the display.

    Working with an LCD indicator from code is not difficult, but there is a certain disadvantage - the indicator requires many control lines (from 7 to 12) from the microcontroller, which is inconvenient. Therefore, the Chinese came up with the idea of ​​combining an LCD indicator with an i2c controller, which ended up being very convenient - only 4 wires are enough to connect (photo from eBay).


    LCD indicators are quite cheap (if you buy them on eBay), large, easy to connect, and can display a variety of information. The only negative is that the viewing angles are not very large.

    OLED indicators

    They are an improved continuation of the previous version. They range from small and cheap with a diagonal of 1.1", to large and expensive. Photo from eBay.

    Actually, they are good in everything except the price. As for small indicators, 0.9-1.1" in size, then (except for learning how to work with i2c) it is difficult to find any practical use for them.

    Gas discharge indicators (IN-14, IN-18)

    These indicators are now quite popular, apparently due to the “warm tube sound light" and originality of design.


    (photo from nocrotec.com)

    Their connection diagram is somewhat more complicated, because These indicators use a voltage of 170V for ignition. A converter from 12V=>180V can be made on a microcircuit MAX771. A Soviet microcircuit is used to supply voltage to the indicators K155ID1, which was created specifically for this purpose. Issue price at self-production: about 500 rubles for each indicator and 100 rubles for K155ID1, all other parts, as they wrote in old magazines, “are not in short supply.” The main difficulty here is that both IN-xx and K155ID1 have long been out of production, and you can only buy them at radio markets or in a few specialized stores.

    2. Platform selection

    We have more or less figured out the display, all that remains is to decide which hardware platform is best to use. There are several options here (I’m not considering homemade ones, because those who know how to route a board and solder a processor don’t need this article).

    Arduino

    The easiest option for beginners. The finished board is inexpensive (about $10 on eBay with free shipping), has all the necessary connectors for programming. Photo from eBay:

    There are a huge number of different libraries for Arduino (for example, for the same LCD screens, real-time modules), Arduino is hardware compatible with various additional modules.
    The main disadvantage: the difficulty of debugging (only through the console serial port) and a rather weak processor by modern standards (2KB RAM and 16MHz).
    The main advantage: you can do a lot of things, practically without bothering with soldering, buying a programmer and wiring boards; you just need to connect the modules to each other.

    32-bit STM processors

    For those who want something more powerful, there are ready-made boards with STM processors, for example a board with STM32F103RBT6 and a TFT screen. Photo from eBay:

    Here we already have full-fledged debugging in a full-fledged IDE (out of all the different ones, I liked the Coocox IDE best), however, we will need a separate ST-LINK programmer-debugger with a JTAG connector (the issue price is $20-40 on eBay). Alternatively, you can buy the STM32F4Discovery development board, on which this programmer is already built-in, and it can be used separately.

    Raspberry PI

    And finally, for those who want full integration with modern world, there are single-board computers with Linux, everyone probably already knows Raspberry PI. Photo from eBay:

    This full-fledged computer with Linux, a gigabyte of RAM and a 4-core processor on board. A panel of 40 pins is located on the edge of the board, allowing you to connect various peripherals (pins are available from code, for example in Python, not to mention C/C++), there is also a standard USB in the form of 4 connectors (you can connect WiFi). There is also standard HDMI.
    The board’s power is enough, for example, not only to display the time, but also to run an HTTP server for setting parameters via a web interface, loading a weather forecast via the Internet, and so on. In general, there is a lot of room for flight of fancy.

    The only problem with Raspberry (and STM32 processors) is that its pins use 3V logic, and most external devices(for example, LCD screens) work “the old fashioned way” from 5V. Of course, you can connect it and it will work, in principle, but it’s not quite correct method, and it’s kind of a pity to ruin a $50 board. The right way- use a “logic level converter”, which costs only $1-2 on eBay.
    Photo from eBay:

    Now it is enough to connect our device through such a module, and all parameters will be consistent.

    ESP8266

    The method is rather exotic, but quite promising due to the compactness and low cost of the solution. For very little money (about $4-5 on eBay) you can buy an ESP8266 module containing a processor and WiFi on board.
    Photo from eBay:

    Initially, such modules were intended as a WiFi bridge for exchange via a serial port, but many enthusiasts have written alternative firmware, allowing you to work with sensors, i2c devices, PWM, etc. Hypothetically, it is quite possible to receive time from an NTP server and display it via i2c on the display. For those who want to connect a lot of different peripherals, there are special NodeMCU boards with a large number conclusions, the issue price is about 500 rubles (of course on eBay):

    The only negative is that the ESP8266 has very little RAM memory(depending on the firmware, from 1 to 32 KB), but this makes the task even more interesting. The ESP8266 modules use 3V logic, so the level converter above will also come in handy here.

    This concludes the introductory excursion into homemade electronics; the author wishes everyone successful experiments.

    Instead of a conclusion

    I eventually settled on using a Raspberry PI with a text indicator configured to work with pseudo-graphics (which turned out to be cheaper than a graphic screen of the same diagonal). I took a photo of the desktop clock screen while writing this article.

    The clock is showing exact time, taken from the Internet, and weather that is updated from Yandex, all this is written in Python, and has been working quite well for several months. At the same time, an FTP server is running on the watch, which allows (coupled with port forwarding on the router) to update the firmware on it not only from home, but also from any place where there is Internet. As a bonus, Raspberry resources, in principle, are enough to connect a camera and/or microphone with the ability to remotely monitor the apartment, or to control various modules/relays/sensors. You can add all sorts of “goodies”, like LED indication about incoming mail, and so on.

    PS: Why eBay?
    As you can see, prices or photos from eBay were given for all devices. Why is this so? Unfortunately, our stores often live by the principle “bought for $1, sold for $3, and live on that 2 percent.” As simple example, Arduino Uno R3 costs (at the time of writing) 3600 rubles in St. Petersburg, and 350 rubles on eBay with free shipping from China. The difference is truly an order of magnitude, without any literary exaggeration. Yes, you will have to wait a month to pick up the parcel at the post office, but I think such a difference in price is worth it. But however, if someone needs it right now and urgently, then there is probably a choice in local stores, here everyone decides for themselves.

    August 20, 2015 at 12:34 pm

    Homemade electronic watch, element base- part 1, measurement of time

    • DIY or Do It Yourself

    Probably every geek who is into homemade electronics sooner or later comes up with the idea of ​​making his own unique watch. The idea is quite good, let’s figure out how and what is best to make them. As a starting point, we will assume that a person knows how to program microcontrollers, understands how to send 2 bytes over an i2c or serial port, and can solder several wires together. In principle, this is enough.

    It is clear that key function clock - measuring time (who would have thought, right?). And it is advisable to do this as accurately as possible; there are several options and pitfalls.

    So, what methods of measuring time are available in hardware that we can use?

    Built-in CPU RC oscillator

    The simplest idea that can come to mind is to simply set up a software timer and use it to count down the seconds. So, this idea is no good. The clock will work, of course, but the accuracy of the built-in generator is not regulated in any way, and can “float” within 10% of the nominal value. It’s unlikely that anyone needs a watch that takes 15 minutes a month.

    Real time module DS1307

    A more correct option, which is also used in most “folk” products, is a real-time clock. The microcircuit communicates with the microcontroller via I2C and requires a minimum of wiring (quartz and a pair of resistors). The price is about 100 rubles per chip, or about $1 on eBay for a ready-made board with a chip, a memory module and a battery connector.

    Scheme from the datasheet:

    What is equally important, the microcircuit is produced in a DIP package, which means that any novice radio amateur can solder it. The built-in battery keeps the clock running even if the power is turned off.

    It would seem that everything is fine, if not for one problem - low accuracy. The approximate accuracy of watch quartz is 20-30ppm. The designation ppm - parts per million, shows the number of parts per million. It would seem that 20 millionths is super, but for a frequency of 32768Hz it turns out 20*32768/1000000 = ±0.65536Hz, i.e. already half a hertz. By simple calculations, it can be seen that with such a difference, a generator “clicks” an extra (or missing) 56 thousand cycles per day, which corresponds to 2 seconds per day. There are different types of quartz, some users also wrote about an error of 5 seconds per day. Somehow it’s not very accurate - in a month such a watch will take at least a minute. This is already a significant difference, noticeable to the naked eye (when grandma’s favorite TV series starts at 11.00, and the clock shows 11.05, the developer of such a watch will be embarrassed in front of relatives).

    However, since the temperature in the room is more or less stable, and the quartz frequency will not change much, you can add software correction. Another advice given on forums is to use watch quartz from old motherboards, according to reviews, they are quite accurate there.

    DS3231 Real Time Module

    We are not the first to ask the question of accuracy, and the Dallas company, following the wishes, released a more advanced module - DS3231. It's called "Extremely Accurate Real Time Clock" and has a built-in generator with temperature correction. The accuracy is 10 times higher, and is 2ppm. The price is a little higher, but the chip body is designed for SMD mounting, soldering is not so convenient, but you can buy a ready-made board on eBay.


    (photo from the seller's website)

    An accuracy of 6 seconds per month is already a good result. But we will go further - ideally, clocks in the 21st century do not need to be adjusted at all.

    Radio module DCF-77

    The method is rather exotic, but for the sake of completeness it cannot be ignored. Few people know, but precise time signals have been transmitted over the radio since the 70s. The DCF-77 transmitter is located in Germany near Frankfurt, and on the VHF frequency 77.5 KHz, precise time stamps are transmitted (yes, they already had wall and table clock, which do not need to be adjusted).

    The good thing about this method is that the circuit has low power consumption, so they are now even producing wrist watch with this technology. Ready board reception DCF-77 can be bought on ebay, the issue price is $20.

    Many watches and weather stations have the ability to receive DCF-77, the only problem is that the signal practically does not reach Russia. Coverage map from Wikipedia:

    As you can see, only Moscow and St. Petersburg are on the border of the reception zone. According to reviews from owners, only sometimes the signal can be received, which is why practical application Of course it won't do.

    GPS module

    If the clock is placed close to the window, then it is quite real method obtaining exact time - GPS module. These modules can be purchased inexpensively on ebay (issue price is $10-15). For example, Ublox NEO-6M connects directly to the serial pins of the processor, and outputs NMEA strings at 9600 speed.

    The data comes in approximately the following format: “$GPRMC,040302.663,A,3939.7,N,10506.6,W,0.27,358.86,200804,*1A”, and parsing them is not difficult even for a weak Arduino. By the way, patriots can purchase the more expensive Ublox NEO-7N module, which supports (according to reviews) both GPS and Glonass.

    Obviously, the GPS module knows nothing about different time zones, so the developer will have to think through their calculation and change of summer/winter time himself. Another minus using GPS- relatively high power consumption (however, some modules can be switched to “sleep mode” using separate commands).

    WiFi

    And finally, the last (and most obvious at the moment) way to get the exact time is to take it from the Internet. There are two approaches here. The first, and simplest, is to use something like a Raspberry PI with Linux as a clock board, then you don’t need to do anything, everything will work out of the box. If you want “exotic” - then interesting option is the esp8266 module.

    This is an inexpensive (issue price is about 200 rubles on ebay) WiFi module can communicate with the server via the serial port of the processor, if desired, it can also be reflashed (there are quite a lot of third-party firmware), and part of the logic (for example, polling the time server) can be done in the module itself. Third-party firmware supports a lot of everything, from Lua to C++, so there are quite enough options to “flex your brain.”

    At this point, the topic of measuring time can probably be closed. In the next part we will take a closer look at processors and time output methods.

    You can find many on sale various models and electronic options digital clock, 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 it was developed and successfully assembled this scheme large LED clock, to which you can connect (via internal transistor switches) LED indicators as desired large size. Increase schematic diagram you can click 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. In this mode, if 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 restart nutrition. 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 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.

    For those who understand at least a little about microcontrollers, and also want to create a simple and useful device for home, there is nothing better build with LED indicators. Such a thing can decorate your room, or it can be used as a unique handmade gift, from which it will acquire additional value. The circuit works like a clock and like a thermometer - modes are switched with a button or automatically.

    Electrical diagram of a homemade clock with a thermometer

    Microcontroller PIC18F25K22 takes care of all data processing and timing, and a share ULN2803A all that remains is to coordinate its outputs with LED indicator. Small chip DS1302 works as a timer of precise second signals, its frequency is stabilized by a standard quartz resonator of 32768 Hz. This complicates the design somewhat, but you won’t have to constantly adjust and adjust the time, which will inevitably be delayed or rushed if you get by with a random untuned quartz resonator of a few MHz. A watch like this is more of a simple toy than a high-quality, accurate timepiece.

    If necessary, temperature sensors can be located far from the main unit - they are connected to it with a three-wire cable. In our case, one temperature sensor is installed in the block, and the other is located outside, on a cable about 50 cm long. When we tried a 5 m cable, it also functioned perfectly.

    The clock display is made of four large LED digital indicators. They were originally common cathode but changed to common anode in final version. You can install any others, then simply select current-limiting resistors R1-R7 based on the required brightness. It was possible to place it on a common, with electronic part clock, board, but this is much more universal - suddenly you want to install a very large LED indicator so that they can be seen from a long distance. An example of such a design of a street clock is here.

    The electronics themselves start at 5 V, but for bright glow LEDs must use 12 V. From the network, power is supplied through a step-down transformer adapter to the stabilizer 7805 , which produces a voltage of strictly 5 V. Pay attention to the small green cylindrical battery - it serves as a source backup power, in case the 220 V network disappears. It is not necessary to take it to 5 V - a lithium-ion or Ni-MH battery at 3.6 volts.

    For the body, you can use various materials - wood, plastic, metal, or build in the entire structure homemade watch into ready-made industrial ones, for example from a multimeter, tuner, radio receiver, and so on. We made it from plexiglass because it is easy to process and allows you to see the insides so that everyone can see - this watch was assembled with your own hands. And, most importantly, it was available :)

    Here you can find all the necessary details of the proposed design of a homemade digital watch, including a diagram, topology printed circuit board, PIC firmware and