# NeoPixel GoPro Lens Light

## Overview and Materials

![](https://cdn-learn.adafruit.com/assets/assets/000/050/568/medium800/leds_P1060414.jpg?1517353108)

GoPros and other small action cams are great for project documentation because they can capture interesting angles without getting in the way of your build. You may not always have optimal lighting in your workspace though, which is where a lens mounted light can come in handy.

All of the code and hardware is running off of a Trinket M0 board using the Arduino IDE or CircuitPython depending on your preference. A NeoPixel 16 x RGBW ring is used for the light since it fits perfectly around the lens with some breathing room. This particular temperature of white (~4500K) looks very natural on camera and doesn’t give off a blue hue. A potentiometer is also in the circuit to adjust the brightness of the light. All of the components fit snuggly into a 3D printed case that fits over the GoPro’s lens.

This light’s housing is designed to fit with the GoPro Hero 3+ which is a slightly older model, but the file can be edited to fit other models or even different types of action cams.

 **For this project you'll need:**

### Part: NeoPixel Ring - 16 x 5050 RGBW LEDs w/ Integrated Drivers - Natural White - ~4500K
quantity: 1
NeoPixel RGBW Ring
[NeoPixel Ring - 16 x 5050 RGBW LEDs w/ Integrated Drivers - Natural White - ~4500K](https://www.adafruit.com/product/2855)

### Part: Adafruit Trinket M0 - for use with CircuitPython / Arduino IDE
quantity: 1
Trinket M0 Board
[Adafruit Trinket M0 - for use with CircuitPython / Arduino IDE](https://www.adafruit.com/product/3500)

### Part: Breadboard trim potentiometer - 10K
quantity: 1
Small potentiometer to fit in the housing
[Breadboard trim potentiometer - 10K](https://www.adafruit.com/product/356)

### Part: PLA Filament for 3D Printers - 1.75mm Natural Translucent - 1KG
quantity: 1
Clear PLA Filament for light diffusion
[PLA Filament for 3D Printers - 1.75mm Natural Translucent - 1KG](https://www.adafruit.com/product/2451)

### Part: Silicone Cover Stranded-Core Wire - 30AWG in Various Colors
quantity: 1
Thin wire for fitting comfortably into the 3D printed housing
[Silicone Cover Stranded-Core Wire - 30AWG in Various Colors](https://www.adafruit.com/product/2051)

https://www.youtube.com/watch?v=dtAe1RzfzP0&amp;

# NeoPixel GoPro Lens Light

## Electronics

The Trinket M0 is the brain of this operation. The NeoPixel ring can be attached to any of the pins, but since the potentiometer is an analog input, it needs to be attached to pin 2, which is Analog 1 on the Trinket.

To reduce wire bulk, 5V and ground will be supplied to the potentiometer from the NeoPixel ring since the ring has two 5V and ground pins for daisy chaining.

![](https://cdn-learn.adafruit.com/assets/assets/000/050/567/medium800/leds_goProLensLight_bb.jpg?1517352554)

# NeoPixel GoPro Lens Light

## Arduino IDE Code

The code is written in the Arduino IDE and uses the NeoPixel library. After the pins are defined, the analog values produced by the potentiometer are mapped to digital values. This is then plugged in as the value for the amount of white light being produced by the RGBW NeoPixel ring. The RGB values are left at zero to avoid any blue tinted light. This allows you to control the “brightness” of the NeoPixels without messing with the brightness parameter in the NeoPixel library which is not meant to be changed after the initial definition in the code setup.

Info: 

https://github.com/adafruit/Adafruit_Learning_System_Guides/blob/main/NeoPixel_GoPro_Lens_Light/NeoPixel_GoPro_Lens_Light.ino

# NeoPixel GoPro Lens Light

## CircuitPython Code

Since we're using a Trinket M0 board, we can also write the code with CircuitPython!&nbsp;

[For more information on CircuitPython, check out the Learn Guide!](https://learn.adafruit.com/welcome-to-circuitpython?view=all)
https://github.com/adafruit/Adafruit_Learning_System_Guides/blob/main/NeoPixel_GoPro_Lens_Light/code.py

As you can see, the code is very similar to the Arduino IDE code. We're still reading the analog value of **Pin 2** ( **A1** ), converting it to a value between 0 and 255 and then having that be the value of the white portion of the NeoPixel.

Since we're using an RGBW ring, we need to declare this in the NeoPixel object. This is done using `bpp` (bytes per pixel). RGBW NeoPixels have 4 BPP, where as RGB NeoPixels have 3 BPP.

The other important point is that analog values in CircuitPython range from 0 to 65535. If you divide 65535 by 257, then it converts the range to 0 to 255 so that it can be read as a digital value for the NeoPixels.

# NeoPixel GoPro Lens Light

## 3D Printing

The housing was designed in Fusion360. First, the parts for all the hardware were designed and printed individually to ensure a good fit. After that, it was back to Fusion360 to join the parts together with channels for the wiring, which is the .STL file that you have here for download.

Prototyping

![leds_IMG_4750.jpg](https://cdn-learn.adafruit.com/assets/assets/000/050/574/medium640/leds_IMG_4750.jpg?1517353898)

![leds_IMG_4753.jpg](https://cdn-learn.adafruit.com/assets/assets/000/050/575/medium640/leds_IMG_4753.jpg?1517353923)

 **Print Settings**

Be sure to print with the lens part on the print bed. Surface supports will be needed for the Trinket portion of the housing. Printing at .2 resolution and 15% infill should yield good results.

![](https://cdn-learn.adafruit.com/assets/assets/000/050/573/medium800/leds_IMG_4786.jpg?1517353855)

[Download the .STL File on Thingiverse](https://www.thingiverse.com/thing:2772508)
 **Color Change**

Clear PLA should be used for the lens portion of the housing for proper light diffusion. If you want the rest of the housing to print in a different color though, you can edit your gcode so that the print pauses at a specific layer height, which will then allow you to swap filaments. As long as your printer is running Marlin firmware (aka accepts gcode) then you can use the Prusa ColorPrint utility ([https://www.prusaprinters.org/color-print/](https://www.prusaprinters.org/color-print/)). To change colors at the Trinket portion, enter in a color change at layer height 7.80.

![](https://cdn-learn.adafruit.com/assets/assets/000/050/572/medium800/leds_IMG_4782.jpg?1517353830)

# NeoPixel GoPro Lens Light

## Assembly

Now it’s time to put everything together. First up is soldering the wires to the Trinket. It’s important to solder so that you’re soldering on the top of the board allowing for the wires to hang from the bottom. Solder wires to 5V, Pin 0, Pin 2 and Ground. Also be sure to use a thin gauge wire to keep everything neat.

![](https://cdn-learn.adafruit.com/assets/assets/000/050/577/medium800/leds_IMG_4788.jpg?1517354115)

Warning: 

Next you’re going to slide the Trinket into the housing, first by gently pulling the wires thru their channels. Ground is going to be led thru the back channel towards the pot section and the data and 5V wires are going to go thru the opening on the Trinket portion of the housing.

After the Trinket is snuggly in the housing with the wires pulled thru, you’ll solder the wire from the Trinket’s Pin 0 to Data In on the NeoPixel ring and 5V and Ground to the corresponding pads on the ring as well. Similar to the Trinket, be sure to solder the wires to the NeoPixel ring so that they hang down from the back. This eliminates any wire bulk on the sides.

Next up for wiring is the potentiometer. Be sure to use some small heat shrink for the potentiometer’s three leads to avoid any shorting. Solder wires to the NeoPixel ring’s secondary 5V and Ground pads to connect to the potentiometer. Solder the wire from the Trinket’s Pin 2 to the potentiometer’s middle pin. Try to gently pull the potentiometer’s data and 5V wires thru the cable channels for neat cable management.

![](https://cdn-learn.adafruit.com/assets/assets/000/050/576/medium800/leds_IMG_4789.jpg?1517354093)

Test the circuit by plugging in the Trinket. If all has gone well then you should have a nice bright adjustable light that sits snugly on your camera’s lens!

![](https://cdn-learn.adafruit.com/assets/assets/000/050/578/medium800/leds_P1060404.jpg?1517354150)

![](https://cdn-learn.adafruit.com/assets/assets/000/050/579/medium800/leds_IMG_4795.jpg?1517354175)


## Featured Products

### NeoPixel Ring - 16 x 5050 RGBW LEDs w/ Integrated Drivers

[NeoPixel Ring - 16 x 5050 RGBW LEDs w/ Integrated Drivers](https://www.adafruit.com/product/2855)
What is better than smart RGB LEDs? Smart RGB+White LEDs! These NeoPixel rings now have 4 LEDs in them (red, green, blue _and_ white) for excellent lighting effects. Round and round and round they go! &nbsp;

**This is the 16 LED RGBW NeoPixel Ring in Natural White**....

In Stock
[Buy Now](https://www.adafruit.com/product/2855)
[Related Guides to the Product](https://learn.adafruit.com/products/2855/guides)
### Adafruit Trinket M0 - for use with CircuitPython & Arduino IDE

[Adafruit Trinket M0 - for use with CircuitPython & Arduino IDE](https://www.adafruit.com/product/3500)
The&nbsp;Adafruit Trinket M0 may be small, but do not be fooled by its size! It's a tiny microcontroller board, built around the Atmel ATSAMD21, a little chip with _a lot_ of power. We wanted to design a microcontroller board that was small enough to fit into any project, and low...

In Stock
[Buy Now](https://www.adafruit.com/product/3500)
[Related Guides to the Product](https://learn.adafruit.com/products/3500/guides)
### Breadboard trim potentiometer

[Breadboard trim potentiometer](https://www.adafruit.com/product/356)
These are our favorite trim pots, perfect for breadboarding and prototyping. They have a long grippy adjustment knob and with 0.1" spacing, they plug into breadboards or perfboards with ease.

This is the same pot that comes with our character LCDs and tutorial...

In Stock
[Buy Now](https://www.adafruit.com/product/356)
[Related Guides to the Product](https://learn.adafruit.com/products/356/guides)
### PLA Filament for 3D Printers - 1.75mm Natural Translucent - 1KG

[PLA Filament for 3D Printers - 1.75mm Natural Translucent - 1KG](https://www.adafruit.com/product/2451)
Having a 3D printer without filament is sort of like having a regular printer without paper or ink. &nbsp;And while a lot of printers come with some filament there's a good chance you've been printing up a storm and need something new. &nbsp;That's why we've started carrying a...

No Longer Stocked
[Buy Now](https://www.adafruit.com/product/2451)
[Related Guides to the Product](https://learn.adafruit.com/products/2451/guides)
### Silicone Cover Stranded-Core Wire - 2m 30AWG Red

[Silicone Cover Stranded-Core Wire - 2m 30AWG Red](https://www.adafruit.com/product/2001)
Silicone-sheathing wire is super-flexible and soft, and its also strong! Able to handle up to 200°C and up to 600V, it will do when PVC covered wire wimps out. We like this wire for being extremely supple and flexible, so it is great for wearables or projects where the wire-harness has to...

In Stock
[Buy Now](https://www.adafruit.com/product/2001)
[Related Guides to the Product](https://learn.adafruit.com/products/2001/guides)
### Micro B USB 2-Way Y Splitter Cable

[Micro B USB 2-Way Y Splitter Cable](https://www.adafruit.com/product/3030)
Double up on your micro USB capabilities with the **Micro B USB 2-Way Splitter Cable**. This splitter is great for reducing cable clutter and freeing up port&nbsp;space. It takes a single Micro B connection (with data and power) and gives you two outputs. **The longer cable...**

In Stock
[Buy Now](https://www.adafruit.com/product/3030)
[Related Guides to the Product](https://learn.adafruit.com/products/3030/guides)

## Related Guides

- [Adafruit Trinket M0](https://learn.adafruit.com/adafruit-trinket-m0-circuitpython-arduino.md)
- [Using DS18B20 Temperature Sensor with CircuitPython](https://learn.adafruit.com/using-ds18b20-temperature-sensor-with-circuitpython.md)
- [CircuitPython Hardware: Charlieplex LED Matrix](https://learn.adafruit.com/micropython-hardware-charlieplex-led-matrix.md)
- [NeoPixel Cyber Falls Wig](https://learn.adafruit.com/neopixel-cyber-falls.md)
- [Clockwork Goggles](https://learn.adafruit.com/gemma-m0-clockwork-goggles.md)
- [Trinket (& Gemma) Servo Control](https://learn.adafruit.com/trinket-gemma-servo-control.md)
- [Glowy Message Crown](https://learn.adafruit.com/glowy-message-crown.md)
- [NeoPixel Manicure](https://learn.adafruit.com/neopixel-manicure.md)
- [Stand-alone programming AVRs using CircuitPython](https://learn.adafruit.com/stand-alone-programming-avrs-using-circuitpython.md)
- [Using Servos With CircuitPython and Arduino](https://learn.adafruit.com/using-servos-with-circuitpython.md)
- [Kaleidoscope Eyes (Trinket-Powered NeoPixel LED Ring Goggles)](https://learn.adafruit.com/kaleidoscope-eyes-neopixel-led-goggles-trinket-gemma.md)
- [CircuitPython Basics: Analog Inputs & Outputs](https://learn.adafruit.com/circuitpython-basics-analog-inputs-and-outputs.md)
- [CircuitPython with Jupyter Notebooks](https://learn.adafruit.com/circuitpython-with-jupyter-notebooks.md)
- [Larson Scanner Shades (Trinket-Powered NeoPixel LED Strip Glasses)](https://learn.adafruit.com/larson-scanner-shades.md)
- [3D Printed LED Fire Horns](https://learn.adafruit.com/3d-printed-led-fire-horns.md)
- [Trinket / Gemma Blinky Eyes](https://learn.adafruit.com/trinket-gemma-blinky-eyes.md)
