Low-speed direct-drive 3-phase motor and controller

strantor

Joined Oct 3, 2010
6,468
I assume you already know how an incremental photo LED encoder/scale versions work?
The lines are photo etched on glass and two photo leds detect two lines 90° apart (quadrature) the resolution is increased by typically squaring up and incrementing by 4, i.e. reading all four edges.
The initial detection results in a sine wave, where this can also be used to calculate the co-tangent angles for very fine resolution and absolute encoding.
I wonder if the x4 resolution of a quadrature encoder could be doubled once again, by adding a 3rd emitter/receiver pair? Instead of quadrature it would be... octacature? Leave existing pair 'A' in its original place, adjust pair 'B' so that it rises/falls 60 degrees after pair 'A' instead of 90 degrees. Then add in the new pair 'C' 60 degrees after 'B'.

Or heck while we're at it, let's double it yet again by adding two sensor pairs. Leave the original 'A' and 'B' sensors alone physically, but rename 'B' to 'C' and add a new sensor 'B' 45 degrees between 'A' and 'C' and add a new sensor 'D' 45 degrees after 'C'.

You could maybe get 131,072 counts per rev out of a common 8192 PPR incremental encoder (8192 × 4 × 2 × 2). +/- 9.9 arc-second resolution for just a couple hundred bucks?

uzernaam

Joined Dec 12, 2021
19
I don't expect that any mechanical means at my disposal is going to be able to create an encoder tape with a bazillion ticks of resolution.

But I don't think I have to.

Your car doesn't have an absolute encoder attached to the Earth, yet it can maintain a cruising speed. If your destination is 60 miles away and you find that you expected to get to your next destination in 1 hour because you were going 60 mph, but it took 61 minutes to get there, you need to increase the speed you were traveling by 1/61 miles per hour.

If I can tell my scope to start moving at a speed I think it needs to, it can wait however long it takes before the next encoder tick, and then compare how much time passed to how much is expected and adjust the speed very slightly to compensate. After a few ticks, it should be settled down and stable.

Now will it react to a hard shove by your hand or wind? Not instantaneously, but it will notice when a tick flys by unexpectedly, and the compensation mechanism can react not by adjusting the "cruise control" but by slamming the brakes and going in reverse, to use an analogy.

But as long as things go as planned, I think you could probably keep a star pinpoint very small with this setup.

strantor

Joined Oct 3, 2010
6,468
I don't expect that any mechanical means at my disposal is going to be able to create an encoder tape with a bazillion ticks of resolution.

But I don't think I have to.

Your car doesn't have an absolute encoder attached to the Earth, yet it can maintain a cruising speed. If your destination is 60 miles away and you find that you expected to get to your next destination in 1 hour because you were going 60 mph, but it took 61 minutes to get there, you need to increase the speed you were traveling by 1/61 miles per hour.

If I can tell my scope to start moving at a speed I think it needs to, it can wait however long it takes before the next encoder tick, and then compare how much time passed to how much is expected and adjust the speed very slightly to compensate. After a few ticks, it should be settled down and stable.

Now will it react to a hard shove by your hand or wind? Not instantaneously, but it will notice when a tick flys by unexpectedly, and the compensation mechanism can react not by adjusting the "cruise control" but by slamming the brakes and going in reverse, to use an analogy.

But as long as things go as planned, I think you could probably keep a star pinpoint very small with this setup.
If we were talking about a motor spinning 2,000 RPM like you car's engine at highway speed, then sure, I would agree. Ever notice how your car won't let you engage cruise control below a certain point? It's because below a certain threshold there's not enough data to establish a stable control loop.

If we were talking about a small DC motor feeding into a 1000:1 worm drive gearbox, then sure, I would agree. You could send it a fixed voltage and it would run at a fairly predictable speed, and every time you get a pulse from your encoder you can calculate how far you're ahead or behind where you're supposed to be, and make corresponding minor correctional adjustments to your output voltage.

But that's not what we're talking about. You've been very explicit about your requirement of direct drive. With a direct drive setup running that slowly, it's less like a car's cruise control at 60mph, and more like trying to balance an upright pendulum. Imagine balancing a broomstick upright in your palm. Staying on setpoint (staying as close as possible to perfectly vertical) requires not just a steady slow motion in one direction, but rather a continuous series of minor corrections in all directions, all the time. If you had a lot of practice at balancing your broomstick (if your control loop were very well tuned) you could do it indefinitely, and with such minor corrections that nobody would be able to tell that your hand is actually moving infinitesimal amounts all the time; it would look like it's just staying perfectly upright on its own in your hand.

With practice you could do this because you can see. All the time. Your encoder (eyeball) is reporting to your cranial control loop about 20-60 times per second so you get feedback whether the broomstick is leaning 0.1 degrees left or 10 degrees right, and the infinite positions in between. Now imagine someone puts some special goggles on you that are made out of camera shutters that only open periodically, or only when you move your hand. You only get one tiny glimpse of the broomstick for every 5 degrees of tilt, or every 10 seconds. Can you still stay on target?

The coils of the motors in the telescope you linked to in your first post are not being energized with ultra-uber-extra-slow-and-steady sine waves to maintain position. If you could perceive current flow like some kind of mutant, what you'd see going on inside those motor coils would look like chaos. Some coils would be pulsing at several kHz in one direction, then the other, then back the other way, then off, then back on again and pulsing furiously in the other direction. You'd see coils working against each other one moment, then the next moment working with each other united in opposition against another coil or group of coils. You'd see some coils energized with 51.53% duty cycle while others are energized with only 27.13% duty cycle. What you'd see is the movement of the tendons and muscles of an extremely well coordinated hand making the infinitesimal corrections required of balancing a broomstick perfectly upright; or, in this case, pointed an extraordinarily specific (moving) point in the sky.

Last edited:

nsaspook

Joined Aug 27, 2009
11,306
If we were talking about a motor spinning 2,000 RPM like you car's engine at highway speed, then sure, I would agree. Ever notice how your car won't let you engage cruise control below a certain point? It's because below a certain threshold there's not enough data to establish a stable control loop.

If we were talking about a small DC motor feeding into a 1000:1 worm drive gearbox, then sure, I would agree. You could send it a fixed voltage and it would run at a fairly predictable speed, and every time you get a pulse from your encoder you can calculate how far you're ahead or behind where you're supposed to be, and make corresponding minor correctional adjustments to your output voltage.

But that's not what we're talking about. You've been very explicit about your requirement of direct drive. With a direct drive setup running that slowly, it's less like a car's cruise control at 60mph, and more like trying to balance an upright pendulum. Imagine balancing a broomstick upright in your palm. Staying on setpoint (staying as close as possible to perfectly vertical) requires not just a steady slow motion in one direction, but rather a continuous series of minor corrections in all directions. If you had a lot of practice at balancing your broomstick (if your control loop were very well tuned) you could do it indefinitely, and with such minor corrections that nobody would be able to tell that your hand is actually moving infinitesimal amounts all the time; it would look like it's just staying perfectly upright on its own in your hand.

With practice you could do this because you can see. All the time. Your encoder (eyeball) is reporting to your cranial control loop about 20-60 times per second so you get feedback whether the broomstick is leaning 0.1 degrees left or 10 degrees right, and the infinite positions in between. Now imagine someone puts some special goggles on you that are made out of camera shutters that only open periodically, or only when you move your hand. You only get one tiny glimpse of the broomstick for every 5 degrees of tilt, or every 10 seconds. Can you still stay on target?

The coils of the motors in the telescope you linked to in your first post are not being energized with ultra-uber-extra-slow-and-steady sine waves to maintain position. If you could perceive current flow like some kind of mutant, what you'd see going on inside those motor coils would look like chaos. Some coils would be pulsing at several kHz in one direction, then the other, then back the other way, then off, then back on again pulsing furiously in the other direction. You'd see coils working against each other one moment, then the next moment working with each other united in opposition against another coil or group of coils. You'd see some coils energized with 51.53% duty cycle while others are energized with only 27.13% duty cycle. What you'd see is movement of the tendons and muscles of an extremely well coordinated hand making the infinitesimal corrections required of balancing a broomstick perfectly upright; or, in this case, pointed an extraordinarily specific (moving) point in the sky.
I mostly agree with your statements but the coils are using ultra-uber-extra-slow-and-steady sine waves to maintain position. My system updates the 3-phase positional values every few kHz using double precision floats for EM field and 32-bit integers for encoder calculations to drive the 3 PWM half-bridges with a duty-cycle resolution of 8ns. The coils don't pulse at several kHz but the software does the equivalent in the digital realm before finding the precise phase mixture of the three motor drive signals to correct for encoder position error loop feedback.

