Using servos

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

Moderator: Benj

Post Reply
poohbear
Posts: 26
Joined: Sat Apr 01, 2017 6:32 pm
Has thanked: 1 time
Been thanked: 8 times
Contact:

Using servos

Post by poohbear »

Hi All
I would appreciate it if someone could help me with a little information on using servos with flowcode 8. I have a small robot which uses 6 servos and have a few questions.

1. As soon as I enable the servos they shoot off at max speed to position 128. I can change this position by using set position before the enable instruction but cannot slow down the speed, which is way too fast.

2. When using movetoposition I can control the speed of the servo but once it has reached the position it effectively disables the servo and it becomes free to move when slight force applied.

Regards

Gary

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: Using servos

Post by Benj »

Hi Gary,

1. This is how servos work, they will jump at full speed to your control position and there is no way to know where the motor is before you enable it (without hacking the motor or adding external position sensors). If you can then you need to put them in to the right position so that when you next enable them you are already in the correct place.

2. This should not be the case unless you are specifically disabling the servo motor output once it has reached position.

If you post your program then this might help for us to see what you're doing and maybe offer better advise.

poohbear
Posts: 26
Joined: Sat Apr 01, 2017 6:32 pm
Has thanked: 1 time
Been thanked: 8 times
Contact:

Re: Using servos

Post by poohbear »

Hi Ben
Thanks for the quick reply. regarding the initial position I have been placing it as close to where it starts as I can, I was just hoping there was a way to slow down the first movement. Regards the servos not locking, this is still happening. Can you please check the attached program and explain if I am doing something incorrect.

Regards

Gary
Attachments
robot v1.1.fcfx
(20.07 KiB) Downloaded 256 times

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: Using servos

Post by Benj »

Hi Gary,

Your program looks ok to me the motors should be staying active after moving and held in position. I've checked the component code just to make sure there is nothing there disabling the motor when arriving at position but everything looks ok.
As soon as I enable the servos they shoot off at max speed to position 128. I can change this position by using set position before the enable instruction but cannot slow down the speed, which is way too fast.
One of the downsides of using servos I'm afraid.

poohbear
Posts: 26
Joined: Sat Apr 01, 2017 6:32 pm
Has thanked: 1 time
Been thanked: 8 times
Contact:

Re: Using servos

Post by poohbear »

Thanks Ben
Ii appears for some reason that either the code or the servos don't like being set above 250, if set at a max of 250 then they stay enabled.

Regards

Gary

Edit
Further to the above, I have changed the program slightly and added a few commands to move some more servos. I have found that if a servo is set to 255 it actually appears to stop the program going any further. I have actually removed the physical connection to the servo to see if it was the servo but the program still appears to stop when the servo is set to 255. All works well in the simulator.

Further Edit
The problem appears to be the trim setting. With this setting set at +50 then the limit is 250 and the servo performs as above. If the is set to 0 then everything works well. I have tried setting the trim both with the set trim command and by changing the setting in the servo board properties, both have the same effect

panuj417
Posts: 10
Joined: Sat Oct 26, 2019 9:33 am
Contact:

Re: Using servos

Post by panuj417 »

i want to control the position of wiper motor using potentiometer
but my program is not work please help.
Attachments
WIPERMOTOR_CONTROL.fcfx
(24.12 KiB) Downloaded 191 times

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: Using servos

Post by Benj »

Hello,

You seem to be using the PWM component as your driving component, this should instead be replaced with the servo controller component as the PWM will not be able to generate the correct timings to drive the motor.

An example is available from here.
https://www.matrixtsl.com/wiki/index.ph ... hatronics)

Hokum52
Posts: 6
Joined: Sat Dec 28, 2019 7:34 pm
Been thanked: 2 times
Contact:

Re: Using servos

Post by Hokum52 »

Yeah, I've tried running my servos with both (as I've heard it was possible to do with the PWM) and it's obviously better with the designated tool.

Post Reply