Enter Your Electronics & Design Project for a chance to win a $200 shopping cart! Back to homepage | Project14 Home | |
Monthly Themes | ||
Monthly Theme Poll |
Holiday season is almost here, which means it time to make something that lights up. As part of this project, we are making a Light up Coaster using an Arduino Nano, LED strip and a grove sound sensor. The coaster changes colour as soon as it hears some sound/music playing.
Here are the steps to follow, to make the coaster
Download and 3D print the STL files attached
There are 2 STL files attached in the zip file below, You can print this coasterBottom.stl file using a coloured filament and the coasterTop.stl using a transparent filament to help with the diffusion of the APA102 LED strip.
Soldering the circuit together
Now for the circuit we will need an Arduino Nano, LED strip APA102 and a Grove sound sensor. Here are the connections to the Arduino Nano
- apa102 led strip Data connected to Arduino pin# 11
- apa102 clock connected to Arduino pin# 12
- Sound sensor connected to A0
Once done hotglue the Arduino, Sound sensor and LED strip to the 3D printed parts.
Upload the Arduino code
Now download latest Arduino IDE, and upload the sketch below to the Arduino IDE. Before uploading the sketch you will also need the APA102 Arduino library from https://github.com/pololu/apa102-arduino
//Created for Project14 Coaster using APA102 and Grove sound sensor //Download the APA102 libary from - https://github.com/pololu/apa102-arduino #include <APA102.h> // Define which pins to use. const int pinAdc = A0; const uint8_t dataPin = 11; const uint8_t clockPin = 12; APA102<dataPin, clockPin> ledStrip; // Set the number of LEDs to control, till will depend on how many you want to add to the coaster const uint16_t ledCount = 10; //Create a buffer for holding the colors (3 bytes per color). rgb_color colors[ledCount]; // Set the brightness to use (the maximum is 31). const uint8_t brightness = 20; const uint8_t delayTimes = 100; uint8_t ared =255, bgreen =255, cblue=255; void setup() { Serial.begin(115200); } void loop() { long vol = 0; vol = analogRead(pinAdc); Serial.println(vol); // change the condition values of the vol based on the output of the serial monitor. if(vol<100) ared =0, bgreen =0, cblue=255; else if(vol>=100 && vol<150) ared =0, bgreen =255, cblue=0; else if(vol>=150) ared =255, bgreen =0, cblue=0; else ared =255, bgreen =255, cblue=255; for(uint16_t i = 0; i < ledCount; i++) { colors[i] = rgb_color(ared, bgreen, cblue); ledStrip.write(colors, ledCount, brightness); } delay(delayTimes); }
Here is a quick test of the circuit, and once done the top should snap fit to the bottom 3D printed part...
Here is a quick video demo.
Top Comments