## Introduction: Mini Drawing Bot - Live Android App - Trignomentry

Thank GOD and all of you for make my project Baby-MIT-Cheetah-Robot won the first prize in the Contest Make it Move. I am very happy because lot of friends ask lot of question in conversation and in messages. One of the important question was how the robot move smoothly (with out body up and down) and asked about the array in the program initialization, how it is calculated. For the answer of that questions i plan to make a drawing bot with the legs i designed for the Baby-MIT-Cheetah-Robot. This is the test leg first i designed before print all the four legs. Also for this i try to draw in android and transfer the data to arduino to draw.

I like maths very much, i believe all in the world run with maths. There is nothing with out maths. Here i detailed the maths used to calculate the degrees of servo in detailed.

## Step 1: Materails Required

Materials Required

1)Arduino Uno R3 - 1No

2) HC-05 Blue tooth module. - 1No

3) Micro Servo - 3 Nos

4) LM2596 DC to DC Voltage Regulator. - 1 No

5) 3.7V 18650 Battery - 2 Nos

6) 18650 Battery Holder

7) 3D printed Arm (obj file given the arm page)

8) Small aluminum pipe (got from old FM antenna).

9) Some scrap items.

10) Plastic sheet to make cover.

## Step 2: Trigonometry and Pythagoras Theorem

The Image is self explanatory if you want to read continue....

What we have is noted first

Image1

Drawing arms dimension both lower arm 3Cm and both upper arm 6 Cm. The distance between the two servo arm arm axis is 4.5cm. So consider you put it all in a graph and mark the first servo center as (0,0) so second servo center is at (4.5,0).

Image2

Now mark a point in the graph where the pen want to move, now i make it at (2.25,5).

Now we want to find the length of two lines (0,0) to (2.25,5) and (4.5,0) to (2.25,5). Use the Distance Formula and Pythagorean Theorem. From the formula Length = sqrt((X2-X1)square +(Y2-Y1)Square) (please see the image to see the formula in correct format). The point is in the center of the y axis with the servo, So the boths sides have same dimension of triangle. So the result is 5.48 in both sides.

Image 4

Now you can able to divide the triangles. We got 3 triangles with all the 3 sides known.

Image 5 Trigonometry - the law of cosines

Use the Trigonometry - the law of cosines to calculate the angles we want. Please see the image for formula.

The result from the Trigonometry is in radiant so use the formula Degree = Radiant * (180/pi()), to convert radiant to degree.

Image 6

Sum up the degrees in the same side to find the rotation of the arms.

## Step 3: Check the Math Again

Now a test, move the point in the graph to different point and calculate the degrees of the arm. I create a excel and find the angle. See the above excel for calculation.

## Step 4: Circuit

Its a very simple diagram with Three servos control using the digital pin 5,6 and 9, where 5 and 6 pins used to drive the arm and 6 used to up down the arm. The HC05 Tx connected to Arduino pin 0 (RX) and RX connected to Arduino pin 1 (TX). From 2 Nos 18650 battery 7.4V given to Arduino vin pin and input side of LM2596 DC to DC Voltage Regulator through switch. Output from LM2596 DC to DC Voltage Regulator is given to the servo supply pins. Thats all the circuit over.

## Step 5: Develop Circuit

As like every project for this project also i make a shield with female header pins for HC-05 bluetooth and Male header for servos.

## Step 6: Create Servo Stand

I use MG90S 2 Nos for arms and SG90 for pen up and down. Cut a small novapan sheet to fix the servos as shown in the figure. As like the picture hot glue the both MG90S servos in straight vertical and the SG90 in the base.

## Step 7: Arm in Tinkercad

The same leg designed for MIT Cheetah Robot and Printed by the 3D print service provider A3DXYZ. Only one set is required for the drawing bot. If you only design for drawing then change the drawing to make the pen holder at the end of one arm

## Step 8: Fix the Drawing Arm

