DIY Unusual Arduino Linear Clock
HTML-код
- Опубликовано: 8 фев 2025
- This is another one of my series of unusual clocks. The time is
displayed on the WS2812 LED strip containing 34 LEDs. Hours, decadic-
minutes and minutes each have their own color.
Device is really simple and contain only a few components:
Arduino Nano microcontroller
WS2812 RGB Led strip containing 34 Leds
Three momentary switches for setting the clock
Potentiometer for adjusting the light intensity of the LEDs
And 3 Pull_up resistors
The way the time is displayed is as follows: The first group of 15 LEDs shows the hour. The second group of six diodes shows the tens of minutes, and The third group of 12 LEDs shows the minutes. For easier reading, all groups are divided into subgroups of 3 LEDs each. Otherwise the idea and the original code is from "Jan" profile on Hackaday. Its code is adapted to change the intensity of the LEDs depending on the outdoor lighting with LDR resistor. In my case this proved to be impractical because My clock is in a place where there is no change of ambient light so I modify the original code and the intensity of LEDs can be changed manually using a potentiometer.
Setting the correct time is done with three keys: menu, plus and minus key. Long pressing the menu key enters the setting mode and the hour LEDs start flashing. Now by pressing the plus or minus keys we set the hour. With the next short click we switch to tens of minutes, then only minutes. When we have finished setting, long press the menu key again to return to the standard clock mode. As I mentioned earlier, the brightness of the LEDs is adjusted manually with a potentiometer located on the back of the watch.Finally, the device is placed in a suitable box and is a functional decoration in the home.
Instructions, schematic and codeat:
www.hackster.i...
If you're interested, you can check out my playlist of unusual clocks at the link:
• My collection of unusu...
Visit my RUclips Channel for more Projects , DIY and How To Make videos:
/ mirkopavleskimk
by mircemk
SUBSCRIBE LIKE AND SHARE !!!!
Thanks for your Support !
Song: Jarico - Landscape (Vlog No Copyright Music)
Music promoted by Vlog No Copyright Music.
Video Link: • Video
#NoCopyrightMusic #VlogMusic #VlogNoCopyrightMusic
Thanks, it works perfectly, I would send you a photo so you can see it, this incredible
Always love how you build your cases from scratch.
I like unusual things and also very like, when maker makes his code available for others to learn. Thank you!
Mirko, tvoji projekti so fantastični 👍👍👍.
Hvala puno
Why not use INPUT_PULLUP?
It is possible to add to the code that the seconds blink between hours and minutes and between minutes and minutes, but these LEDs are not used anyway.
I would really appreciate it, If I knew how to do it, I would gladly share it with everyone
Interesting idea
Nice 👍👍👍
Very nice project... So sad you did not share the code... ;-)
// LINEAR CLOCK.
// This project was originally a Week-end project using elements from other projects: Arduino, Neopixel and wood support are re-used. DS1307 is later added just to play.
// Is a SIMPLE CLOCK using three colors: 5 Red LED indicates the HOUR. 1 Green LED indicates the MINUTE and 1 Blue LED indicates the SECOND. Neither date nor AM/PM indication is showed.
// 2 buttons are added to increase Hour and Minute.
// 7 LEDs are showed at a time: this allows to use +5V output from Arduino UNO pin. If more LEDs are activated, you are advised to check if an external +5Vdc power is needed to supply the Neopixel strip.
// You will need:
// 1 Arduino UNO.
// 1 NEOPIXEL LED Strip (60 LEDs per meter).
// 1 DS1307 RTC board.
// 2 Buttons
// 2 1K Ohm resistance.
// 1 5Vdc Power supply and USB cable to Arduino.
// Optional material: 1 prototyping board + 1 piece of wood to act as a support of the LED strip and Arduino.
// This code works for the Neopixel strip "upside down": the cables are in the inferior part of the strip (so the Arduino is placed near the base and closer to power plug).
// The code for Neopixel strip "straight" is called "Linear_Clock_RTC".
// RUclips video at:
// Images and more information at: Instructables.
// THIS CODE IS CREATIVE COMMONS: DISTRIBUTE AND USE IT MENTIONING THE AUTHOR @LluisLlimargas / www.llimargas.com (I'll be glad to know your opinion and suggestions).
// Stay Geek!
#include
#include
#include
#define NEOPIN 6 // Neopixel strip control to Pin 6.
#define BRIGHTNESS 64 // Maximum LED brightness definition.
Adafruit_NeoPixel strip = Adafruit_NeoPixel(60, NEOPIN, NEO_GRB + NEO_KHZ800); // Neopixel strip definitiol.
RTC_DS1307 RTC; // Real Time Clock (RTC) used.
DateTime Clock; // RTC defined.
byte hora, minut, segon; // Time managing variables.
int estatbotohora,estatbotominut = 0; //Hour and Minutes button stat variables.
void setup () {
Wire.begin(); // Activate I2C.
RTC.begin(); // Activate RTC.
strip.begin(); // Activate Neopixel.
pinMode(NEOPIN, OUTPUT);
pinMode(2, INPUT); // HOUR button attached at Pin 2.
pinMode(4, INPUT); // MINUTE button attached at Pin 4.
strip.setBrightness(BRIGHTNESS); // Set Brightness.
borra_tot(); // FYI: if the Arduino is powered from a computer, uncomment to send the computer time to Arduino.
// if (! RTC.isrunning()) {
// //Serial.println("RTC is NOT running!");
// RTC.adjust(DateTime(__DATE__, __TIME__));
// }
}
//------- LOOP--------------
void loop () {
Clock = RTC.now(); // Arduino gets time from DS1307. Notice that no am/pm discrimination and no date is obtained.
hora = Clock.hour(); // Obtain Hour.
minut = Clock.minute(); // Obtain Minutes.
segon = Clock.second(); // Obtain Seconds.
estatbotohora = digitalRead(2); // Pin 2: if the button is pressed, the Hour is increased.
if (estatbotohora == HIGH) {
if (hora = 12) // Hour from 0 to 12.
hora = hora-12;
switch (hora) {
case 0:
pinta_leds_hora(0); // 0 hour is showed at the extreme of the strip.
break;
case 1:
pinta_leds_hora(55); // Hour 1 is showed at the other extreme of the strip.
break;
case 2:
pinta_leds_hora(50);
break;
case 3:
pinta_leds_hora(45);
break;
case 4:
pinta_leds_hora(40);
break;
case 5:
pinta_leds_hora(35);
break;
case 6:
pinta_leds_hora(30);
break;
case 7:
pinta_leds_hora(25);
break;
case 8:
pinta_leds_hora(20);
break;
case 9:
pinta_leds_hora(15);
break;
case 10:
pinta_leds_hora(10);
break;
case 11:
pinta_leds_hora(5);
break;
default:
break;
}
}
//------------------ TURNS ON THE HOUR LEDS
// Play with the Brightness parameter.
void pinta_leds_hora(int primer_led){
strip.setPixelColor(primer_led,10,0,0);
strip.setPixelColor(primer_led+1,70,0,0);
strip.setPixelColor(primer_led+2,100,0,0);
strip.setPixelColor(primer_led+3,70,0,0);
strip.setPixelColor(primer_led+4,10,0,0);
strip.show();
}
//------------------ TURNS ON THE MINUTE LED
void pinta_minut(int minut){
if (minut == 0) // Paint the complete minute at the "end" of the strip.
minut = 60;
strip.setPixelColor(60-minut-1,0,10,0);
strip.setPixelColor(60-minut,0,100,0);
strip.setPixelColor(60-minut+1,0,10,0);
strip.show();
}
//------------------ TURNS ON THE SECOND LED.
void pinta_segon(int segon){
if (segon == 0) // Paint the complete second at the "end" of the strip.
segon = 60;
strip.setPixelColor(60-segon,0,0,100);
strip.show();
}
//------------------ TURNS OFF ALL THE LEDs.
void borra_tot(){
for(int i=0;i
I found this code on github, raw.githubusercontent.com/Giroair/Linear-Clock-Arduino/master/Linear_Clock___RTC__inverted_.ino
@@TradieTrev Thank you very much! :-D
But that has to do with the Neopixel system... Need to translate to WS2812 ;-)
@@luigimorelli6444 It'll be something simple, have a look how coding neopixels compares with a ws2812. Good luck mate, the majority of the functionality code is there with the authors credits.
Schematic and code at: create.arduino.cc/projecthub/mircemk/diy-unusual-arduino-linear-
clock-5e5a43
Nice Project but where is the DS3231 module in the shematic diagram?
Sorry, SDa toA4 ad SCL toA5 of arduino
RTC_3231' does not name a type; did you mean 'TCNT2_1'?
please clear
The code has errors ('class RTC_DS3231' has no member named 'lostPower') and cant install on arduino nano
Get Libraries from Arduino project Hub page
Please send code
create.arduino.cc/projecthub/mircemk/diy-unusual-linear-clock-5e5a43