With Instructables you can share what you make with the world, and tap into an ever-growing community of creative experts.
Tell us about yourself!
Hello again ... got back after some learning , but i still cant get it to work , am having problems with aligning the arms of the servo . I tried working with proccessing in order to help me but am not making anything to work , ok so ill provide a picture and where i align with proccessing : the first image shows the paper in which am tryn to draw . What should i change in the code ? Or if its not the code i should change then what should i change ? am so confused ... and when i thought i was done ... thank you for your time .
Simple Arduino XY Plotter
I hope you are still watching this post :). Ok first of all , great project awsome work . Ive been looking for something like this and finaly i found it so thanks .My question now : I see you code but i cant understand how you get to use angle from first servo and the angle of second servo and by that you calculate (x,y).Can you please show me how you did it based on your code ? Green angle is servo 1 angle , while red is servo 2 angle . so we need based on those 2 angles to calculate brown angle as showed in your picture.My trigonometry is bad , so please when you have time answer my questions . Thanks in advance .
Thanks a lot for your fast reply i still fail to get it xD . Am a student atm at greece Automation Engineer and i still am dumb enough to understand trigonometry . So lets go one more time please :L1 is the armlength of the base servo as you can see in the picture ,L2 is the second servo armlength , so they are kinda different .While φ1 is the angle of the base servo , and φ2 is the angle of the second servo.Is this equation right ?x= L1*cosφ1 + L2*cosφ2 .y=L1*sinφ1 + L2*sinφ2 .if that equation is right am gona need some help to translate it into code , am sorry to put you through this .Although your code seems advanced for my eyes it seems more awsome .. lets give it another try . first you define this int posX = 90, posY = 90; then you say armTo(posX, posY); So the angle of the first and second servo is 90 .And then you calculate this : float h = sqrt(square(x) + square(y)); which seems to be the L3 = Length of the base of the triangle am i right ? Next step you say this : float a1 = (getAngle(ARMLENGTH, ARMLENGTH, h) + atan2(y, x)); So you have a function that takes the armlength of the base servo which in your case is 100 and second also 100 , and the length of that base of triangle which you calculated before the float h , but what is that atan2(y, x) and why you add it to your a1 ? a1 == x ? or y ? I dont see it in your next line : where you calculate a2 float a2 = (getAngle(h, ARMLENGTH, ARMLENGTH)); Also at the getAngle function what is the use of this equation what is it called so i can look it up or something ?return acos((square(b) + square(c) - square(a)) / (2 * b * c)); And finaly the moveServo is a function that you go from the radians to degree because the values you found from before "a2 = (getAngle(h, ARMLENGTH, ARMLENGTH));" is radian , am i right ?I analyzed your code better this time and i hope that i understood it better , i hope ... Please take your time to explain me and thank you so much for your time i really appreciate it .
Join 2 million + to receive instant DIY inspiration in your inbox.
Download our apps!
© 2016 Autodesk, Inc.