Pages: 1 [2]   Go Down
Author Topic: Simple project, willing to pay $$$ for basic coding - 4 Servos + Ping)))  (Read 4457 times)
0 Members and 1 Guest are viewing this topic.
Miers 46500 France
Offline Offline
Sr. Member
****
Karma: 14
Posts: 306
EmbeddedAT .. From Concept to Prototype to Production
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Code:
        servoSpeed[roll]= inches/10;
        servoSpeed[pitch]= 2 * inches/10;
        servoSpeed[yaw]= 2 * inches/10;
        servoSpeed[Boo]=  inches/10;

If they are all to be the same speed then the code needs to be ...

Code:
        servoSpeed[roll]= inches/10;
        servoSpeed[pitch]=  inches/10;
        servoSpeed[yaw]=  inches/10;
        servoSpeed[Boo]=  inches/10;

although it might be quicker to calculate it once and use it several times

Code:
        int Speed = inches/10;
        servoSpeed[roll]= Speed;
        servoSpeed[pitch]= Speed;
        servoSpeed[yaw]= Speed;
        servoSpeed[Boo]=  Speed;

Cheers Pete.
Logged

EmbeddedAT .. From Concept to Prototype to Production

Electronics and firmware design and project mentoring

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

Thank you so much everyone for all your support! Using the code that you guys suggested the servos now communicate with the sensor and it all works beautifully.....except for one small thing.

For some reason the servo's movement is now really jittery, especially when working at higher speeds. I don't know if its an issue with the code (somewhere in the loop prompt), or if its the batteries which cannot provide enough amperage for the servos under heavy loads (the battery pack is 4 AS's).

If anyone has an idea why this might bee, some suggestions to resolve the problem would be highly appreciated.

Thanks a million,

Michael
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 601
Posts: 48556
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
or if its the batteries which cannot provide enough amperage for the servos under heavy loads (the battery pack is 4 AS's).
Ooh, ooh, I know. It isn't the software.
Logged

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

So four AA's is not a good way to power the servos? Could any one suggest an alternative capable of providing the charge necessary? 
Logged

Miers 46500 France
Offline Offline
Sr. Member
****
Karma: 14
Posts: 306
EmbeddedAT .. From Concept to Prototype to Production
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
or if its the batteries which cannot provide enough amperage for the servos under heavy loads (the battery pack is 4 AS's).
Ooh, ooh, I know. It isn't the software.

Oddly enough it could well be the software  smiley-confuse If the timing loop that is setting the time between the PWM is too long the servos stop trying to seek, they go into no resistance mode. If the servos are under a small load that causes them to move off the desired point slightly when this happens then they will indeed jitter or oscillate about the desired point.

But then a really big battery might fix it too  smiley-lol

Cheers Pete.
Logged

EmbeddedAT .. From Concept to Prototype to Production

Electronics and firmware design and project mentoring

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 601
Posts: 48556
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Could any one suggest an alternative capable of providing the charge necessary?
I'd suggest that you think about where the servo you are using was intended to be used. Most likely, the place you got it from also sells RC cars, trucks, boats, airplanes, and helicopters. You'll notice that none of them use 4AA batteries. They use big, rechargeable batteries.

Why? Because servos need a lot of current, and 4AA batteries just can't provide the needed current. Look at the batteries available from the same vendor you got your servo from, and pick one of them. Matched to your servo's voltage and current requirements, of course.
Logged

Pages: 1 [2]   Go Up
Jump to: