Hello everyone! I'm a bit of a novice to Arduino programming as this is only my second project .

Basically, I have four servos connected to an Arduino, and I would like their speed to be regulated by a Ping ultrasonic proximity sensor.

At the moment, my code enables me to control all Servos manually by inputing values for speed. Pretty much I would like to move the servo, measure a distance, change speed, move the servo, measure a distance, change speed etc. That way if I move close to the servo's they gradually move to a halt, and as I step away they gradually build up speed.

Can this be done? Would anyone be willing to modify my code to implement the Ping changing Servo speed for a negotiable amount of $?

Please email me at fathersonholyghostarts@gmail.com with any bids or questions.

I would post my code below but I don't know how to post seperate tabs of code in the forum.

do you actually mean Servos, generally these are thought of as the thing that is used in RC projects and their speed is not normally controlled but their position is with PWM and is maintained using an internal closed loop feedback in the servo itself.

I can help, what is your budget.

Cheers Pete.

EmbeddedAT .. From Concept to Prototype to ProductionElectronics and firmware design and project mentoringI do answer personal requests for help when accompanied with a PayPal receipt

Yes I do indeed mean servos. Lame old cheap 180 degree servos. I know they are not the most precise, or in any way the most reliable motors out there - at the moment I'm really just out to build a proof of concept but I can't adjust the code accordingly.

I'm not entirely sure how but I am definitely able to adjust the speed of the servos...Maybe it has to do with altering the frequency of the internal loop?

It would probably make more sense if I showed you the code I already have:

servo[roll].attach(2); // attaches the servo on pin 9 to the servo object servo[pitch].attach(3); // attaches the servo on pin 9 to the servo object servo[yaw].attach(4); // attaches the servo on pin 9 to the servo object servo[Boo].attach(5); // attaches the servo on pin 9 to the servo object

And as for the budget, I really wouldn't know - I can't really gauge how difficult a task this would be for someone to code.... I also don't know what people usually ask for in these kind of scenarios....

If you can vary the speed of the servos by altering a delay in between the setting of the Pulse width that sets the position of the servo just link this delay to the results from your ultrasound sensor.

You can use the map function to map an input range from the sensor to an output range that fits in with how fast/slow you want to move the servo.

Cheers Pete.

EmbeddedAT .. From Concept to Prototype to ProductionElectronics and firmware design and project mentoringI do answer personal requests for help when accompanied with a PayPal receipt

What I need to do makes sense in my mind (mapping a range from the sensor, working out an input range for the speed of the servo, and linking the two together) - the issue is I don't know how to modify the code in order to do that.

Any suggestions would be really helpful....

- I know I need to define the sensor (aka assign it a name).

- Link it to pin, and set it as an input pin.

- Work out the input range of the sensor and map that to an output range for the servo speed.

I posted the code I have for controlling the speed of the servos a few posts back. The portion of the code where I physically input a value for speed is in the 3rd tab "loop", where I can change the 'servoSpeed[roll]= 1;' section.

Inches is indeed a global variable. I would like the speed of all the servo's (roll, pitch, yaw, & boo) to be equally affected by the change in distance (defined in inches).

For example, if I'm 10 inches away from the sensor, I would like the speed of all the servos to be 1 ( servoSpeed[roll]= 1, servoSpeed[yaw]= 1 etc.) If I increase that distance to 20 inches, all the servo's speed would change to 2.

To summarize it:

-All the servos are moving at equal speeds.

-The value for speed is directly proportional to the distance in inches from the sensor.