DIY

Non-pixel clock with animation

Non-pixel clock with animation The main element of this watch is a LED non-pixel ring (WS2812). The ring consists of addressable red, green and blue (RGB) LEDs. The brightness of each color can be adjusted independently, providing up to 16.8 million colors. The microprocessor in this watch is needed to get the time from the Internet and give the command which LEDs should light up and in what color.
Tools and materials: -LED ring WS2812 60 pixels; -ESP8266 Wemos D1; ​​-470 Ohm resistor; -Electrolytic capacitor 1000 uF;
-Screws M3 x 12 – 2 pcs;
-Nuts M3 – 2 pcs;
-Multi-core cable;
-Superglue;
-Power connector;
-Screws;
-Power supply 5V 3A; Step one: project
The physical body of the table clock is based on the dimensions of the non-pixel ring. The master wanted the design to be minimalistic and have smooth design lines so that the thing not only shows the time, but also looks attractive.
To work, the watch should not have buttons or switches. Time synchronization will take place over the network.
The watch is powered by an AC adapter. The master calculated that 15 mA would be required for each LED, and three LEDs per neopixel. The entire ring may require a maximum current of 45mA x 60 = 2.7A.
The corpus was developed using FreeCAD software and consists of two key components. The ring holder is a neopixel shroud that only exposes the front face of the neopixels, hiding the wire connections at the back. The base houses a microprocessor and a power connector. These elements will be connected using super glue, and the electronics will be accessed through the panel at the base of the device.
The ESP8226 microprocessor was chosen for this project. It's fast enough, has a built-in antenna, and can communicate with the network wirelessly. These devices are cheap and easy to program using the Arduino IDE platform.
Non-pixel clock with animation Non-pixel clock with animation Non-pixel clock with animation Non-pixel clock with animation Non-pixel clock with animation Non-pixel clock with animation Step two: network time protocol
The key task of the microprocessor is to connect to the Internet and retrieve UTC time from the server using Network Time Protocol (NTP). A sample NTP client is included in the Arduino IDE. Its principle of operation is to obtain the IP address of a random time server from the list of available ones. This means that we will always be able to synchronize the time, even if one of the time servers goes down.
The microprocessor then sends a data packet to the time server, which asks for the time and waits for a 48-byte data packet to be returned. Upon receipt, the packet is split into bytes to restore the time stamp. Converted to a number and represents the number of seconds since January 1, 1900.
For example, here are the typical 48 bytes returned in a data packet: 28 1 13 227 0 0 0 16 0 0 0 32 78 73 83 84 227 40 119 255 0 0 0 0 0 0 0 0 0 0 0 0 227 40 120 43 108 18 197 18 32 27 40 120 43 108 18 234 100
The time stamp is stored in four bytes starting at byte 40 (highlighted in blue). They are then converted to binary b11100011 00101000 01111000 00101011 = 3811080235. Unix time starts on January 1, 1970, but the calculations done refer to January 1, 1900, so you need to remove the seconds calculated for 70 years (2208988800).
time from 1 January 1900 (3811080235) – January 1, 1970 (2208988800) = time since January 1, 1970 (1602091435)
When we calculate 1602091435 seconds since January 1, 1970, this number is converted to 17:23:55 October 7, 2020. In real time, the entire process of executing a request, sending a data packet and performing calculations takes a few milliseconds.
Step three: the clock hands
Each “hand” of the clock is represented by a neopixel of its own color: red – hours, blue – minutes, green – seconds. If you look at a traditional watch, it is easy to understand how the minute and second hands move, jumping to the next digit. The hour hand moves slowly and evenly, including between numbers. The master also implemented this function so that the arrow slowly rotates around the ring.
Every 15 minutes, the watch starts a different set of light shows with a longer set of effects at noon and midnight. Adafruit has developed some great animated lighting effects and they are available for free if their neopixel library is installed (Examples → Adafruit Neopixel → strandtest). To these, the master added the equivalent of a “bell” at the end of the light show, which is displayed as a white LED indicator filling a quarter of an hour.
Non-pixel clock with animation Non-pixel clock with animation Step Four: British Summer Time
Since the master lives in the UK, he introduces adjustments for summer and winter time. Such an adjustment should be “hardcoded” into the code, since the microcontroller does not have an internal clock, as, for example, on Rusbury.
We will not go into detail about this step, since the review of homemade products produced for a Russian-speaking audience, where clock translation is not relevant. Those interested can familiarize themselves with this step on the source site, at the end of the article.
Step five: non-pixel ring
The first thing to do when assembling the watch is to assemble the ring. Usually, the seller supplies it in 4 segments.
The assembly must be carefully disassembled and uneven edges can be sawed off with a diamond file. These four segments should form a perfect circle.
 Non-pixel clock with animation Non-pixel clock with animation Non-pixel clock with animation
