servo simulation

For questions and comments on programming in general. And for any items that don't fit into the forums below.

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 simulation

Post by achillis1 »

Hello,

I am simulating a servo in flowcode and I noticed that the servo arrow on the servo image can only rotate upto a certain point and that cannot achieve a full rotation! Actually can only rotate at byte 255, that is if I enter the number 255 at the servo macro. If I make a loop and increment the byte number that I have as a parameter in the servo macro then the servo simulation goes up to a point(255) and then instead of continuing to rotate it just jumps to position 0!
So, cant I make the servo fully rotate? In real life can I achieve a full rotation of a servo? Can I connect an HDD servo to the e-blocks servo board and drive it?

Thank you in advance,

Best Regards,
Achilles

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 simulation

Post by Benj »

Hello,

A normal DC servo motor will not turn fully without modification. The Flowcode simulation reflects this.

There is a way to mod a normal servo motor so that it will spin rather then be positional controlled.

http://www.instructables.com/id/How-to- ... s-rotatio/

Im not sure about a hard drive servo as im not sure of the specs that are used to A) voltage to drive the motor and B) the signals that are required. If the servo follows the voltage (5V) and the signals for a standard servo motor then the HDD motor should work great with the component.

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

Re: servo simulation

Post by achillis1 »

Hello Ben,

Sorry to ask this question: but what would be the use of a servo if it does not fully rotates?

Say that I do not want to continuously rotate but move at advancing positions slowly/step by step; can I do that?
So, even if I make modifications to the servo and can fully rotate, still flowcode will have the limitation of not showing the full rotation?


Ben, is shouldn't be there a stepper motor board? How can I drive a stepper motor from flowcode?

Thank you in advance,

Best Regards,
Achillis

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 simulation

Post by Benj »

Hello,
but what would be the use of a servo if it does not fully rotates?
Servo motors are normally used for positional control eg on a R/C car servos are used for throttle and steering.
Say that I do not want to continuously rotate but move at advancing positions slowly/step by step; can I do that?
Yes this should be fine but a standard servo will have end stops. You can remove these by following the quide I posted earlier.
How can I drive a stepper motor from flowcode?
Flowcode v4 comes with a stepper motor component. To boost the current on the I/O pins you will have to use something along the lines of NPN transistors. The link below explains how you would go about wiring up a stepper to a microcontroller.

http://www.matrixmultimedia.com/mmforum ... per#p18083

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

Re: servo simulation

Post by achillis1 »

Hello Ben,

Thank you for the reply.
So in order to drive a robotic arm at say 90 degrees movement, it will be ok?
What is the degree range that flowcode can rotate the servo?

As you mentioned above, in order to fully rotate I must modify the servo; then the HDD servo must be already modified? If the case is that the HDD servo is actually fully rotating inside the case?

Will Matrix develop a stepper motor board?

Best Regards,
Achillis

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 simulation

Post by Benj »

Hello Achillis,

A robotic arm moving through 90 degrees will be fine on any servo motor. Standard DC servos can normally rotate a bit more than 180 degrees.

The HDD servo must be different to a standard servo as it allows full rotational control. You may want to check that the control of such a motor is compatible with a standard servo output. It could be that instead you simply have to generate a analogue voltage to drive the motor. In this case a PWM output and a transistor may be enough to drive the motor correctly.

The EB022 Motors board can be used to drive a stepper motor. Or you could rig up the circuit using transistors and an EB016 or an EB017.

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 simulation

Post by Benj »

I've had a quick look and it seems that a main HDD motor is a simple stepper, no problems there.

Then the servo arm is actually a dual phase system that allows for pan tilt and zoom functionality.

Are you trying to control the HDD or are you building some robotics? You may have a lot more luck using a standard DC servo if your doing robotics.

http://shop.ebay.co.uk/?_from=R40&_trks ... Categories

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

Re: servo simulation

Post by achillis1 »

Hello Ben,

Thanks a lot for your trouble and help!

Actually, I want to achieve two things.
One, to gradually manage( if I can, due to low programming skills) to have a PIC to be able to control a large number of interface e-bocks boards and peripherals.
In small words to achieve to have working flowcode routines that include all of the flowcode/pic functionality. Ex. to be able to communicate through USB, RS232
RFID, control servos, stepper, dimm LEDs and so on.
This would be for the fun of it and to have a fully equiped "PIC suitcase" that can be carried to a potential customer and make a presentation.

The second is, I want to make a sort of robotic arm to be able to just pick up/grab a small item such as CD case and tranfer it at an opposite side.

The other thing is that, in the market there is a wide range of servos and steppers; and I did not yet managed to clear out what are their differences and which board should I use to drive them!
For example there are servos and DC servos, which can flowcode and ECIO40 can drive and how.
Unipolar, bipolar, three/four/five wire and whatever stepper motors, what is the best to have when working with flowcode and ECIO.

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 simulation

Post by achillis1 »

Hello,

I have purchased a servo from hextronik HX12K model @ 60 degrees and I connected it to the servo board but it seem s that I cannot make it to work!
I make a flow program that will tell to the servo to move and/or set to various positions but when the program loads, the servo just makes a small movement and stops(but it has current in it because I cannot rotate the helic manually.
Do you have any idea?
When I reset the board it does the movement again and if I manually fully rotate it, then when I reset the board then just rotates to the other end and stops.

I also get these messages while compiling: I will attach the file. At the end I canceled because the board was not connected but even if it was the message would be the same.

When I read the servo pdf document, it says something for a servo.hex test file.....Can you tell me where to find that? :)

Thank you.
Attachments
New Text Document (2).txt
(4.11 KiB) Downloaded 351 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 simulation

Post by achillis1 »

Hello,

Ben I have managed to control the servo but it seems that I cannot find the start or at least the end point of the servo's rotation-in terms of byte value within the servo macro.
What I mean, if the servo rotates at an angle of 60 degrees, then what I sent in the macro byte value ''set position'' in order to move the servo at the end point? Should it be 255? The start point is 1?

Thank you in advance,

Best Regards

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 simulation

Post by Benj »

Hello Achillis,

The servo should rotate through its start point (0) through to its end point (255) so you get the whole range of a byte or 256 positions. As well as this there is a Trim property that allows you to shift the range slightly past the endpoints.

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

Re: servo simulation

Post by achillis1 »

Hello Ben,

Thank you for your replies.
So, say that I want to achieve a full rotation of a servo; then I have to make a counter that counts from 0 or 1 up to 255 and then again from 255 to 1 and up to 255 again?
Will I have to also set trim to the 255 endpoint in order for the servo axis move a little bit to the start point 1? I am saying that in order to avoid the possibility of the servo to turn back as it came when the counter goes from 255 to 1; but to continue at same direction to the point 1.

Thank you in advance,

Best Regards

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 simulation

Post by Benj »

Hello,

A standard unmodified servo motor can only spin through about 180 degrees. eg 0 is 0 degrees and 255 is 180 degrees or thereabouts.

So if you do as you say running from 0 to 255 and then back to 0 the servo arm will move through 180 degrees and then return back to its start position. The arm will return via the path it took to travel in the first place and therefore will not be a full 360 degree rotation.

I have never modified a servo motor to fully rotate before, I just know it is possible. I'm assuming if you do the modification then the position parameter controlls the speed of the motor rather then the position. I could be wrong on this though.

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

Re: servo simulation

Post by achillis1 »

Hello Ben,

There are servos of 360 degrees.
I have already order some and soon I will be able to test them.
Here's a link... http://www.futurlec.com/Servo_Motor.shtml#SM-S4306R

Post Reply