How to Make a Rubber Band Turret With 180 Aiming Using Arduino Servos

Introduction: How to Make a Rubber Band Turret With 180 Aiming Using Arduino Servos

Would you like to make a manual turret that you can aim x and y-axis with two potentiometers?

Then this the guide for you!

Supplies

1. Arduino Uno

2. 2x Servo

3. 13 wires

4. Breadboard

5. 2x Potentiometer

6. Piece of wood that 15 mm long 1.5 height and 7.5 width

7. 2x Pieces of wood that can hold the rubber in place

8. Dremel with Drill/Sanding/Cutting Attaching

9. Jigsaw or saw

10. Two paper clips

11. 2x Nails that are same size as drill

12. Wood glue/Superglue/Epoxy

Step 1: Create Crossbow Base

You need to create a piece of wood that is at least have a width 15 mm (Long enough for the rubber band to be fully stretched) and length of at least 7 mm (To accommodate the length of the pencil) and have a height of 1 mm for to be strong enough support the wooden studs and iron sight.

This Piece doesn't have to be wood, Any strong workable material works as long as it light enough for the servo.

Step 2: Adding the Studs

We need something to hold in place the rubber bands so we can use two studs to this affect. We can use two square blocks of wood(Or any other strong and light material) that are 1mm by 1mm, we then make a two dents such that these blocks can fit in quarter way in. We then Glue the dents and insert the blocks into the dents and wait for the glue to set. Once glue has set you can notches in the wood blocks so that the rubber band can better stay in place.

Step 3: Adding the Iron Sight

We take two paperclips and open them up into a triangle on line. We then drill two holes 40mm apart onto the front on crossbow base where the pencil would fire from. Then put the ends of the paper into the holes making sure it makes a iron sight for people using the crossbow. Then pour glue into the drilled holes and hammer in the nails into the holes to ensure a stable and strong iron sight.

Step 4: Make the Circuit

Make the circuit as shown.

Essentially this is a circuit with a two potentiometer(Left one controlling the x-axis connected to A0 and the right controlling the y-axis connect to A2 ) and two servo motors connected (One controls x-axis controlled by the left potentiometer connect to pin 10 and y-axis controlled by right potentiometer).

Step 5: Attach and Glue the Servo.

Make sure all of plastic arms are secured to the servo by screw that is at least halfway into servo(but not too much into servo or else the servo won't move). This ensure that the plastic arm will stay attached to the servo.

Now glue the servo arm of the x-axis servo (The servo connected to the pin 9) to the bottom of crossbow base underneath where the iron sight is situated. Then after this arm is fully glued, glue the y-axis servo arm to the forward facing side of the x-axis servo.

Once this glued you have finished the physical aspects of the project.

hurray! :)

Step 6: Arduino Code

Now connect the Arduino cable to a PC with Arduino software and put this code into the complier and upload.

Code:

______________________________________________________________________________________________

#include //Servo library

Servo servoXpos; //initialize a servo object for the connected servo Servo servoYpos;

int xPin = A0; //analog pin connected to potentiometer int yPin = A2; int Xval = 0; //variable to read the value from the analog pin int Yval = 0;

int intX = 0; //variable to read the value from the analog pin int intY = 0;

void setup() { Serial.begin(9600); servoXpos.attach(9); // attahced servo to pin 9 servoYpos.attach(10); pinMode(xPin, INPUT); pinMode(yPin, INPUT); }

void loop() { intY = analogRead(yPin); intX = analogRead(xPin);

if ((analogRead(yPin) != intY) and ((analogRead(yPin)+1) != intY) and ((analogRead(yPin)+2) != intY) and ((analogRead(yPin)-1) != intY) and ((analogRead(yPin)-2) != intY) == true) { Ymove(); } if ((analogRead(xPin) != intX) and ((analogRead(xPin)+1) != intX) and ((analogRead(xPin)+2) != intX) and ((analogRead(xPin)-1) != intX) and ((analogRead(xPin)-2) != intX)== true){ Xmove(); }

}

void Ymove(){ Yval = analogRead(yPin); Yval = map(Yval, 0, 1023, 15, 35); servoYpos.write(Yval); Serial.println("y"); Serial.println(Yval); delay(15); }

void Xmove(){ Xval = analogRead(xPin); Xval = map(Xval, 0, 1023, 100, 140); servoXpos.write(Xval); Serial.println("x"); Serial.println(Xval); delay(15); }

______________________________________________________________________________________________

Now you have finished! Hurray!

Be the First to Share

    Recommendations

    • First Time Author Contest

      First Time Author Contest
    • DIY Summer Camp Contest

      DIY Summer Camp Contest
    • Fandom Contest

      Fandom Contest

    Comments