Introduction: CD-ROM Agitator
Step 1: Get a Old CD-ROM Drive
Step 2: How to Set Up the Arduino and Breadboard
Step 3: The H-Bridge Connected to the Arduino (No Toggle Switch)
// Arduino Code:
const int switchPin = 2; // switch input
const int motor1Pin = 3; // H-bridge leg 1 (pin 2, 1A)
const int motor2Pin = 4; // H-bridge leg 2 (pin 7, 2A)
const int enablePin = 9; // H-bridge enable pin
void setup() {
// set the switch as an input:
pinMode(switchPin, INPUT);
// set all the other pins you're using as outputs:
pinMode(motor1Pin, OUTPUT);
pinMode(motor2Pin, OUTPUT);
pinMode(enablePin, OUTPUT);
// pinMode(ledPin, OUTPUT);
// set enablePin high so that motor can turn on:
digitalWrite(enablePin, HIGH);
}
void loop() {
// if the switch is high, motor will turn on one direction:
digitalWrite(motor1Pin, LOW); // set leg 1 of the H-bridge low
digitalWrite(motor2Pin, HIGH); // set leg 2 of the H-bridge high
delay(500); // waits for a second
// if the switch is low, motor will turn in the other direction:
digitalWrite(motor1Pin, HIGH); // set leg 1 of the H-bridge high
digitalWrite(motor2Pin, LOW); // set leg 2 of the H-bridge low
delay(500); // waits for a second
}
Step 4: Take Apart the CD-ROM Drive and Solder 2 Cables to the Motor
Step 5: Put the Arduino and Breadboard in the CD-ROM Housing
Step 6: Screw the CD-ROM Drive Back Onto the Housing That Is Now Flipped Over
Step 7: Glue a Plastic Container to the CD-ROM Tray, Put Your Contents in and Plug It In!
Participated in the
UP! Contest