-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using PWM output as servo control signal (1ms to 2ms pulse) corresponding to 0-100% set point #99
Comments
What do you mean by ""on" time varying from 1ms to 2ms"? |
To control a servo you need a pulse repeating at about 50 times per second.
This signal is a positive pulse that has a minimum of 1 ms (0%) up to a
maximum of 2 ms (100%) so, the mechanism goes from one end position to
another end position where the pulse width varies from 1 to 2 ms.
I hope to have explained
El sáb., 12 mar. 2022 11:09, ptvo ***@***.***> escribió:
… What do you mean by ""on" time varying from 1ms to 2ms"?
—
Reply to this email directly, view it on GitHub
<#99 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AOL66VSDAII2U5MPI2JAE5DU7RUPBANCNFSM5QEVVAJA>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
I could definitely use this feature!!!!! To be able to control a Servo using PWM just like ATMEGA chips can would be ideal. Right now the only solution is to use the PCA9685 with adds unnecessary costs to a project, especially when you only need one or two Servos. |
I've tested low frequency PWM output that is available in the Premium version with MG90S, and it works well at 120 Hz. The main disadvantage is you cannot use the full range of the PWM output. The servo accepts impulses in the range from 20 to 79. |
Ok. Thank you.
If you decide to include this feature let me know.
I don't need it just now because I don't have time. I will make the design
about January.
If not, I could use another approach with an all analog servo, but it is
far less convenient for me.
El vie, 4 nov 2022 a las 7:09, ptvo ***@***.***>) escribió:
… I've tested low frequency PWM output that is available in the Premium
version with MG90S, and it works well at 120 Hz. The main disadvantage is
you cannot use the full range of the PWM output. The servo accepts impulses
in the range from 20 to 79.
—
Reply to this email directly, view it on GitHub
<#99 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AOL66VXSAXEXVF5LGVHUOOLWGSSDLANCNFSM5QEVVAJA>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
--
Luis Hierro
|
The reason that it only accepts 20 to 79 may be because the servos need a PWM signal at 50Hz, not 120Hz. I believe this is the case for most servos in the market. Could you retest using 50Hz? |
Or perhaps looking at the Servo class for Arduino. Here are some good references: |
The standard time for servos is a pulse of between 1ms and 2 ms. 1ms
corresponds to one mechanical end of the servo and 2ms to the other end.
The repetition time is nor relevant, but usually is in between 10 and 20 ms
El dom, 11 dic 2022 a las 18:38, Lenir Santiago ***@***.***>)
escribió:
… Or perhaps looking at the Servo class for Arduino. Here are some good
references:
https://gist.github.com/ajfisher/8c5146bff264b88d04cc
https://github.com/arduino-libraries/Servo
—
Reply to this email directly, view it on GitHub
<#99 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AOL66VX5EODPRRAEMLZJP2DWMYGS3ANCNFSM5QEVVAJA>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
--
Luis Hierro
|
@LenirSantiago With the 50Hz frequency, this range (20 - 79) is rather narrow. I don't know the precise numbers, but in my case, 120 Hz provides more smooth control. |
I don't use 1,0,high,low because it depends on polarity. I prefer to use
the terms on off or active inactive.
That said, the "off" inactive part of the pulse is the rest level between
pulses and the "on" or active part of the pulse is what indicates the
mechanical position that should have the servo.
Thus, the "on" time has to be between 1ms and 2 ms. If it is narrower or
wider than these values, the electronics will drive the servo to either end
and force the mechanics and the motor, which causes a lot of power
consumption and possibly damage something.
Some electronics detects the overdriving and limits the driving to avoid
damage.
With each pulse that the servo receives (on time), it compares the actual
position with the width of the pulse (on tiime) and eventually drives the
motor to coincide with the received consign.
Don't hesitate to ask if you need more explanation.
Best regards.
El lun, 12 dic 2022 a las 9:39, ptvo ***@***.***>) escribió:
… @LenirSantiago <https://github.com/LenirSantiago> With the 50Hz
frequency, this range (20 - 79) is rather narrow. I don't know the precise
numbers, but in my case, 120 Hz provides more smooth control.
—
Reply to this email directly, view it on GitHub
<#99 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AOL66VVU436PVAR2RBME6JTWM3QF5ANCNFSM5QEVVAJA>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
--
Luis Hierro
|
In that case, as long as follows how servos signal works, meaning 20 is an ON pulse of 0.5ms, 50 is an ON pulse of 1.5ms and 79 is an ON pulse of 2.5ms, updating at least every 20ms, then as per @HardSoftMus it should work without causing any mechanical/electrical problems. |
Here's a few articles about interfacing an 8051 MCU with a servo, including C code: |
0.5ms and 2.5ms *are clearly out of margins*.
The pulse *has to be **between 1ms and 2ms.*
This is a standard comes from the invention of the micro-servos for
aeromodels, many many years ago and remains unchanged.
with less than 1ms or more than 2ms the mechanic and/or the electronic part
can suffer. Furthermore, the position of the servo will not correspond with
the input consign, as it would be out of the mechanical and electrical
margins of the servo.
I attach a PDF that explains the fundamentals of servos.
El lun, 12 dic 2022 a las 17:28, Lenir Santiago ***@***.***>)
escribió:
… Here's a few articles about interfacing an 8051 MCU with a servo,
including C code:
https://technobyte.org/8051-servo-motor-interfacing/
https://www.electronicwings.com/8051/servo-motor-interfacing-with-8051
https://myvirtualgarage.wordpress.com/2012/07/19/servo-motor-serial-com-and-8051/
—
Reply to this email directly, view it on GitHub
<#99 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AOL66VXF66MH4NJMDSQUV23WM5HETANCNFSM5QEVVAJA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
--
Luis Hierro
|
[All chips] Added options to set minimum and maximum limits of a PWM signal (by default, 0 and 255). It can be useful if control servo motors with limited PWM pulse width (#99). [All chips] Added an option to configure an offset (shift) for PWM outputs. It may help to control LED outputs with low sensitivity for short PWM impulses. [All chips][LED] Added a possibility to configure RGB order for WS2812B strips (#167). By default, it is GRB. [All chips][LED] Added support for RGBW and RGBWW modes with color temperature control (#168). Checked with the GledOpto bulb (look at the corresponding preset). [All chips][LED] Fixed color control using Hue/Saturation commands (#163). [All chips][LED] All LED lamps and strips, after flashing, start switched off. [All chips][LED] All PWM control channels of RGB, RGBW or RGBWW lamps start at the same time. It prevents blinking of some LEDs when the lamp if off, and you connect power. [СС2652] Added the SCD40/41 sensor (#81). [СС2652][OTA] Added support for some new flash modules (#162). [All chips] Now, you can link a rotary encoder to a LED or PWM outputs and crease a versatile dimmer device (#155). [All chips] Other minor fixes and improvements.
It would be very interesting to have a "modified" PWM output for controlling mechanical servos.
It sould generate a PWM pulse of about 50Hz with an "on" time varying from 1ms to 2ms when the parameter goes from 0% to 100%
This opens a new world of oportunities for controlling a lot of common mechanic devices (venetian curtains, AC grids...)
There are a lot of powerful servos out there, moving up to 50kg/cm force that could be used, like these:
https://es.aliexpress.com/item/1005003352672567.html?spm=a2g0o.productlist.0.0.2cc75d4aZgOwbA&algo_pvid=f67a634b-9e75-451a-9402-b8f1044549b0&algo_exp_id=f67a634b-9e75-451a-9402-b8f1044549b0-4&pdp_ext_f=%7B"sku_id"%3A"12000025360895100"%7D&pdp_pi=-1%3B50.28%3B-1%3B-1%40salePrice%3BEUR%3Bsearch-mainSearch
https://es.aliexpress.com/item/725115447.html?spm=a2g0o.productlist.0.0.2cc75d4aZgOwbA&algo_pvid=f67a634b-9e75-451a-9402-b8f1044549b0&aem_p4p_detail=202203071451144733336428780000003821898&algo_exp_id=f67a634b-9e75-451a-9402-b8f1044549b0-0&pdp_ext_f=%7B"sku_id"%3A"66461318699"%7D&pdp_pi=-1%3B32.81%3B-1%3B-1%40salePrice%3BEUR%3Bsearch-mainSearch
Thank you very much for your wonderful software.
Best regards
The text was updated successfully, but these errors were encountered: