Go Down

Topic: Simultaneous and Gradual Servo Control (Read 2583 times) previous topic - next topic

Tezcatlipoca

Hello,
I've been struggling with controlling multiple servos at the same time with different speeds and angles for quite a while and i finally gave up trying on my own and wanted to ask for your help.
This is my goal;
Imagine we have 4 time periods t1,t2,t3 and t4.
The first servo will move forward from 40 degrees to 100 degrees in t1 and go back to 40 degrees gradually in t2,t3 and t4. So if it moves 3 degrees per step in t1 it should move 1 degree per step in other periods.
The second servo will do the same thing but it should start moving forward in t2
And so on; servo 3 moves forward in t3 and servo4 moves forward in t4 and the whole process loops seamlessly.

I'm fairly new to arduino and programming so maybe I'm missing a basic step. I've tried for loops but they seem to interrupt each other. I tried to use millis() method but the interruption seemed to persist.

P.S: I do not want to control them via serials, as mentioned in several similiar questions.

Drew Davis

This helped me build something similar to what your working on…
http://forum.arduino.cc/index.php?topic=61586.0

Tezcatlipoca

I think I got it to work, that library seems very useful. Thank you.

piratebrian

#3
Sep 02, 2013, 08:57 am Last Edit: Sep 02, 2013, 06:41 pm by piratebrian Reason: 1
I (may) have solved this problem with controlling multiple servos with the addition of speed control, smooth sine wave movement, and added time delay between when servos start their motion.   The code has limitations as listed and is very bloated, but it works.    I hope this helps.  
http://forum.arduino.cc/index.php?topic=184377.0

-correction-
you will need to adjust a couple things to my code to accomplish your tasks.    That code will have to have a more array based individual servo motion with a slightly different speed setup per activity, along with an overlapping repeat cycle of movement.   I see the limitations of my code to your application and the code would require spline servo position stitching which it also does not do :(
-pb

Go Up