Author Topic: Closed loop stepper control and encoder resolution?  (Read 4534 times)

0 Members and 1 Guest are viewing this topic.

Offline rwgast_lowlevellogicdesinTopic starter

  • Frequent Contributor
  • **
  • Posts: 659
  • Country: us
    • LowLevel-LogicDesign
Closed loop stepper control and encoder resolution?
« on: April 02, 2019, 07:23:15 pm »
So I am working on a fully robotic telescope/astrophotography system. I ordered a new equatorial mount some nema17 steppers and A4988 driver boards. My plan is to use two .9deg steppers at 1/16th micro stepping with encoders to count steps and provide on the fly correction for missed steps, and lastly to use a DIY absolute encoder along with an MPU attached to the right accession access after the standard worm gear/spur combo found on equatorial mounts in order to correct for any periodic error in the gears and final point accuracy problems with the micro stepping.

So here the first thing I ran in too, I ordered these stepper motors off ebay. I chose them because they have plenty of power, they are 0.9 degree, lastly they have back shaft to mount encoders. The nice perk is the vibration dampening system, which is what is kind of confusing me. The black wheel on the back is a soft rubbery material, looking at the pictures online I assumed it was just a fly wheel for the vibration dampening. The thing is these things have magnetic properties, magnets stick to them and are repelled from them, although they dont attract metal. When I use an analog compass near the wheel the needles south side flips directly tword the wheel and stays that way until the compass is about a half inch from the wheel, using a cell phones manometer I measured the general magnetic field of the stepper around 500uT and the wheel around 2500uT. So im wondering if these are actually magnetic encoder disks? I only have a single one of these hall effect sensors I can find to test the theory, but I found a similar looking "Rotary Damper" at this website. Im just a bit confused as to why these rubber discs would give such crazy magnetic reading if they are not some sort of encoder disc.

Now lastly this is where I think i didn't quite think my plan through all the way when it comes to closed loop steppers, this is my first time using steppers although I have plenty of experience with brushed gear motors and home made encoders for motion control. If I want to 1/16th step these motors I am going to end up with a .0625 degree resolution and 5760 steps per revaluation, if im doing my math right. So in order to make sure i am not missing steps on the fly I am going to need an encoder disc with a minimal of 2,880 read in quadrature counting rising and falling edges to get enough encoder counts for minimal usable resolution which would be 2*5760, or do I only need to have enough ticks to match the steps? I just know with a basic dc motor servo you need double encoder resolution you actually want. At this point ive broke my budget on this project and I only have one encoder wheel around with 2,900 counts, which I ripped out of a printer along with its optical quad head. Im use to just using a program called wheel encoder generator to print my own optical transmissive encoders out, but 2900 ticks is to many to DIY like that unless the encoder has like a 2 foot radius! I cant seem to find any encoders online for under 50 bucks that have more than a few hundred ticks. I was thinking maybe I could use a low res encoder wheel and then add some gearing to the back shaft of the stepper but im also thinking that experiment may be a huge waste of time due to backlash and gear imperfections... idk though thats why im asking here. Or maybe im thinking about this all wrong and i dont need two time the number of steps in 360 degrees in order to correct missed micro steps? The real issue here is I need to get as close as I can to about 5 arc second accuracy per pixel on the DSLR as I can and that is such a mega challenge in and of itself that im afraid any kind of compromising in any part of the motor system will just compound to much error by the time i read the absolute encoder connected after the mechanics.

Offline awallin

  • Frequent Contributor
  • **
  • Posts: 694
Re: Closed loop stepper control and encoder resolution?
« Reply #1 on: April 02, 2019, 07:31:22 pm »
afaik most if not all commercial stepper-solutions for telescope mounts are open loop.
the periodic errors are due to worm-gear errors, not missed steps on the stepper.
why not start first with an open-loop system - there's a lot to do until you have star-trails to analyze on a long-exposure DSLR photo.

the next step up might be a geared servo that drives that same worm-gear. the gearing would reduce the need for a really high-count encoder.

usually the periodic errors are servoed out with a separate guide-scope + webcam that looks at a single star and tries to keep it in one place on the camera by giving extra guide-commands to the mount..
 

Offline rwgast_lowlevellogicdesinTopic starter

  • Frequent Contributor
  • **
  • Posts: 659
  • Country: us
    • LowLevel-LogicDesign
Re: Closed loop stepper control and encoder resolution?
« Reply #2 on: April 02, 2019, 10:22:42 pm »
The problem is most systems suck and cost way more than there worth. My challenge is to create an easily reproduced system that can do 10 minute exposures without a guide cam. The reason i want to add a 3rd encoder after the gearing where the telescope physically joins the right accession access is to use it along with an IMU in order to eliminate any periodic error, an  automatically calculate polar alignment. The only reason I want to close the loop on the steppers is to make sure they dont miss any steps when micro stepping every step they miss will just end up throwing the absolute encoder off that many arc seconds from where I expect it to be

This is really an exercise in high precision motor control than anything else, there is already all kinds of solutions out there on micro's and sbc's that can take care of the goto, camera control etc etc. The problem i am trying to solve is tracking objects along right accession with as much accuracy as possible without the need for a seperate guide cam and without using exotic expensive parts.

For example an absolute encoder is ridiculously expensive, they actually sell 3 million count abs encoders for telescopes at a whopping 10,000. Instead of doing that why not print out a lower res abs encoder use a few ir sensors to read it and then in code keep track off quad encoder ticks from the motor in arcseconds until you hit the degree on the abs encoder that way you can always read you position with even sub arc second accuracy without the need for some specialized 3000000 million count encoder. I know accurate pointing and dead reckoning arent easy but i feel like most commercial telescope gear solves problems very poorly using standard parts or just throws tons of money at things like synchrounous torque motors and nothing imbetween.

Offline duak

  • Super Contributor
  • ***
  • Posts: 1048
  • Country: ca
Re: Closed loop stepper control and encoder resolution?
« Reply #3 on: April 02, 2019, 11:52:02 pm »
Many years ago I worked with an electro-optical device that had a linear stage like in the attached image.  It was open-loop with a two phase stepper and a torsional damper on the end.  The stepper was microstepped with a sine/cosine driver with, I think, about 64 microsteps per step.  At that time, the dampers had a silicone fluid but I believe newer ones may be based on ferrofluids ie. https://en.wikipedia.org/wiki/Magnetorheological_damper  These things work under the influence of a magnetic field so the ones you have probably have some sort of magnet inside.  BTW, without the damper, the stepper motor made typical stepper motor noises and could only run at about half speed before stalling.  With the damper, it was dead quiet at any speed.  Makes sense as a stepper motor has terrific cogging, ie., it has preferred positions caused by the interactions of the magnetic field and the stator/rotor design.

One of my colleagues was tasked with improving the fine stepping capability by predistorting the drive waveforms by adding harmonics.  In this case, he burned new EPROMs for the sine/cosine lookup tables.  If memory serves, he used 4th harmonic to reduce the error.

After I retired, I got involved with occasionally repairing CNC machine tools.  All of the ones I worked with have servo motors with integral optical encoders (about 2000 pulses per rev) driving ball screws without any overall position feedback.  All of the machines have correction charts that are used by the control to take out overall ballscrew error.  Some of the CNC machines could have been ordered with optional linear encoders to provide more accurate positioning.  When a ballscrew bearing is on the way out, it usually manifests as a noise, and often affects the positioning accuracy with a period about the size as the ballscrew pitch.  Since the pitch was almost always 10 mm, it was easy for me to plot an error chart by using a dial indicator to measure the position while I stepped the table by fixed amounts.

When working with rotation and angles, measuring the position directly is difficult.  A high res encoder is one way but it's expensive.  However, since this is a camera mount, perhaps you can take images of a scale at various angular positions to determine the error and perhaps compensate for it.  ie., set a graticule line on the zero of the scale and then make small jumps in the same direction and figure out the angle from the displacement observed on the scale.  Surveyors get some pretty decent accuracy by using methods like this.

Cheers,
 

