Thingiverse

Pi Cam Cover for Neopixel 12 Ring
by Thingiverse
Last crawled date: 5 years, 3 months ago
Remixed the Pi Camera Cover to be able to use a 12 RGB Ring Light (https://www.amazon.com/gp/product/B0105VMUUQ/ref=ppx_yo_dt_b_asin_title_o01_s00?ie=UTF8&psc=1)
I wired the LEDs directly to the raspberry pi using this guide: https://learn.adafruit.com/neopixels-on-raspberry-pi/raspberry-pi-wiring
And setup the dependencies using:
sudo apt-get install python3 python3-pip
sudo pip3 install rpi_ws281x adafruit-circuitpython-neopixel
I also added an entry to the sudoers file to allow the python script to execute as root since the rpi_ws281x library wont run otherwise.
NOTE: This isn't really good practice due to allowing all python scripts to run as root. I haven't spent enough time testing a better way to work around this.
sudo visudo #Add the following at the bottom of the file.
pi ALL=NOPASSWD: /usr/bin/python3
LEDs are controlled with some event triggers in the config.yaml located at /home/pi/.octoprint/config.yaml
events:
enabled: true
subscriptions:
command: sudo python3 /home/pi/on.py
event: PrintStarted
type: system
command: sudo python3 /home/pi/off.py
event: PrintDone
type: system
command: sudo python3 /home/pi/off.py
event: PrintCancelled
type: system
command: sudo python3 /home/pi/off.py
event: PrintFailed
type: system
on.py contains the following:
import board
import neopixel
pixels = neopixel.NeoPixel(board.D18, 12)
pixels.fill((255, 255, 255))
off.py contains the following:
import board
import neopixel
pixels = neopixel.NeoPixel(board.D18, 12)
pixels.fill((0, 0, 0))
I wired the LEDs directly to the raspberry pi using this guide: https://learn.adafruit.com/neopixels-on-raspberry-pi/raspberry-pi-wiring
And setup the dependencies using:
sudo apt-get install python3 python3-pip
sudo pip3 install rpi_ws281x adafruit-circuitpython-neopixel
I also added an entry to the sudoers file to allow the python script to execute as root since the rpi_ws281x library wont run otherwise.
NOTE: This isn't really good practice due to allowing all python scripts to run as root. I haven't spent enough time testing a better way to work around this.
sudo visudo #Add the following at the bottom of the file.
pi ALL=NOPASSWD: /usr/bin/python3
LEDs are controlled with some event triggers in the config.yaml located at /home/pi/.octoprint/config.yaml
events:
enabled: true
subscriptions:
command: sudo python3 /home/pi/on.py
event: PrintStarted
type: system
command: sudo python3 /home/pi/off.py
event: PrintDone
type: system
command: sudo python3 /home/pi/off.py
event: PrintCancelled
type: system
command: sudo python3 /home/pi/off.py
event: PrintFailed
type: system
on.py contains the following:
import board
import neopixel
pixels = neopixel.NeoPixel(board.D18, 12)
pixels.fill((255, 255, 255))
off.py contains the following:
import board
import neopixel
pixels = neopixel.NeoPixel(board.D18, 12)
pixels.fill((0, 0, 0))