This is a fork of Dylan Rush's excellent "Categorical-Sectional".
The purpose of this version was to unify the control code of different LED light types and to add support for WS2801 "individually" addressible LED lights.
I have also attempted to make setup easier by moving the LED configuration into data files.
To complete this project you will need to:
- Edit two text files.
- Solder three wires.
The instructions given here are for the NeoPixel/WS2801 version of LEDs.
The electronics cost about $90 USD if you are buying everything new.
To complete the project you will need to supply your own chart and backing board.
Soldering is required for three (3) wires, along with some electrical tape.
To finish the instalation you will need a monitor, and a keyboard.
A parts manifest lists a Raspberry Pi Zero due to its size and lower power consumption, but a spare 2 or 3 will work as long as it has WiFi. The wiring diagram does not change.
Description | Cost | Link |
---|---|---|
Raspberry Pi Zero W | $29.99 | https://www.amazon.com/CanaKit-Raspberry-Wireless-Starter-Official/dp/B06XJQV162/ref=sr_1_7?s=electronics&ie=UTF8&qid=1528557992&sr=1-7&keywords=raspberry+pi+zero+w |
5 volt, 4 amp power supply | $12.99 | https://www.amazon.com/gp/product/B00MRGKPH8/ref=oh_aui_detailpage_o06_s00?ie=UTF8&psc=1 |
Barrel jack adapters | $7.99 | https://www.amazon.com/gp/product/B01M4RBARQ/ref=oh_aui_detailpage_o06_s01?ie=UTF8&psc=1 |
Individually addressable LEDs (WS2801 based) | $39.95 | https://www.amazon.com/12mm-Diffused-Digital-Pixels-Strand/dp/B073MZWBYS/ref=sr_1_1?ie=UTF8&qid=1528558371&sr=8-1&keywords=adafruit+ws2801 |
4 Pin JST SM Plugs | $7.99 | https://www.amazon.com/Visdoll-Pairs-Female-Connector-Cable/dp/B075K48BD9/ref=sr_1_8?ie=UTF8&qid=1528559351&sr=8-8&keywords=4+Pin+JST+SM+Plug |
This section gets you started with instaling the software.
A full tutorial on how to install the Operating System is available at: https://www.raspberrypi.org/documentation/installation/noobs.md
- Boot the Raspberry Pi with the empty SD card.
- You will be given a choice of operating systems to install. You will also be asked for your WiFi network and password.
- Choose the WiFi network that will be used when the project is completed.
- Choose "Raspbian" as the operating system.
- When it is finished, login with the username:pi password:raspberry
From the command line, after logging in:
git clone https://github.com/JohnMarzulli/categorical-sectional.git
This will install this software onto the Raspberry Pi.
From a terminal on the Raspberry Pi
sudo pip install Adafruit-GPIO
sudo pip install RPi-GPIO
sudo pip install pytest
sudo pip install Adafruit_WS2801
Run 'raspi-config' and enable the SPI bus under Advanced
sudo raspi-config
If you are using multiple strands of lights, plug them together. Tape off the red and blue tap wires between the connectors and at the end of the strand.
Leave the read and blue wire at the start of the strand for the moment.
For the barrel jack, use the two thinner wires that come out of the top of the plastic connector from the LED lights.
One is red, the other blue.
- Blue -> Barrel jack minus
- Red -> Barrel jack positive
Use the group of four wires from a male JST SM adapter.
Solder them to the board.
- Blue -> Tied off and shrink wrapped. Not connected.
- Red -> Raspberry Pi 3V Pin 17 (Physical)
- Yellow -> Pin 19(Physical)/SPI MOSI
- Green -> Pin 23(Physical)/SCLK/SPI
- Connect the Male JST and LED connectors together.
- Connect the barrel jack into the Neopixel strip.
- Add the SD card to the Pi.
- Plug inthe NeoPixels first, then the Raspberry Pi.
All of the configuration files will be in the "data" sub directory.
Unless you are building the same exact map that I did (Puget Sound to Oshkosh), then you will want to modify at least one of these.
This is the first file loaded. It tells the software what type of lights are being used, and which airport file to open.
{
"mode": "ws2801",
"pixel_count": 50,
"spi_device": 0,
"spi_port": 0,
"pwm_frequency": 100,
"airports_file": "data/south_sound.json",
"night_lights": true
}
Set this to true if you would like the airports to switch to yellow when the airport is past sunset but not yet to sunrise.
Switches to normal flight category colors during daylight hours.
This controls which type of LED system to use for controlling the lights.
Value | Description |
---|---|
ws2801 | Use WS2801 based light strands like those from AdaFruit |
pwm | Use pulse width modulation based LEDs. This can have their colors changed more than normal LEDs. |
led | Use standard LEDs that have a positive wire for each color and a common ground. |
If you are using ws2801 based LEDs then you may need to change "pixel_count". Each strand will come with a numbe rof LEDs. You you are using a single strand, then set this number to that count. If you have combined strands, then set the total number of lights.
You will probably not need to change this. If you do need to change this, then you probably know what to do.
Used if you are using PWM LEDs.
This is the file that contains the airport names and the wiring configuration for them.
This shows the two sections for an example airport file.
{
"pwm": [
{ "KRNT": [3, 5, 7] },
{ "KSEA": [11, 13, 15] },
{ "KPLU": [19, 21, 23] },
{ "KOLM": [29, 31, 33] },
{ "KTIW": [32, 35, 37] },
{ "KPWT": [36, 38, 40] },
{ "KSHN": [8, 10, 12] }
],
"ws2801": [
{ "KRNT": { "neopixel": 0} },
{ "KSEA": { "neopixel": 2} },
{ "KPLU": { "neopixel": 4} },
{ "KOLM": { "neopixel": 6} },
{ "KTIW": { "neopixel": 8} },
{ "KPWT": { "neopixel": 10} },
{ "KSHN": { "neopixel": 12} }
]
}
There are two sections:
Contains the airport name and wiring information. The first number is the wire controlling the red LED, then the green LED, and finally the blue LED.
These wire numbers refer to the physical board number on the Raspberry pie.
So for KRNT (Renton), the wire leading to the Red LED would be wired to the GPIO board at pin 3. The Blue LED would be wired to pin 5, and the green LED wire would be wired to pin 7.
NOTE: The "pwm" section is used by both the normal LEDs and the pulse width controlled LEDs.
This section contains the information required to control a strand of WS2801 lights.
Once again, this starts with an airport or weather station identifier.
Next to contains a "neopixel" identifier. This is the order of the light on the strand.
NOTE: The first light is "0", the second light is "1".
Due to the way your lights may need to be arranged to fit on the map, some lights may need to be skipped, so keep track of your lights.
Using the first few lines of the ws2801 section from above, this shows how the numbering works.
This project uses "zero based indexing".
In this scenario the second and fourth light are not used. They will remain off the entire time.
The first light is assigned to Renton airport. The third light will show SeaTac aiport.
[Pi] ------[LED]------[LED]------[LED]------[LED]
0/KRNT Skipped 2/KSEA Skipped
To run it at boot, perform the following steps:
- Log into the device as the user "pi" with password "raspberry".
- Type "crontab -e"
- Select "Nano" (Option 1)
- Enter the following text at the bottom of the file:
@reboot python /home/pi/categorical-sectional/controller.py &
- Save the file and exit.
- sudo reboot now
Capitalization counts. The map lights should come on with each boot now.
This project uses the standard airport coloring for flight rules category.
Green is VFR Blue is MVFR Red is IFR Blinking red is LIFR.
NOTE: A blinking blue light indicates an error getting the weather from the station.
https://learn.adafruit.com/12mm-led-pixels/wiring https://tutorials-raspberrypi.com/how-to-control-a-raspberry-pi-ws2801-rgb-led-strip/ https://www.raspberrypi.org/documentation/linux/usage/cron.md
Airport Location data from http://ourairports.com/data/ Airport sunrise/sunset data from https://sunrise-sunset.org/api