## Introduction: Drawing Arm

Hello! For a school project, I made a Bob Ross drawing arm, controlled by a joystick and two servos. Of course you can decorate the arm the way you want, but I chose to make a Bob Ross out of it. In this project I use the math library, so when we give an input of an x and y position, the math library calculates in what angle they have to be in, to get to that x,y position. In this instructable I'll explain how I did it.

## Step 1: Supplies

First step is to make sure you have all supplies needed for this project. These are the things I used:

- Arduino uno

- 2x Micro Servo 180 degrees

- 1x Joystick

- Wires

- Female - male wires

- Tiewraps

- 13cm wooden sticks

- Cardboard

- Instant glue

- Clothespin

## Step 2: Building the Arm

We're now going to build the arm. Make sure you have strong sticks, preferably strong and light. You need one base stick, that's the one you attach to the ground. Then add the first servo on top of it, at the very end, and fasten it tightly with tiewraps. Then attach a propeller to it and screw it fixed. Now you attach your next stick to the propeller. You have to do the same thing with the next servo and next stick. You can either choose to put the second servo on top of the second stick, or you attach it to the bottom. Attaching it to the bottom makes the arm more stable. Now you can attach your clothespin to the very end of the third stick, you can put it on top of the stick or next to it. I choose for a clothespin so I can easily change the pencil in the hand, and it's pretty sturdy. Fasten everything with tyraps and make sure everything is stable, this is very important.

## Step 3: Connecting the Wires

Third step is to connect the servos. For now, we're using a Arduino uno and terminal blocks. The servos have three coloured wires: Yellow, red and brown.

In order to connect the terminal block to the arduino, we put one wire into a hole in the terminal block, and the other end we put into GND. We do the same with a second wire, but we put it in one of the holes next to it and put the end in the arduino's 5V

How to attach the wires of servo 1:

Yellow -> Digital 7

Red -> 5v/+ in terminal block

Brown -> GND/- in terminal block

How to attach the wires of servo 2:

Yellow -> Digital 4

Red -> 5v/+ in terminal block

Brown -> GND/- in terminal block

Now we're going to connect the joystick. Here's how it's done:

GND -> GND in the arduino

+5V -> 5v/+ in terminal block

URX -> A0

URY -> A1

## Step 4: Coding

Now we're done with making the arm itself, we can start coding. First of all, open or install the math.h and Servo.h libraries.

You'll have to define the length of the arm. Measure the two last sticks and make sure they are the same length. Now you can define the arm with the following code:

`//radialen naar graden<br>const float radTodegree = 180 / PI;`
```#define ARMLENGTH 130 //arm lengte in mm

```

Then you define the servo's, joystick and moveSpeed of the arm. Keep the moveSpeed low at first, so you can turn it up without possibly breaking the arm.

After that I made a void loop. I changed the value to the length of the arm, in my case, each part is 130mm. This way, it's easier to read the input the servos receive.

```//leest x en y as van joystick<br>void loop() {
joyVa1 = map (joyVa1, 0, 1023, -bounds, bounds); //vertaalt de value van 0-1023 naar -130 - 130

if(abs(joyVa1) > 30){```

I added a constrain, to make sure the arm doesn't go any further than I want. Bounds is the same length as the arm.

`posX = constrain(posX,-bounds,bounds);`

I sent the input position to the serial monitor. This helps to understand how the arm acts, and it helps to find solutions of problems if they occur.

```//print postitie<br>void PrintPosition(){
if (Serial.available() > 0)
{
posX = Serial.parseInt();
posY = Serial.parseInt();```
```  }
//
Serial.print(posX);
Serial.print(",");
Serial.println(posY);
}```

After that, there's the code to calculate the angles of the servo's. This part of the code is made by tomasdecamino. Please download the full code to see everything. Now you can use the joystick to move the arm! You can edit things you want, like moveSpeed and constrain.

## Step 5: Decorating the Arm

Now it's time to give your arm a body! You can basically make anything you want. I decided to make a Bob Ross out of it. One of his hands is holding a paint palette and the other one is the drawing arm. First I made a prototype with normal 80gram paper to make sure everything will fit. I made the body, neck, arm and head with thick cardboard and glued it together with instant glue. Then I teased wool to make it look like frizzy hair and glued it in place. Then I cut and nailed a blouse to fit the seize of my project and cut the sleeves open and put velcro in it so I can easily dress and undress the body if you have to edit something underneath. At last, I cut some hole into the body so wires can get through without destabilizing the whole project.

You can now put a pencil into your project's hand, give him a piece of paper and draw!