Skip to content

suhlig/wordclock

Repository files navigation

Ruby Word Clock

Build Status

Front Back

This is an implementation of a Word Clock in Ruby. It maps every point in time between midnight and 23:59 hours to a sentence, which is represented as positions of pixels to light up. The current implementation uses German words.

The LEDs are driven by a Fadecandy board using faderuby.

The hardware setup was largely inspired by the WordClock mit WS2812 article at mikrocontroller.net. It uses it's 24 hours version as character table.

LED Indices

The following table shows the positions for a single, continuous strip of LEDs. Read from top to bottom, with the MSB in the top row:

                                                                                                    1         1         1         1         1         1         1         1         1         1         2         2         2         2         2         2         2         2         2
          1         2         3         4         5         6         7         8         9         0         1         2         3         4         5         6         7         8         9         0         1         2         3         4         5         6         7         8
012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567
ESAISTOVIERTELEINSDREINERSECHSIEBENEELFÜNFNEUNVIERACHTNULLZWEINZWÖLFZEHNUNDOZWANZIGVIERZIGDREISSIGFÜNFZIGUHRMINUTENIVORUNDNACHEINDREIVIERTELHALBSIEBENEUNULLZWEINEFÜNFSECHSNACHTVIERDREINSUNDAELFEZEHNZWANZIGGRADREISSIGVIERZIGZWÖLFÜNFZIGMINUTENUHREFRÜHVORABENDSMITTERNACHTSMORGENSWARMMITTAGS

Development

This is a regular Ruby project, i.e. after cloning the project, the usual

$ bundle install
$ bundle exec rake

will get you started with running the tests.

For further investigation, there is also a terminal simulator that shows a text version of the clock in action:

$ bundle exec exe/wordclock-simulator "12.11.2017 17:23"

17:23

It's even prettier when the party mode is enabled (e.g. on Shrove Tuesday):

$ bundle exec exe/wordclock-simulator "28.2.2017 23:59"

Party Mode

Deployment

See deployment for details.

Troubleshooting the WS2811B LEDs

Wiring

I accidentally killed a number of LEDs with a ground loop because the Raspberry Pi and the soldering iron were connected to different wall sockets.

To find out whether an LED is dead, someone in the forum recommended to measure the resistance between DATA and GND:

  • If the resistance is between 2 and 15 MΩ, the LED is ok.
  • If the resistance is ∞, the LED is dead.

Since then, this is my safety procedure when soldering LEDs:

  1. Connect GND of soldering iron to GND of the LED strip to be soldered
  2. Connect GND of power supply to GND of the LED strip to be soldered
  3. Solder black wire to GND of LED strip
  4. Solder red wire to +5V of LED strip
  5. Connect GND of Fadecandy to LED strip
  6. Connect DATA of Fadecandy to LED strip
  7. Connect Fadecandy to USB
  8. Connect +5V of power supply to LED strip
  9. Start test

Software Tests

  • fadecandy comes with a number of useful examples that can exercise a number of LEDs:

    $ cd ~/workspace/fadecandy/examples/perl
    $ ./random.pl; ./turnthemoff.pl

    Having random.pl and turnthemoff.pl in one line ensures that all LEDs are turned off when random.pl is interrupted.

  • Tailing the log file

    Assuming that wordclock is the host, the following will tail entries related to fcserver from the system journal:

    ssh wordclock sudo journalctl -u fcserver -f

    Once a client connects, it will show a line similar to this:

    Dec 17 18:07:52 wordclock fcserver[684]: [1481994472:2735] NOTICE: New Open Pixel Control connection
    

Bill of Materials

Electronics Parts

Component Price
300 WS2811B LEDs 33,21 €
Adafruit FadeCandy Dithering USB-Controlled Driver for NeoPixels 28,45 €
Raspberry Pi 3 Model B 34,99 €
SanDisk Ultra Android microSDHC 16GB 7,99 €
MeanWell LED-Netzteil 5V 37,00 €
Kabel USB 2.0 Micro B Stecker auf 2x offene Kabelenden 1,49 €

Mechanical Parts

Component Price
Back plane for mouting the LEDs 7,88 €
Front plane 54,00 €
Mounting plane 59,50 €
Picture frame (incl. mounting set) 42,48 €
Cable box 12,99 €

All prices as of Sept. 2016 incl. S&H.

Icons

Switch to SSD (USB)

https://forums.raspberrypi.com/viewtopic.php?t=196778

Benchmarks

https://jamesachambers.com/raspberry-pi-storage-benchmarks-2019-benchmarking-script/

  • before:

    Raspberry Pi 3 with Kingston - Model: SD32G

    Running HDParm tests ...

    Category                  Test                      Result
    

    HDParm Disk Read 20.87 MB/s HDParm Cached Disk Read 20.71 MB/s DD Disk Write 17.1 MB/s FIO 4k random read 1775 IOPS (7103 KB/s) FIO 4k random write 93 IOPS (375 KB/s) IOZone 4k read 5818 KB/s IOZone 4k write 1093 KB/s IOZone 4k random read 6255 KB/s IOZone 4k random write 599 KB/s

                          Score: 634
    
    
    
  • after:

    Raspberry Pi 3 with SanDisk Extreme PRO USB 3.2 SSD 128 GB

        Category                  Test                      Result
    HDParm                    Disk Read                 34.49 MB/s
    HDParm                    Cached Disk Read          33.90 MB/s
    DD                        Disk Write                32.1 MB/s
    FIO                       4k random read            1985 IOPS (7941 KB/s)
    FIO                       4k random write           2581 IOPS (10327 KB/s)
    IOZone                    4k read                   11261 KB/s
    IOZone                    4k write                  10129 KB/s
    IOZone                    4k random read            7718 KB/s
    IOZone                    4k random write           10143 KB/s
    
                              Score: 2203
    

Not as impressive as I had hoped, but it's likely due to the Raspberry Pi 3 having only USB-2.

Releases

No releases published

Packages

No packages published

Languages