This is a project to construct and build a word clock using a raspberry pi zero and the adafruid neopixels. This project is currently in progress. The repository will document the current work.
To use the the great library rpi_ws291x this project adds a Java-Wrapper.
- Raspberry Pi Zero (W)
- XP Power ECE60US05 AC/DC converter 5V 60W
- 74AHCT125 Level Converter
- Adafruit NeoPixel Digital RGBW LED Strip
The wiring is done how it is explained in the adafruit guide This is my result for the demo:
-
Setup an evironment where the pi is accessible through ssh. There are several guides on the web that explain how to setup the pi.
-
Assigning PWM0 and PWM1 pins to GPIO 18 and 13. The NeoPixel protocol will be controlled by the raspi's sound output. To make the raspi ouput the signal to the GPIO 18 and 13, we need to digitally wire them up. These steps are copied from this guide
sudo apt-get update
sudo apt-get install git-core
git clone git://git.drogon.net/wiringPi
cd ~/wiringPi
./build
- test the installation with
gpio -v
- Copy the gpio_alt.c code from this repo to your folder on the pi
gcc -o gpio_alt gpio_alt.c
sudo chown root:root gpio_alt
sudo chmod u+s gpio_alt
sudo mv gpio_alt /usr/local/bin/
- now the script to wire up the GPIO has been compiled and installed
- wire them up
gpio_alt -p 13 -f 0
gpio_alt -p 18 -f 5
-
Now the pi is setup to output your signals to the stripe. To test the wiring and setup clone the rpi_ws281x repository and run the test
sudo apt-get install scons
https://github.com/jgarff/rpi_ws281x
cd rpi_ws281x
nano main.c
Change the strip height to1
and the width to something like100
and set theSTRIP_TYPE
toSK6812_STRIP_RGBW
scons
this runs the compilersudo ./test
you should see a running led snake
-
If the test was successful add the java wrapper to code the clock
scons .
to compile the so file and copylibws2811.so
to/usr/local/bin/libws2811.so
withsudo cp ~/rpi_ws281x/libws2811.so /usr/local/bin/libws2811.so
- install java 8
sudo apt-get install oracle-java8-jdk
- execute
mv compile assembly:single
from inside the root of this repo and copyout/build/ws2811.jar
to the raspi. - run
java -cp ws2811.jar de.konsultaner.demo.Main
- Result: