Servo Control

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 5.
To post in this forum you must have a registered copy of Flowcode 5 or higher.

Moderator: Benj

Post Reply
JDR04
Posts: 271
Joined: Tue Mar 05, 2013 10:49 pm
Has thanked: 111 times
Been thanked: 13 times
Contact:

Servo Control

Post 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

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 Control

Post 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.

JDR04
Posts: 271
Joined: Tue Mar 05, 2013 10:49 pm
Has thanked: 111 times
Been thanked: 13 times
Contact:

Re: Servo Control

Post 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
Attachments
SERVO 1.fcf
(7.5 KiB) Downloaded 271 times

dazz
Posts: 1314
Joined: Sun Jan 15, 2012 3:15 pm
Has thanked: 474 times
Been thanked: 458 times
Contact:

Re: Servo Control

Post 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
To sign up to the V5 forum follow this link http://www.matrixmultimedia.com/forum_upgrades.php

JDR04
Posts: 271
Joined: Tue Mar 05, 2013 10:49 pm
Has thanked: 111 times
Been thanked: 13 times
Contact:

Re: Servo Control

Post by JDR04 »

Hi dazz, thanks for the help. I will work on it tonight and post for further corrections. Thanks again - JDR04

dazz
Posts: 1314
Joined: Sun Jan 15, 2012 3:15 pm
Has thanked: 474 times
Been thanked: 458 times
Contact:

Re: Servo Control

Post 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
To sign up to the V5 forum follow this link http://www.matrixmultimedia.com/forum_upgrades.php

JDR04
Posts: 271
Joined: Tue Mar 05, 2013 10:49 pm
Has thanked: 111 times
Been thanked: 13 times
Contact:

Re: Servo Control

Post 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
Attachments
SERVO 1.fcf
(7.5 KiB) Downloaded 263 times

dazz
Posts: 1314
Joined: Sun Jan 15, 2012 3:15 pm
Has thanked: 474 times
Been thanked: 458 times
Contact:

Re: Servo Control

Post 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
Attachments
SERVO 1 (3).fcf
(11.5 KiB) Downloaded 290 times
To sign up to the V5 forum follow this link http://www.matrixmultimedia.com/forum_upgrades.php

JDR04
Posts: 271
Joined: Tue Mar 05, 2013 10:49 pm
Has thanked: 111 times
Been thanked: 13 times
Contact:

Re: Servo Control

Post 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

dazz
Posts: 1314
Joined: Sun Jan 15, 2012 3:15 pm
Has thanked: 474 times
Been thanked: 458 times
Contact:

Re: Servo Control

Post 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
To sign up to the V5 forum follow this link http://www.matrixmultimedia.com/forum_upgrades.php

JDR04
Posts: 271
Joined: Tue Mar 05, 2013 10:49 pm
Has thanked: 111 times
Been thanked: 13 times
Contact:

Re: Servo Control

Post by JDR04 »

Thanks Dazz, I'll give it go and thanks so much for your patience so far.

Post Reply