variable servo movements for animatronics

Joecolo

New Member
I am trying to make smooth, continuous and variable servo movements for animatronics. I found this program that operates one servo at a time at a fixed rate. Is there a way to make fluid lifelike movements using Picaxe to control servos? I have a project that requires two servos to move at varied rates independently. Space and power is at a premium. Any information would be greatly appreciated.

Thanks Joe

1. symbol delay=30
2.
3. start:
4. servo 2,150
5. pause 1000
6. for b1 = 150 to 180
7. servopos 2,b1
8. pause delay
9. next b1
10. pause 1000
11.
12. for b1 =180 to 150 step -1
13. servopos 2,b1
14. pause delay
15. next b1
16. pause 1000
17. goto start
 

SAborn

Senior Member
By changing the "180" will change the amount of movement and changing the "delay=30" will change how fast the movement is.
The bigger the delay the slower the movement, but i would expect it to get a little jittery in movement steps with big delays.
 

westaust55

Moderator
Welcome to the PICAXE forum.

All analog servos will always travel at the same speed between to point.
To provide the illusion of slower motion the servo is moved in a series small steps between the initial point and the destination point.

Which PICAXE chip are you using?
If it is an M2 part then you can run two separate routines with one in each task (using labels Start0: and Start1: ) so that the two servos can run independent of each other.
 

Joecolo

New Member
Saborn Yes changing symbol delay to 60 will make it go slower, how do I transition the speed up or down smoothly while in motion? Thanks Joe
 

Joecolo

New Member
Westaust 55 I am using the 08M2, I am not familiar with Start0: and Start1: this will help running two at a time. I am looking to ramp the speed up or down while in motion. I’ll give Start0: and Start1: a try, Thanks Joe
 

SAborn

Senior Member
Im not sure what it is you want to do exactly
You could try something like this.

Code:
1. symbol delay=b5. 

     delay = 30
3. start:
4. servo 2,150
5. pause 1000
6. for b1 = 150 to 180
7. servopos 2,b1
8. pause delay
    inc delay
9. next b1
10. pause 1000

11. 
12. for b1 =180 to 150 step -1
13. servopos 2,b1
14. pause delay
     dec delay
15. next b1
16. pause 1000
17. goto start
 
Top