One of the best features of Arduino is its versatility and ease of use, as it is a platform based on free software and hardware that supports makers and developers. It is therefore an excellent tool for setting up electronic projects with open source code.
Among the basic work you can do Arduino, found the clock. By default, they are perfect to start practicing and approaching the tricks the platform offers.
It is interesting to know how to make a clock with Arduino and what are the advantages, you will find out in this post. And also the best kits on the market to implement these ideas.
What do I need to build an Arduino clock from scratch? Materials used
To make such an accessory with an Arduino, certain elements are needed, depending on the software and hardware. In the case of software, only the Arduino Integrated Development Environment (or Arduino IDE), a platform-independent application written in the Java programming language, should be used.
As for the hardware, it is recommended to use an Arduino card (Arduino UNO or another model), for example. B. the PSTN module and the male cables. If you want to build a digital clock, you have to use it: A display with 7 segments and 4 digits, a drawing board, a 9 V battery, a couple of push buttons and 6 resistors of 220 ohms (or similar).
Learn step by step how to make an Arduino clock from scratch to use in other projects
As mentioned above, building a clock with Arduino requires the use of both software and hardware elements.
It is therefore useful to consider the following step-by-step methods in the creation process:
Software
First of all, you need to make a clock with Arduino hand in hand with the development environment of this platform. Based on a library (in this case Time.h) that must be installed in one of the following ways: Add a library. Zip, via the library folder or via the library manager. To add the Time library to the Arduino IDE, click on the Program tab, select Activate Library and choose Time from the list.
The following code is then inserted into the software :
#include
#include
void setup() {
// Enter your installation code here which should be executed once:
}
void loop() {
// Insert your basic code here to make it work over and over again:
}
To perform the first functions of the Arduino clock (hours, minutes and seconds), the code corresponds to :
#include
#include
void setup() {
Serial.begin(9600) ;
}
void loop() {
// Imprimos la hora
Serial Print (Mount: ) ;
Serial.print(time() ;
Serial.print(:);
Serial.print(minute() ;
Serial.print(:);
Serial.println(second() ;
Delay(1000) ;
}
For proper code structure, note that the configuration function ( ) starts a serial monitor to display the data:
void setup() {
Serial.begin(9600) ;
}
The loop function ( ) uses :
Serial.print(time()); Para devolver la hora.
Serial.print(minute()); Para devolver los minutos.
Serial.println(second()); Para devolver los segundos.
Serial.print(day()); Para devolver el dÃa del mes.
Serial.print(month()); Para devolver el mes.
Serial.println(year()); Para devolver el año.
Later, to set the correct time on the Arduino clock, use the SetTime (…) function, which can be called in different ways depending on the different parameters, to return one type or the other; depending on the needs of the creator or the user. In this case, the following data are important: Hour, minutes, seconds, day, month and year: setTime(hour, minutes, seconds, day, month, year) ;
So, for example, the modified code would be: B. the following:
void setup() {
begins (9600) ;
// La Chora and La Feca facilities
setTime(11, 40, 6, 14, 8, 2021) ;
}
Equipment
To build a clock with Arduino from hardware, an RTC component is needed. They use a crystal oscillator or a network frequency and are used to have a real time clock that avoids the errors that the Time.h library usually makes (sometimes it loses time). In general, BTSs have a back-up power supply that is used when the main power supply is switched off, so that the time and date are maintained at all times.
Among the wide range of PSTNs suitable for Arduino, the DS3231 and DS1307 devices stand out as closed-loop devices. Between the two solutions, the DS3231 is much more accurate than the DS1307 because it has an internal oscillator that temperature fluctuations do not affect and can only reflect a few minutes delay over a year. The DS1307, on the other hand, can be delayed by up to 5 minutes per month due to extreme temperatures affecting its accuracy.
Similarly, the DS3231 has certain alarm functions (i.e. it can also function as an alarm clock). However, both devices are capable of generating square waves of different frequencies (to be used as clock signals) and have an EEPROM memory. Connection is easy because both the DS3231 and DS1307 use an I2C bus.
Therefore, the pins to be used depend on the Arduino model used :
- Arduino UNO, PRO MINI : SDA = A4 and SCL = A5.
- Arduino Leonardo, One: SDA = 2 and SCL = 3.
- Arduino MEGA, DUI: SDA = 20 and SCL = 21.
- Arduino MKR1000 : SDA = 11 and SCL = 12.
In particular, SDA is the data signal and SCL is the clock signal.
If you have any questions, leave them in the comments. We will get back to you as soon as possible, and that will certainly be of great benefit to more members of the community. Thank you.
Author: Saharaj Perez
My passion is technology and social media. I search and document the latest news and tips from Facebook, Twitter, Instagram, WhatsApp and all other social media.
You may also be interested in the following product:
Related Tags:
arduino clock without rtc,arduino mechanical clock,arduino digital clock seven segment,arduino clock module,arduino rtc ds3231 set time button,arduino rtc ds3231 set time from pc,ds1307 arduino library,ds1307 rtc module arduino,arduino due clock speed,arduino nano clock speed,arduino uno clock speed,Privacy settings,How Search works,ds3231 set time,arduino clock code without rtc,arduino rtc,arduino 7 segment clock without rtc,arduino wall clock,automatic alarm clock with arduino without rtc,arduino led clock project