Category Archives: Arduino

Neopixel VU Meter

Adafruit Neopixels

And so it begins, this is part of a project that I am starting that is a embedded 1176 like compressor. I wanted to start off with the easy part and play around with this neopixles from Adafruit they can be found here Adafruit Neopixels. Heres what I came up with so far.

 

Code:

#include <Adafruit_NeoPixel.h>
#ifdef __AVR__
#include <avr/power.h>
#endif
#define PIN 6
Adafruit_NeoPixel strip = Adafruit_NeoPixel(8, PIN, NEO_GRB + NEO_KHZ800);
int ammount=0;

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

void loop() {

//int brightness=analogRead(A0); //Variable Brightness
//brightness = map(brightness, 0, 1023, 0, 50);

ammount = analogRead(A0);
ammount =map(ammount,0,1023,0,8);

if (ammount <4){
colorWipe(strip.Color(0, 150, 0), 1); // Red
colorWipe(strip.Color(0, 0, 0, 255), 1); // White RGBW

}
if (ammount <6){
colorWipe(strip.Color(75, 75, 0), 1); // Red
colorWipe(strip.Color(0, 0, 0, 255), 1); // White RGBW

}
if (ammount >=6){
colorWipe(strip.Color(75, 0, 0), 1); // Red
colorWipe(strip.Color(0, 0, 0, 255), 1); // White RGBW
}
}

void colorWipe(uint32_t c, uint8_t wait) {
for(uint16_t i=0; i<ammount; i++) {
strip.setPixelColor(i, c);
strip.show();
delay(wait);
}
}

More to come!

Arduino DC Load

This is a project that I am working on for class a Pasadena City College as well as for AEA Ribbon Mics. The class is an introduction to micro-controllers and is based around the Arduino. For this midterm project I wanted to build a DC load that would ramp up the current draw on the positive and negative voltage rail and be able to read the current draw and read the voltage. For the most part this project is working.

 

Here is a few slides describing more of the scope of the project:

PWM Presentation

 

Here it is in action on the positive voltage rail.

 

Here is the code if you want to check it out:

Arduino_DC_Load_PWM

 

More to come later on this project!

Arduino Voltage Average With Arrays

So I needed to make a program that would average four values that are present at the analog input.

This is what I came up with

Screenshot 2016-03-09 21.29.28

I wanted something that could easily scale if I wanted to sample more then twice and average the value, so that is why I did this with an array. When the code runs it samples the value at A0 four times and sticks that into the array, then it prints the values in the serial monitor. This is followed by the averageValue function that reads the values in the array adds them together and then divides the total.

Below is the file that has this Arduino code snippet, I hope to continue to develop more of these code snippets and upload them.

Average_With_Array