servo not working

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 2 and 3.

Moderators: Benj, Mods

Post Reply
User avatar
achillis1
Posts: 347
Joined: Thu Oct 09, 2008 9:19 am
Has thanked: 91 times
Been thanked: 8 times
Contact:

servo not working

Post by achillis1 »

Hello,

I have the servo board and attached a 60 degree servo. I did a simple flowcode routine to move the servo to right and left continuously. After a gazillion tries ( I do not know why it did not work from the first tries) the servo motor moved! After I left the laptop and e-blocks board untouched for a week or two and when I powered up the board again then it could not work! I resent the routine again but nothing. After I got a 360 degree servo and tried to send the precompiled test file from flowcode and nothing happens.
I checked with a multimeter the voltages accross the servo board and seem to be OK. I run the routines in flowcode and the simulation is working but real life not!
note: I installed flowcode in another PC and sometimes the simulation on both PCs could not behave as expected( servos not moving)
Is there something else I have to do to work with servos? Any patch? ANy trick?

Now I got errors such as ECIO not installed, ECIO continuously blinking, the eb006 board with 16f877a cannot connect(usb cable not connected).

I send simple routines such as write on LCD and the chips are working but with servos not.

Any ideas?

Thank you in advance,

Best Regards,

Achillis

User avatar
Jan Lichtenbelt
Posts: 797
Joined: Tue Feb 17, 2009 8:35 pm
Location: Haren GN, the Netherlands
Has thanked: 128 times
Been thanked: 264 times
Contact:

Re: servo not working

Post by Jan Lichtenbelt »

Dear Archillis,

Try this flowcode with 1 msec pulses for 1 sec and 2 msec pulses for 1 sec etc. etc. The repetition frequency of the pulses is 50 Hz.

Kind regards

Jan Lichtenbelt
Attachments
Test_servo.fcf
(5 KiB) Downloaded 675 times

User avatar
achillis1
Posts: 347
Joined: Thu Oct 09, 2008 9:19 am
Has thanked: 91 times
Been thanked: 8 times
Contact:

Re: servo not working

Post by achillis1 »

Hello Jan,

I appreciate that you uploaded the file.
I will try it as soon as I manage to upgrade flowcode from v3 to v4 because I have some registration issues.
I will let you know if it worked.

Thank you,

Best regards,
Achillis

User avatar
achillis1
Posts: 347
Joined: Thu Oct 09, 2008 9:19 am
Has thanked: 91 times
Been thanked: 8 times
Contact:

Re: servo not working

Post by achillis1 »

Hello Jan,

Nothing happended running your programme!
A note though, I connected the servo on the servo board and not directly to the PIC.

Thank you.

User avatar
achillis1
Posts: 347
Joined: Thu Oct 09, 2008 9:19 am
Has thanked: 91 times
Been thanked: 8 times
Contact:

Re: servo not working

Post by achillis1 »

Hello Jan,

I tested your program againand it worked fine!
Already thanked the post.
Tell me, how can you achieve the servo to change its direction?

By the way do you have any idea how to make the servo rotate to a specific angle and freeze there? I do not need it to continuously rotate.

Thank you in advance,

Best Regards
Andreas Achilleos

Spanish_dude
Posts: 594
Joined: Thu Sep 17, 2009 7:52 am
Location: Belgium
Has thanked: 63 times
Been thanked: 102 times
Contact:

Re: servo not working

Post by Spanish_dude »

Hi,

A servo motor uses a PWM to set it's position.
A period of 20ms and a Ton not exceeding the 2ms is the basic PWM to drive the servo.

"Playing" with the value of Ton will move the servo to an angle, and it will stay there, unless you change the Ton value.

Hope this helps.

Regards,

Nicolas L. F.

