Led clock on arduino nano. We make an electronic clock on Arduino with our own hands. Ready clock on Arduino

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

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

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

Solution in the screenshot:


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

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

Let's start collecting.

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

The principle of attaching indicators remained the same as on.

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

Markup process







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

We draw paths and etch.




bathing in ferric chloride

Ready!
control board:


indication board:


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

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




rear control board

Rear display board:

Terrible smd installation:


Launch

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

One of the first projects that beginners build using an Arduino board is a simple clock that keeps time. Basically, such clocks are based on an RTC (Real Time Clock) module connected to Arduino. Today, electronic components are available on the market different models RTCs that vary in accuracy and price. Common models include DS1302, DS1307, DS3231.



But you can make a clock on Arduino without using an RTC, especially if you can’t get such modules. Of course, the accuracy in this case will be low, so the project should rather be considered as a training project.


The operating principle of such watches is quite simple. Every time you turn on this Arduino clock, you will need to set it to the current time, just like any analog clock. It is certainly better not to use such watches in your Everyday life with their activity for a long time without rebooting and further configuration, since desynchronization with the current time during long-term operation can be significant.


This clock can be assembled on a regular breadboard, since it does not require many components. Our main link here will be the Arduino Uno board. To display the time, you can take a 16x2 LCD display. To change the time settings, you need to connect two buttons (for hours and minutes). The buttons are connected to Aduino via 10KΩ resistors. To change the brightness of the display you will need a 10 kOhm potentiometer. The connection diagram for all these components to the Arduino Uno board is presented below.



Now you need to program the Arduino. A simple code (sketch) that allows you to display the time on the LCD screen is given below.


#include LiquidCrystal lcd(12,11,5,4,3,2); int h=12; int m; int s; int flag; int TIME; const int hs=8; const int ms=9; int state1; int state2; void setup() ( lcd.begin(16,2); ) void loop() ( lcd.setCursor(0,0); s=s+1; lcd.print("TIME:"); lcd.print(h ); lcd.print(":"); lcd.print(":");<12)lcd.print("AM"); if(flag==12)lcd.print("PM"); if(flag>12)lcd.print("PM"); if(flag==24)flag=0; delay(1000); lcd.clear(); if(s==60)( s=0; m=m+1; ) if(m==60) ( m=0; h=h+1; flag=flag+1; ) if(h==13 ) ( h=1; ) lcd.setCursor(0,1); lcd.print("HAVE A NICE DAY"); //-------Time // setting-------// state1=digitalRead(hs); if(state1==1) ( h=h+1; flag=flag+1; if(flag<12)lcd.print("AM"); if(flag==12)lcd.print("PM"); if(flag>12)lcd.print("PM");

if(flag==24)flag=0; if(h==13)h=1; ) state2=digitalRead(ms); if(state2==1)( s=0; m=m+1; ) )   Thank you for your interest in
information project
website.

   If you want interesting and useful materials to be published more often and with less advertising,
This unique watch with LED backlight and pulsating minute hand was made using the TLC5940 PWM controller chip. Its main task is to expand the number of PWM modulation contacts. Another feature of this watch is that it has converted an analog voltmeter into a device that measures minutes. To do this, a new scale was printed on a standard printer and pasted on top of the old one. As such, the 5th minute is not counted, it’s just that during the fifth minute the time counter shows the arrow pointing to the end of the scale (off scale). The main control is implemented on the Arduino Uno microcontroller.

To ensure that the clock backlight did not glow too brightly in a dark room, a circuit was implemented to automatically adjust the brightness depending on the illumination (a photoresistor was used).

Step 1: Required Components



Here's what you'll need:

  • 5V DC analog voltmeter module;
  • Arduino UNO microcontroller or other suitable Arduino;
  • Arduino circuit board (proto board);
  • DS1307 Real Time Clock (RTC) module;
  • Module with PWM controller TLC5940;
  • Petal LED backlights – 12 pcs.;
  • Components for assembling an automatic brightness control (LDR) circuit.

Also, for the production of some other components of the project, it is desirable to have access to a 3D printer and a laser cutting machine. It is assumed that you have this access, so the instructions will include manufacturing drawings at the appropriate stages.

Step 2: Dial




The dial consists of three parts (layers) cut on a laser cutting machine from 3 mm MDF sheet, which are fastened together with bolts. A plate without slots (bottom right in the picture) is placed under another plate to position the LEDs (bottom left). Then, individual LEDs are placed in the appropriate slots, and the front panel is put on top (top in the figure). Four holes are drilled along the edge of the dial, through which all three parts are bolted together.

  • To test the performance of the LEDs at this stage, a CR2032 coin cell battery was used;
  • To secure the LEDs, small strips of adhesive tape were used, which were glued to the back of the LEDs;
  • All LED legs were pre-bent accordingly;
  • The holes along the edges were re-drilled, through which the bolting was carried out. It turned out that this was much more convenient.

Technical drawing of the dial parts is available at:

Step 3: Design the circuit



At this stage it was developed electrical diagram. Various textbooks and guides were used for this. We won’t delve too deeply into this process; the two files below show the finished electrical circuit that was used in this project.

Step 4: Connecting the Arduino Circuit Board





  1. The first step is to unsolder all the needle contacts on the circuit boards and section boards;
  2. Further, due to the fact that 5V power and GND are used by so many boards and peripheral devices, for reliability, two wires for 5V and GND were soldered on the circuit board;
  3. Next, a TLC5940 PWM controller was installed next to the used contacts;
  4. Then the TLC5940 controller is connected according to the connection diagram;
  5. In order to be able to use the battery, an RTC module was installed on the edge of the circuit board. If you solder it in the middle of the board, the pin markings will not be visible;
  6. The RTC module has been connected according to the connection diagram;
  7. An automatic brightness control (LDR) circuit has been assembled, you can view it at the link
  8. The wires for the voltmeter are connected by connecting the wires to pin 6 and GND.
  9. At the end, 13 wires for the LEDs were soldered (In practice, it turned out that it was better to do this before proceeding to step 3).

Step 5: Code

The code below was compiled from various pieces of clock components found on the Internet. It has been fully debugged and is now fully functional, and some pretty detailed comments have been added. But before loading into the microcontroller, consider the following points:

  • Before flashing the Arduino firmware, you need to uncomment the line that sets the time:
    rtc.adjust(DateTime(__DATE__, __TIME__))
    After flashing the controller with this line (the time is set), you need to comment it out again and flash the controller again. This allows the RTC module to use the battery to remember the time if the main power is lost.
  • Every time you use "Tlc.set()" you need to use "Tlc.update"

Step 6: Outer Ring

The outer watch ring was 3D printed using a Replicator Z18 printer. It attaches to the watch using screws on the face of the watch. Below is a file with a 3D model of the ring for printing on a 3D printer.

Step 7: Assembling the Clock


The Arduino microcontroller with all the other electronics was secured to the back of the clock using screws and nuts as spacers. Then I connected all the LEDs, analog voltmeter and LDR to the wires that were previously soldered to the circuit board. All LEDs are interconnected by one leg and connected to the VCC pin on the TLC5940 controller (a piece of wire is simply soldered in a circle).

So far, all this is not very well insulated from short circuits, but work on this will continue in future versions.




Top