Introduction: DIY Speaker - Make Your Own Salt Shaker!

You have adventured to the Instructables website, which means you must want to create your own salt shaker! Good choice! Hope you have fun creating and experimenting following these instructions...

What you will need:

Start Arduino Kit

DIY Speaker Kit

Step 1: Set Up Your Hardware!

Picture of Set Up Your Hardware!

Set up your Arduino, breadboard, and components following this beautiful schematic diagram!

Using jumper wires that corresponds to the diagram will help you to keep track of where your components are connected and where your positives (red wires) and negatives (black wires) are connected.This is good practise when creating any circuit.

Use a blue jumper wire from 'Pin 9' on the Arduino to 'VOL' (volume) pin on DIY Speaker kit

Use a green jumper wire from 'Pin 10' on the Arduino to 'SIG' (signal) on DIY Speaker kit

Use a red jumper wires from 'Pin 5V' on the Arduino to '5V' on the DIY Speaker kit

Use a black jumper wires pin 'GND' on the Arduino to 'GND' on the DIY Speaker kit

Step 2: Type in Your Code

You can write out the code for yourself ,shown in the image, (you are more likely to learn more if you copy out the code) - but if you want to jump straight to the fun bit - you can open the Arduino file and upload straight to your circuit!

How the code works is explained step by step within the Arduino code - these explanations are written in grey and do not interfere with the code as they have two backslashes (//) before them.

// Define the notes you will use and the melody

#define NOTE_C1 33

#define NOTE_E1 41

#define NOTE_F1 44

#define NOTE_G1 49

int melody[] = {NOTE_F1, NOTE_G1, NOTE_E1, NOTE_C1};

int noteDurations[] = {2, 2, 2, 1}; //The length of your notes

//Set up your LDR sensor on analog pin A0

int sensorPin = A0;

unsigned int sensorValue = 0;

void setup()

{

//Begin writing to the serial so that you can read the value of the LDR if you need to debug

Serial.begin(9600);

//Set pin9 as an output for volume

pinMode(9, OUTPUT);

//You can add your melody to the setup as it will keep playing continuosly

for(int thisNote = 0; thisNote < 5; thisNote++)

{

int noteDuration = 1000/noteDurations[thisNote];

tone(10, melody[thisNote]*4, noteDuration);

int pauseBetweenNotes = noteDuration * 1.30;

delay(pauseBetweenNotes);

}

}

void loop()

{

//This line is printing the values from your LDR sensor to the serial monitor

Serial.println(analogRead(sensorPin));

//Read sensor value and turn your volume from 0% to 100%

sensorValue = analogRead(sensorPin);

if(sensorValue<500) //This number will change depending on the ambient light in the room.

{digitalWrite(9, HIGH);}

else

{digitalWrite (9, LOW);}

}

Step 3: Experiment With Salt Patterns!

Picture of Experiment With Salt Patterns!

Experiment with how many patterns you can make, by using your light sensors to manipulate the vibrations of salt!

Comments

ibenkos (author)2014-10-18

Smart idea! Thanks for shearig :)

seamster (author)2014-09-30

Looks like fun! Thanks for sharing this.

About This Instructable

1,139views

11favorites

Bio: Technology Will Save Us is a haberdashery for making technology in everyday life. We design, manufacture and sell DIY technology Kits and run workshops to ... More »
Add instructable to: