It Seems that Every Time I Fix Something, Something Else is Still Broken

It’s been an interesting lab today. I got a working microphone from a classmate, and hooked that up with one of the led strips that my professor told me was fixed, only to have a lot of trouble getting the led strip to work. It turns out the jumper cables I was using to connect the led strip to the Arduino were pretty unreliable, so I soldered wires onto the strip that would more easily plug into the Arduino, and tried to move forward from there. When I plugged everything into the board to do a finall test before building the suspenders I had intended to build last week, neither my laptop nor the mac I’d been using in the lab would upload the code. They both even rejected the simplest Blink sample code for a few minutes, but after waiting a bit, I was able to upload code eventually, though both computers will just spontaneously quit. I sat working with one of my TAs, Nikki, trying to figure this out, but we got nowhere. I’m still not able to get the leds to light up from my sample code. I think I will begin building the suspenders themselves and schedule a meeting with my professor to sort out the code. 

Advertisements

Code is All About the Details

Went to TA hours with Nikki and we discovered that the reason the Serial monitor on Arduino wasn’t working was that we forgot to write Serial.begin(); into the setup. This means we never launched the serial monitor. I then went through the serial monitor, and printed out the sound sensed. Initially, the amount of sound sensed from the microphone varied slightly, and now it is constant, and doesn’t change no matter how loudly I scream at the microphone. I fear my microphone may have died. I’ve put in another hour and half, with little tangible progress…

Frustrations

I spent at least 2 hours today working with my code when I finally got my hands on a led strip I borrowed from a friend. Initially, I thought my code worked, but it doesn’t seem to have much response to any input from the microphone. When I tried to switch my code and microphone over to the Arduino Uno so I could run the serial monitor, I ran into serious problems. I wanted to use the serial monitor to analyze the input received from the microphone, but whenever I try to run it, nothing happens. I’m not sure if this is a problem with my code or my computer settings. My professor and I suspect it has do do with my computer settings, but I don’t know, and there’s not much I can do to progress from here until I figure it out, especially since I still don’t have a working led strip. I may have to use the small individual flora neopixels that I bought for my second project, and order more later. I think if I can’t make much progress with the code, I will at least move forward with building, since I finally got my hands on a pair of suspenders.

Coding Success

I’m going to relish my small coding victory from tonight. After a total of three hours spent in the lab tonight, I have a code that should work with both the led strip and a microphone to make the colors cycle faster when more sound is sensed. Unfortunately, I cannot test this code because I do not have a working rgb strip. I will post more about the code tomorrow, and hopefully put it up once I get some sleep and clean up the code a bit.

Dead Parts

I’ve been working in the lab for at least an hour tonight, and the led strip I was using to test code just died. I guess maybe I should have considered that these strips may have a lifespan, but I was using a strip of 60 leds, and it now won’t respond to any code at all. The reason I hadn’t cut this strip smaller for tests was because I didn’t want to cut the weatherproofing, in case someone else in my iDesign class eventually decided they wanted a weatherproofed strip for their project. But now it’s dead. I was running test code on the strip when the blue bulbs went out, then the green, and the red was blinking manically for a few moments before it went out too. Now the strip does not respond at all. 

A small happy moment: I figured out which part of the sample code cycles the colors the way I want, and I’ve combined it with the code I had for the microphone. Problem is, I don’t know if it actually works and I have no way to test it.

rainbow leds


took another hour, but I finally got the rainbow led sample code sent from Ray to work for the strip! I’m really excited, and these leds look really pretty.

the sample code on the strip right now is this:

// This is the demo provided in
// Adafruit’s neopixel library
// Changed to use pin D1 as
// data pin
#include <Adafruit_NeoPixel.h>

#define PIN 1

// Parameter 1 = number of pixels in strip
// Parameter 2 = pin number (most are valid)
// Parameter 3 = pixel type flags, add together as needed:
// NEO_KHZ800 800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)
// NEO_KHZ400 400 KHz (classic ‘v1’ (not v2) FLORA pixels, WS2811 drivers)
// NEO_GRB Pixels are wired for GRB bitstream (most NeoPixel products)
// NEO_RGB Pixels are wired for RGB bitstream (v1 FLORA pixels, not v2)
Adafruit_NeoPixel strip = Adafruit_NeoPixel(35, PIN, NEO_GRB + NEO_KHZ800);

double brightness = .25;

void setup() {
strip.begin();
strip.show(); // Initialize all pixels to ‘off’
}

void loop() {
// Some example procedures showing how to display to the pixels:
colorWipe(strip.Color(brightness * 255, 0, 0), 10); // Red
colorWipe(strip.Color(0, brightness * 255, 0), 10); // Green
colorWipe(strip.Color(0, 0, brightness * 255), 10); // Blue
rainbow(20);
rainbowCycle(15);
}

// Fill the dots one after the other with a color
void colorWipe(uint32_t c, uint8_t wait) {
for(uint16_t i=0; i<strip.numPixels(); i++) {
strip.setPixelColor(i, c);
strip.show();
delay(wait);
}
}

void rainbow(uint8_t wait) {
uint16_t i, j;

for(j=0; j<256; j++) {
for(i=0; i<strip.numPixels(); i++) {
strip.setPixelColor(i,Wheel((i+j) & 255));
}
strip.show();
delay(wait);
}
}

// 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) {
if(WheelPos < 85) {
return strip.Color(brightness * WheelPos * 3, brightness * (255 – WheelPos * 3), 0);
} else if(WheelPos < 170) {
WheelPos -= 85;
return strip.Color(brightness * (255 – WheelPos * 3), 0, brightness * WheelPos * 3);
} else {
WheelPos -= 170;
return strip.Color(0, brightness * WheelPos * 3, brightness * (255 – WheelPos * 3));
}
}

My next project is to figure out what all this code means so I can alter it to work with the microphone.

Progress so far

After coming up with the design plan and ordering supplies, I spent half an hour searching for sample code for rgb leds, and writing out possible ideas for the code for the strand of leds on each suspender strap for my led suspenders. Then, this monday november 11th, I spent and hour and a half trying to open the NeoPixel strip sample code and failing miserably. I have a lot of work to do, though I can’t start actually building the suspenders until they’re delivered -_-