Project showcase
Wireless Charger with a Sound-Sensing Sparkle

Wireless Charger with a Sound-Sensing Sparkle © CC BY-NC

Wireless charger with interactive light effects that can change the lighting according to the music to make your desktop more interesting.

  • 5,977 views
  • 0 comments
  • 24 respects

Components and supplies

Necessary tools and machines

3drag
3D Printer (generic)
09507 01
Soldering iron (generic)

About this project

This is a DIY Christmas gift idea, a wireless charger with interactive lighting effects that can change the lighting according to the music to make your desktop more interesting. You can also add an acrylic shell to have more dazzling and colorful effects.

Code

Sensing the sound and changing the lightArduino
#include <Adafruit_NeoPixel.h>
#ifdef __AVR__
#include <avr/power.h>
#endif

#define PIN            10

#define NUMPIXELS      16


Adafruit_NeoPixel strip = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);
int ledlighton = 7;
int colorramdom = 1;
int loopledtop = 0;
int colorR = 0;
int colorG = 0;
int colorB = 0;
int colorchange = 10;
int mic = 0;
float mictop = 10;
int mic_basic = 0;

void setup() {
  // put your setup code here, to run once:
#if defined (__AVR_ATtiny85__)
  if (F_CPU == 16000000) clock_prescale_set(clock_div_1);
#endif

  strip.begin(); // This initializes the NeoPixel library.
  Serial.begin(9600);
 micbasic();
}




void loop() {

musicin2();


}
void musicin2()
{
    mic = analogRead(A3);

 mic = mic-mic_basic;//335
 
//  if (mic < 10)
//  {
//    mic = 0;
//  }


  if (mic < 0)
  {
    mic = ~mic + 1;
  }

    if (mic < 4)
  {
    mic = 0;
  }
  else
  {
    mic = mic-3;
    }
      mic = mic * 2;

    /////////////
  //mic = mic / 10;

  
  if (mic > 0)
  {
    Serial.print(mic);
    Serial.print("|");
    if (mic > 10)
    {
      mic = 8;
    }

    Serial.print(mic);
    Serial.println("");
    /*
    */
    ledlighton = random (0, 16);
    colorramdom =  random (1, 3);
    if (colorramdom == 1)
    {
      colorR = random (101, 255);
      colorG = random (101, 255);
      colorB = 0;
    }
    else if (colorramdom == 2)
    { colorR = random (101, 255);
      colorG = 0;
      colorB = random (101, 255);
    }
    else if (colorramdom == 3)
    { colorR = 0;
      colorG = random (101, 255);
      colorB = random (101, 255);
    }





    // strip.setPixelColor(ledlighton, strip.Color(colorR, colorG, colorB));
    strip.setPixelColor(ledlighton, strip.Color(255, 255, 255));
    // strip.setPixelColor(ledlighton, strip.Color(colorR, colorG, colorB));
    strip.show();
    delay(50);
    if (mic > 2)
    {
      for (int i = 1; i < mic; i++)
      {
        if (colorR - i * colorchange > 0)
        {
          colorR = colorR - i * colorchange ;
        }
        else
        {
          // colorR = colorR + i * colorchange ;
        }
        if (colorG - i * colorchange > 0)
        {
          colorG = colorG - i * colorchange ;
        }
        else
        {

          // colorG = colorG + i * colorchange ;
        }
        if (colorB - i * colorchange > 0)
        {
          colorB = colorB - i * colorchange ;
        }
        else
        {

          //  colorG = colorG + i * colorchange ;
        }
        strip.setPixelColor(ledlighton + i, strip.Color(colorR, colorG, colorB));
        strip.setPixelColor(ledlighton - i, strip.Color(colorR, colorG, colorB));
        strip.show();
        delay(20);
      }


      for (int i = 0; i < mic; i++)
      {
        strip.setPixelColor(ledlighton + i, strip.Color(0, 0, 0));
        strip.setPixelColor(ledlighton - i, strip.Color(0, 0, 0));
        strip.show();

        delay(30);
      }
    }
    strip.setPixelColor(ledlighton, strip.Color(0, 0, 0));
    strip.show();


  }

  }

  
void micbasic()
{

for (int mb = 0; mb <20; mb++)
{
mic_basic = mic_basic+analogRead(A3);
}
mic_basic = mic_basic/20;
}

Custom parts and enclosures

3d print shell -- slt

Schematics

wrielesschanger_led_bb_XO10BvOaUC.jpg
Wrielesschanger led bb xo10bvoauc

Comments

Similar projects you might like

Arduino - PV MPPT Solar Charger

Project tutorial by Abhi Verma

  • 25,729 views
  • 12 comments
  • 38 respects

Minimal MIDI Drum Kit with 3D Printer

Project tutorial by ryokosaka

  • 16,207 views
  • 3 comments
  • 41 respects

Scent-terrific Smart Candle

Project tutorial by Darian Johnson

  • 4,352 views
  • 0 comments
  • 34 respects

Smart Soft Switch

Project tutorial by Vishwas Navada

  • 1,145 views
  • 0 comments
  • 3 respects

Fairytale

Project in progress by siliconchris

  • 1,141 views
  • 3 comments
  • 3 respects

Head Tracking for Wireless 3D First Person Vision

Project showcase by twhi2525

  • 10,207 views
  • 7 comments
  • 58 respects
Add projectSign up / Login