Page 1 of 1

Servo Control

Posted: Tue May 21, 2013 8:50 am
by JDR04
Hi all, I'm hoping you guys can show me how to write a program in FLOWCODE 5 to control a servo.

Servo Specs;

Torque 1.2Kg/cm at 4.8V
1.4Kg/cm at 6.0V
Speed 0.10/60 deg. at 4.8V
0.09/60 deg. at 6.0V
Voltage 4.8Vdc - 6.0Vdc

I'm using a PIC 16F690 at this stage and have a PICKIT 2 programmer with a low pin count board from Microchip.

I'm trying to get the servo to start at 0 degrees and then progress to 60 degrees, pause for about 1 minute and then return to 0 degrees. This needs to be looped so it continues until switched off.

If somebody could do the program for me and then I can study it and ask any questions as I am still a "newbie"

Thankd a lot guys - JDR04

Re: Servo Control

Posted: Tue May 21, 2013 12:03 pm
by Benj
Hello,

Perhaps you could have a go at the program and see how you get on. We can then help to improve your program rather then writing it for you.

All comes down to teach a man to fish and he can then go on and provide for himself.

PICkit 2 info can be found here.
http://www.matrixmultimedia.com/support ... f=68&t=787

If you have problems then let us know what they are and we will do our best to help, should be some servo examples as part of the main Flowcode examples download to help get you started.

Re: Servo Control

Posted: Tue May 21, 2013 11:24 pm
by JDR04
Thanks, I've given it a try but clearly not good at all.

I can't seem to determine the degree position of the servo or the timing intervals.Can these be set by including delay periods?
Thanks again-JDR04

Re: Servo Control

Posted: Wed May 22, 2013 12:33 pm
by dazz
Hi JDR04
You are 99.9% there, you need to think on what is happening after your delay (concentrate on the delay) , also change the move macro to the auto move
have a go if you still can't get it to work repost with your mods and i will correct it

REgards
Dazz

Re: Servo Control

Posted: Wed May 22, 2013 3:39 pm
by JDR04
Hi dazz, thanks for the help. I will work on it tonight and post for further corrections. Thanks again - JDR04

Re: Servo Control

Posted: Wed May 22, 2013 3:48 pm
by dazz
hi
The move macro needs called repeatedly until your poistion is reached it returns a 1 when in position, so would need another variable and a loop to work
the automove does just that it move instantly to where you ask it
but you still need to look at the elay ;)
Regards
dazz

Re: Servo Control

Posted: Thu May 23, 2013 7:09 am
by JDR04
Hi Dazz and thanks for that.

I've posted my new program for you to check over please. Can you explain to me how the speedsteps is worked out please. Is it steps per millisecond, per second etc?

It would be great if I could control the speed of the servo changing position.Is this possible?

Your help is appreciated. Thanks again - JDR04

Re: Servo Control

Posted: Thu May 23, 2013 10:38 am
by dazz
Hi JDR04

Cool you got there, to be honest i'm not sure what the speeds steps is measured in, one for someone with more knowledge of the servo component to help with :) . but try changing it and testing on hardware .
i've attached a start on using the move to position macro for you, you need to add the next bit, when done or if you get stuck then attach your flowchart and i can help further

Regards
Dazz

Re: Servo Control

Posted: Mon May 27, 2013 5:19 pm
by JDR04
Hi Dazz, sorry for the late reply as I have been away.

I dont understand what you are asking of me,sorry. I also tried to simulate your attachment and it would not play.

Thanks again JDR04

Re: Servo Control

Posted: Mon May 27, 2013 5:53 pm
by dazz
HI

Double click the move=move to position macro icon, add a number to the position box. resimulate then change the delay and simulate again
when done add another macro to return home, but use a different delay, just another way to move a servo with adjustable timing

Regards
Dazz

Re: Servo Control

Posted: Wed May 29, 2013 7:24 pm
by JDR04
Thanks Dazz, I'll give it go and thanks so much for your patience so far.