Yes, you can with the caveats already listed.

Use a pwm output.  Set your pwm rate to 400hz. (lower it if needed, but 
most will accept inputs in the 50-400hz range.
Add a lower and upper limit to keep the output in the range the servo 
expects.
Add an offset so inputting 0 now outputs your lower limit.
Add a multiplier so inputting your max angle outputs your max pulse.

You'll end up using something like 5% duty cycle for minimum position to 
10% for maximum position so make sure you have a good bit of resolution on 
your pwm generation.  You may need to decrease the cycle time to get better 
resolution.

On Thursday, July 27, 2017 at 11:47:12 AM UTC-4, TJoseph Powderly wrote:
>
> Hello
> the rc-servo has an internal position control loop, and so, it is not a 
> 'suitable' device for linuxcnc.
> this is because linuxcnc is a control, you would end uo with 'two people 
> driving a car'.
>
> having 2 control loops ( the rcservo loop inside the linuxcnc loop ) is 
> possible but can be done.  
>
> linuxcnc controls motion by (usually) getting in the middle of the control 
> loop
> to get linuxcnc in the middle requires some surgery .
> 1) you use the servo open loop ( where linuxcnc cannot control the 
> position, it can only ask the device to goto the position and hope for the 
> best )
> or
> 2) you can break open the loop and include linuxcnc
> or
> 3) you leave the rcservo loop closed, add a 2nd position feedback that 
> goes to linuxcnc, and have a cascaded loop control
>
> thes 3 have been attempted as follows 
> 1) this is what you found by Kirk Walace, i've tried this and its fun, but 
> is not a cnc motion, it is more like a PLC motion or HAL motion.
>
> 2) I have not broken the loop but have a few rc-servos and played with 
> such an idea.
> MAYBE you can modify the rc-servo to make the internal potentiometer 
> available to linuxcnc and NOT available to the internal servo loop.
> How to do this depends on the circuit used inside the rc-servo.
>
> You can find how to modify an rc-servo for continous rotation on the web
> the trick is to remove the pot feedback and any mechanical stops
> BUT if the pot is merely removed from the internal positional loop and 
> routed to the linuxcnc (external) loop
> you should be able to devise a linuxcnc controlled closed loop rc-servo.
>
> If the pot's output, (analog DC voltage) could be converted to a number 
> ( say like the pots on an old gameport joystick which read 0-5V as a 
> number 0-254 or 0-1023 )
> then, linuxcnc could use this number as the current position of the 
> rc-servo
>
> ( I see you will use BBB. so google up analog inputs for BBB. you'll find 
> several howtos )
> ( also , you should take advantage of the Machinekit folks working with 
> thier fork of linixcnc on BBB )
>
> Next linuxcnc could use this current position to calculate where the 
> rc-servo should be next.
> the 'next position' will also be a number and needs to be converted to the 
> PWM command for the rc-servo.
>
> 3) adding a rotary encoder to the output shaft ( or geared to it)
> would allow linuxcnc t0 have an independant position channel on the 
> rc-servo.
> Linuxcnc could then issue a position command to the device and observe the 
> actual position
> and correct for any difference ( thus becoming a true closed loop servo).
> The internal position loop would be ignored, yet still active.
>
> Notes:
>
> Please realize the rc-servo is not a precision cnc servo, it is a 
> interesting toy with a crude position pot .
> (compared to real machine tools used to produce real products you buy at 
> real stores)
>  
> The appeal of the rc-servo is its size and cost. 
> You wont get metal cutting power or tool making precision.
> So, expect  toy quality and have fun experimenting.
>
> Of course, more expensive hardware can get better results.
>
> HTH tomp tjtr33
>
>
> On Wednesday, July 26, 2017 at 3:55:30 PM UTC+7, ZWN wrote:
>>
>> Hi guys,
>>
>> I am building a 5-axis cnc machine (XYZAB). Four of the axes are going to 
>> be driven by stepper motors.
>>
>> The plan is to use a *RC-Servo* (Hitec HS-65HB - 
>> https://servodatabase.com/servo/hitec/hs-65hb) for one of the rotary 
>> axis (A). The axis is just turning +-90°. 
>>
>> My question is: Is it possible to integrate the rc-servo to the 
>> axis-system, because so far I just found the option to integrate stepper 
>> motors. 
>>
>> Just to clarify, I am not talking about the normal type servos… the one I 
>> want to use works with pwm… my model has a pulse cycle of 20ms. During this 
>> 20ms it expects a pulse with a length between 900µs and 2100µs, 900µs for 
>> -90° and 2100µs +90°. So the pulselength defines the position of the axis. 
>>
>>  
>>
>> I know that there is a RC-Servo-Test (
>> http://wiki.linuxcnc.org/cgi-bin/wiki.pl?RC_Servo_Test), but I am 
>> honestly speaking not yet deep enough into hal to know if this code will do 
>> me any good. 
>> Also I have seen this conversation about rc-servos (
>> https://groups.google.com/forum/#!searchin/machinekit/rc$20servo|sort:relevance/machinekit/F1LWtX0vnew/dmgj1jgLBQAJ).
>>  
>> However, this ends without any result L
>>
>>   
>>
>> BTW.: The platform will be a beaglebone black. So far I am planning to 
>> without any commercial cape, but soldering my own.
>>
>> Thanks for your help
>>
>> Sven
>>
>

-- 
website: http://www.machinekit.io blog: http://blog.machinekit.io github: 
https://github.com/machinekit
--- 
You received this message because you are subscribed to the Google Groups 
"Machinekit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
Visit this group at https://groups.google.com/group/machinekit.
For more options, visit https://groups.google.com/d/optout.

Reply via email to