Persistence of Vision (PoV) Clock

Поделиться
HTML-код
  • Опубликовано: 10 сен 2024
  • I recently created this PoV clock. One of its less ubiquitous features is that it employs a strip of individually controllable LEDs. This makes it easier to place the microcontroller (an Arduino-compatible Teensy 4.0) and electronics in the base of the clock, rather than on the rotor. However, this approach necessitates the use of an Arduino/Teensy library which imposes tricky timing constraints. For more details, check out the geek zone below.
    ****************** Beware, you are entering the Geek Zone **********************
    What's inside:
    Microcontroller: Teensy 4.0
    Motor: DC 775 Motor, 12V (much less powerful motor would have sufficed)
    Encoder: self-made, 60-slots, single-channel (not quadrature), with index pulse
    Slip Ring: Hollow shaft, 6 wires, ID 5mm X OD 22mm
    Realtime Clock: Adafruit DS3231 Precision RTC Breakout
    LEDs: WS2812B RGB 5050SMD individually addressable
    Arduino/Teensy libraries used:
    WS2812Serial.h, FastLED.h, TimerOne.h (all for WS2812B strip)
    TimerThree.h (for interrupts)
    Wire.h, DS3231.h (for realtime clock)
    Challenges: Rotor spins at 10 rpm. That's the bare minimum to achieve PoV effect. Faster would be better. However, in order to display the seconds-hand, the system must distinguish between 60 positions per revolution and each position requires one on and one off command for each LED. This amounts to 10 x 60 x 2 = 1200 commands per second to be issued to the LED strip, or one command for each LED every 1/1200 sec = 0.83 ms.
    Bummer: FastLED and WS2812Serial libraries both have hard-coded minimum refresh times (i.e., the time between successive commands) of 2.4 ms. This means that they can't switch the LED strip on and off at the required interval of 0.83 ms.
    Workaround: The minimum refresh time of 2.4 ms is coded into the libraries to maintain compatibility with some older WS2812B strips. Newer strips require a minimum of 300 us per cycle + 30 us per LED. A strip with 16 LEDs requires a minimum of 300 us + 16 x 30 us = 780 us (= 0.78 ms). With that minimum refresh time in mind, I outcommented the single line in WS2812Serial.h that forces the hard-coded delay of exactly 2.4 ms. Now WS2812Serial.h takes exactly 0.78 ms to switch the 16 LED on or off, thus fitting into the timing constraint of 0.83 ms.

Комментарии • 6