loading

For a school project I made an automatic crusher for crushing small spices or plants.

Its controlled by 2 buttons on a breadboard which make a servo mode spin 180 degrees left or right making a crushing movement.

Step 1: Components Needed

You need 1 audino can be small or big.

9 cables to wire everything together.

1 breadboard to connect everything.

2 resistors

1 servo motor

and 1 crushing element

And a casing

Step 2:

first you connect the resistors, And you connect one button to + and number 2 and the other to 4.

Second you connect the ground to minus on the breadboard and the 5v to plus on the breadboard.

make sure you give the buttons power otherwise they wont work.

Step 3: Servo

Extend the servo plug a red cable in the red one and a black in the black one. and a yellow in the yellow one.

Connect the yellow cable on number 9 on the arduino.

and the red goes on the plus on the breadboard and the black one goes in the minus on the breadboard.

Step 4: Casing

Create a lid so it can crush when the servo motor rotates.

Step 5: Code

Finally upload this code which makes the buttons control the servo because theyre connected to number 2 and 4, and the servo is connected to number 9.

#include
const int buttonPin = 2;

const int buttonPin2 = 4;

int buttonState = 0;

int buttonState2 = 0;

Servo servoA;

int position = 0;

void setup() {

servoA.attach(9);

pinMode(buttonPin, INPUT);

pinMode(buttonPin2,INPUT);

}

void loop() {

buttonState = digitalRead(buttonPin);

buttonState2 = digitalRead(buttonPin2);

if(buttonState ==HIGH && position < 180){

servoA.write(position++);

delay(5);

}

if(buttonState2 == HIGH && position > 3){

servoA.write(position--);

delay(5);

}

}

<p>Great Aduino project. You should enter this into the Arduino contest.</p>

About This Instructable

105views

2favorites

License:

More by MaxJ32:Automatic Crusher 
Add instructable to: