With Instructables you can share what you make with the world, and tap into an ever-growing community of creative experts.
We have a be nice comment policy. Please be positive and constructive.
We noticed you attached photosto your comment.
You change the output angle command over time more slowly. Servo motors are controlled with a pulse that's between 1000uS and 2000uS, which sets the angle of the shaft. Ideally the pulse would cause the shaft of the motor to reach the correct position instantly.
So the way you would do it is after importing the servo library (which is really unessesary since you can really just do digitalWrite(sensePin, HIGH); delayMicroseconds(value); digitalWrite(sensePin, LOW);
You have the "value" variable increment up and down. This will increment the angle in proportion to how fast the code loops, which may be undesirable. I've not dealt with arduino in a while but there may be a function which creates a busy loop until a timer resets which effectively caps the maximum speed of the void loop() function.
You can use timers and interrupts which causes the increment/decrement code to run at specified time intervals much more precisely, by attaching an interrupt on an unused timer, which itself if configured to count up to a certain 16 bit unsigned integer value with a clock divider set appropriately to create as much or little delay as you want! :) As you can tell this does get a bit technical and advanced, involving ports, registers, flags, timer configurations, etc. But it's the best solution as well as it leaves your code to run independantly.
Small and fast stepper motors with a worm drive might be a better solution unless your arm is too small....
I'm relatively new to Arduino myself so you will no doubt get a better answer from someone else, but I'll try to offer some help if I can.
First of all remember that the speed at which a servo can move is determined by the specific servo (i.e. different servos can have varying specs and speeds), consult the datasheet for your chosen servos to confirm this. Also the physical load on the servo can have an effect on the speed.
To vary the speed from Arduino you could consider using a modified servo library that includes speed control. I've provided a link below, but note that this is a few years old and things may have changed in the current servo library since then, but it's probably worth a shot.
Control Arduino Robot Arm with Android App
Using an Arduino Drawing Robot with Hour of Code Tutorials
Robot Arm Arduino App
How to Make an Obstacle Avoiding Robot
Arduino: sensitive robot
Beginners guide to building Arduino robots with Bluetooth and Android
Arduino - Robotic Arm Control with a Potentiometer
Wireless gloves that controls a robot by moving your fingers
How to Build Obstacle Avoiding Robot For Beginners With Arduino Tutorial
bowie dancing robot
Posted:Feb 19, 2017
Join 2 million + to receive instant DIY inspiration in your inbox.
© 2016 Autodesk, Inc.