Filed Under #hardware

Midterm: Neopixel Earring

alt text I made a battery powered earing with neopixels. My goal for this assignment was to learn how to use surface mount components so I kept the design and functionality simple.

Schematic and Board Design

alt text alt text

Parts List

Code

I used Adafruit’s example code for neopixels and adapted it for my needs. I turned the brightness down since I’m only powering it with a 3V coin cell battery.

#include <Adafruit_NeoPixel.h>

int pin = 3;
int len = 7;

Adafruit_NeoPixel strip = Adafruit_NeoPixel(len, pin, NEO_GRB+ NEO_KHZ800);

void setup() {
  strip.begin();
  strip.show();
  strip.setBrightness(20);
}

void loop() {
  rainbowCycle(20);
}

/*
  from adafruit's strandtest example
*/

// Slightly different, this makes the rainbow equally distributed throughout
void rainbowCycle(uint8_t wait) {
  uint16_t i, j;

  for(j=0; j<256*5; j++) { // 5 cycles of all colors on wheel
    for(i=0; i< strip.numPixels(); i++) {
      strip.setPixelColor(i, Wheel(((i * 256 / strip.numPixels()) + j) & 255));
    }
    strip.show();
    delay(wait);
  }
}


// Input a value 0 to 255 to get a color value.
// The colours are a transition r - g - b - back to r.
uint32_t Wheel(byte WheelPos) {
  WheelPos = 255 - WheelPos;
  if(WheelPos < 85) {
    return strip.Color(255 - WheelPos * 3, 0, WheelPos * 3);
  }
  if(WheelPos < 170) {
    WheelPos -= 85;
    return strip.Color(0, WheelPos * 3, 255 - WheelPos * 3);
  }
  WheelPos -= 170;
  return strip.Color(WheelPos * 3, 255 - WheelPos * 3, 0);
}

Process

I had to remill the board several times while making the dimensions larger so that the ground plane would not get disconnected. alt text

After placing surface mount components and reflow: alt text

I left pads to solder wires to that connect to my Arduino Uno to program the ATTiny85. While programming, something went wrong and I could no longer get a device signature from my ATtiny85. I ended up replacing it with another one which worked. alt text

Mistakes in Board Design

After receiving the battery holders, I found out that they are different from the part I used in the board design. The ground pin is on the side and not in the center (as it is in the board design file). I soldered a wire to connect the ground plane in the center to the side plane which was not connected to anything. I then soldered the battery holder on top of that. While programming, I realized I also made a mistake in the board design and forgot to add an external pull-up resistor to VCC on the reset pin of the ATTiny85. I also did not add a resistor before my first neopixel which is recommended by Adafruit.

Documentation Images

Written on March 21, 2018

Marquee PCBs

alt text For the marquee, I was assigned the letter ‘i’. I designed the letter board and changed the sensor board since my last post. The new sensor board is based on Andy’s; I only changed the sensor headers from 2 pins to 3 to fit a potentiometer.

Boards after milling alt text

After soldering on components alt text

Schematics and Board Designs

ATtiny85 and sensor board alt text alt text

‘i’ board alt text alt text

Code

I programmed the ATtiny85 to make the leds pulse. I changed the interaction so that the potentiometer adjusts the pulse rate of the leds.

/*
  Changes speed of fading led based on potentiometer reading
*/

int led = 0;           // the PWM pin the LED is attached to
int brightness = 0;    // how bright the LED is
int potValue = 0; // value from potentiometer
int fadeAmount = 1;    // how many points to fade the LED by
int delayTime;

void setup() {
  pinMode(A1, INPUT);
  pinMode(led, OUTPUT);
}

void loop() {

  // set the brightness of pin 9:
  analogWrite(led, brightness);

  // change the brightness for next time through the loop:
  potValue = analogRead(A1);
  delayTime = map(potValue, 0, 1023, 30, 0);       //map pot value to a fade delay 
  brightness = brightness + fadeAmount;

  // reverse the direction of the fading at the ends of the fade:
  if (brightness <= 0 || brightness >= 255) {
    fadeAmount = -fadeAmount;
  }
  // wait to see the dimming effect
  delay(delayTime);
}

Video Documentation of Interaction

It works!!

Written on February 17, 2018

Marquee Schematic and Board Layout

alt text

alt text

Written on February 8, 2018

Breadboard ATtiny85 Sensor

alt text Made a simple sensor that dims the led through potentiometer value.

Schematic

alt text

Video Documentation

Written on February 1, 2018