More information on Servo macro?

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
hyperion007
Posts: 528
Joined: Sat Dec 01, 2012 1:23 pm
Location: Sweden
Has thanked: 49 times
Been thanked: 101 times
Contact:

More information on Servo macro?

Post by hyperion007 »

I am having trouble using the servo macro.
The pic is a PIC18F26K80 and the servo is this one: http://www.airyear.com/6009-9kg-metal-g ... 18825.html

The help file for the servo macro isn't really that good. doesn't explain in detail how the macro works etc.

The only thing that happens when I apply power to the PIC is that the servo moves a few degrees CW and stops. It does this no matter what servo functions I use.

Any ideas?

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: More information on Servo macro?

Post by medelec35 »

Hi hyperion007,
If you can post your flow chart, then we can give you further advice to where the problem is.
what part/command of the help file, did you want additional help on?
Martin

hyperion007
Posts: 528
Joined: Sat Dec 01, 2012 1:23 pm
Location: Sweden
Has thanked: 49 times
Been thanked: 101 times
Contact:

Re: More information on Servo macro?

Post by hyperion007 »

I made a small test file that I have uploaded here now.
It simulates just fine, but behaves as described earlier.

For instance, what does "Trim" actually do? What does "SetPosition" do? does it define the current position of the servo or does it move the servo to that set point as an initial starting point?
Attachments
PIC18F26K80_Servo_Test_01.fcf
(9 KiB) Downloaded 249 times

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

Re: More information on Servo macro?

Post by dazz »

hi
have a quick look at this thread i posted a flowchart using ser pos
http://www.matrixmultimedia.com/mmforum ... azz#p48599

Regards
Dazz
To sign up to the V5 forum follow this link http://www.matrixmultimedia.com/forum_upgrades.php

hyperion007
Posts: 528
Joined: Sat Dec 01, 2012 1:23 pm
Location: Sweden
Has thanked: 49 times
Been thanked: 101 times
Contact:

Re: More information on Servo macro?

Post by hyperion007 »

Yes, I am well aware of that thread but it doesn't help me. doing it that way still makes the servo act as previously described.

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: More information on Servo macro?

Post by medelec35 »

Although Your Flowchart does not look correct.
E,g you have step time of 1 second, yet delay is 10ms so by the time a step has been completed N would have looped from start to finish 100 times
However I'm not convinced that Automove function is even working correctly.

To test your servo, I have modified your flowchart in the way I know that drives my servo.

As for automove and trim, a similar question was asked here:
http://www.matrixmultimedia.com/mmforum ... 43&#p22284

Martin
Attachments
PIC18F26K80_Servo_Test_01a.fcf
(9 KiB) Downloaded 240 times
Martin

hyperion007
Posts: 528
Joined: Sat Dec 01, 2012 1:23 pm
Location: Sweden
Has thanked: 49 times
Been thanked: 101 times
Contact:

Re: More information on Servo macro?

Post by hyperion007 »

Hi all.

I have had some success on my own but I changed to a PIC18F4550 instead.

However, I do have a followup question. The servo I am using seem to be working just fine moving back and forth and between position 0 and 255, without drifting for instance, and position 127 is just about in the middle. But the servo seems to have quite a bit larger range of motion than what I am getting with positions 0-255. With no power applied to it I can move it a lot more. Is this normal? Maybe the servo is only meant to move 160 degrees in each direction from it's middle position?

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: More information on Servo macro?

Post by Benj »

Hello,

There is normally only a limited range of the servo movement which runs from around 1ms (0) to around 2.5ms (255). Around 160 degrees of controlled movement is fairly standard. You can use the Trim setting to adjust where the range of movement is by slightly tweaking the initial minimum delay.

In v6 I added a feature to override the timings so it may be possible to get full 180 degree movement out of a motor. Hitting an end stop will likely break the motor or at least grind down the gears so be careful if you try and attempt this.

User avatar
Jay Dee
Posts: 398
Joined: Tue Aug 18, 2009 6:42 pm
Has thanked: 121 times
Been thanked: 154 times
Contact:

Re: More information on Servo macro?

Post by Jay Dee »

Hi guys,
Am I right in assuming that Servo Controller component 'bit bangs' the control pulse?
An internal timer is use to hold the pin high for a period between the minimum and maximum pulse times. 1ms to 2.5ms, relating to min and max servo positions.
The positional resolution would be related to the specific PIC's timer resolution ? and I can use most of the I/O pins not just the hardware PWM channel?
Thanks, J.

Ah yeah, also this component uses an interrupt? , which one is it... I dont think you can use an interrupt twice for different timings and want to make sure I don't use the one in the Servo component.
J.

Post Reply