Go Down

Topic: sg90 servo deflection (Read 4544 times) previous topic - next topic

Robin2

#15
Feb 16, 2017, 05:22 pm Last Edit: Feb 16, 2017, 06:08 pm by Robin2
My errant HK15178 servo was not tamed by either a pull up or a pull down resistor.

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

Robin2

#16
Feb 16, 2017, 06:13 pm Last Edit: Feb 16, 2017, 06:16 pm by Robin2
I have been chatting online with HobbyKing.

I had not noticed that the tiny HK-5330 is a digital servo and the guy I was chatting with said that the digital servos will not misbehave at startup. He suggested these models
  • hkscm12-5
  • hkscm9-5
  • hkscm9-6
  • turnigytm-tss-10hm-ds

as possible alternatives.

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

septillion

Yep, digital servo's are better at it. That's why I take a SG92 over a SG90. It's his digital brother :)
Use fricking code tags!!!!
I want x => I would like x, I need help => I would like help, Need fast => Go and pay someone to do the job...

NEW Library to make fading leds a piece of cake
https://github.com/septillion-git/FadeLed

Robin2

My old Hitec is certainly not digital but it is house-trained :)

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

colubridae

Thanks for all replies.

For the moment I'm postponing (not abandoning) the vertical axis movement and going with PWM on the windmill sails only.

Will continue my attempts at a later date.

Nice to know there's lots of help available.

thanks again
Saddo railway nerd (65yrs)

Robin2

I have not yet had time but I plan to test whether the problem is reduced when there is no bootloader code on an Atmega MCU. That should mean that it gets to the servo.attach() in a millisec or less.

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

colubridae

Hi all.

Can I ask for more advice please.

My servo problem is now slightly different.

The sudden surge of 20 degrees at power-up I can now cure by two steps:-

a) performing a servo.write before the servo.attach
b) by applying power to the servo after the two servo commands in step (a) above.

This gives a very slight kick as mentioned by ALKA's reply above.

Step b) is achieved by using a software controlled power-up pin used for another purpose (that is for IR leds used to provide beams for railway signals 'interrupts'. The leds are controlled through a ULN2003 darlington array. All the inputs to the array are ganged to the aforementioned 'power-up' pin -pin 2 on my arduino mega.)

 my idea was to apply power to the servo via the ULN2003 via the 'power-up' pin 2.

This works as planned and does stop the servo jump at power-up.

BUT (there's always a but) now the servo buzzes. If I connect the power leads of the servo directly to external power supply the 'buzz' disappears but the jerk returns because I cannot delay the servo power-up.

Is there something I can do to continue with my 'software' control idea?

Would a capacitor across the servo power leads solve the problem? (i've not tried it in case I cause damage - at the edge of my knowledge and understanding).

hope that all makes sense

Ps in case someone asks the servo negative is connected to the ouput of the ULN2003 and the positive connected to my 5V rail.

Many thanks ins advance.

Saddo railway nerd (65yrs)

alka

Have you tried servo.detach after its moved where you want it?

How is the ground connected to the Arduino? Is it connected to the servo negative or the uln2003 ground?

colubridae

Have you tried servo.detach after its moved where you want it?

How is the ground connected to the Arduino? Is it connected to the servo negative or the uln2003 ground?
Have not tried detach. Will now do so.


(I've got several 'sort of' sub-systems on the model layout. I've used a 'recycled' PC power supply for all these sub-systems. So that all grounds are tied together. Or should be. The arduino ground is connected to the ULN2003 ground.

Servo negative is connected to the number six output of the ULN2003 - ULN2003 number six input is connected to the 'power-up' pin of the arduino. Positive of the servo is connected to the 5V rail.)

will let you know on the detach.
Saddo railway nerd (65yrs)

Robin2

Ps in case someone asks the servo negative is connected to the ouput of the ULN2003 and the positive connected to my 5V rail.
Why not just use a relay?

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

alka

Why not just use a relay?

...R
Probably because we both told him a transistor would be better!

Robin2

#26
Feb 25, 2017, 09:15 pm Last Edit: Feb 25, 2017, 09:15 pm by Robin2
Probably because we both told him a transistor would be better!
Fair enough. I had forgotten.

@colubridae, another thing that just occurred to me - you say "Servo negative is connected to the number six output of the ULN2003". That probably means that the servo power GND is not the same as the signal GND. Put the ULN2003 (or a simple transistor) on the + side of the servo power supply.

And I assume you are NOT powering the servo from the Arduino 5v pin.

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

colubridae

Fair enough. I had forgotten.

@colubridae, another thing that just occurred to me - you say "Servo negative is connected to the number six output of the ULN2003". That probably means that the servo power GND is not the same as the signal GND. Put the ULN2003 (or a simple transistor) on the + side of the servo power supply.

And I assume you are NOT powering the servo from the Arduino 5v pin.

...R
The servo +ve is connect to an external 5V rail.

Servo ground is definitely not the same as arduino ground, therefore not the same as the signal ground. I had stupidly not considered this. If my understating is correct the current must run up from the ground of the ULN2003 to its output pins.

ULN2003 must be (and is) grounded the same as arduino ground (i think). I suspect you have pinpointed the problem right there, though. For this to work as I want I will have to stop using the spare 'port' on the ULN2003 and simply use a separate transistor between the servo and the positive rail.

The 'strange' thing is that using the ULN2003 works as expected - except for the buzzing.

Should I browse rapid online (I buy all my stuff there) and look for an NPN transistor to switch power to the servo on and off? (the whole point of the software controlled on/off is to prevent the  servo startup jerk) - I assume I can still use the voltage from the 'power-up' pin (pin 2) whilst that voltage also still being used for my ULN2003 powering my IR lEDs?

That is pin 2 voltage runs to the base of the transistor, emitter to the positive of the servo and collector to the 5V rail.

many thanks for your help. :)
Saddo railway nerd (65yrs)

alka

#28
Feb 26, 2017, 12:25 am Last Edit: Feb 26, 2017, 12:33 am by alka
I was wondering how it would go with the darlington. It has a 1.2v drop so the servo would be getting a signal that was -1.2 to 3.8 compared to its ground if it was getting a 0 to 5v input. A MOSFET for its low resistance or even a PNP would work. If you switch before the servo the grounds are the same.

colubridae

I was wondering how it would go with the darlington. It has a 1.2v drop so the servo would be getting a signal that was -1.2 to 3.8 compared to its ground if it was getting a 0 to 5v input. A MOSFET for its low resistance or even a PNP would work. If you switch before the servo the grounds are the same.
Thanks ALKA
Saddo railway nerd (65yrs)

Go Up