Servo myservo; // create servo object to control a servo
// twelve servo objects can be created on most boards
int pos = 0; // variable to store the servo position
void setup() {
myservo.attach(9); // attaches the servo on pin 9 to the servo object
}
void loop() {
for (pos = 0; pos <= 180; pos += 1) { // goes from 0 degrees to 180 degrees
// in steps of 1 degree
myservo.write(pos); // tell servo to go to position in variable 'pos'
delay(15); // waits 15ms for the servo to reach the position
}
for (pos = 180; pos >= 0; pos -= 1) { // goes from 180 degrees to 0 degrees
myservo.write(pos); // tell servo to go to position in variable 'pos'
delay(15); // waits 15ms for the servo to reach the position
}
}
this is the default sweep code.
my signal is on pin 9
ground is ground
hot is 3.3 ( or 5 ) neither do anything different.
I would expect one of those to work when plugged in in place of a regular servo.
Have you any other means to test it so you can be sure it is not faulty?
You should not really power any servo from the Arduino 5v pin as it is not intended for the currents required by motors. Give servos their own power supply with a common GND with the Arduino. A pack of 3 or 4 AA cells should be suitable for testing. After reading Reply #6 this may be wrong. I was assuming it used the standard servo supply voltage.
In general those servos work normally with the same signals as a standard servo...but they are quite fragile. If you're isn't doing anything then it's probably broken. Check if the motor seems to be trying to turn but the slider isn't moving. They do sometimes stick and just moving the slider a little can free them up.
OTOH if you've been running it on 5V with it stalled you may have burnt it out. They're only intended for a single lipo - 4.2V max.
Are you sure you haven't fastened the servo to something that is preventing the cog on the end from moving? Trying to stick those servos down with double sided tape or similar will often stop them dead because of that.
One thing you can try is turning the bigger white cog on the end manually and checking that the slider can move freely. If not you need to look for why.
BTW I've just checked one of my Spektrum linear servos (older 1.5g version with smaller motor) with Sweep and it works fine.
That looks like its using a tiny slotless coreless motor, they can take 2A at stall, you need a supply
that's good for that. This is the sort of motor used in micro quad-copters and has a very high
power rating for its size. It will be easy to burn it out.
The servo is not attached to anything, just dangling on it's wire. Turning the wheel when no power is applied lets it go back and forth with no issues.
Slipstick, are you using external power for the servo?
Thank you MarkT, I'll get a power supply setup externally and try. 2A???? that thing is as big as my thumbnail.
O.K. I checked mine again and I can't even guess what's happening with yours. You say the slider moves freely back and forth when you turn the end cog, which implies that the motor pinion is also turning freely. But when motor is powered it makes a grinding noise and doesn't turn the pinion/cog i.e. nothing moves.
The motors on both servos must be dead in some odd way so maybe 5V will kill them even more rapidly than I thought.
I've had problems with those linear servos both standalone and on the receiver boards but always something physically jamming the slider or something else or else a wire breaking. Yours is an odd one.
@deezle, have you shown us a wiring diagram? I would like to see how you have the servos wired, powered and such.
Pencil, paper and a camera is good enough if you include details like pin numbers where wires attach.
deezle:
new servo does nothing when plugged into heli
Wait, what? I would have expected that a good servo, hooked into a known good RC radio system, would perform as expected.
Is your blade a known good system? Do you have any servos that work with that receiver?
And yes, your ground will be connected to 3 things, battery, servo and arduino. You conveniently have a pin on that black wire that can be inserted into the header for GND on the arduino.