loading

[This was my first ever instructable when I was a teenager in high school.] Today we will be building an automatic sprayer which will spray bug spray or almost any spray with the press of a button.

Step 1: Getting the Needed Materials

You do not need much to do this project. It is low cost and does not take up much time to finish. All you need are basic Vex parts, a vex motor, some wiring, a circuit board, a optional bread board, and an arduino. When you have these items esempeled you will be ready to begin.

Step 2: Programming Your Arduino

When you get you arduino up and running and are ready to program it this is the program you can use for this project.

int spray = 11;

int button = 9;

int spray2 = 10;

int button2 = 6

;void setup()

{

pinMode(button, INPUT);

pinMode(spray, OUTPUT);

pinMode(button2, INPUT);

pinMode(spray2, OUTPUT);

}

void loop()

{

if (digitalRead(button) == HIGH) {

// turn LED on:

analogWrite(spray, 240);

delay(50);

} else if(digitalRead(button) == LOW) {

// turn LED off:

analogWrite(spray, 0);

}

if (digitalRead(button2) == HIGH) {

// turn LED on:

analogWrite(spray2, 240);

delay(50);

}

else if(digitalRead(button2) == LOW) {

// turn LED off: analogWrite(spray2, 0);

}

//analogWrite(spray, 0);

}

If you type this program exactly it will compile and upload onto the arduino if not go back and check your code to find outs whats going on. This program is for using two of the sprayers on one arduino put it will work if you only make one as well.

Step 3: Building

Using your vex pieces you can make any type of holding container you would like. The gears just need to be able to bring a lever down that will be able to press the button that will spray the bug spray, or whatever type of spray you would like to use. On this step you have the freedom to do almost any design you would like. The more you experiment on different designs the better you will get at creating your own projects and making this one your own.

Step 4: Soldering It to a Circuit Board

Now if you would like you can use a breadboard first to test I strongly suggest that but i t is not necessary. To put the board together you have two different small circuits. The first is the motors circuit. To control the motor you have three main wires the ground, power, and control. You connect the power and ground to their respective ports on the battery and you connect the control cable to a cable that is plugged into the "11" port on the arduino. This could vary based on whether you altered the earlier code. Now the other part of the circuits is the Button which controls the motor. After you solder the button to the circuit board you connect it to a control wire and 5 volts. You also need to add a resistor that is also connected to 5 volts. The control wire now is plugged into the "9" slot on the arduino, again based on whether you altered the code. After that clean up the solder if necessary and connect everything respectively.

Step 5: Extra!

If you have some extra plexi glass or any acrylic lying around you can use it to build a container to set this in so it looks more presentable. Thank You for going through this Instructable i hope you enjoyed it!

So it is a button-operated button presser?

About This Instructable

759views

8favorites

License:

Bio: I'm a physics student who originally made this profile for a final project at a summer camp. I love the Instructables community so I ... More »
More by N1CK66:Electronic Sprayer Prototype 
Add instructable to: