Hi All,
I'm not a coder myself (a friend of mine has been helping me with that part) and I'm new to Arduino and servos. So my hunch is that the problem I'm running into is something simple, but for the life of me my researches on Google and on this forum haven't enabled me to figure it out yet. Hence this post.
PROJECT OVERVIEW
I am building a machine that helps to speed up one of the processes in our new, small business. We have small tubes that are filled with a specific volume of small vegetable seeds, and I have created a small machine that will speed this process up by about 3x when it is up and running. It uses a high torque digital servo (20kg-cm). I've linked to several videos below, as well as to the tech specs for the servo we are using, and the foot pedal we would like to use. **Please note, in the first video I have a Raspberry Pi hooked up to the servo, but I've since switched to an Arduino Uno (along this line, I still need to figure out whether the USB of the foot pedal can be hooked up to the Arduino, and how, to allow me to step on the pedal to command the servo to move).
SEED FILLING MACHINE VIDEO 1: Dropbox - IMG_6613.MOV - Simplify your life
SEED FILLING MACHINE VIDEO 2: Dropbox - IMG_6855.MOV - Simplify your life
SEED FILLING MACHINE VIDEO 3: Dropbox - IMG_6857.MOV - Simplify your life
20kg-cm SERVO SPECS LINK: Amazon.com
SERVO TESTER LINK: Amazon.com
ARDUINO MODEL: Amazon.com
LINK TO SETUP (note that we are now using the Arduino Uno and not the pictured Raspberry Pi--but that the servo issue/phenomenon is exactly the same when connected to either one): Dropbox - IMG_6794.jpg - Simplify your life
ISSUE ENCOUNTERED
As you can see in the video, the servo operates perfectly when connected to the servo testing board and controlled using the built in manual testing/control knob. I need the servo to swing, in total, 119 degrees, from seed loading position (a) to seed dumping position (b).
When we connect the servo to the arduino all we get is erratic jittering that appears to have no pattern at all, though it does stay within the 180 degree motion range of the servo. (I don't have the code that she is using available to me currently, but I can have her send it to me so I can post it, if that helps.)
I would normally think the issue to be code related (and it may very well be), but when we then connect a smaller servo the arduino and run the same exact code, this smaller servo works perfectly and follows the code commands. If it helps, I believe that this code is simply the stock arduino code that can be found online for 'servo sweep'.
This leads me to believe that my digital, high torque servo requires a different kind of code to operate correctly? Or that digital servos require different code from smaller, analog servos (the one we were using is a common, cheap servo called the SG-90 and I believe it is made by Tower Pro).
The high torque servo is powered externally, using a dedicated 6V/2A plugged in power source. The low torque (SG-90) servo is powered from the board directly as it does not have a significant power draw.
Here is a link to a photo of the setup we are using. This photo is from when we were using the Raspberry Pi, but we are now using the Arduino Uno and we are using the exact same setup. I'll also note that we had the exact same servo phenomenon (random jittering the moment you plug the servo signal wire in to the PWM port) when we were using the RPi vs the Arduino Uno.
Lastly, in case this helps, I've used 4 separate servos and they all have behaved this way when connected as described above.
I'd love any help that this forum can offer. Thanks to everyone in advance, I appreciate it!
EDITED
I've pasted (below) the code that was being run on successfully on the SG-90 analog servo but that fails to run the listed high-torque digital servo above. Also attached a photo of the setup to this thread.
#include <Servo.h> //include servo library
Servo myservo; //create servo
int z = 0; //create variable that can be incremented to position servo
void setup() {
myservo.attach(5); //attach servo to pin 5 of the Arduino
}
void loop() {
for (z=0;z<=90;z++) { //increment z from 0 to 90, setting the servo to each value as it goes
myservo.write(z);
delay(5);
}
delay(1000);
for (z=90;z>=0;z--) { //decrement z from 90 back to 0, setting the servo to each value as it goes
myservo.write(z);
delay(5);
}
//full program should spin motor 90 degrees and then return to 0, pause for one second, then repeat
}