To secure the ring , a temporary template has been printed. Segments are fixed on it with tape.
 Non-pixel clock with animation Non-pixel clock with animation  Non-pixel clock with animation Non-pixel clock with animation Non-pixel clock with animation Non-pixel clock with animation Non-pixel clock with animation Then all connections are soldered except one. This is the point at which data is fed to the ring and will be located at the 6 o'clock position.
You need to prepare three wires. They are soldered at right angles to the ring. Red is for + 5V power (Vcc), black is for ground, and green is for serial data input. A 470 ohm resistor must be soldered on the data line.
Non-pixel clock with animation Non-pixel clock with animation Step six: printing the case
Next, you need to print the details of the case. Files for printing can be downloaded below.
Base.stlneopixel support ring.stlBase Cover.stlneopixel soldering jig.stl
Non-pixel clock with animation  Non-pixel clock with animation Non-pixel clock with animation  Non-pixel clock with animation Step Seven: Assembling
Next, the wizard starts assembling the watch.
The ESP8266 needs two holes to be drilled so that it can be attached to the main body.
The wires attached to the ring can be passed through the hole in the front of the base. The ring body can now be glued to the body and temporarily fixed with tape.
Non-pixel clock with animation Non-pixel clock with animation  Non-pixel clock with animation Non-pixel clock with animation  Non-pixel clock with animation Non-pixel clock with animation  Non-pixel clock with animation Non-pixel clock with animation Non-pixel clock with animation Everything is connected according to the scheme.
Non-pixel clock with animation Non-pixel clock with animation Non-pixel clock with animation The device will be able to consume enough power and via USB connection, but it is recommended to use a 5V power adapter.
Next, you need to download the code, which can be downloaded below.
ESP8266_Desktop_Equinox_Clock_Instructables.ino
After the code is loaded and the device is tested, you can stick LED ring inside the holder and install the cover.
Non-pixel clock with animation  Non-pixel clock with animation Non-pixel clock with animation Everything is ready.
 Non-pixel clock with animation Non-pixel clock with animation  Non-pixel clock with animation Although LEDs are ring-shaped, they are really just a sequence of LEDs. The ring is not completely electrically connected, so it has a beginning and an end. Initially, the craftsman decided to place the start of the LED sequence at the top of the circle, representing 12 o'clock, as this made programming easier. Over time, the LEDs light up clockwise. The problem was that he set himself the goal of physical design – to be minimal in order to create an elegant thing. For correct operation, it was necessary to stretch the wires to the upper point, and if you connect the lower one, the time “turned over”. Then the master programmatically shifted the calculated positions of hours, minutes and seconds by 180 degrees.
Then he decided to program self-diagnostics, like on a PC. Different beep sequences indicate specific PC problems. He did not design a buzzer in his watch, but built a few simple visual effects into the startup routine. When the device is turned on, a full red circle is displayed to show that all LEDs are working. Then it tries to connect to the Internet, and after connecting, it turns green. The next step is to get the timestamp from the time server. While it waits for this data, it displays an amber light. With a strong Wi-Fi signal, these processes occur almost instantly, so when turned on, the clock turns red.

Source:

usamodelkina.ru

Show More

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button