Author Topic: Servo problems, read the forum, no joy, help!...  (Read 8795 times)

RBSe

  • Newbie
  • *
  • Posts: 8
Servo problems, read the forum, no joy, help!...
« on: April 22, 2014, 05:41:42 pm »
I've read all the forum has to offer but i'm still not getting my servos to work.
none of the includes seem to work, i just get a jump of about 10 degrees in the same direction, once between resets.
the servos are EMAX ES08 MA II Analog Servo mini type w/metal gears.
Also when i launch the program the servos jump and then resets the digispark.
I read somewhere the digispark has a 500ma regulator, my servors draw 200ma max at 60 degrees of travel, that should be enough(?)
maybe?
i noticed that the digispark has 3 PWM outputs, 2 of which are at 504Hz, and 1 at 1007Hz, i'm using the 2 504Hz channels, is that the problem with this servo?
I'm up for any help at all at this point and it would be much appreciated...

Robert
.

gogol

  • Sr. Member
  • ****
  • Posts: 398
Re: Servo problems, read the forum, no joy, help!...
« Reply #1 on: April 22, 2014, 11:59:39 pm »
I read somewhere the digispark has a 500ma regulator, my servors draw 200ma max at 60 degrees of travel, that should be enough(?)
maybe?
Even when the digispark has an 500mA regulator, that does not make the attiny85 supporting this current on its pins!
Per pin there is a max. current of 40 mA (Chapter 21 of the attiny85 datasheet, "Electrical Characteristics")!

If there is no transistor in between, be happy if you have not fried your digispark!

The regulator provides more power, than the attiny85 needs. So you should be able to drive your servo over the regulator, but not direct from an attiny-pin!


RC Navy

  • Jr. Member
  • **
  • Posts: 54
  • When you like, even too much, it is not enough!
Re: Servo problems, read the forum, no joy, help!...
« Reply #2 on: April 23, 2014, 12:14:05 pm »
Hi RBSe,

Could you please post your sketch.
You cannot use regular PWM (analogWrite) to drive servos.
For servos, command and power are different:
- Servo signal requires few µA,
- Servo + and - can require x 100 mA.
The Digispark can drive easily a little servo.

RBSe

  • Newbie
  • *
  • Posts: 8
Re: Servo problems, read the forum, no joy, help!...
« Reply #3 on: April 23, 2014, 02:41:55 pm »
Thanks for your responses so far...

I have used all the pre-written sketches that have to do with servos that i could find and the only modifications made were to match the right pins...

Here is an example:

Code: [Select]
#include <SoftRcPulseOut.h>
SoftRcPulseOut servo1;

int led = 2;  // LED on P2

void setup() {               
  // initialize the digital pin as an output.
  pinMode(led, OUTPUT);     
  servo1.attach(0);  // servo on P0
  servo1.setMaximumPulse(2200);

}

void loop() {
uint32_t StartMs;

  digitalWrite(led, HIGH);   // turn the LED on (HIGH is the voltage level)
  servo1.write(30);  // move servo to 30 degrees
  /* Refresh pos during 2 sec */
  StartMs=millis();
  while(millis() - StartMs < 2000UL)
  {
    SoftRcPulseOut::refresh(); //without argument, refresh occurs every 20 ms (internal to the lib)
  }

  digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW
  servo1.write(130);  // move servo to 130 degrees
  /* Refresh pos during 2 sec */
  StartMs=millis();
  while(millis() - StartMs < 2000UL)
  {
    SoftRcPulseOut::refresh(); //without argument, refresh occurs every 20 ms (internal to the lib)
  }
}

no joy...
it just jumps about 10 degrees in the same direction....
?
If you know of other code to try, pass it on please...

Robert
.

RBSe

  • Newbie
  • *
  • Posts: 8
Re: Servo problems, read the forum, no joy, help!...
« Reply #4 on: April 23, 2014, 02:49:45 pm »
Thanks Gogol,  only the signal wires is connected to a pin, the +5vdc and GND are tied to the busses...

gogol

  • Sr. Member
  • ****
  • Posts: 398
Re: Servo problems, read the forum, no joy, help!...
« Reply #5 on: April 24, 2014, 03:00:40 am »
Ok, that was not so clear in your statement.
As RC Navy told, posting code and schematics makes the question much more clear
« Last Edit: April 24, 2014, 03:59:34 am by gogol »

RC Navy

  • Jr. Member
  • **
  • Posts: 54
  • When you like, even too much, it is not enough!
Re: Servo problems, read the forum, no joy, help!...
« Reply #6 on: April 24, 2014, 10:52:40 am »
Hi RBSe,

I've just tested the code you posted: it works perfectly on my Digispark with a Futaba servo S3003: every 2 seconds, the motion is around 100° as expected.

If you played with high speed HW PWM, maybe you changed the MS_TIMER_TICK_EVERY_X_CYCLES value in wiring.c file in

/Your_Installation_Path/Digispark-Arduino-1.0.4/hardware/digispark/cores/tiny/

For <SoftRcPulseOut.h> library, the MS_TIMER_TICK_EVERY_X_CYCLES shall be set to 64 (the default arduino value):

#define MS_TIMER_TICK_EVERY_X_CYCLES  64

If you set it to a lower value, this can explain the behaviour of your servo.

If the MS_TIMER_TICK_EVERY_X_CYCLES value is already set to 64, it seems you have a wiring/hardware issue between the Digispark and the servo.

Another reason, can be the current drawn by the servo, try an external power supply rather than the built-in 5V. (You must connect the GND of the external power supply with the GND of the Digispark).


RBSe

  • Newbie
  • *
  • Posts: 8
Re: Servo problems, read the forum, no joy, help!...
« Reply #7 on: April 25, 2014, 09:58:10 am »
Hi RC Navy, thanks for your assistance...

I have looked at the "wiring.c" file and verified it is set to 64.

The servo has a brown wire which is tied GND, orange is tied to +5 (center pin), and the yellow is the signal wire off P0, to the best of my knowledge of the color code.

If that is wrong how do i test it?

I thought the voltage and current is derived from the USB port which uses the power supply in the computer, so how can i draw too much power, please explain why i need an external power supply...???

Just to be sure, i ran the sketch again and as soon as the signal to move the servo starts it jumps about 10 degrees clock-wise, looking at the shaft, and resets the digispark, and that loops....

I appreciate your help...

RC Navy

  • Jr. Member
  • **
  • Posts: 54
  • When you like, even too much, it is not enough!
Re: Servo problems, read the forum, no joy, help!...
« Reply #8 on: April 25, 2014, 10:40:51 am »
Hi RBSe,

I did'nt know this model of servo. However, it seems your wiring is correct.

Quote
I thought the voltage and current is derived from the USB port which uses the power supply in the computer, so how can i draw too much power, please explain why i need an external power supply...

When the motor starts, it draws "lots" of current (peak), if the power supply is not powerful enough, the voltage drops, and your Digispark reboots.

With my laptop, I can drive at least up to 3 x Futaba S3003 without any issue, but Futaba is known for producing "high quality" servos.

Usually, the max current available through USB is around 500mA.

Maybe your servo requires around or more than 500mA as peak current?
That's why, you can try to use an external power supply which will prevent your Digispark to reboot.

RBSe

  • Newbie
  • *
  • Posts: 8
Re: Servo problems, read the forum, no joy, help!...
« Reply #9 on: April 25, 2014, 01:05:02 pm »
Hi RC Navy,

the Futaba servo S3003 you mentioned is not a mini servo, but at this point i'm desperate to get this working before the end of the month deadline.

Do you know of a vendor that sells the Futaba servo S3003 with 2-3 day delivery...?

i need to drive 2 of them, will the digispark handle 2...?

I do have a 2 amp dc/dc power source if i need that, and can i have the usb and the power supply connected at the same time, and connected to what pin...?

Thanks

RC Navy

  • Jr. Member
  • **
  • Posts: 54
  • When you like, even too much, it is not enough!
Re: Servo problems, read the forum, no joy, help!...
« Reply #10 on: April 25, 2014, 01:34:28 pm »
As your mini servo is very cheap, can you please open the bottom cover. Take a picture and post it. The aim is to check if internally the wires are properly soldered and not swapped.
The last assumption, I make is that at least 2 wires are swapped. This means that when the motor starts it takes its energy from the Digispark control pin rather than the power supply (+5V) pin. This also can explain a reboot of the Digispark.

For your information, I also used small servos: Tower Pro S90 and it works fine with the Digispark.
That's why I suspect you have a faulty servo (out of order or with swapped wires).
Quote
i need to drive 2 of them, will the digispark handle 2...?
Obviously, I already made some tests with 3 Futaba S3003 on the same Digispark and powered through the USB of my laptop.
Quote
At this point i'm desperate to get this working before the end of the month deadline.
Do you know of a vendor that sells the Futaba servo S3003 with 2-3 day delivery...?
Unfortunately no, maybe some forum members know?

RBSe

  • Newbie
  • *
  • Posts: 8
Re: Servo problems, read the forum, no joy, help!...
« Reply #11 on: April 25, 2014, 04:59:37 pm »
Thanks guys for all your help,

The problem was cheep china servos AND not enough power through the USB port...
I was surprised to find a good hobby store in my little town, problem solved...
All is well once again... 8)

Robert
RBSe
.