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.

  • 8,550 views
  • 1 comment
  • 28 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

  • 46,032 views
  • 18 comments
  • 54 respects

Minimal MIDI Drum Kit with 3D Printer

Project tutorial by ryokosaka

  • 26,908 views
  • 5 comments
  • 49 respects

Scent-terrific Smart Candle

Project tutorial by Darian Johnson

  • 6,855 views
  • 0 comments
  • 37 respects

Smart Soft Switch

Project tutorial by Vishwas Navada

  • 2,830 views
  • 0 comments
  • 6 respects

Fairytale

Project in progress by siliconchris

  • 2,259 views
  • 3 comments
  • 4 respects

Stereo NeoPixel Ring VU Meter

Project showcase by ericBcreator

  • 115,926 views
  • 373 comments
  • 206 respects
Add projectSign up / Login