Introduction: Soda Bottle Arduino Lamp - Sound Sensitive
I had some individually addressable LEDs left over from another project and wanted to create another fairly easy but fun challenge for my Year 10 (age 13-15) level Product Design classes. This project uses an empty soda bottle (or fizzy drink if you are from NZ!), an Arduino Nano, KY-037 sound level sensor, a strip of 10 LEDs, photocopier paper, cardboard, hot glue, mobile phone charger, switch plus the usual joining hardware.
You can also make it without the KY-037 sensor and just have an interesting light sequence playing by altering the Arduino code.
KY-037 Arduino compatible sound sensor https://www.aliexpress.com/item/32820988119.html?s...
RGB LED strip (individually addressable LEDs), 5V, WS2812 https://www.aliexpress.com/item/32682015405.html?s...
Soda bottle (drinking contents optional!)
Hot glue gun & glue sticks
Soldering iron & electrical solder
Slider or rocker switch https://www.aliexpress.com/item/32707748423.html?s...
Mobile phone charger & USB cable - any
Male headers - possibly use spares from the Arduino Nano
Paint to decorate
Step 1: Get Your LEDs Working
The following is copied from my other Instructable "Unsafe noise level meter" as it is the same procedure. Skip the KY-037 sensor bit if you are not adding this:
It's useful to practise lighting up your RGB strip. I used 10 LEDs for the meter so this is what I practised with. You cut your strip at the copper join - it's obvious where. I soldered a small 3 pin header which I had from an Arduino starter kit onto the end. Soldering onto the RGB strip copper contacts is quite fiddly so good luck! Notice the arrows on the RGB strip - you must connect so that your power & data signal follow the arrows. You will see the letters DO & Din meaning Data Out and Data In.
This allowed me to plug the strip into a breadboard along with jumpers to the Arduino. The picture shows the larger Arduino Uno board, but the pins on the Nano are the same. In the code you will see that the data pin of the strip is connected to the number 6 digital pin of the Arduino. I set the number of LEDs to 10. The void loop cycles the LEDs on/off up and down the strip, one colour after the other. Note that i goes from 0 to 9, i.e. a total of 10 lEDs. I omitted the sensor at this stage (unlike the pic) to keep it simple - give yourself some success! Once you have done this, next challenge is to calibrate and incorporate the KY-037 sensor. There's a great tutorial done by ElectroPeak on the Arduino website that gives you some simple code that outputs numbers to the serial monitor of the Arduino, allowing you to calibrate with the potentiometer screw on the sensor. Here's the link: https://create.arduino.cc/projecthub/electropeak/h... . I've added this code file to this tutorial as you'll see. Next, connect the RGB LED strip into the circuit as per the circuit diagram you'll see in the accompanying PDF doc (partial thanks to Tinkercad Circuits for this). After this you can upload the code (KY_037_sound_sensor_LEDS_v2) to your Arduino Uno or other board you may be using (a Nano would work too). Bear in mind that you will need the FastLED folder & files added to your Arduino Library folder that will have installed itself when you installed Arduino onto your computer. The library could be in a filepath such as: C:\Program Files (x86)\Arduino\libraries. Download it from the likes of Github: https://github.com/FastLED/FastLED . Other things to watch out for are to remember to choose the correct board in the Arduino software under Tools...board and make sure the board is talking to your PC's port by clicking Tools...port. Other than this, you will need to make adjustments to your potentiometer pot on the KY-037 sensor depending on the mobile phone power supply output you have - the amps output will vary across different chargers thereby changing the response of the RGB strip. Calibrate it to your situation or use a separate decibel meter as I do to guesstimate the colour change threshold. I've simplified the code so it no longer incorporates conversions from voltage output from the sensor into absolute decibel level as in the Rice University project.
Step 2: Start Making the Lamp Body
This part is fun. First cut the soda bottle around its circumference a bit down from the cap to allow you to insert a rolled up piece of photocopy paper. It will unfold against the sides of the bottle after you drop it in. Cut it a bit to fit your bottle. This acts as a shade so that the LEDs aren't too bright to look at.
I used a cling film cardboard roll (Glad Wrap if you are from NZ) to go down the centre of the bottle (you could also just use a rolled up copier paper sheet). On this I wrapped the 10 LED strip in a spiral, held in place with hot glue. Make sure the soldered pin end of the LED strip is uppermost and accessible. Glue this paper or cardboard tube to the bottom of the bottle. Next make a cardboard circle to go over the top of the bottle & paper/cardboard tube, with a notch to allow the LED wires through. Then you can connect this to the Nano and glue the Nano in place (see pics).
You'll have to look at the wiring diagram I have posted & do some of your own figuring out. Basically you want the + pin from the KY-037 sound sensor and the +5V terminal from the LED strip to connect to the 5V pin on the Nano. The GND pins from these both go to the GND on the Nano. This is where I used some spare headers soldered together. From these pins you join two wires going down through the centre of the cardboard tube and out to the USB cable which connects to the mobile phone charger. Make sure to match +ve and -ve.
Before going further I once again tested the LED strip to make sure it still lights up (no broken connections), powered both from the USB to a computer as well as from the 5V and GND.
The power supply wires I routed down through the centre of the cardboard tube and out via the bottom of the bottle. The switch goes down here - to be hot glued to the cone shaped base - so allow enough wire for this operation. I then cut my spare USB Arduino/printer cable in half, connected one end to the Nano power supply wires. The other end goes into the mobile charger. The cable has a black and a red wire, plus other data wires. Use the black (negative/GND) and red (+5V).
Step 3: FInishing Things
You'll see from the pics that I used cardboard to shape a cylindrical top for my lamp - this helps conceal the Nano board and wires. Note that I've left the USB socket accessible so that I can further program the Nano to utilise the sound sensor. I'll do this as time allows.
The base of my lamp is a cone. This is trickier to achieve. However, there is a very useful website that allows you to create a cone, PDF it and print a cone template that can be translated onto cardboard. Just measure the diameters and height you want. Here's the link: https://www.blocklayer.com/cone-patterns.aspx Mine was 167mm x 93mm x 40mm high.
I'll leave it here for now. My lamp still needs some trim and painting, plus the addition of more sophisticated code so that it responds to the sound sensor - but that can be added in the near future.
I hope you enjoy this project as much as I did. I look forward to trialing it in the classroom.
Participated in the
Arduino Contest 2020