Tell us about yourself!

Complete Your Profile
  • Big, Auto Dim, Room Clock (using Arduino and WS2811)

    #include <DS3232RTC.h>#include <Time.h>#include <Wire.h>#include "FastLED.h"#define NUM_LEDS 142 // Number of LED controles (remember I have 5 leds / controler#define COLOR_ORDER GRB // Define color order for your strip#define DATA_PIN 6 // Data pin for led comunicationCRGB leds[NUM_LEDS]; // Define LEDs stripbyte digits[10][35] = {{0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}, // Digit 0{0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1}, // Digit 1{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0}, // Digit 2{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1}, // Digit 3{1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1}, // Digit 4{1,1,1,1,1,0,0,0,0,0...

    see more »

    #include <DS3232RTC.h>#include <Time.h>#include <Wire.h>#include "FastLED.h"#define NUM_LEDS 142 // Number of LED controles (remember I have 5 leds / controler#define COLOR_ORDER GRB // Define color order for your strip#define DATA_PIN 6 // Data pin for led comunicationCRGB leds[NUM_LEDS]; // Define LEDs stripbyte digits[10][35] = {{0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}, // Digit 0{0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1}, // Digit 1{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0}, // Digit 2{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1}, // Digit 3{1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1}, // Digit 4{1,1,1,1,1,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1}, // Digit 5{1,1,1,1,1,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}, // Digit 6{0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1}, // Digit 7{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}, // Digit 8{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1}}; // Digit 9 | 2D Array for numbers on 7 segmentbyte firstdigit[2][10] = {{0,0,0,0,0,0,0,0,0,0}, // Digit 0 first number{1,1,1,1,1,1,1,1,1,1}}; // Digit 1 first number | 2D Array for numbers on 7 segmentbool Dot = true; //Dot statebool DST = false; //DST statelong ledColor = 0x006400 ; // Color used (in hex)void setup(){Serial.begin(9600);Wire.begin();LEDS.addLeds<WS2812B, DATA_PIN, COLOR_ORDER>(leds, NUM_LEDS); // Set LED strip typeLEDS.setBrightness(255); // Set initial brightnesspinMode(2, INPUT_PULLUP); // Define DST adjust button pinpinMode(4, INPUT_PULLUP); // Define Minutes adjust button pinpinMode(5, INPUT_PULLUP); // Define Hours adjust button pin}// Check Light sensor and set brightness accordinglyvoid BrightnessCheck(){const byte sensorPin = 3; // light sensor pinconst byte brightnessLow = 170; // Low brightness valueconst byte brightnessHigh = 255; // High brightness valueint sensorValue = digitalRead(sensorPin); // Read sensorif (sensorValue == 0) {Serial.println("Brightness High");LEDS.setBrightness(brightnessHigh);}else {Serial.println("Brightness Low");LEDS.setBrightness(brightnessLow);}};// Get time in a single number, if hours will be a single digit then time will be displayed 155 instead of 0155int GetTime(){ tmElements_t Now; RTC.read(Now); //time_t Now = RTC.Now();// Getting the current Time and storing it into a DateTime object int hour=Now.Hour; if (DST) { if (hour==24) {hour=1;}else {hour += 1;}};if (hour>12 ){hour -= 12;};int minutes=Now.Minute;int second =Now.Second;if (second % 2==0) {Dot = false;}else {Dot = true;};return (hour*100+minutes);};void DSTcheck(){int buttonDST = digitalRead(2);Serial.print("DST is: ");Serial.println(DST);if (buttonDST == LOW){if (DST){DST=false;Serial.print("Switching DST to: ");Serial.println(DST);}else if (!DST){DST=true;Serial.print("Switching DST to: ");Serial.println(DST);};delay(500);};}// Convert time to array needet for displayvoid TimeToArray(){int Now = GetTime(); // Get timeint cursor = 142;Serial.print("Time is: ");Serial.println(Now);if (Dot){leds[70]=ledColor;leds[71]=ledColor;}else {leds[70]=0x000000;leds[71]=0x000000;};for(int i=1;i<=4;i++){int digit = Now % 10; // get last digit in timeif (i==1){cursor =107;Serial.print("Digit 4 is : ");Serial.print(digit);Serial.print(", the array is : ");for(int k=0; k<=34;k++){Serial.print(digits[digit][k]);if (digits[digit][k]== 1){leds[cursor]=ledColor;}else if (digits[digit][k]==0){leds[cursor]=0x000000;};cursor ++;};Serial.println();}else if (i==2){cursor =72;Serial.print("Digit 3 is : ");Serial.print(digit);Serial.print(", the array is : ");for(int k=0; k<=34;k++){Serial.print(digits[digit][k]);if (digits[digit][k]== 1){leds[cursor]=ledColor;}else if (digits[digit][k]==0){leds[cursor]=0x000000;};cursor ++;};Serial.println();}else if (i==3){cursor =35;Serial.print("Digit 2 is : ");Serial.print(digit);Serial.print(", the array is : ");for(int k=0; k<=34;k++){Serial.print(digits[digit][k]);if (digits[digit][k]== 1){leds[cursor]=ledColor;}else if (digits[digit][k]==0){leds[cursor]=0x000000;};cursor ++;};Serial.println();}else if (i==4){cursor =0;Serial.print("Digit 1 is : ");Serial.print(digit);Serial.print(", the array is : ");for(int k=0; k<=34;k++){Serial.print(digits[digit][k]);if (digits[digit][k]== 1){leds[cursor]=ledColor;}else if (digits[digit][k]==0){leds[cursor]=0x000000;};cursor ++;};Serial.println();};Now /= 10;};};void TimeAdjust(){int buttonH = digitalRead(5);int buttonM = digitalRead(4);if (buttonH == LOW || buttonM == LOW){delay(500);tmElements_t Now;RTC.read(Now);int hour=Now.Hour;int minutes=Now.Minute;if (buttonH == LOW){if (Now.Hour== 24){Now.Hour=1;}else {Now.Hour += 1;};}else {if (Now.Minute== 59){Now.Minute=0;}else {Now.Minute += 1;};};RTC.write(Now);}}void loop() // Main loop{BrightnessCheck(); // Check brightnessDSTcheck(); // Check DSTTimeAdjust(); // Check to se if time is geting modifiedTimeToArray(); // Get leds array with required configurationFastLED.show(); // Display leds array}

    View Instructable »
  • MohN4 followed AlanV24 months ago
      • Smart Home Automation With Android + Ethernet Internet + Arduino