The 3D Printed arm is received as 6 pieces, 4 arm pieces and 3 screw like pieces to joint the arms. Join the arms and use the feviquick to paste the screw piece. Paste the horn in the arm and quick fix it using fevi quick. Now make a simple program and put the servo 1 to 150 degree and servo2 to 30 degree and fix the horn in the arm and screw it. For up down mechanism simply use a servo horn.

## Step 9: Hinge for Up Down Mechanism

For Making Hinge i use a old micro tip pencil from scrap and a round metal rod from the scrap. Cut both sides of the Micro tip pencil and take the tube hot glue it with the novapan sheet, already servo is pasted. Now insert the rod in to the tube and place a tiny piece of novapan sheet on both sides of the rod between the base and rod and hot glue it. now the Hinge is ready.

## Step 10: Fix All in One Board

Use hot glue gun to fix it all in the single novapan sheet. I change the 18650 battery holder with the new one with switch built with it (old one fitted in the fully 3D printed Baby MIT Cheetah currently in development).

## Step 11: Pen Holder

I search for lot of items and finally found a aluminium tube in the scarp from FM antenna. Cut a 43 cm length (15 + 13 + 15) of the pipe abd try the sketch fitted in it correctly. Cut slot in the 15 cm from both sides and open the both sides and make it flat. bend it to 90 degree and make the rectangle to circle. Use file to polish the edges and put it straight to the arm and Quick fix it with the holder with the arm using feviquick.

## Step 12: Make a Cover

Make a cover using plastic sheet and paste all the joints of the plastic sheet so it look like a box. Make a slot in the side for switch ON and OFF. Now every thing is completed. Mechanical and Electronics works are finished. Now its time for Computer program in Android and Arduino.

## Step 13: Paper Holder

Cut 3 pieces of plastic sheets and paste in the edges with the board as shown in the figure. Cut paper 11cm X 16 cm to use in this holder.

## Step 14: Arduino Code

In this program i minimize the coding in android and insert all the maths calculation in the Arduino. So the android only send the X,Y,Pen up down from the mobile through bluetooth and once the arduino receive the point as detailed in the step 2 of this project arduino program calculated the actual degree for two servos. Servo only rotate up to 180 degree at 60 degree the servo arms are very close so i set 60 as 0. So from 60 to 240 degrees only taken in account and rotate. If the degree go less than 60 or greater than 240 or not able to calculate then the pen up. Once the servo move to that position it send back "N" to the android once the android received "N" it send the next point.

## Step 15: Android Program

As like other Projects I use MIT App inventor to develop the android app. On the screen start use bluetooth picker to pick up the HC-05. If the bluetooth is connected, the next screen shown. In that screen a Canvas area is used to draw the line drawing once you start draw the Mini drawing bot also start to draw with you. in the bottom of the screen two buttons and one label box present. Redraw button is used to draw again in the line drawing and clear button is used to clear the image in the canvas. In the label it show the text send to arduino.

Only draw in bottom half only drawn by the bot because of the length of the arm.

Download the app from the link and install in your android mobile. aia file for the program is also attached for the developers.

## Step 16: First Test

This is the first test draw in the novapan sheet. The name Siva is tested first. Sorry i forgot to reord this video.

## Step 17: For Cheetah Leg

Lot of leg moving pattern available on the net. Or use ur own pattern. Draw it in the mobile and record it in arduino used that pattern for leg movement. Main thing keep it in mind is if the chettah walk at the height of 6 cm two cross legs in 6cm and move forward and othe two cross legs in the air of 5.5 cm ad all come to 6cm then only the cycle repeats.

## Step 18: Final Workings Video and Some Output

I enjoy a lot on making in this project. same words again, I lean some new things from this project, I feel you also learn some small thing on reading this project. Thank you all for reading it.

Lot more to enjoy...............Don't forgot to comment and encourage me friends.

Second Prize in the