PS: Remember that servo motors do not rotate 360° (some of them do turn 360°, I know, but I'm talking about the "most common" servos) and more, like a normal motor. Most of the servos rotates ~180°.

User avatar
achillis1
Posts: 347
Joined: Thu Oct 09, 2008 9:19 am
Has thanked: 91 times
Been thanked: 8 times
Contact:

Re: servo not working

Post by achillis1 »

Hello,

Thank you for you reply.
I have searched a little bit in the Net and somehow I get the general idea.
I know that the common servos rotate 180 degrees and less but the servos I have can rotate 360 from factory.
Now the thing with driving the servo is that when I send high to my servo via the port pin for 1ms and then zero for 19ms =total 20ms required to drive the servo, the servo moves but does not have an accurate stepping. Gets the pulse and then whenever it stopps from luck of power. If you keep sending the pulse within a loop then the servo keeps rotating and does NOT keep the specific angle and freezes there. Whatever value is the pulse then the servo just rotates.
Only if I send a command via the flowcode servo component macro I can play with the speed of the servo.
Ex. if I send the value 1 then the servo rotates clockwise with full speed and if I send 118 then the servo does not move and if I send 150 it rotates anti clockwise.
In order to rotate the servo and then make it to stay there, then I must add a ''disable servo'' macro in the routine BUT I can NEVER make it to rotate from one angular position to another that I wish and make it to stay there.
Say for example if the servo is at zero point to make it go to 96 degrees and stay there.

Best Regards.

Spanish_dude
Posts: 594
Joined: Thu Sep 17, 2009 7:52 am
Location: Belgium
Has thanked: 63 times
Been thanked: 102 times
Contact:

Re: servo not working

Post by Spanish_dude »

When the servo turns clockwise (or anti-clockwise) does it turns more than 360° ?

If it does, then I think that's a modified servo and a modified servo will stop only if you don't send a pulse to it.

User avatar
achillis1
Posts: 347
Joined: Thu Oct 09, 2008 9:19 am
Has thanked: 91 times
Been thanked: 8 times
Contact:

Re: servo not working

Post by achillis1 »

Whell it turns more than 360 degrees.
I have another that rotates up to 60 degrees I will check that.

User avatar
Jan Lichtenbelt
Posts: 797
Joined: Tue Feb 17, 2009 8:35 pm
Location: Haren GN, the Netherlands
Has thanked: 128 times
Been thanked: 264 times
Contact:

Re: servo not working

Post by Jan Lichtenbelt »

Dear Achillis,

A servo can move about 180 degrees. You can make a real motor of it by removing the meachnical stop in the servo. I found an arctible (in Dutch) to get that fixed. Than you can rotate 360 degrees and more.

Good luck

Jan Lichtenbelt

http://duteela.et.tudelft.nl/~elca/Xili ... vohack.pdf

But there also english sites. Try Google with remove stop servo, or something like that

User avatar
achillis1
Posts: 347
Joined: Thu Oct 09, 2008 9:19 am
Has thanked: 91 times
Been thanked: 8 times
Contact:

Re: servo not working

Post by achillis1 »

Helo Jan,

Thanks for the link but I already got a servo that rotates at 360 degrees. Actually there are servos that rotate at 60, 180 and 360 degrees.

About your program you attached, can I make the servo rotate at different sppeds?

Thank you

Spanish_dude
Posts: 594
Joined: Thu Sep 17, 2009 7:52 am
Location: Belgium
Has thanked: 63 times
Been thanked: 102 times
Contact:

Re: servo not working

Post by Spanish_dude »

Hi,

To make a servo rotate faster you'll need to reduce the period of the signal (I'm noth sure 100%).

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: servo not working

Post by Benj »

Hello,

The servo will move as fast as it can to the position specified. Therefore to increase or decrease the speed of the servo you need to interpolate between your values.

Moving directly 0 to 255 will be full speed

Using the auto move to position hardware macro allows a fixed speed slower then direct move to speed to be used.

Using the move to position hardware macro allows you to define the speed the motor moves by how often you call the macro. Eg calling more often will move the servo faster.

User avatar
achillis1
Posts: 347
Joined: Thu Oct 09, 2008 9:19 am
Has thanked: 91 times
Been thanked: 8 times
Contact:

Re: servo not working

Post by achillis1 »

Hello,

Is there a value to use with the automove command in order for the servo to move at the right end and a value to move at the left end?
I use the automove with byte value 220 and the servo almost moves all the way to the left end; but if I include a macro with auto move byte value 0 or up to 50 then the servo does not move to the right end.
Right or left I am using just to explain.
Using the move to position hardware macro allows you to define the speed the motor moves by how often you call the macro. Eg calling more often will move the servo faster.
So when using once the move command the servo will not go to that position? I will have to keep calling the macro do achieve that?

Thank you.

User avatar
achillis1
Posts: 347
Joined: Thu Oct 09, 2008 9:19 am
Has thanked: 91 times
Been thanked: 8 times
Contact:

Re: servo not working

Post by achillis1 »

By the way, I have left aside the 360 degress servo and connected the 180 degrees one so we can talk right.
I know that is working.
So far with macros I am not doing great but with the attached fcf file if you see the servo is working as predicted. When I press 1 on keypad then it moves rightwards and stops immediately. When I press 2 then moves at the other side. I have to keep pressing the key in order for the servo to stop immediately, if I press it very quickly then it tries to move to that position but due to inertia it passes the stop point. Note that the servo is not moving exactly to the end point, it need some degrees more.

The idea for the following routine was a help from Jan Lichtenbelt and I modified it a little bit. Thanks Jan. (http://www.matrixmultimedia.com/mmforum ... f=5&t=7972)
Attachments
servo repeated simple.fcf
(6 KiB) Downloaded 422 times

Post Reply