Make a Beat Using Solenoids
Intro: Make a Beat Using Solenoids
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
• 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
Start breadboarding the:
-transistor
-1K OHM resistor
-and a couple of jumpers
STEP 3: Add the Next Components 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?
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
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
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
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.
2 Comments
Urban inventor 8 years ago
craftclarity 9 years ago
Interesting....sounds like an old-school manual typewriter tapping away. Sounds cool!