Corey Childress
Published © MIT

Guitar LEDs

Neopixel LEDs are fitted behind the guitar pickups and illuminate with the rhythm of your strumming allowing for a custom and unique design.

IntermediateWork in progress6 hours2,894
Guitar LEDs

Things used in this project

Hardware components

Photon
Particle Photon
×1
LM386N-1 OpAmp
×1
Capacitor 10 µF
Capacitor 10 µF
×1
Breadboard (generic)
Breadboard (generic)
×1
Adafruit NeoPixel Digital RGB LED Strip
×1
Jumper wires (generic)
Jumper wires (generic)
×1
USB Battery Pack - 2200 mAh Capacity - 5V 1A Output
×1

Software apps and online services

Blynk
Blynk

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)
Phillips Head Screwdriver (Generic)
Wire Strippers (Generic)

Story

Read more

Schematics

Circuit Schematic

Circuit

Code

Guitar LEDs

C/C++
#define BLYNK_PRINT Serial
#include "blynk/blynk.h"
#include "application.h"
#include "neopixel/neopixel.h"

SYSTEM_MODE(AUTOMATIC);

#define PIXEL_COUNT 4
#define PIXEL_PIN D0
#define PIXEL_TYPE WS2812B

char auth[] = "0c3266c1e6804327975901f9d36be444";

void colorAll(uint32_t c, uint8_t wait);
void colorWipe(uint32_t c, uint8_t wait);
void rainbow(uint8_t wait);
void rainbowCycle(uint8_t wait);
uint32_t Wheel(byte WheelPos);

Adafruit_NeoPixel strip = Adafruit_NeoPixel(PIXEL_COUNT, PIXEL_PIN, PIXEL_TYPE);

int led = D0;
int boardLED = D7;
int pickupVoltage = A0;


//DEFINE A THRESHOLD VOLTAGE, IF THE ANALOG PIN READS OVER THIS VOLTAGE THEN TURN ON THE LIGHTS
// I PICKED 2200 BECAUSE OBSERVING THE GRAPH IN THE BLYNK APP, THE RESTING VOLTAGE IS APPROXIMATELY 2100
int strumThresholdVoltage = 2000;

void setup() {
Serial.begin(9600);
delay(5000); 
Blynk.begin(auth);
pinMode(led,OUTPUT);
digitalWrite(led,LOW);
pinMode(boardLED,OUTPUT);
digitalWrite(boardLED,LOW); 
pinMode(pickupVoltage,INPUT);
}

void loop() {
Blynk.run();

strip.setPixelColor(0, 0, 0, 0);//TURN ALL THE PIXELS OFF
strip.setBrightness(0);
if (maxReading(pickupVoltage,100,1)>strumThresholdVoltage){// IF THE MAX VOLTAGE ON YOUR PIN IS ABOVE THE SPECIFIED THRESHOLD THEN
    strip.setPixelColor(0, 0, 0, 255);//SET THE FIRST PIXEL/LED TO BLUE
    strip.setPixelColor(1, 0, 0, 255);
    strip.setPixelColor(2, 0, 0, 255);
    strip.setPixelColor(3, 0, 0, 255);
    strip.setBrightness(255);
    strip.show();

}
strip.show();

}
// THIS IS THE FUNCTION THAT DETERMINES THE MAXIMUM VOLTAGE ON THE PIN
// IT READS FROM THE PINS MULTIPLE TIMES AND THEN KEEPS THE HIGHEST VOLTAGE
// THE IDEA HERE IS THAT IF YOU POLL THE PIN MULTIPLE TIMES IN RAPID SUCCESSION THEN
// ONE OF THOSE READINGS SHOULD BE THE PEAK VOLTAGE, IF YOU'RE STRUMMING THEN THE
// PEAK VOLTAGE WILL BE HIGHER (HOPEFULL OVER YOUR THRESHOLD DEFINED ABOVE)
int maxReading(int pinNumber,int numberOfMeasurements,int measurementInterval){
    int maxReading = 0;
    int currentReading = 0;
    for (int i=0;i<=numberOfMeasurements;i++){
        currentReading = analogRead(pinNumber);
        if(currentReading>maxReading){
            maxReading= currentReading;
        }
        delay(measurementInterval);
    }
    
    return maxReading;
}

Credits

Corey Childress

Corey Childress

1 project • 3 followers
Mechanical Engineering Student UNCC

Comments