Unstable PWM motor control issue
- F4br1c4t3D
- Topic Author
- Offline
- Senior Member
Less
More
- Posts: 51
- Thank you received: 1
14 Apr 2019 22:16 #130876
by F4br1c4t3D
Replied by F4br1c4t3D on topic Unstable PWM motor control issue
Here's what the PWM output pin looks like in hal scope. Shouldn't the pulses remain in the same position?
Please Log in or Create an account to join the conversation.
- tommylight
- Online
- Moderator
Less
More
- Posts: 19219
- Thank you received: 6440
14 Apr 2019 22:46 #130879
by tommylight
Replied by tommylight on topic Unstable PWM motor control issue
What you have achieved so far is quite remarkable, given what you are using and how you are using it.
The RC servo motor is not made to be controlled by simple PWM, it is controlled by variable on time from 1 to 2 ms ( standard was 1.2 to 2.2 ms, centter at 1.7 ) . PWM controls the on time from 0 to 100% ( or thereabouts ) and can be set to do that at different frequencies.
You could check what is the frequency that the RC requires or capable of working with, then in hal set that same frequency and set the min and max values of the PWM signal to correspond to roughly 1 to 2 ms. Also check what is the time frame from one signal to another.
The RC servo motor is not made to be controlled by simple PWM, it is controlled by variable on time from 1 to 2 ms ( standard was 1.2 to 2.2 ms, centter at 1.7 ) . PWM controls the on time from 0 to 100% ( or thereabouts ) and can be set to do that at different frequencies.
You could check what is the frequency that the RC requires or capable of working with, then in hal set that same frequency and set the min and max values of the PWM signal to correspond to roughly 1 to 2 ms. Also check what is the time frame from one signal to another.
The following user(s) said Thank You: F4br1c4t3D
Please Log in or Create an account to join the conversation.
15 Apr 2019 02:10 #130881
by jmelson
The pulses look even;y spaced.
Jon
Replied by jmelson on topic Unstable PWM motor control issue
No, because you are not triggering on anything. (Lower right corner, no channel selected for trigger.)Here's what the PWM output pin looks like in hal scope. Shouldn't the pulses remain in the same position?
The pulses look even;y spaced.
Jon
The following user(s) said Thank You: F4br1c4t3D
Please Log in or Create an account to join the conversation.
- F4br1c4t3D
- Topic Author
- Offline
- Senior Member
Less
More
- Posts: 51
- Thank you received: 1
15 Apr 2019 11:00 #130896
by F4br1c4t3D
Replied by F4br1c4t3D on topic Unstable PWM motor control issue
Cheers Jon,
The more you know! Like I mentioned a few posts back I'm not 100% familiar with the operation of a scope. Feeling like I should add one to my arsenal as I've been flapping around in the dark a few times on this project and an oscilloscope would have made things much simpler.
The more you know! Like I mentioned a few posts back I'm not 100% familiar with the operation of a scope. Feeling like I should add one to my arsenal as I've been flapping around in the dark a few times on this project and an oscilloscope would have made things much simpler.
Please Log in or Create an account to join the conversation.
- F4br1c4t3D
- Topic Author
- Offline
- Senior Member
Less
More
- Posts: 51
- Thank you received: 1
15 Apr 2019 11:42 #130900
by F4br1c4t3D
Replied by F4br1c4t3D on topic Unstable PWM motor control issue
Hi Tommy,
I'm certainly not the first idiot to attempt to use hobby grade RC motors in machine tool scenarios. There's plenty of examples of people attempting it on this forum and elsewhere on the web.
I think the standard is somewhat loose, or has been deviated from in recent years as ESC technology has moved on. Frequencies between 50 and 400Hz are now used and I think this is perhaps my problem.
Below is an excerpt from the manual for a "hobbytronics 12 channel servo controller pro":
"Over and above the standard servo pulse frequency of 50Hz, the frequency can be increased to 66Hz, 80Hz, 100Hz, 133Hz, 200Hz or 400Hz. This is a very useful feature when controlling electronic speed controllers (ESC’s) as it enables a faster output response to the motors. This is needed in projects such as Quadrocopters."
The ESC I have is responding well to the output of the little servo tester I have so I brought it to work with me today to analyse it's output. (we have a scope here) From what I can gather it outputs a frequency of 66.666'Hz with 1-2ms on time. Curiously it's one of the values mentioned in the manual quoted above and very close to the 50Hz frequency I currently have set up in LCNC, which may account for the not *quite* working functionality I'm experiencing. With any luck, simply adjusting the frequency to 66.6 Hz in my hal will have me sorted and I can move on to implementing the closed loop control.
I'm certainly not the first idiot to attempt to use hobby grade RC motors in machine tool scenarios. There's plenty of examples of people attempting it on this forum and elsewhere on the web.
I think the standard is somewhat loose, or has been deviated from in recent years as ESC technology has moved on. Frequencies between 50 and 400Hz are now used and I think this is perhaps my problem.
Below is an excerpt from the manual for a "hobbytronics 12 channel servo controller pro":
"Over and above the standard servo pulse frequency of 50Hz, the frequency can be increased to 66Hz, 80Hz, 100Hz, 133Hz, 200Hz or 400Hz. This is a very useful feature when controlling electronic speed controllers (ESC’s) as it enables a faster output response to the motors. This is needed in projects such as Quadrocopters."
The ESC I have is responding well to the output of the little servo tester I have so I brought it to work with me today to analyse it's output. (we have a scope here) From what I can gather it outputs a frequency of 66.666'Hz with 1-2ms on time. Curiously it's one of the values mentioned in the manual quoted above and very close to the 50Hz frequency I currently have set up in LCNC, which may account for the not *quite* working functionality I'm experiencing. With any luck, simply adjusting the frequency to 66.6 Hz in my hal will have me sorted and I can move on to implementing the closed loop control.
Please Log in or Create an account to join the conversation.
- Mike_Eitel
- Offline
- Platinum Member
Less
More
- Posts: 1150
- Thank you received: 184
15 Apr 2019 15:39 #130906
by Mike_Eitel
Replied by Mike_Eitel on topic Unstable PWM motor control issue
Have you tried one simple test:
Use setp with a constant vule to the input of your pwm generator.
Do you still have changing speed then? Can you run in the. Same time some system monitoring, showing cpuload, network and especially disk activities?
If you can hear the speed changes it must be a big difference or as pcw wrote to low resolution.
Mike
Use setp with a constant vule to the input of your pwm generator.
Do you still have changing speed then? Can you run in the. Same time some system monitoring, showing cpuload, network and especially disk activities?
If you can hear the speed changes it must be a big difference or as pcw wrote to low resolution.
Mike
The following user(s) said Thank You: F4br1c4t3D
Please Log in or Create an account to join the conversation.
- F4br1c4t3D
- Topic Author
- Offline
- Senior Member
Less
More
- Posts: 51
- Thank you received: 1
15 Apr 2019 17:11 #130909
by F4br1c4t3D
Replied by F4br1c4t3D on topic Unstable PWM motor control issue
Well it seems the ESC will also respond to a 66hz pulse with the offset tuned accordingly. So I'm guessing the ESC can interpret a range of frequencies. I could probably even set it up to run at 100Hz or any of the other frequencies listed above, so long as the on time is in the range of 1 to 2 ms. I take it I'll get a better resolution of speed at higher frequencies?
Unfortunately though, the problem is not in the signal parameters as it persists even at 66Hz. I think it's in the signal quality and it could well be a system performance issue as I think you were trying to suggest, Mike. I had hal scope open looking at the output pin for my PWM signal (with source set to the correct channel - thanks Jon) and now it appears as though the occasional pulse is ever so slightly out of place and marginally shorter or longer. This may well be within tolerance though I don't know how off it would need to be to cause problems but it's certainly measurable.
As I was carrying out this test however, I noticed that whenever I moved my mouse over the display on the scope the pitch of the motor would audibly change, sometimes quite dramatically. So I think the consistency of the pulses is being upset by other processes. Is this possible? The machine did OK in latency tests. ~30000 was my max jitter iirc. Not the greatest, but far from the worst. I have machines that are better on specs but performed less favourably (but probably still capable enough) in the latency department, could it be worth trying one of these machines?
I will have to re-run the latency test and see if anything has changed. Updates have been installed since I initially installed the image which could potentially be causing problems?
If it is performance, what choices do I have to remedy the situation aside from changing the computer?
Unfortunately though, the problem is not in the signal parameters as it persists even at 66Hz. I think it's in the signal quality and it could well be a system performance issue as I think you were trying to suggest, Mike. I had hal scope open looking at the output pin for my PWM signal (with source set to the correct channel - thanks Jon) and now it appears as though the occasional pulse is ever so slightly out of place and marginally shorter or longer. This may well be within tolerance though I don't know how off it would need to be to cause problems but it's certainly measurable.
As I was carrying out this test however, I noticed that whenever I moved my mouse over the display on the scope the pitch of the motor would audibly change, sometimes quite dramatically. So I think the consistency of the pulses is being upset by other processes. Is this possible? The machine did OK in latency tests. ~30000 was my max jitter iirc. Not the greatest, but far from the worst. I have machines that are better on specs but performed less favourably (but probably still capable enough) in the latency department, could it be worth trying one of these machines?
I will have to re-run the latency test and see if anything has changed. Updates have been installed since I initially installed the image which could potentially be causing problems?
If it is performance, what choices do I have to remedy the situation aside from changing the computer?
Please Log in or Create an account to join the conversation.
- Mike_Eitel
- Offline
- Platinum Member
Less
More
- Posts: 1150
- Thank you received: 184
15 Apr 2019 19:22 #130919
by Mike_Eitel
Replied by Mike_Eitel on topic Unstable PWM motor control issue
Honesty.... Buy a Mesa.
There is no sw stepping as good as hw-based-stepper.
If you in electronics you could do some double changing of running your bob as analog out and make yourself a voltage to pwm. This might be easier to filter....
Mike
There is no sw stepping as good as hw-based-stepper.
If you in electronics you could do some double changing of running your bob as analog out and make yourself a voltage to pwm. This might be easier to filter....
Mike
The following user(s) said Thank You: F4br1c4t3D
Please Log in or Create an account to join the conversation.
- F4br1c4t3D
- Topic Author
- Offline
- Senior Member
Less
More
- Posts: 51
- Thank you received: 1
15 Apr 2019 19:53 #130920
by F4br1c4t3D
Replied by F4br1c4t3D on topic Unstable PWM motor control issue
Curiously, I was just on their website weighing up cards. What would I need to interface 2 stepper drivers, an encoder, index sensor and 2 limit switches as well as externally generating a PWM of course? I'm guessing I need an pci or ethernet FPGA board and a suitable daughter board. There's a rather overwhelming amount of choice though. What's my most cost effective solution for the above?
Well I'd thought about doing essentially what you're suggesting with my BOB. It will output 0-10v for spindle control. The servo tester I'm using has a pot which is presumably just adjusting a voltage (it runs on 5V so I'd guess it's 0-5v) that determines the PWM output. I could run the 0-10V output from the BOB through a buck converter (not sure if this is the best choice but attenuate the signal somehow) and have it do the job of the pot on the servo tester. Like you say I could then filter any wobblies out with a suitable capacitor, correct? Terribly hacky and probably an awful solution but It's got me curious.
Could fill the time between now and when a mesa card arrives.
Well I'd thought about doing essentially what you're suggesting with my BOB. It will output 0-10v for spindle control. The servo tester I'm using has a pot which is presumably just adjusting a voltage (it runs on 5V so I'd guess it's 0-5v) that determines the PWM output. I could run the 0-10V output from the BOB through a buck converter (not sure if this is the best choice but attenuate the signal somehow) and have it do the job of the pot on the servo tester. Like you say I could then filter any wobblies out with a suitable capacitor, correct? Terribly hacky and probably an awful solution but It's got me curious.
Could fill the time between now and when a mesa card arrives.
Please Log in or Create an account to join the conversation.
15 Apr 2019 20:15 - 15 Apr 2019 20:17 #130921
by Grotius
Replied by Grotius on topic Unstable PWM motor control issue
Steven,
Your lollipop can consider Ethercat.
This is the fasted lollipop on Earth at the moment....
It's expensive, but you are master kenobi and have unlimited configuration to input and output side.
Consider your choice. The only matter is.... You may not use Ethercat devices in nuclair installation's for warranty purposes.
I think the German's are concidering : nl.wikipedia.org/wiki/Wernher_von_Braun
Your lollipop can consider Ethercat.
This is the fasted lollipop on Earth at the moment....
It's expensive, but you are master kenobi and have unlimited configuration to input and output side.
Consider your choice. The only matter is.... You may not use Ethercat devices in nuclair installation's for warranty purposes.
I think the German's are concidering : nl.wikipedia.org/wiki/Wernher_von_Braun
Last edit: 15 Apr 2019 20:17 by Grotius.
Please Log in or Create an account to join the conversation.
Time to create page: 0.102 seconds