NeoPixel Waag logo
I’m gonna make the Waag logo emit light with NeoPixels, with 3 modes that you can switch between: white light that can be dimmed with a pot meter, color that can be changed with the same pot meter, and rainbow mode (a standard NeoPixel option).
Neopixels and Arduino Mini
What I’m using:
- Arduino Pro Mini (for prototyping)
- NeoPixel 1/4 Ring (SK6812) Datasheet
- Rotary switch This one
- Button switch
- Jumper wires
- Resistors
- Breadboard
- Acrylic lasercut Waag logo (logo can be found here)
Neopixel specifications:
Chaotic breadboard wiring:
First I soldered the NeoPixel quarter rings into a circle. I used wires of about 10cm long so I could make a wider circle; since we want to mount the NeoPixels to the Waag logo it won’t be (too) noticable that the circle is interrupted. Below you can see the soldered neopixels and a sneak preview of the milled PCB.
- I first tried a 500 Ohm resistor between the DATA-IN and the Arduino, but that was too much resistance; 330 Ohm worked perfectly.
- I used a pulldown resistor for the switch (pulldown is between ground and the button); this is to prevent shorting the circuit. The resistor is there to prevent the short by limiting the current flowing; typically 1k to 10k in value..
- I used the strandtest.ino file in the NeoPixel library in the Arduino IDE to test whether it worked. First it wouldn’t upload, but that was because I specified the wrong board (Arduino Mini instead of Arduino Pro Mini). Then the ring wouldn’t turn on, first because some connections weren’t properly soldered and then because I connected to A6 instead of D6.
Arduino code
Notes on the code:
- Analog values between 0 and 1023 for the potentiometer; 65536 values in the color range so 65536 / 1023 so multiply value by about 64 to use the potentiometer to scroll through the colors.
- For the dimming of the white light: 0-1023 values divided by 4 is about 0-255.
Code used:
Replacing Arduino Pro Mini with Attiny
- Following these steps to program ATTiny with Arduino IDE:
“On the preferences window, locate the “Additional Board Manager URLs” text box and enter http://drazzy.com/package_drazzy.com_index.json into the field as shown below and click the OK button”.
- Then you can download the megaTinyCore library from the board manager.
- While trying to compile I encountered this error: I googled CPU speed not supported, and found an easy fix here. Just change one line in the Adafruit_NeoPixel.cpp file (increasing the speed limit on the 16MHz code to 21MHz, because the clock speed of the ATTiny’s used is 20MHz) and then the code succesfully compiles for both the ATTiny 3216 & ATTiny 1614.
- When in doubt, look at Nadieh’s documentation
- Power via pin for the switch, and use the internal pullup resistor instead of a pulldown resistor. This flipped the state of the button from high to low and low to high, so I had to change some values for the code to work again (HIGH to LOW and 0 to 1 as base states).
KiCad
Project schematic (including the capacitor mistake for the neopixel ring).
This is where I assigned all components that I was going to add with wires to through-hole solder pads.
The rat’s nest:
Final design with the rat’s nest all sorted out:
3d preview of the board:
Milling the board
Below collage summary of milling the board. It wasn’t too eventful except that the through holes didn’t properly cut all the way through, so I used the milling bit afterwards to push through the holes.
Soldering the board
Notes
- Capacitor across power supply (to protect the chip against the initial onflow of electricity): 1uF
- 330 Ohm resistor for neopixel
- Capacitor neopixel: 1000uF. Not adding a capacitor is the cause of NeoPixel flickering; I’ve added the capacitor to the board with through holes, not to the board as SMD since we didn’t have an SMD polarized capacitor of 1000uF.
I accidentally connected the 330 Ohm resistor to the power instead of the data pin in KiCad and only found out that that happened when I was already done milling, so I added a 0 ohm resistor in place of the 330 one, removed a bit of the trace between the data pin and the ATTiny and added it there.
Programming the ATTiny
I used these specific hooks/claws (I forgot the name) to attach to the individual legs of the chip to program them. You can use these if you haven’t added a connector for a programmer.
First prototype of the box:
Assembly process:
Final result: