Introduction: Make a Beat Using Solenoids

This instructable will show you how to make a drum-like object using solenoids. It's schematics are based off of the instructable Controlling solenoids with arduino. The final product will sound like the thrumming of a drum and will be a tactile experience for the user to come up and interact with. It also feels like a hand massage if you lay your palm over the solenoids as the drum away.

This whole project is operating off of one 9V battery. YES! Some research that I came across suggested using a 12V battery but the 6 solenoids run perfectly off of the 9V. Note that all of the solenoids for this project are PUSH solenoids and come with springs in them. Any solenoids that do not come with springs in them will get stuck when the power is applied to them and you will need to build your own springs. This is a huge headache, so save yourself the trouble and buy them from the get-go complete WITH SPRINGS :)


Step 1: Supplies

Here's what you'll need:

• Arduino board
• USB cable for programming and powering the Arduino
• Breadboard 
• Some jumper cables
• A 1K resistor (Will need 6 total to run with 6 solenoids)
• TIP120 transistor (TIP102 will also work fine) (will need 6 total to run with 6 solenoids)
• 1N4004 diode (1N4001 also works) (will need 6 total to run with 6 solenoids)
• 9V battery
• Battery clip for the 9V solenoid power
• 6 Push Type solenoids with springs in them
•  A prototyping board.  Can be found at RadioShack, easiest to solder the circuits with.
• A few headers to slot the proto-board on to the Arduino.  A pack of 100 in strips should be around $3 or less.
• A small wood box to encase the project within
• Jewelry "rings"  to create a solenoid holding bracket (I found mine at the local craft store in the beading aisle)
• Hot glue gun and hot glue
• Small pieces of wood to hold up the brackets that support the solenoids up (I also found these at the local craft store. You won't  need anything very thick or large, so a craft store is just as well as a hardware store)
• Nails and hammer to nail in supports for the brackets
• A Drill to drill a hole for battery access from outside the box.

Step 2: Test Out One Solenoid on the Breadboard

Go ahead and test out breadboarding one of the solenoids onto the breadboard. Note that in order to activate the solenoid and get it to spring up the solenoid must be held at a certain height up and must be also supported from the bottom so that the pin does not fall out completely when the power shuts off. This is why you will need to build a shelf with brackets to hold the bottoms of the pins and to keep the solenoids positioned at the correct height to activate.

Start breadboarding the:
-transistor
-1K OHM resistor
-and a couple of jumpers

Step 3: Add the Next Components to the Breadboard

Add the solenoids and the diodes to the breadboard.
The solenoid cords are not polarized so there is no need to worry about which side is which during this step.
The resistor should be connecting into Pin 13 on the Arduino.

Once you finish, connect your Arduino Uno to a computer with the Arduino program installed on it. Put the example code into the Arduino program and verify and upload it.
The solenoid should activate the same as an LED light would in the blink sketch.
The Solenoids are actually being called "led" in the code, but no worries, the code will work on the solenoids.

Example Code:

/*
Blink
//By 47anc
Turns on an LED on for one second, then off for one second, repeatedly.
This example code is in the public domain.
*/

// Pin 13 has an LED connected on most Arduino boards.
// give it a name:
int led = 13; //pin 13, solenoid #1
int led1 = 12; //pin 12, Solenoid #2
int led2= 11; //pin 11, solenoid #3
int led3= 2; //pin 2, solenoid #4
int led4= 4; //pin 4, solenoid #5
// the setup routine runs once when you press reset:
void setup() {
// initialize the digital pin as an output.
pinMode(led, OUTPUT);//pin 13
pinMode(led1, OUTPUT);// pin 12
pinMode(led2, OUTPUT);// pin 11
pinMode(led3, OUTPUT);// pin 2
pinMode(led4, OUTPUT);// pin 4
}

// the loop routine runs over and over again forever:
//pin13
void loop() {
digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level)
delay(500); // wait for a second
digitalWrite(led, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second

digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level)
delay(100); // wait for a second
digitalWrite(led, LOW); // turn the LED off by making the voltage LOW
delay(70); // wait for a second

digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level)
delay(50); // wait for a second
digitalWrite(led, LOW); // turn the LED off by making the voltage LOW
delay(500); // wait for a second

digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level)
delay(200); // wait for a second
digitalWrite(led, LOW); // turn the LED off by making the voltage LOW
delay(700); // wait for a second
}

Step 4: Did the Solenoid Work?

OK!
Now repeat the same steps for the next 5 solenoids.

The resistors should connect to these pins:
pin 13, solenoid #1
pin 12, Solenoid #2
pin 11, solenoid #3
pin 2, solenoid #4
pin 4, solenoid #5
pin 7, solenoid #6

Example Code:

/*
Blink
//by 47anc
Turns on an LED on for one second, then off for one second, repeatedly.
This example code is in the public domain.
*/

// Pin 13 has an LED connected on most Arduino boards.
// give it a name:
int led = 13; //pin 13, solenoid #1
int led1 = 12; //pin 12, Solenoid #2
int led2= 11; //pin 11, solenoid #3
int led3= 2; //pin 2, solenoid #4
int led4= 4; //pin 4, solenoid #5
int led5= 7; //pin 7, solenoid #6

// the setup routine runs once when you press reset:
void setup() {
// initialize the digital pin as an output.
pinMode(led, OUTPUT);//pin 13
pinMode(led1, OUTPUT);// pin 12
pinMode(led2, OUTPUT);// pin 11
pinMode(led3, OUTPUT);// pin 2
pinMode(led4, OUTPUT);// pin 4
pinMode(led5, OUTPUT);// pin 7
}

// the loop routine runs over and over again forever:
//pin13
void loop() {
digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level)
delay(500); // wait for a second
digitalWrite(led, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second

digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level)
delay(100); // wait for a second
digitalWrite(led, LOW); // turn the LED off by making the voltage LOW
delay(70); // wait for a second

digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level)
delay(50); // wait for a second
digitalWrite(led, LOW); // turn the LED off by making the voltage LOW
delay(500); // wait for a second

digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level)
delay(200); // wait for a second
digitalWrite(led, LOW); // turn the LED off by making the voltage LOW
delay(700); // wait for a second

// Everything below this is for pin 12
//pin12
digitalWrite(led1, HIGH); // turn the LED on (HIGH is the voltage level)
delay(50); // wait for a second
digitalWrite(led1, LOW); // turn the LED off by making the voltage LOW
delay(10); // wait for a second

digitalWrite(led1, HIGH); // turn the LED on (HIGH is the voltage level)
delay(10); // wait for a second
digitalWrite(led1, LOW); // turn the LED off by making the voltage LOW
delay(70); // wait for a second

digitalWrite(led1, HIGH); // turn the LED on (HIGH is the voltage level)
delay(50); // wait for a second
digitalWrite(led1, LOW); // turn the LED off by making the voltage LOW
delay(50); // wait for a second

digitalWrite(led1, HIGH); // turn the LED on (HIGH is the voltage level)
delay(20); // wait for a second
digitalWrite(led1, LOW); // turn the LED off by making the voltage LOW
delay(70); // wait for a second

//pin11
digitalWrite(led2, HIGH); // turn the LED on (HIGH is the voltage level)
delay(50); // wait for a second
digitalWrite(led2, LOW); // turn the LED off by making the voltage LOW
delay(10); // wait for a second

digitalWrite(led2, HIGH); // turn the LED on (HIGH is the voltage level)
delay(10); // wait for a second
digitalWrite(led2, LOW); // turn the LED off by making the voltage LOW
delay(70); // wait for a second

digitalWrite(led2, HIGH); // turn the LED on (HIGH is the voltage level)
delay(50); // wait for a second
digitalWrite(led2, LOW); // turn the LED off by making the voltage LOW
delay(50); // wait for a second

digitalWrite(led2, HIGH); // turn the LED on (HIGH is the voltage level)
delay(20); // wait for a second
digitalWrite(led2, LOW); // turn the LED off by making the voltage LOW
delay(70); // wait for a second

//pin 2
digitalWrite(led3, HIGH); // turn the LED on (HIGH is the voltage level)
delay(50); // wait for a second
digitalWrite(led3, LOW); // turn the LED off by making the voltage LOW
delay(10); // wait for a second

digitalWrite(led3, HIGH); // turn the LED on (HIGH is the voltage level)
delay(10); // wait for a second
digitalWrite(led3, LOW); // turn the LED off by making the voltage LOW
delay(70); // wait for a second

digitalWrite(led3, HIGH); // turn the LED on (HIGH is the voltage level)
delay(50); // wait for a second
digitalWrite(led3, LOW); // turn the LED off by making the voltage LOW
delay(50); // wait for a second

digitalWrite(led3, HIGH); // turn the LED on (HIGH is the voltage level)
delay(20); // wait for a second
digitalWrite(led3, LOW); // turn the LED off by making the voltage LOW
delay(70); // wait for a second

//pin 7
digitalWrite(led5, HIGH); // turn the LED on (HIGH is the voltage level)
delay(50); // wait for a second
digitalWrite(led5, LOW); // turn the LED off by making the voltage LOW
delay(10); // wait for a second

digitalWrite(led5, HIGH); // turn the LED on (HIGH is the voltage level)
delay(10); // wait for a second
digitalWrite(led5, LOW); // turn the LED off by making the voltage LOW
delay(70); // wait for a second

digitalWrite(led5, HIGH); // turn the LED on (HIGH is the voltage level)
delay(50); // wait for a second
digitalWrite(led5, LOW); // turn the LED off by making the voltage LOW
delay(50); // wait for a second

digitalWrite(led5, HIGH); // turn the LED on (HIGH is the voltage level)
delay(20); // wait for a second
digitalWrite(led5, LOW); // turn the LED off by making the voltage LOW
delay(70); // wait for a second

}



Step 5: Making the Brackets and Support System

After testing your solenoids you should notice what height they must be held up in order for the pins to fire. Next, you will build the bracket system to hold them up at this height. I used jewelry rings to clasp the solenoid boxes and hot glued the rings to the shelf I made out of the wood pieces. I screwed two screws into the box to support the shelf and brackets and allow room below for the arduino and the prototyping board to be stored.

I drilled a hole on the bottom corner of the box so that I could pull the battery clip through and be able to connect and change out the batteries from the outside of the project.

Step 6: Transfer to the Prototyping Board

Now its time to transfer your project over to the prototyping board. Once again, the whole project is being powered by a 9V battery.
I separated my solenoids up to have 3 solenoids on one prototype board and the other 3 solenoids on a second prototype board. Power is run to the second board by connecting the ground and power of the second board to the ground and power of the first board using jumpers.

Step 7: Here's the Final Product!