Make NeoPixels react to Twitter trends
- PiXel runs on a Raspberry Pi, and triggers LED animations based on current Twitter trends.
- For every tweet in the last 5 seconds that matches one of the user supplied keywords, PiXel flashes a random LED on the strip.
- If nearly the same number of tweets as pixels are found, then a random special animation is triggered
- If barely any tweets are found, then the pixels glow dimly
- If a user supplied special keyword or author is found, then a specific special animation is triggered.
- A toggle button can be added to cycle the array between the Standby/OFF, Twitter, and Glow states
- Raspberry Pi (2x/3x) with Latest Raspbian
- Raspberry Pi Power Supply (2+ Amps)
- WS281X LED Strip (NeoPixel or clone)
- 5v Power Supply - (0.06 * Number of Pixels) Amps
- Logic Level Conversion (see Adafruit Guide to Using NeoPixels with Raspberry Pi for more details on wiring)
- (Optional) Toggle button (for controlling modes)
Alternatively, Order and Assemble a NeoPixel Shield
- Should be preinstalled in newer Raspbian
- Follow library installation instructions
- Install with
$ pip install python-twitter
or follow the link and install manually.
- Follow Adafruit Guide to Using NeoPixels with Raspberry Pi to set up WS281X Strip. Connect to [GPIO18, GND]
- (Optional): Connect Toggle button to [GPIO24, GND] for Mode Toggle
- Install Raspbian & Dependencies on Raspberry Pi (see raspbian installation guide for more details)
- Set up Twitter Dev account and register for API keys. See python-twitter docs for information about setting up API Keys
- Configure conf.py with API keys, LED colors, and correct GPIO pins
- run main.py with super user permissions, i.e.
sudo python $PIXEL_PATH/PiXel/main.py
OR to run at startup (hack-y)
## Enable PiXel @ start
if ! ps ax | grep -v grep | grep python > /dev/null; then
screen -d -m -S PiXel bash -c 'cd $PIXEL_PATH/PiXel/ && sudo python main.py'
fi
PiXel uses 3 query types. For information about formatting, see Twitter Search API documentation. All three queries are included in the q
field of a Twitter Search call.
- QUERY_KEYWORDS: These keywords trigger a single flash.
- QUERY_SPECIALS: These keywords trigger a special animation.
- QUERY_FROM_USERS: If a tweet was written by this user a special animation is triggered.
Ian McLinden, 2018
- done