Pi Cam Cover for Neopixel 12 Ring

Pi Cam Cover for Neopixel 12 Ring

thingiverse

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)) Update: Thank you daniel2887 for finding and posting the solution for this! Regarding: "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." FYI, I found a solution here: https://askubuntu.com/questions/556527/run-script-with-arguments-as-sudo-without-being-asked-for-password I created a file called: /etc/sudoers.d/octoprint-leds And it contains: pi ALL=NOPASSWD: /usr/bin/python3 /home/pi/turn_on_led_ring.py pi ALL=NOPASSWD: /usr/bin/python3 /home/pi/turn_off_led_ring.py I was then able to run the script through octoprint custom actions like this: system: actions: - action: leds_on command: sudo python3 /home/pi/turn_on_led_ring.py name: Turn LEDs on - action: leds_off command: sudo python3 /home/pi/turn_off_led_ring.py name: Turn LEDs off Don't forget to change ownership and the permissions for the python scripts themselves or else this whole exercise is moot since anyone could write anything they want in the scripts. My permissions are: -rwx------ 1 root root 121 May 23 19:51 turn_on_led_ring.py -rwx------ 1 root root 115 May 24 19:00 turn_off_led_ring.py

Download Model from thingiverse

With this file you will be able to print Pi Cam Cover for Neopixel 12 Ring with your 3D printer. Click on the button and save the file on your computer to work, edit or customize your design. You can also find more 3D designs for printers on Pi Cam Cover for Neopixel 12 Ring.