Offline Someone

  • Super Contributor
  • ***
  • Posts: 5154
  • Country: au
    • send complaints here
Re: Closed loop stepper control and encoder resolution?
« Reply #4 on: April 03, 2019, 01:22:05 am »
The only reason I want to close the loop on the steppers is to make sure they dont miss any steps when micro stepping every step they miss will just end up throwing the absolute encoder off that many arc seconds from where I expect it to be
You don't lose or drop (miss) micro steps, only whole steps. The cheaper solution than precision encoders is usually to add a larger motor so you have enough headroom in the torque to avoid missing steps unless there is something seriously wrong (person leaning on the telescope).
 

Online Smokey

  • Super Contributor
  • ***
  • Posts: 3042
  • Country: us
  • Not An Expert
Re: Closed loop stepper control and encoder resolution?
« Reply #5 on: April 03, 2019, 02:41:03 am »
The only reason I want to close the loop on the steppers is to make sure they dont miss any steps when micro stepping every step they miss will just end up throwing the absolute encoder off that many arc seconds from where I expect it to be
You don't lose or drop (miss) micro steps, only whole steps. The cheaper solution than precision encoders is usually to add a larger motor so you have enough headroom in the torque to avoid missing steps unless there is something seriously wrong (person leaning on the telescope).

This.  Also max incremental quad encoder resolution is 4x the line count (each of the 4 edges).  Do not make your own encoders.  That defeats the purpose of having a high resolution position reference if there are hand made error tolerances.  If you are looking to make a one off thing for yourself then it's a one time expense.  Save up for real encoders.  Or get creative with your eBay skills and buy brushless motors with quad encoders on them and pull off the encoders.  There are options for around 50 bucks.  Or better yet, just use some brushless servo motors.  You will get better performance than with steppers.
 

Offline rwgast_lowlevellogicdesinTopic starter

  • Frequent Contributor
  • **
  • Posts: 659
  • Country: us
    • LowLevel-LogicDesign
Re: Closed loop stepper control and encoder resolution?
« Reply #6 on: April 03, 2019, 06:07:12 am »
I know max res is 4x, as i said i need about 2900 ct encoders to get the 11,5200 counts per rev I need. Im not sure what is wrong with making your own encoders, the program I mentioned generate the encoder patterns with equadistant measurement between each tick or line of bin/gray code for an abs style, then you just print the wheel out stick it on something hard and use a reflective IR sensor to read the difference between black and white. As I said printing off 2900 tick wheels is not feasible unless the wheel is much bigger than practical so that is why i am looking for a different solution. I dont mind buying the encoders at a reasonable price, but hell my little honywell 129cpr sleeve bearing optical was $50. In order to get 2880 lines+ at a reasonable price it is looking like sourcing the nice transmissive encoder discs from inkjets off alibaba or the junk yard. But I also said i wanted the project to be easily repeatable for others when it is done, that is why im looking for a solution that is kind of DIY or under 50 an encoder. I do plan to print out the 2048 bit abs encoder though, becuase no matter what the disc size for a workable refelctive encoder is 100s less than an off the shelf abs encoder, If there is any real accuracy problems I am not seeing please tell me so I can figure out a fix or a different path.

Like said above this is my first project ever using steppers I have always used geared dc motors or synchro drives, in a pid loop. I chose steppers becuase for this project it seems much easier to calculate timing just right, with the ultra slow movement the holding torque will be a nice feature, and ive been reading newer stepper drivers along with newer style motor are becoming alot more reliable and can match or beat a dc servo system in most cases. I did not realize that steppers only miss steps if they are under powered for the job, I thought it was just something that happened when microstepping.. and if they miss a full step when they do miss than that would mean for a .9 degree stepper I would only need 200cpr quad encoders to get 800 counts I was thinking my encoders needed to be at least twice the amount of micro steps per rev. Is that correct? Also when paired with the worm wheel reduction of the mount these motors are beefier than I need so i guess I shouldnt miss steps anyways? Even if that is the case its better to be safe than sorry you never know how wind drag could play out or some other unexpected  thing that may add more force to the telescope than expected. Im anal about things and always want to double check a piece of gear is doing exactly what I told it to and not just assume an open loop system behaves right :)

Offline Someone

  • Super Contributor
  • ***
  • Posts: 5154
  • Country: au
    • send complaints here
Re: Closed loop stepper control and encoder resolution?
« Reply #7 on: April 03, 2019, 10:52:57 pm »
Im not sure what is wrong with making your own encoders, the program I mentioned generate the encoder patterns with equadistant measurement between each tick or line of bin/gray code for an abs style, then you just print the wheel out stick it on something hard and use a reflective IR sensor to read the difference between black and white.
Whats the geometric accuracy of your printing process? What scale and skew are achievable in each axis? Resolution does not imply Accuracy
 

Offline pardo-bsso

  • Regular Contributor
  • *
  • Posts: 235
  • Country: ar
Re: Closed loop stepper control and encoder resolution?
« Reply #8 on: April 04, 2019, 11:55:29 am »
Like they said, most mounts are not closed loop and rely on tables to map the errors.

We are also building one at the Uni using big steppers and absolute encoders (Allen Bradley 842E) but nothing is cheap and the whole system is like a small house in size.

If you are just starting I'd try with a belt reduction from the stepper to the worms and from there another one with a higher ratio to the encoder so you get more pulses per revolution.

For small mounts, provided that the worm and gear are sufficiently mated, periodic correction using an index pulse on the worm shaft is enough.

Take a look at the OnStep project, http://www.stellarjourney.com/index.php?r=site/equipment_onstep

While we are at it, perhaps some of our code would be of help later: https://github.com/telescopio-montemayor/
 

Offline rwgast_lowlevellogicdesinTopic starter

  • Frequent Contributor
  • **
  • Posts: 659
  • Country: us
    • LowLevel-LogicDesign
Re: Closed loop stepper control and encoder resolution?
« Reply #9 on: April 04, 2019, 07:16:14 pm »
Due to res of encoder im actually having a local print shop with a large format hi res epison print my wheels on transmissive material. I am would think the accuracy of a 5k+ printer would be better than a cheaper encoder.. As far as know as long as an incremental encoders lines are equadistant and it is read out of phase(my first diy the sensors were more like  40 degrees out of phase instead of 90) you can still accurately track velocity, direction, hard stops etc.

@pardo-bsso, thank you very much for code sharing, in my original post I had asked about gearing the back shaft down before the encoder no one else has answered that question. Wouldnt gearing the back-shaft cause backlash and periodic error on the encoder wheel and severely hamper accuracy?

Since last posting ive been researching and thinking about this a little more and have come up with two other solutions id like input on.

The first is commercial AMS makes these abs encoder soc chips, and they only require a regular magnet from home depot from what I can tell. https://www.digikey.com/product-detail/en/ams/AS5311-ATST-500/AS5311-ATST-500TR-ND/5892378 at 6 bucks for a 12 bit abs encoder I could just stick these on both motos and then use there 16 bit version on the RA access after the worm/spur combo. I have read that magnetic encoders have more accuracy and glitching problems than optical though especially when flipping the motors direction. Im not sure if this is still applicable to these newer magnetic encoders though?

Second idea is what about using an optical system still but using a lower res wheel and adding more photodetectors like have 4 channels reading the same track 45 degrees out of phase each? Seems logical to me but then if it were im sure I would see this set up used before.

Offline pardo-bsso

  • Regular Contributor
  • *
  • Posts: 235
  • Country: ar
Re: Closed loop stepper control and encoder resolution?
« Reply #10 on: April 04, 2019, 09:30:16 pm »

@pardo-bsso, thank you very much for code sharing, in my original post I had asked about gearing the back shaft down before the encoder no one else has answered that question. Wouldnt gearing the back-shaft cause backlash and periodic error on the encoder wheel and severely hamper accuracy?


You're welcome. If the belts are properly tensioned and the mount balanced it will give better results compared to a direct drive. In case I wasn't clear on the other post, what I suggested was using one reduction from the motor to the worm (so for example 10 turns on the motor result in one worm turn) and also another from the worm to the encoder (say, one worm turn ten in the encoder to keep numbers simple). Or just the one from the worm to the encoder.

Also, think about how the difference in position between the axis of rotation of your encoder shaft and the center of the printed pattern affects readings if they are not aligned.

We haven't tried gears bewteen the motors/encoders/worms on this project but some older (and waaaay bigger) telescopes here used a drum with several turns of steel wire and a dead weight on the shaft to provide a more or less constant load on the gear train and reduce backlash.

There are lots of sites showing the insides of Meade telescopes for inspiration.

In any case you'll spend a lot of time tweaking things.
 

Online Smokey

  • Super Contributor
  • ***
  • Posts: 3042
  • Country: us
  • Not An Expert
Re: Closed loop stepper control and encoder resolution?
« Reply #11 on: April 05, 2019, 04:21:36 am »
If you are after accuracy, it's not a bad idea to start thinking like an organization that has a healthy respect for accuracy, like NASA for example.  WWND.  If you answered ignoring all commercial products and instead spending a lot of time and energy hand making , debugging, and generally fiddling with something that was a foundation for the performance of the whole system then you would be wrong.  If you answered using a common off the shelf product that has detailed specifications for accuracy, resolution, reliability, and tollerances that you can just use and trust without spending a lot of time fiddling then you would be on the right track. 
Encoders are a solved problem.  If you think the machine heidehein uses to create their encoder wheels only cost 5k, you would also be wrong.
eBay is literally crawling with inexpensive used encoders with crazy resolutions.    This route will save you machine space,  time, money, effort, and make your widget better.   
 

Offline mrflibble

  • Super Contributor
  • ***
  • Posts: 2051
  • Country: nl
Re: Closed loop stepper control and encoder resolution?
« Reply #12 on: April 05, 2019, 01:57:45 pm »
If you are after accuracy, it's not a bad idea to start thinking like an organization that has a healthy respect for accuracy, like NASA for example.
Or if the objective is to spend lots and lots of time on homebrewing precision positioning gadgets, some casual reading on ASML EUV wafer steppers might be in order.

Quote
eBay is literally crawling with inexpensive used encoders with crazy resolutions. This route will save you machine space,  time, money, effort, and make your widget better.
Precisely this. If you want to do this for the fun of it, then have at it! If you're having fun while doing it, mission accomplished, that's what hobbies are for. If however your brain is providing you with bullshit rationalizations such as "I want to create a simple DIY solution anyone can make, using only their local print shop. ^_^", then yeah ... no. If you really believe that, then do the following experiment: go to a DIY astronomy forum and start a poll. Are people interested in making an encoder such as described above. I'm willing to bet the answer "Not only no, but fuck no!" is going to get the most votes. Why? Not because it's an inherently bad idea. But simply because it's frigging 2019. Why would anyone want to faff about with the local print shoppe for something like this? "Nono, not this usb stick, that usb stick. Nono, not this pdf standard 2.0 sub XYZ/, that pdf standard sub 2.1 QED. If you don't use that version the output of your pdf exporter will not result in the toner placement you intend." <Insert multiple trips to print shoppe here>. Now contrast that with: pointey-clickey-ebay, go about your business until part arrives, integrate part into project. Hell, if you find out later that the encoder you got was not precisely what you needed, there will always be that other project where you can use it.

So if you need wafer stepper precision, go aim for it! You won't reach the goal, but your efforts can have a good price/performance ratio. You will learn lots of stuff, and if you post that as a DIY-howto with parts list, it'll even be relevant in 2020! For anything less, maybe the ebay encoder is a better use of limited time...

Regardless of the encoder... As other posters have already suggested, open loop is probably the way to go. You can characterize the positioning error and compensate for it. The simplest way would be to use a deconvolution filter based on the estimated positioning error. Probably iterative, with a sprinkling of wavelets and l1-minimizers. Or if numberical solutions are too boring, and you simply have to have something mechanical in the mix, I'd suggest looking into make a rotational flexure, driven by a piezo stack. That can be made pretty damn stiff, and the loads are fairly predictable. At least, I certainly would hope so, if you value your optics. ;D That flexure would then be placed at the telescope mount, and make minor corrections for any rotation errors caused by the imperfections of the stepper, worm gear, etc. Making such a flexure doesn't have to be super expensive in terms of material. But don't worry! That will be more than compensated for by the time spent in design. ;)
 

Offline rwgast_lowlevellogicdesinTopic starter

  • Frequent Contributor
  • **
  • Posts: 659
  • Country: us
    • LowLevel-LogicDesign
Re: Closed loop stepper control and encoder resolution?
« Reply #13 on: April 05, 2019, 06:36:56 pm »
Thank you guys for the input, btw i may be hell no against an open loop solution, BUT i have not said I was against a commercial solution as long as it is reasonably priced and sourced. Those requirements kind push cheap second hand e-bay encoders out, which is the same reason im trying to go the print shop route instead of tearing up a few scrap printers for there disks. Also if i was following a project i would much rather go have something printed for 2 bucks than run around sourcing and tearing of scrap. Also I started with hobby robotics about 6 years ago and at that time it feels like everyone was just printing there own encoder disks, i still see diy encoder stuff on letmakerobots... i think alot of people enjoy building what they can when its feasible and economical.

I am really starting to think that getting some of the ATST-500TR encoder chips or breakouts are the best bet though... as far as anything optical when looking on digikey and mouser anything suitable for motor applications with at least 2880cpr or more, that include sensor and wheel starts at $300 dollars! I will also look in to all the algorithms you guys have suggested open loop or not.

Part of my problem right now is the mount I ordered turned out to be back ordered so i am sitting here with my steppers, driver boards, gears/pullyes, belts, etc etc.. and I have no idea of the worm drive reductions. So really im just kind searching around for solutions to things without being able to do exact math because on top of the worm drives im not sure what kind of gearbox/belt drive reductions I plan to use between the motor and worm.

I am not looking for NASA precision here, im just looking for what I would consider the pointing accuracy one should get at a few hundred bucks total. I feel like the robotic mounts or even the goto/tracking kits to add to a mount that companies like meade/orion/celestron sell give pretty poor performance for there price. When using small aperture short refactor telescopes with a 2 to 4 degree FOV of the sky a $1500 celestron mount cant even track accurately enough for long exposure for 10minutes, it basically just uses open loop motor control with some lower res quad encoders to help with go to.

In 2019 we can add a 4 dollar GPS with some ttl chips on it 1pps pin, a decent tcxo, and an rtc chip, for a super accurate sidereal clock. Next is a 10 imu with manometer to find true north with a high degree of accuracy given integration time, and who's angular output can be fused with encoder data. Lastly it looks like 5+ dollars on a magnetic absolute encoder that will give at least 360 in relation with are true north measurement from imu. Lastly a combination of quadrature encoders and gearing on are steppers that will allow us enough resolution to track 3600 tiks accurately. This way when we put the encoders on the motors together with the abs encoder on the mounts RA access we can then say o well the RA shaft says we are at 15 degrees and the ra motor has counted 1200 tiks so that means we are at 15 deg 20 mins. This can then easily be shared with a planatarium program also for are go to. Using the exact sidereal time along with information from the ABS encoder and the quadrature encoders along with long integration IMU time I would think we should be able to adjust out all the periodic error from the mechanics. So why do mounts that cost 1500 dollars still use open loop control with maybe a gps for location only? Using a guide cam for doing exposure under 10 minute in still weather without earthquakes seems like a copout

Offline Someone

  • Super Contributor
  • ***
  • Posts: 5154
  • Country: au
    • send complaints here
Re: Closed loop stepper control and encoder resolution?
« Reply #14 on: April 05, 2019, 11:11:19 pm »
So why do mounts that cost 1500 dollars still use open loop control with maybe a gps for location only?
Because at that price range the best accuracy is achieved with open loop control, instead of spending money on encoders it goes to larger motors and intelligent drive methods. Correcting motion by looking at the target is very much the correct way to do it when following the target is the most important characteristic of the drive, removing all the errors in the rest of the system.

You can go ahead with your plan for encoders on the motors, but its not closed loop. The gearing and mounts add their own errors which are unaccounted for and those may well be far in excess of the error you correct by using an encoder on the stepper motor. These things can be measured and quantified before deciding on the system architecture, because right now you've made many many assumptions which our experience tells us are wrong.
 

Offline Doctorandus_P

  • Super Contributor
  • ***
  • Posts: 4004
  • Country: nl
Re: Closed loop stepper control and encoder resolution?
« Reply #15 on: April 07, 2019, 12:28:15 pm »
If you want accurate and smoot operation of a "stepper motor" then you should start with looking at it as a "stepper" motor and begin looking at it as a BLDC motor (or PMSM motor, which is the same).
 "Stepper" motors come in 2 phase and 3 phase variants, (Also with 5-phase, but these are rare). The smaller motors are however almost always 2-phase.

The ideal voltage / current waveform for a 2-phase (bipolar) stepper motor is 2 sine waves with a 90 degree phase difference.
 Anoter way of looking at this is "infinite" micro stepping.

When you look at it from this point of view, you can controll the motor with FOC (Field oriented Controll).
As you probably know, a stepper motor just stands still if you put a constant current through one (or both) of the windings, without delivering any torque. With FOC the goal is to always have a 90 degree phase difference between the mechanical position of the motor, and the magnetic field generated by the stator windings. This optimizes torque and efficiency in the motor.

For FOC to work properly the rotor position must be measured. This can be done with optical encoders, but in these modern times there are alternatives with HALL sensors. Have a look at the AS5600 sensors or the TLE5012.

There are also several open source closed loop stepper motor controllers. One of them is the "ananasstepper".
https://www.ogadget.com/x/ananasstepper3

Another very similar project is "Mechaduino".

« Last Edit: April 07, 2019, 01:43:09 pm by Doctorandus_P »
 

Offline rwgast_lowlevellogicdesinTopic starter

  • Frequent Contributor
  • **
  • Posts: 659
  • Country: us
    • LowLevel-LogicDesign
Re: Closed loop stepper control and encoder resolution?
« Reply #16 on: April 07, 2019, 09:29:20 pm »
@Someone

 I would just like to point out that many times I have said there will be an absolute encoder after all the gearing on the mount where the right accession access at its point of rotation (with the cost of encoders like the one Doctprsndus suggested I will probably add one on declination too) this makes the system closed loop and any mechanical error except scope flexure, which guiding cant help either. Using a camera sensative enough to always pick a guide star along with a decent guide scope is kind of an expensive solution and also has problems which only an even more expensive off access guider can solve, which in turn needs an even more sensative camera. To me this is just throwing money at a problem, to fix a solution that has been used since the 1800s for following the sky.

In an open mind the problem were solving is not tracking a star, it is accurately producing a well known and mathematically sound pre determined path across the sky. What if we needed to track a satellite with hi accuracy because we need to point an 8ghz dish with .10degree beam width at it? That problem and others tracking invisible objects accross the sky has been solved without cameras.. When guide scopes/off axis guiding was developed they did not even have electric motors let alone the technology to discipline a hi accuracy oscillator with GPS in order to run as a sidereal clock.

@Doctorandus_P

Thank you very much for the great input i have already been looking in to FOC too. I also started with the intention of using either brushed or brush-less servos and PID as I mentioned earlier in the thread i have never used steppers, they never seemed like a good solution for any projects I have done. This time I chose steppers for two reasons, number on being able to step the shaft at a specific degree and track that seems an intuitive way to solve the tracking problem in the higher level code, second from what i have read if you have an application where slow movement with high position accuracy and repeat-ability a stepper servo fits the bill the best. Like i said this is just what i have been reading i finally got my driver chips in the mail so now i can start playing around and hope im not wasting time/money on steppers.

Just for general clarity here the system ideally consists of four encoders, each motor will have an encoder on its back shaft. These encoders do not use pid, and do not have much to do with the actual control of the mount. Even if you have great brand name steppers with good resolution and dampening they will always have a percentage of mechanical error usually 1-5% depending on the motor. Now these encoders will be used as a reference to compare against steps and microsteps, if the position is 3 microsteps of the expected position of the shaft we go ahead and compensate for those steps. Running with a pid loop just turns there steppers in to a regular servo system and eliminates the constant torque and stepping properties, might as well go BLDC :)! The absolute encoders mounted directly to the mounts RA and DEC access (and other sensors systems imu/gps time etc) can then be used with a PID loop to replace guide cam and as a way to correct for any mechanical errors present in the mount or gearing systems. Of couse things like FOC, Wavelet Filters, fancy motion profiles can also all be implemented too.

Now if this idea wont work I am all ears as to why not or what serious problems i may face, and i am actually grateful for constructive criticism as it can only help me see something i may be overlooking. But i dont believe companies like celestron arent using these kind of techniques in there mounts because they wouldn't work, i think its because there is no need for invoation when it comes to this... these companies wouldn't be able to sell you all there expensive guiding accessories if they added 30 dollars of sensors and encoders on there eq goto mounts.


Offline rwgast_lowlevellogicdesinTopic starter

  • Frequent Contributor
  • **
  • Posts: 659
  • Country: us
    • LowLevel-LogicDesign
Re: Closed loop stepper control and encoder resolution?
« Reply #17 on: April 07, 2019, 10:14:02 pm »
Acually i have a legit question i can seem to find much of an answer too when it comes to stepper motors. When dealing with brushed motors its always good to tie each lead to the motors case through a small decoupling cap and use flyback diodes to eliminate noise and potential voltage generation from a shaft being turned by outside forces.

I am using the A4988 boards just to start with as they seem simple they are cheap and have good microstepping performance from the independent testing ive seen on hack a day, i also see people selling "filter" boards for these which are just flyback diodes and they claim to increase the waveform distortion quite a bit. But ive always been looking in to building my own driver or maybe using a more advanced trinomic brand driver and these chips read back EMF as a form of feed back to help set decay and other things in there motion profiles.

So whats standard practice for a stepper, flyback diodes a yay or nay... what about decoupling caps to case ground? Seems to me most people just plug the motor in to there driver and thats it


Offline Doctorandus_P

  • Super Contributor
  • ***
  • Posts: 4004
  • Country: nl
Re: Closed loop stepper control and encoder resolution?
« Reply #18 on: April 08, 2019, 12:38:01 pm »
The coils in steppermotors are pretty inductive, and can produce voltage spikes when trying to turn them off quickly.
The flyback diodes short these spikes to VCC.
Stepper motors are also quite good dynamo's. They generate AC, which is rectified by the flyback diodes and charge the buffer cap.
Sometimes when the motors are back driven they can charge these caps to such high voltages that they (or another part of the circuit) may get damaged.

Most (all ?) of the modern IC's have the flyback diodes built in. It's easy because the MOSfets always inherently have a parasitic diode. With old generation MOSfets these parasitic diodes were a nuisance because their paramaters were not good enough, but in more recent generations of MOSfets they have been given more Engineering love and are usable.

With Brushed DC motors, the brushes generate a lot of electrical HF noise, which is usually shorted to the motor housing.

If you want to look more into FOC, some of the Open Source closed loop stepper motor boards use 2 separate H bridges to set the current for the coils and do the rest in software. Such a board (with source from Github) is a good way to start.

ST has also made a series of youtube video's about FOC which are worth watching. But any manufacturer of motor controllers has lots of datasheets and application notes of using their chips with FOC.

About microcontrollers:
STM32F103C8T6 boards are about EUR2 from Ali / Ebay / China and these uC's have a built in timer designed especially for  3-phase controll of motor drivers. They also do for example dead time generation in hardware.
This is the uC used in the "Blue pill". As most ARM controllers it is supported by GCC. It can be programmed via a built in serial bootloader, but I prever to use a ST-Link V2 clone (Also from Ali for about EUR 2). With the "Black magic probe" you have more debug capabilities & freedom, but I never used it (yet).


 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf