LED Clock, Part I: Hands

The first part of making an LED clock was actually learning how to control the LEDs in the strip.

I had experimented with the LED strip before, flashing a rainbow, before realising I had no practical use the damn thing. At the time, I had used a Neopixel library.

Upon googling the subject again, another library came recommended, called FastLED. I had a quick look at the library and decided to give it a go.

#include <Arduino.h>
#include <FastLED.h>

#define NUM_LEDS 144

CRGB leds[NUM_LEDS];

void setup()
{
  Serial.begin(9600);

  FastLED.addLeds<NEOPIXEL, D4>(leds, NUM_LEDS);

  fill_solid(leds, NUM_LEDS, CRGB::Black);
}

void loop()
{
  leds[0].red   = 255;

  leds[1].green   = 255;

  leds[2].blue   = 255;

  leds[3] = CRGB::White;

  FastLED.show();
}
Four LEDs lit with different colours

Flashing an LED was just a case of turning it “black” and blue.

#include <Arduino.h>
#include <FastLED.h>

#define NUM_LEDS 60
CRGB leds[NUM_LEDS];

void setup() 
{ 
  Serial.begin(9600);
  FastLED.addLeds<NEOPIXEL, D2>(leds, NUM_LEDS); 
}

void loop() 
{
  Serial.write("On");

  leds[1] = CRGB::White; 
  FastLED.show(); 
  delay(30);
	
  Serial.write("Off");

  leds[1] = CRGB::Black; 
  FastLED.show(); 
  delay(30);
}
Flashing between white and “black”

I experimented a little more and ended up with a moving yellow light and a pretty static red slash of colour. This was sort of how I imagined the clocking running.

Power consumption was also on my mind. I had read that the each WS2812 on the strip would consume around 80mA. With my intention to power 180 of these, the power requirement was around 12A. This seemed very excessive, especially given the puny wires that were soldered to the strip. If somebody had tried to light them with that power consumption, the wire would have evaporated.

With my initial experimentations, a year before, I was sure I had run a LED rainbow lighting program through it and I new my 3A supply did the job and nothing went on fire.

I hooked it all up and lit all 144 LEDs.

It was only consuming 2.7A, including 200mA required to run the ESP8266 that was controlling it. I knew I’d need another 0.7A to power the intended 180 LEDs. This put the consumption at a little under 20mA for each WS2812.

With the LEDs under control, my next area of investigation was Real Time Clocks. I’ll do a post about that, once I’ve got something to report!

2 thoughts on “LED Clock, Part I: Hands

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.