Pages: [1]   Go Down
Author Topic: Simultaneous and Gradual Servo Control  (Read 2421 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Florida
Offline Offline
God Member
*****
Karma: 2
Posts: 559
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Offline Offline
Newbie
*
Karma: 1
Posts: 14
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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 smiley-sad
-pb
« Last Edit: September 02, 2013, 11:41:25 am by piratebrian » Logged

Pages: [1]   Go Up
Jump to: