loading

Playing Catapult at the Office inspired me to build this Arduino Arm to press the ruler and release to shoot. Although it fails to fulfill my first intension, I believe this Simple Arduino Arm will lead to other cooler projects.

My first idea was to build a manual aiming catapult with potentiometer and a push button to launch/shoot.

What we need are :

  • An Arduino microcontroller. Here I use Arduino Uno R3.
  • Two Micro Servos.
  • Two 10K Potentiometers.
  • Two Tiny Breadboards. Why two? I will explain later :)
  • Some Wires.
  • Adhesive tape.

Step 1: Prepare the Arm

Put one side of servo body to the other servo horn. Here I use adhesive tape. Then I put a pen on the other servo horn. So the lower servo is moving left or right and the upper servo is moving upward or downward.

Then I circle a piece of adhesive tape forming double tape. and stick it on the bottom of the servo and stick the servos on a box. I also tape the servo's cables on the box.

Step 2: Breadboards and Pots

I want to position the potentiometers as their function. I bend one pot so that its shaft is heading up. This one moves the Left-Right servo (LR Servo). The other one is just plugged in the breadboard. It moves the Up-Down servo (UD Servo).

Added upon publishing time :

Only while writing this instructable I see that I can go on with only one breadboard, just plug the LR Pot on the opposite side and bend the pot as I have already done.. 

Why I don't have a vision of this earlier? Arghh.... never mind ^_^ With two tiny breadboards will be easier to describe the wiring and also easier to reach the LR Pot.

Step 3: Wiring

First I put power rail and ground rail on the breadboad. I marked the board with "+" for 5V and "-" for Ground so that I don't plug them the wrong way.

  • Black wire from Arduino GND to Breadboard GND rail.
  • Red wire from Arduino 5V to Breadbaord 5V rail.

  • Red and orange wires from Breadboard 5V rail to servos' red wires.
  • Brown and Yellow wires from Breadboard GND rail to servos' brown wires.

  • Green and Purple wires goes from Breadboard 5V to Potentiometers left pins.
  • Blue and Grey wires goes from Breadboard GND to Potentiometers right pins.

Note : There is no polarity on potentiometer pins. You can switch the 5V and GND pins with no harm. But wiring as the picture above will move the servo accordingly to your potentiometer turning direction.

  • The Green wire goes from Left-Right Pot center pin to Arduino A0.
  • The Orange wire goes from Up-Down Pot center pin to Arduino A1.

  • The Blue wire goes from Left-Right Servo orange pin to Arduino D9.
  • The White wire goes from Up-Down Servo orange pin to Arduino D10.

Step 4: Arduino Sketch

This sketch only need a little modification from the standard Servo > Knob sketch by Michal Rinott and Scott Fitzgerald which I then called it Dual Knob ^_^

/*
Controlling a servo position using a potentiometer (variable resistor) by Michal Rinott

modified on 8 Nov 2013 by Scott Fitzgerald http://www.arduino.cc/en/Tutorial/Knob */

#include <Servo.h>

Servo myservoLR; // create servo object to control a servo Left-Right Servo myservoUD; // servo Up-Down

int potpinLR = 0; // analog pin used to connect the potentiometer int potpinUD = 1; int valLR; // variable to read the value from the analog pin int valUD;

void setup() { myservoLR.attach(9); // attaches the servo on pin 9 to the servo object myservoUD.attach(10); }

void loop() { valLR = analogRead(potpinLR); // reads the value of the potentiometer (value between 0 and 1023) valUD = analogRead(potpinUD); valLR = map(valLR, 0, 1023, 0, 180); // scale it to use it with the servo (value between 0 and 180) valUD = map(valUD, 0, 1023, 0, 180); myservoLR.write(valLR); // sets the servo position according to the scaled value myservoUD.write(valUD); delay(15); // waits for the servo to get there

}

Step 5: Testing the Arm

Power on your Arduino. Synchronize the servos positions to the potentiometers. Move it to the leftmost and the rightmost and determine the center of the pots. Then unplug and re-plug the servos horns at the center positions.

Step 6: Testing the Arm With Office Catapult

English is not my native language and I'm so shy to speak out loud in the video recording. I will learn to shoot a better video ^_^

As you can see in the video, it fails shooting the catapult. But it can be fixed by using a plastic ruler instead of metal one for they are more flexible. Then we also need to get a better mounting for the servos rather than just a double tape :D With firm mounting these micro servos are strong enough to hold down the ruler at pre-shooting position, even a metal ruler for sure.

If only I had a 3D printer, I would have made a better catapult or a gripper to this Arduino Arm...

Step 7: Proof of Concept

As I said earlier that this project can lead to another cooler project. Here I present you a working clipper prototype from cardboard with only one micro servo, a potentiometer and an Arduino Uno.

can I use characters in map function
You can't. Just explore the map() function and it is written to distribute value from one range to another with math calculation.<br><br>long map(long x, long in_min, long in_max, long out_min, long out_max)<br>{<br> return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;<br>}<br><br>But this function has a flaw. You better change the type from &quot;long&quot; to &quot;float&quot; or you can refer to the methode in :<br>http://www.jetmore.org/john/blog/2011/09/arduinos-map-function-and-numeric-distribution/

About This Instructable

741views

19favorites

License:

Bio: Just an ordinary person who loves #thinking and #tinkering
More by chienline:SkaterBoseBuild Traveller's Handcuff Cup Holder  Industrial Style Fidget Spinner 
Add instructable to: