Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.
|
Forum Index : Microcontroller and PC projects : Servo control with MM?
Author | Message | ||||
aargee Senior Member Joined: 21/08/2008 Location: AustraliaPosts: 255 |
Has anyone done it? Want to avoid using a Picaxe intermediary. - Rob. For crying out loud, all I wanted to do was flash this blasted LED. |
||||
Keith @ Senior Member Joined: 19/06/2011 Location: AustraliaPosts: 167 |
Hey Rob first question ... analog or digital? secondly .... manufacturer? thirdly ... what application? UAV? CNC? just curious optional to answer. Keith The more we know, the more we know we don't know ! |
||||
Keith @ Senior Member Joined: 19/06/2011 Location: AustraliaPosts: 167 |
Ok Rob some more info .... credits to Wikipedia RC servos are hobbyist remote control devices servos typically employed in radio-controlled models, where they are used to provide actuation for various mechanical systems such as the steering of a car, the control surfaces on a plane, or the rudder of a boat. Due to their affordability, reliability, and simplicity of control by microprocessors, RC servos are often used in small-scale robotics applications. RC servos are composed of an electric motor mechanically linked to a potentiometer. A standard RC receiver sends pulse-width modulation (PWM) signals to the servo. The electronics inside the servo translate the width of the pulse into a position. When the servo is commanded to rotate, the motor is powered until the potentiometer reaches the value corresponding to the commanded position. RC servos use a three-pin 0.1" spacing jack (female) which mates to standard 0.025" square pins. The most common order is signal, +voltage, ground. The standard voltage is 4.8 V DC, however 6 V and 12 V has also been seen for a few servos. The control signal is a digital PWM signal with a 50 Hz frame rate. Within each 20 ms timeframe, an active-high digital pulse controls the position. The pulse nominally ranges from 1.0 ms to 2.0 ms with 1.5 ms always being center of range. Pulse widths outside this range can be used for "overtravel" -moving the servo beyond its normal range. This PWM signal is sometimes (incorrectly) called Pulse Position Modulation (PPM). The servo is controlled by three wires: ground, power, and control. The servo will move based on the pulses sent over the control wire, which set the angle of the actuator arm. The servo expects a pulse every 20 ms in order to gain correct information about the angle. The width of the servo pulse dictates the range of the servo's angular motion. A servo pulse of 1.5 ms width will typically set the servo to its "neutral" position or 45°, a pulse of 1.25 ms could set it to 0° and a pulse of 1.75 ms to 90°. The physical limits and timings of the servo hardware varies between brands and models, but a general servo's angular motion will travel somewhere in the range of 90° - 120° and the neutral position is almost always at 1.5 ms. This is the "standard pulse servo mode" used by all hobby analog servos. A hobby digital servo is controlled by the same "standard pulse servo mode" pulses as an analog servo.[3] Some hobby digital servos can be set to another mode that allows a robot controller to read back the actual position of the servo shaft. Some hobby digital servos can optionally be set to another mode and "programmed", so it has the desired PID controller characteristics when it is later driven by a standard RC receiver.[4] hope this helps if no one else responds Keith The more we know, the more we know we don't know ! |
||||
Gizmo Admin Group Joined: 05/06/2004 Location: AustraliaPosts: 5078 |
Actually, thats a point, what type of servor are we talking about? The little RC hobby servo's, or the servo motors used in CNC ( industrial applications ). Glenn The best time to plant a tree was twenty years ago, the second best time is right now. JAQ |
||||
aargee Senior Member Joined: 21/08/2008 Location: AustraliaPosts: 255 |
Sorry, should've been a bit clearer.. Just two RC hobby servos! Playing with a gimble mount driven by servos, maybe using the Wii numchuck. It seems like I could be using all the MMs resources just driving the two sevos because of timing constraints. The other idea was to use a Picaxe to do the driving, slaved via serial or I2C to the MM. Thanks for your replies (so far). - Rob. For crying out loud, all I wanted to do was flash this blasted LED. |
||||
crackerjack Senior Member Joined: 11/07/2011 Location: AustraliaPosts: 164 |
This may just be a silly idea - I don't really know because I've never tried it - but what would the possibility be of using the MM's PWM output as a basic DAC to drive a simple 555 Servo Controller? |
||||
crackerjack Senior Member Joined: 11/07/2011 Location: AustraliaPosts: 164 |
Obtaining a DC voltage from PWM should only require a simple low-pass (RC) filter. See ideas here and here. I'm a bit time short at present (as always!), but I'd like to see if this is possible. Of course MM only has a single PWM output, but this just increases the challenge... |
||||
graynomad Senior Member Joined: 21/07/2010 Location: AustraliaPosts: 122 |
I'm not very knowledgeable about the MM but it's a bloody powerful processor, it should be able to control two servos while spell checking War and Peace on the side. But doesn't that depend on MMbasic having the appropriate functions because you don't have direct access to the hardware? ______ Rob Rob Gray, AKA the Graynomad, www.robgray.com |
||||
crackerjack Senior Member Joined: 11/07/2011 Location: AustraliaPosts: 164 |
Now that in 3.1 we have the PULSE command, controlling of servos from any pin might just be a snap, right? [code] SetPin 1,8 period=20 position=2 Do Pulse 1, position Pause 20 - position Loop [/code] The above should hold a serve in it's Max position. Obviously the code above is only an example of generating a demo servo signal where position is varable between ~1 and ~2 mS. I have no servo at hand to try this out, but I'd be keen to see if this works. See the output on the scope as attached (5 V/DIV, 2 mS/DIV) Cheers, CrackerJack. |
||||
Bill.b Senior Member Joined: 25/06/2011 Location: AustraliaPosts: 226 |
RC servos. The servo is controlled by a series of pulses, wherein the length of the pulse indicates the position to take. pulse width angle comment 0.6m Sec -45 degrees minimum pulse length 1.5m Sec 0 degrees center position 2.4 mSec -45 degrees maximum pulse length Notes: Increasing the pulse width by 10 µSec results in about a degree of movement on the output shaft. These numbers are nominal, and vary slightly between manufacturers and models. For example, the HiTech HS81 likes pulses between 0.74 mSec and 2.14 mSec. The rate at which these pulses are sent isn't terribly important - only th e width of the pulse. Some typical rates are 400 Hz (2.5 mSec pulse spacing) and 50Hz (20 mSec pulse spacing). So, the short story is, if you can make a series of electrical pulses, you can rotate the servo shaft through a range of 90 degrees. The driving pulse is usually specified as 3-5 Volt Peak to Peak, but I suspect that in many cases you can get by with whatever power the motor is getting. I would avoid using a drive pulse greater than the motor power. sample code required to drive RC servo for couter = 1 to 20 pulsout Pin Number ,Pulse Width pause 20 next counter In the interests of the environment, this post has been constructed entirely from recycled electrons. |
||||
iggy Newbie Joined: 26/12/2011 Location: AustraliaPosts: 15 |
The "standard" frame rate is 50Hz or 20mS between pulses, running high repetition rates on standard servos can cause over heating so stick to something near 20mS. Practical experience has shown that even if you do output 1500uS pulses you will not actually get true centre on the servo so allow for adjustment, likewise the travel and minimum / maximum pulse lengths the servo responds to is likely to vary between models. This is based on experiments in my shack over way too many moons :-) Some useful links: RC Servo code More examples and info |
||||
Dave Everett Regular Member Joined: 24/06/2011 Location: AustraliaPosts: 43 |
I'm working on a servo controller block that will be able to control 12 servos. I have been on other jobs since last week so haven't gotten very far yet. Next week is a bitch too. These will all be controlled by timer 4 and an interrupt so you'll only need to declare the servo number and what I/O pin it connects to and then you can write values directly to that servo number. Dave Everett |
||||
Dave Everett Regular Member Joined: 24/06/2011 Location: AustraliaPosts: 43 |
I should have read on, I only just received 3.1 so did not know about the pulse command. To control a servo you first set the control line high for 1ms, then change the pulse width in the next 1ms cycle. You should then leave the control line low for about 18ms. This also gives you time to set other servos in the system. Dave Everett |
||||
Print this page |