GetDeviceInfo

Joined Jun 7, 2009
2,146
Im still thinking that image pixelation is the ultimate position sensor, as the final product is an image. Could one not establish targets within a image, and track them to a pixel resolution. Could modern lens USM stabilizing systems create analog motion between axis driver increments. Arc of motion, calculated against pixel count should produce an exposure duration, or sampling rate, with further shifting and stacking of images in post processing.
Question for those in the know, with a fixed camera position, how long can one expose without acceptable blur, at desired pixel count?

Last edited:

strantor

Joined Oct 3, 2010
6,468
I mostly agree with your statements but the coils are using ultra-uber-extra-slow-and-steady sine waves to maintain position. My system updates the 3-phase positional values every few kHz using double precision floats for EM field and 32-bit integers for encoder calculations to drive the 3 PWM half-bridges with a duty-cycle resolution of 8ns. The coils don't pulse at several kHz but the software does the equivalent in the digital realm before finding the precise phase mixture of the three motor drive signals to correct for encoder position error loop feedback.
Well that's nifty. I had to go back to your thread you linked earlier to see how you did that. You assume they did it the same way as you? Probably so. Seems like the best way to go. In my world it's not uncommon to hear a servo hum at zero/near-zero speed from the internal chaos.

strantor

Joined Oct 3, 2010
6,468
Im still thinking that image pixelation is the ultimate position sensor, as the final product is an image. Could one not establish targets within a image, and track them to a pixel resolution. Could modern lens USM stabilizing systems create analog motion between axis driver increments. Arc of motion, calculated against pixel count should produce an exposure duration, or sampling rate, with further shifting and stacking of images in post processing.
Question for those in the know, with a fixed camera position, how long can one expose without acceptable blur, at desired pixel count?
I thought of image tracking as like a "trim" or "modifier" - a low-speed secondary feedback loop to supplement motor/encoder's primary high-speed feedback control loop. But if one were using a system like @nsaspook designed, maybe it could be the primary? I'm curious too now.

nsaspook

Joined Aug 27, 2009
11,306
Well that's nifty. I had to go back to your thread you linked earlier to see how you did that. You assume they did it the same way as you? Probably so. Seems like the best way to go. In my world it's not uncommon to hear a servo hum at zero/near-zero speed from the internal chaos.
My 'design' is for a specific type of controller and driver chip combination. Just about everybody uses Sinusoidal/FOC commutation (generated from a several kHz PWM carrier) for these sorts of low-speed direct-drive applications today.
https://www.magnelab.com/wp-content...phase-permanent-magnet-brushless-dc-motor.pdf
https://www.motioncontroltips.com/what-is-sinusoidal-commutation-for-dc-motors/
Sinusoidal Commutation of a Brushless Motor
...
For a full derivation, refer to Appendix A. Equation (25) states that the torque supplied to the rotor shaft is no longer a function of rotor angle. Torque ripple is all but eliminated and the system has linear characteristics quite similar to a conventional DC brush motor. The calculation of torque based on rotary position assumes an ideal machine. The position  is read and the calculated current I to be supplied occur at exactly the same instant. Because this system is subject to physical reality, it is important to understand the effect of an inaccurate position read due to the inherent lag in the system.
http://www.berryjam.eu/2015/04/driving-bldc-gimbals-at-super-slow-speeds-with-arduino/
https://docs.simplefoc.com/bldc_motors

strantor

Joined Oct 3, 2010
6,468
My 'design' is for a specific type of controller and driver chip combination. Just about everybody uses Sinusoidal/FOC commutation (generated from a several kHz PWM carrier) for these sorts of low-speed direct-drive applications today.
https://www.magnelab.com/wp-content...phase-permanent-magnet-brushless-dc-motor.pdf
https://www.motioncontroltips.com/what-is-sinusoidal-commutation-for-dc-motors/

http://www.berryjam.eu/2015/04/driving-bldc-gimbals-at-super-slow-speeds-with-arduino/
https://docs.simplefoc.com/bldc_motors
Cool! Thanks for the free lesson. I'm not sure how I got to this point without knowing about this. Maybe I would have been exposed to it if I ever tried to make a motor run slower than tar. But it's intriguing stuff and I'll try to educate myself so I can keep up in this thread because I find it really interesting.

nsaspook

Joined Aug 27, 2009
11,306
Cool! Thanks for the free lesson. I'm not sure how I got to this point without knowing about this. Maybe I would have been exposed to it if I ever tried to make a motor run slower than tar. But it's intriguing stuff and I'll try to educate myself so I can keep up in this thread because I find it really interesting.
You see these sorts of systems (low-speed gimbal motors) used with an IMU in motion stability systems. (steady cam)

uzernaam

Joined Dec 12, 2021
19
Strantor, your response is textbook accurate.

Problem is, I'm just stupid enough to ignore the textbook and try something else!

My idea involves a form of "analog feedback," let's say.

strantor

Joined Oct 3, 2010
6,468
Strantor, your response is textbook accurate.

Problem is, I'm just stupid enough to ignore the textbook and try something else!

My idea involves a form of "analog feedback," let's say.
Oh, let me guess, is it a million dollar idea that you won't be at liberty to disclose and this conversation will get harder and harder to follow as you dodge repeated inquiries for the details needed to provide you the best free help the internet has to offer?

nsaspook

Joined Aug 27, 2009
11,306
Strantor, your response is textbook accurate.

Problem is, I'm just stupid enough to ignore the textbook and try something else!

My idea involves a form of "analog feedback," let's say.
It will be a good learning experience for you.

"Analog feedback" is textbook, from the 1940's. I've worked on old (some from the BB-62 class) Naval analog computer systems that used pots, servo/syncro sets, resolvers, ampdynes, mag-amps,etc.. for target tracking, antenna pointing and navigation. Digital feedback systems replaced those relics of history because they capable of magnitudes more precision in tracking and direction.

Let's look at one of the best analog speed and position devices. I work on motion control systems that use both (on the large disk in the video). The resolver is used to generate the motion drive signal in a closed-loop to an 360,000 count encoder error signal from a set-point.
https://www.heidenhain.us/resources-and-news/resolvers-vs-encoders/
https://www.analog.com/media/en/technical-documentation/application-notes/394309286AN263.pdf

uzernaam

Joined Dec 12, 2021
19
Why do I sense a condescending attitude?

This is all a game and I'm having fun with it.

Not everyone gets to your level of expertise by following the same path.

Sometimes a wrong turn is the best way to come to a 100% comprehension of a complex subject.

Sometimes a wrong turn leads to serendipity.

It's only a waste of time if you're getting paid for results and need the money.

Neither is the case here.

nsaspook

Joined Aug 27, 2009
11,306
Why do I sense a condescending attitude?

This is all a game and I'm having fun with it.

Not everyone gets to your level of expertise by following the same path.

Sometimes a wrong turn is the best way to come to a 100% comprehension of a complex subject.

Sometimes a wrong turn leads to serendipity.

It's only a waste of time if you're getting paid for results and need the money.

Neither is the case here.
"It will be a good learning experience for you"
Many have walked the path(s) before you. I'm only saying to choose the path wisely. The condescending attitude is to assume the path has not been taken before.

strantor

Joined Oct 3, 2010
6,468
Why do I sense a condescending attitude?

This is all a game and I'm having fun with it.

Not everyone gets to your level of expertise by following the same path.

Sometimes a wrong turn is the best way to come to a 100% comprehension of a complex subject.

Sometimes a wrong turn leads to serendipity.

It's only a waste of time if you're getting paid for results and need the money.

Neither is the case here.
I can see how it came across as condescending, I apologize; that's not what I intended to convey. It was a bit of tongue in cheek; a joke about how often people come here with an idea they think is worth more than Microsoft but no ability to make it happen, wanting the members of this forum to design it for them for free, and are totally unhelpable because so many aspects of their idea are "secret" that they won't even provide the fundamental details needed to even point them in the right direction.