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
- Acrylic lasercut Waag logo (logo can be found here)
- 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.
- 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.
- 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.
Step 2: 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
- Connect capacitor for the NeoPixel with through holes
- 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).
- capacitor across power supply (to protect the chip against the initial onflow of electricity): 1uF
- capacitor neopixel: 1000uF
330 Ohm resistor for neopixel
- 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
- Not adding a capacitor is the cause of NeoPixel flickering