Pi Cam Cover for Neopixel 12 Ring

Pi Cam Cover for Neopixel 12 Ring

thingiverse

Remixed the Pi Camera Cover to use a 12 RGB Ring Light. I wired the LEDs directly to the Raspberry Pi using this guide: https://learn.adafruit.com/neopixels-on-raspberry-pi/raspberry-pi-wiring. Setup the dependencies with: sudo apt-get install python3 python3-pip, and then pip3 install rpi_ws281x adafruit-circuitpython-neopixel. Added an entry to the sudoers file to allow the Python script to execute as root since the rpi_ws281x library won't run otherwise. This isn't really good practice due to allowing all Python scripts to run as root, but I haven't spent enough time testing a better way to work around this. I created a custom entry in the sudoers file by running: sudo visudo. Then I added 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 to this issue! Regarding "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." 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, which 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 Then I ran 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.