Electronics > Projects, Designs, and Technical Stuff
Closed loop stepper control and encoder resolution?
<< < (4/4)
Doctorandus_P:
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".

rwgast_lowlevellogicdesin:
@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.

rwgast_lowlevellogicdesin:
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

Doctorandus_P:
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).


Navigation
Message Index
Previous page
There was an error while thanking
Thanking...

Go to full version
Powered by SMFPacks Advanced Attachments Uploader Mod