SuperKitz.com Project Manual
Arduino Sound Activated Christmas Hat DIY Kit
Using Arduino Nano , Sound Sensor and LED
This project we are going to make DIY Sound Activated Christmas LED Light Hat. We are using voice unit (VU) meter concept, which is a device that displays a representation of the signal level in audio equipment. It is used in some consumer audio equipment for utilitarian purposes such as in recording devices or for aesthetics like playback devices.
In this version of the meter, the signals will be collected via a microphone, and the LEDs row is replaced with a LED logo to visualize the VU meter output.
Requirements :
● Computer with an internet connection
● Download and install Arduino IDE
Components
Arduino Nano
USB 2.0 Male to Mini USB Cable
Sound Senor
Jumper wires
Set of assorted LEDs
Breadboard
Hardware
ARDUINO NANO
The Arduino Nano is basically a mini arduino uno which has all the capabilities as it is also made with the came chip atmega328 but in a SMD package .We are able to connect and give power to it through the MINI-B usb cable port.
Getting
Started with
Arduino Nano
Another wonderful feature of the arduino is the option of using a add-on boards to the arduino which comes as a module and they are known as “Shields”
Pin out diagram
Arduino Nano
Sound sensor
The sound sensor converts sound waves in air to electronic signals ,it works-out just like our ‘ear’ .
The Sound sensor has 4 pins .
5V & GND
A0 (analog output)
D0 (Digital output)
(here we are going to use the analog output )
A0
What is sound waves?
Sound waves are longitudinal waves which propagate through a medium (air, water etc) .The longitudinal waves create compressions and rarefactions in the air which then travels to our ear to hear.
Circuit Diagram
Wiring up the circuit
You could power it from a usb or a 9v and make a arduino uv meter.
Another great application is Christmas hat made of this Arduino UV meter. Whenever the sound/music intensity changes the led light up accordingly.
Getting started with Arduino
Before starting any project, we need to interface Arduino with a computer. So we have to write and compile code for the Arduino to execute, as well as providing Arduino to function with the computer.
Installing The Arduino Software Package On Windows
Download a version of Arduino software suitable for your version of Windows from Arduino website / superkitzs.com. After downloading, check the instructions below to install the Arduino Integrated Development Environment (IDE).
CONNECT YOUR ARDUINO UNO BOARD WITH AN A B USB CABLE; SOMETIMES THIS CABLE IS CALLED A USB PRINTER CABLE
In order to program the board, the USB connection with the PC is necessary to program the board and not just to power it up. The Arduino Uno is capable of withdrawing power from either the USB or an external power supply. Connect the board to your computer using the USB cable. The green power LED (labelled PWR) should go on.
If you used the Installer, as soon as you connect your board the Windows – from XP up to 10 – will install drivers automatically
If the board is not properly recognized when the zip package is downloaded and expanded, please follow the procedure below.
- START menu> CONTROL PANEL MENU
- From the control panel, check for System and Security
- Select system
- Select Device Manager from the System window
- Select open port named “Arduino UNO (COMxx)”, under Ports (COM & LPT). If there is no COM & LPT section, check “Other Devices” for “Unknown Device”.
- Choose the “Update Driver Software” option by right-clicking on the “Arduino UNO (COmxx)” port
- Navigate to the “Browse my computer for Driver software” option.
- Choose the driver file named “arduino. inf”, located in the “Drivers” folder of the Arduino Software download (not the “FTDI USB Drivers” sub-directory). If you are using an old version of the IDE (1.0.3 or older), Choose the Uno driver file named “Arduino UNO.inf”, If an old version of the IDE (1.0.3 or older) is used
- Thus the windows driver installation is completed
Select your board type : Arduino Nano and port
Choose Tools | Serial Port menu. This is likely to be COM3 or higher (COM1 and COM2 are usually reserved for hardware serial ports). To find out, you can disconnect your board and re-open the menu; the entry that disappears should be the Arduino board. Reconnect the board and select that serial port
Press CNTRL + A and press DELETE on keyboard for clearing the Arduino IDE page
Upload the program
Copy the Sketch Code given below And try to understand
After that click on the “Upload” button. Then we can see the RX and TX LED on the board flashing. The message “Done uploading.” will appear if the uploading is a success
Arduino Programming
This program uses only the following commands:
ins
= which is written first of all and serves to ensure that instead of repeating a number for each delay. For example, the pin number used can be given by the command ins
led1
=
pin
number;
or for example even the delay you gave for the time like ins
p
=
delay
number;
void
setup()
{ } =this is the part of the software in which you tell the program which pins indicate inputs and which outputs, the most important thing to remember when working in the various setups. This { } indicates the start and end of the setup in which you are writing.
pinMode(led1,OUTPUT);
=with this command it is defined that the led1 is an output whereas if we wanted a pin to become an input for a signal instead of OUTPUT we must write INPUT.
loop
setup()
{ } =with this command you write what must Arduino do in a loop
digitalWrite(led1,HIGH);
=with this command you can decide from the various pins that you have put in OUTPUT when giving a current signal from that pin
digitalWrute(led1,LOW);
=while with this command you can tell when to remove the current from that pin
delay(p);
=this is the command that indicates after how much time to activate the following command (we must remember that the figures that are put are in milliseconds)
Sketch Code
int led[13] = { 2,3, 4, 5, 6, 7, 8, 9,10,11,12,13};
int Audio = A0;
int s,i;
void setup()
{
//Serial.begin(9600);
for (i = 0; i < 13; i++)
pinMode(led[i], OUTPUT);
}
void loop()
{
s = analogRead(Audio);
//Serial.println(s);
s = s / 40;
if (s == 0)
{
for(i = 0; i < 13; i++)
{
digitalWrite(led[i], LOW);
}
}
else
{
for (i = 0; i < s; i++)
{
digitalWrite(led[i], HIGH);
delay(5);
}
for(i = i; i < 13; i++)
{
digitalWrite(led[i], LOW);
}
}
}
Output
Hook the LED to the hat and it will light up according to the music.
LED is light up as sound intensity increase. Adjust the value of denominator to adjust senitivity.