I work for RLS, where we design and manufacture high-resolution magnetic encoders. It seems you're heading in the right direction, but what you need to do is perform FFT analysis over the accuracy plot. This will reveal the harmonic components of your signal (accuracy). The DC component will represent the offset (+ latency) between your reference and the DUT (encoder). The first harmonic represents the eccentricity of the magnet, and so on...
yes, fft would have been nice, would have a few low frequency peaks for eccentricity and manetic encoder errors and some high frequency peaks for step and microstep errors. But just showing it in time domain, I think, is more helpful for unerstanding.
@@matthiasrandomstuff2221"unerstanding" may be my new favorite word... essentially "removal of error in one's [prior] understanding." Great work, here, with this vid, and so many others. I hope they bring much unerstanding to this world.
Why are the RLS linear position sensors so expensive :( I am building a core-less linear actuator at home but I need position sensing to correctly commutate the currents. But the price of the linear incremental encoders are quite high haha
There's some legit engineering that goes into Lego, that they're able to mass-produce them to the very precise measurements required to lock into each other reliably is seriously impressive
Matthias is a true scientist. Creates hypothesis, experiments, learns and writes it down. He’s even enjoying being wrong in his theories, because that enables him to learn more! Oh how I love that he’s gone from excellent wood worker, to science and research, just to become even better at woodworking!
He’s a true engineer. He is can use the principles of science to expand his knowledge and understanding. Engineers take those principles and apply them to to the identification, definition, and characterization of problems, synthesize potential alternative solutions, apply scientific analysis to select the optimal solution, apply best practices in the detailed design, planning, implementation, sustainment, and eventual decommissioning of solutions. To borrow and adapt an expression used by every non-commissioned military officer ever: “Do NOT call me a scientist goddamnit! I’m an engineer. I WORK for a living!”
I have checked a micro stepping stepper motor by attaching a laser pointer and drawing dots on a wall. The accuracy is affected by the linearity of the DAC's in the driver (probably very good) and the linearity of the magnetic fields which is probably related to the shape of the stepper motor's "teeth" (probably not so good). As a toolmaker in a past life and, more recently, an electronics engineer, I'd be using a dividing head to make gears, with a stepper motor to drive it. Love your stuff, particularly your systematic approach!
The error graphs from 2:55 and forward are just textbook encoder eccentricity examples, usually caused by misalignments between encoder and target. As many pointed out, the center of magnetic encoders are sometimes not in the chip's center. A decent PCB design might fix that by putting the magnetic center at the center of the PCB, instead of just aligning the chip's center. But, even then, due to manufacturing tolerances in the entire chain, you may end up with eccentricity. Thankfully, this can be removed by software through calibration. Many of these magnetic encoders come with a built-in function that you can trigger, but not necessarily all. One possibility is doing your own calibration on the controller side, as eccentricity errors have fairly low frequency, compared to microstepping and cogging errors. Ben Katz has a very good blog post on doing such a calibration, though for BLDCs that will run FOC. For steppers, you'd essentially just have to low-pass filter your eccentricity graph, and apply it to your measurement through a lookup table. (That would be where running the FFT on that plotted data would help, as the employee from RLS cited: it would help you determine a good cutoff frequency for the filter. Also, because the motor is periodic, you don't need a windowing function, and there should be zero spectral leakage. Perfect FFTs are my jam!)
@@jaro6985I’m pretty sure it’s not in the center. I own multiple AS5600L (same chip and form factor but you can change the I2C address) and after designing my own PCB for it and thus really studying the technical documentation I can with certainty say that those don’t have the center of the sensor in the center of the IC (which is really annoying and unnecessary). It’s off by roughly 0.16mm
I ran across this same issue. We were driving a furnace loader with a stepper motor and battling with resonance. It turned out that the stepper motor position was not linear when micro-stepped. Our drive used two ROMs, one for cosine and one for sine to control the current going to each phase of the stepper motor. I created an adjusted version to correct the error. The motors ran smoother but the first step away from the pole was not very predictable. I only corrected for position under no load, we planned to also adjust detent torque, but ran out of time.
That’s exactly right: microstepping is a “guess”. The only really trustable position is on full steps. I read a few articles about the drivers that allow for microstepping calibration table, they point that when the load changes, the response curve from the motor is affected.
Those magnetic sensors are really good. Depending on the exact part number, you can also use them to emulate a quadrature encoder, and at start-up it will output exactly the right number of pulses for the starting position.
Matthias as a compliment. "you are too smart" Thank you for sharing your world with us. I miss your previous location and adventures, but life moves ever forward.
This is a really great video, I have magnetic encoders built into the Odrive but I've always stuck to the CUI AMT212B encoders because I've been skeptical of magnetic encoders in VERY high precision applications I typically mess with them at. But this video actually shows a really great example of I think quite reasonable achievable accuracy given very high concentricity between the encoder and magnet. I very much like the way you visualized the encoder values in the rotary configuration as well as the linear application. Fantastic!
I really like those AS5600 encoders and have used them in a lot of my projects. Like you noticed, the alignment of the magnet matters a lot. Also, the distance from the magnet to the chip matters. If I remember correctly the spec sheet calls out a distance of 0.5mm from the magnet to the top of the IC package. Great video!
@@jaro6985 Absolutely not universally true, though it may be for some devices of course. Check the datasheet for the specific device you're using. Some are marked with a dot to show the optimal centre of rotation.
Daaamn, you are good. I wish so much I'd have time to learn so much stuff as you know. I've been a subscriber for over 10 years now and I am still impressed by how wide your knowledge is.
The lego had me laughing, thank you! Good stuff once again; now I have to go and see what Scott was doing. Good luck with your gear cutting, I have faith in your ability to work it out.
Encoder designer here :) It is funny to watch using stepper motor as a reference for the encoder performance measurement. Right here you created the chicken & egg problem. TBH, your measurement of +/- 0.15 deg of error are quite spot on for a regular magnetic encoder or big stepper motor. Good job. Let me know if you need some other encoder types to continue playing with this technology :)
Car manufacturers use magnetic angle sensors to determine wheel angle rotation. They have a main gear and some smaller satellite gears which are being measured. By choosing a smart divider between those gears one can use Verniers principle to calculate multiple rotations with the accuracy of the smallest gear.
I get similar results in my tests. The magnetic position vs step position is good up to about 800 s/rev. Another source of error is the drivers, with different varieties having different microstepping accuracy. I was going to do a test of stepper vs magnetic and optical encoders. That fell apart when I took the back off a $10 aliexpress optical encoder. It wasn’t an optical encoder at all but was a magnetic encoder.
The encoder I have is 600 ppr or 2400 Quadrature transitions. I have it geared up about 4:1 so close to 10000 quadrature transitions per stepper revolution. I put the project aside when I found out it was magnetic.
Just checked an optical rotary encoder I purchased from AliExpress recently. Things weren't looking good when I realised it didn't actually say "optical" on the device or packaging, but was relieved to find it did actually use an optical mechanism, and even had an O-ring sealing the casing. Hopefully I didn't introduce any dust in the couple of seconds it took for me to peek inside.
VERY cool video! Yeah - most people assume microstepping goes perfectly. It is not linear. You can only trust the correct position of full steps. What happens between full steps varies a lot between each motor. I read that Trinamic has more expensive drivers that allow you to calibrate a microstepping curve… but I never had one to play with.
@@matthiasrandomstuff2221 I suggest you check this encoder > MPS MA630. It has an internal memory for calibration data, but you can achieve more accurate positioning with chepaer magnetic encoders too (MA302) , if you calibrate them and record calibration data into memory. Calibration involves very slow rotation of the shaft in microstep mode ( to allow settling down between steps ), and recording the difference between commanded position vs. encoder readout. Then compensate for that during your control loop. Also, when powering on a stepper, it will be in unknown position that may be anywhere between two poles, so you should energize the windings first to lock the rotor in a fixed position before starting any calibration. Othervise you will have random offset to your data ranging +- half step. Very high accuracy can be achieved with this method.
used as5600 for my final uni project. 3d printed a bracket to mount it nicely on the back of stepper, and used a kaman filter for any measurement noises. works pretty nice
if you are planning on cutting gears, then using a stepper motor to drive a turn table is a good solution. Turn tables have a significant gear reduction (worm gear) commonly 90:1. So the actual angle error of the turn table would improve the accuracy of 0.3 degrees on the stepper to 0.3/90 deg, Your program would need to keep track of the actual number of turns as well as steps of the stepper motor, as well as the gear ratio of the turn table. If your plan was to cut gears with out a turn table you may also run into hold in place issues, unless you have a very strong motor.
I have worked with these encoders in FRC, and when you use a precisely machined part, you can get about a half a tenth of a degree of error but when they are even just 2-3 mms off, their accuracy goes down so much they aren’t worth using at all. The distance of the magnet to the encoder also matters to the mm. I bet if you had a lathe and made a shaft for the magnet to go into and attach it to a motor, you would have way more accuracy to less than a tenth of a degree.
I love your custom wooden parts for things like this. reminds me of before i had a 3D printer, I'd also carve little parts out of wood. very cool but also very time consuming
A heavy flywheel and some bearings and drive the magnet around this way. Then you can let it coast slowly to a halt and look at the noise from the magnetic encoder itself seeing how you reduce the other noise to bearing rumble and inertia.
This is amazing stuff! Btw, I think you could still manage to do a dividing head with one, if you gear it down enough so the motor is doing more steps per degree on the head. Ofc, that adds in backlash, but as long as you end every move to a new position with a move in one fixed direction, it should cancel out. You'd also need a way to lock the head after moves... Really what I'm saying is that I'd love to watch a build video of you doing that 😉
Hey Matthias, if you're looking for good accuracy for you dividing head project I can recommend the AMT series of capacitive encoders from CUI. I retrofitted my telescope with AMT112S encoders, and with the 0.35 degree field of view I usually use, I always find my target object within half a radius of the center of the field of view, so they really do live up to the 0.2 degree specification they promise. They are capacitive encoders with a captured but floating rotor. This obviously makes them less easy to install than the magnetic encoders (and they are definitely less cheap), but they are not position critical: even if the body of the encoder ends up misaligned to the rotor or the rotor has some radial runout (within reason, ~0.5mm allowable error), they still report correctly. My home-brew telescope retrofit was by no means perfectly accurate. If you want to mount them to a stepper as intended, they are actually very easy to use since that's what the included brackets are designed for. The AMT112S is quadrature output and produces up to 16384 positions per rev (4096 quadrature cycles per rev), but I only used this model because of the limitations of the firmware I wanted to use and the size I had available for mounting: there are more convenient versions that have SPI or UART position output (AMT21 series). There is a larger version that has slightly higher resolution, and also a larger 0.1" pitch connector (the small connector on the AMT112S was hard to obtain and assemble). But this is an older model and actually has worse overall stated accuracy, not sure how good they are.
I was originally attracted by the woodwork magic but have stayed for everything else, and of course, the woodwork. I have learned so much from you over the years, keep up the good work!
Even the mounted magnet one can see the magnet wobble in the holder mounted on the shaft...... ideally even the motor shaft when in rotation is machined with a fine cut for "truness" before mounting the magnet holder.....similarly the holder is then machined..lastly the magnet is mounted... This is normally the setup procedure for extremely accurate alignments... Make sure of a really good fit (mating) btwn. shaft & hole & not an interference type fit...magnet face must also run true else it may contribute to errors due to magnetic field strength variation 😊
The big thing is if the error is repeatable or not and where you're accurate sensing is from. If you can use both a magnetic sensor and incremental encoder on the same motor you can use one to calibrate the other and remove any of the repeatable errors. This is one of the ways we're dealing with position errors found in resolvers at work. Also, you should try tuning your drive current and take note of how much it affects your microstepping position accuracy. I expect there's a certain amount of offsets within each full step and the quality of the stepper as well as how well the current is tuned for said motor will make a difference.
oh, yeah, these hall effect sensors are quite impressive; we deal with quite a few arcade games which use magnetic encoders for sensing analog inputs in place of potentiometers and you can almost always notice immediately because of how much more stable and precise the inputs are only issue with those tends to come when the magnet is mounted strangely or somehow gets rotated off from whatever axis it was placed in as a reference direction, because measuring something like up or down gets harder when the magnet you expect to be exactly level in exactly one direction gets spun 120 degrees out of axis :P
Love your videos, super interesting and straight to the point! I got PTSD seeing that wobble on the adapter holding the magnet hahaha. I was making a rotating platform with a nema17 for calibrating some angle measurement equipment and absolutely could not get the concentricity to be decent using 3d printed adapters.
I figured the lego would get me close enough, but no. Problem is, there's a fraction of a millimeter of play with the lego shaft in the lego holes, and that was enough to throw thigns off. If you can get consistent to a range of 2 degrees with one of those thingys, you are doing pretty good.
@@matthiasrandomstuff2221in astronomy, where those errors matter a lot, they use 2 motors torquing in opposite directions and move by adjusting the difference in torque between the two. Completely eliminates backlash and vibrations in at least one direction, possibly both, depending on where exactly you place the two actuators in the chain
Just put an additional angular encoder on a worm-drive or other low backlash gear reduction attached to the rotary divider. The primary encoder gives absolute orientation, the other gives high precision relative angular values. Just a thought to help feed the algorithm.
Without taking into account the positioning of the magnet or sensor, there is another variable here, the stepper drivers are really not that accurate as you may think, they tends to have deviation from the ideal position, in my field of work we do much higher microstepping that on these drivers (let's call it "continuous" microstepping), then, in the calibration phase, correction are made for each microstepping step, to verify the angle is actually right, once that is done, you ensure a VERY precise angle for the voltages provided to the coils. You just ends up with a big voltage correction table that smooth it all. Problem is here to have a very precise reference, but even without an ideal one, you can still improve the system.
@@matthiasrandomstuff2221Right, and even if that was the case, each stepper from the same manufacturer is slightly different. For example each DC motor we use, from very reputable sources, are recalibrated in house, same issue
If you introduce a gearbox between your stepper motor and rotary table you can reduce the micro stepping error to a value in arcseconds. My tilting rotary table has a 90:1 gearbox on it.
Make sure you magnetically decouple the rotor of the stepper from the magnet at the tip of the shaft. The rotor will induce some magnetics onto the sense magnet. And since youre conducting sensitivty tests, this effect could be non negligible. You can get rubber couplings to do this
Some time ago i ordered some encoders (MagAlpha MA730),some magnets and a flux detector card... The data sheet recommended diametral magnetized ring magnets. Since they did not have the right size i ordered some similar magnets to experiment. What i noticed with the flux detector card is that the ring magnets have a very clear line through the center where diametral disc magnets have an almost homogeneous magnet field around the middle...
@@matthiasrandomstuff2221 Not an exception in liking your videos. In fact I can't recall not liking one. An exception in commenting that I liked it. I need to get in the habit.
Funny how you switched from measuring accuracy of that detector using your stepper motor to measuring accuracy of your stepper motor using that detector.
Great video! I'd be curious to see what your results are with higher quality magnetic encoders like the AS5047P or MT6701. The AS5600 is kind of the runt of magnetic encoders, its meant to be a replacement for analog potentiometers instead of an encoder for control applications. It also has effectively 10 bit resolution instead of the claimed 12 bit resolution if you factor in the noise from it, but other sensors intended for motor control can have much higher resolutions and tend to perform much better in dynamic applications, as people from the SimpleFOC library community have found.
If you're getting 0.3 degrees of error, would a gear reduction help with that? Like, turn the stepper motor 10 steps to get a single step on the other end of the reduction. Would that give you a 0.03 degree error on the other end?
Matthias, some of what you are observing is the inherent accuracy of the stepper motor construction, which I assume has to do with the accuracy of the effective angle of the windings with respect to the rotation axis. According to a supplier we use for our products, Lin Engineering, the industry standard is 1.5% accuracy for a 200 step (1.8 degree) motor, but they say their motors are 0.4% accurate for a 200 step motor. So this accuracy, like any engineering specification, is a parameter of the motor and one you can improve with a better (and probably more expensive) motor. You are probably also observing some of the encoder's inherent accuracy.
@@matthiasrandomstuff2221 1.5% step accuracy. So if the motor has 200 steps, 1.8 degrees per step, the full step location will be within 1.5% of 1.8 degrees (0.03 degrees) of the true position. Typical cheap stepper motors would have 5% step accuracy, or 0.09 degrees max error.
oops, fixed. I actually go over the auto captions to fix stuff, but just trusted that it got the number right there, cause I wasn't actually listening to the video while I did that.
You're videos are fasinating. Your mind is great at exploring a new thing in a very quantitative way! (e.g. I heard this, how can I prove or disprove it experimentally? My experiment has a lot of error, what are the source(s) of error? How can I eliminate, reduce or measure the error(s)?) Ridiculously cool!
Would the spread be reduced if you use gear reduction like 1:10? You probably don't need the speed for cutting threads and closed loop steppers have speed to spare anyway. Really like seeing you play with this stuff :)
Makerbase makes an addon unit for converting dumb steppers to closed loop. Fully contained addition, fairly inexpensive too. MakerBase ServoXXD Insert stepper size in mm for XX
It is a cogging torque. Stepper has 50 poles and every 4 steps rotor and stator are alighed creating a cogging force. You can feel it when rotaing the shaft by hand.
If I remember correctly, you can get the sensor status for errors. One of those is the magnet not being detected. I used it to reject the readings while in this state.
This is all new to me so I expect this idea to be wrong but what if you attach the encoder to a big gear and then that drives a small gear, does that mitigate the inaccuracy?
Great video very interesting....Could this board be used to make a wind vane direction sensor for a rc sailing boat. ? Fitting the magnet to the vane so the wind direction is sensed by the board?
There's a couple of things I would try: storing the error (or trying to predict it in some other way) to compensate for it, and to have the magnet and sensor further away from the motor itself so the magnetic fields are smaller.
These magnetic encoders are usually attached to the back shaft of a stepper motor, sometimes just stuck on the shaft even though it is flush. Even other types of magnetic encoder are just mounted directly on the back of motors so moving the magnet and sensor further away likely doesn’t make enough of a difference to matter.
For driving a dividing head with a motor I would argue you want a gear reduction anyway (preferably a worm gear due to it being self-locking), which would increase your angular resolution by the gearing ratio.
I work for RLS, where we design and manufacture high-resolution magnetic encoders. It seems you're heading in the right direction, but what you need to do is perform FFT analysis over the accuracy plot. This will reveal the harmonic components of your signal (accuracy). The DC component will represent the offset (+ latency) between your reference and the DUT (encoder). The first harmonic represents the eccentricity of the magnet, and so on...
yes, fft would have been nice, would have a few low frequency peaks for eccentricity and manetic encoder errors and some high frequency peaks for step and microstep errors. But just showing it in time domain, I think, is more helpful for unerstanding.
Does the sending of the data induce a magnetic field as wel (radiosignal)?? Would utp-cable be more stable?
@@matthiasrandomstuff2221"unerstanding" may be my new favorite word... essentially "removal of error in one's [prior] understanding."
Great work, here, with this vid, and so many others. I hope they bring much unerstanding to this world.
Why are the RLS linear position sensors so expensive :( I am building a core-less linear actuator at home but I need position sensing to correctly commutate the currents. But the price of the linear incremental encoders are quite high haha
@@Peter_Enis Induced magnetic fields are way too small. The magnet was probably 4×4mm, and the magnetic field of the magnet is approximately 100mT.
Luvvin how you're introducing the Lego for more accuracy
There's some legit engineering that goes into Lego, that they're able to mass-produce them to the very precise measurements required to lock into each other reliably is seriously impressive
Back in the 1980s he built a working Lego engine.
I only have one word "Danish Quality" - Oh wait that was two words, but I stand by them 🙂
Can you measure some lego for me? With micrometer❤?@@Koushakur
The great thing about it, the uniform parts.
Matthias is a true scientist. Creates hypothesis, experiments, learns and writes it down. He’s even enjoying being wrong in his theories, because that enables him to learn more!
Oh how I love that he’s gone from excellent wood worker, to science and research, just to become even better at woodworking!
That's science! Beautiful process!
He’s a true engineer. He is can use the principles of science to expand his knowledge and understanding. Engineers take those principles and apply them to to the identification, definition, and characterization of problems, synthesize potential alternative solutions, apply scientific analysis to select the optimal solution, apply best practices in the detailed design, planning, implementation, sustainment, and eventual decommissioning of solutions.
To borrow and adapt an expression used by every non-commissioned military officer ever:
“Do NOT call me a scientist goddamnit! I’m an engineer. I WORK for a living!”
He's an engineer.
If this guy was my teacher in high school I would’ve focused on Computer Science and done a Masters. Amazing content and execution. Thank you.
It isn't too late.
You don't need a degree to work in computer science.
no, you will be addicted in wood working instead:)
If it wouldn't rain as much, I would run more and be in better shape.
I think he's inspiring more engineers than computer scientists.
I have checked a micro stepping stepper motor by attaching a laser pointer and drawing dots on a wall. The accuracy is affected by the linearity of the DAC's in the driver (probably very good) and the linearity of the magnetic fields which is probably related to the shape of the stepper motor's "teeth" (probably not so good).
As a toolmaker in a past life and, more recently, an electronics engineer, I'd be using a dividing head to make gears, with a stepper motor to drive it.
Love your stuff, particularly your systematic approach!
Fun presentation and coffee points for the lego finale! :)
Thank you!
I don't drink cofee, but lets just say that pays for another one or two of those sensors.
Everyone should drink coffee, health permitting.@matthiasrandomstuff2221
The error graphs from 2:55 and forward are just textbook encoder eccentricity examples, usually caused by misalignments between encoder and target.
As many pointed out, the center of magnetic encoders are sometimes not in the chip's center. A decent PCB design might fix that by putting the magnetic center at the center of the PCB, instead of just aligning the chip's center.
But, even then, due to manufacturing tolerances in the entire chain, you may end up with eccentricity. Thankfully, this can be removed by software through calibration. Many of these magnetic encoders come with a built-in function that you can trigger, but not necessarily all. One possibility is doing your own calibration on the controller side, as eccentricity errors have fairly low frequency, compared to microstepping and cogging errors.
Ben Katz has a very good blog post on doing such a calibration, though for BLDCs that will run FOC. For steppers, you'd essentially just have to low-pass filter your eccentricity graph, and apply it to your measurement through a lookup table.
(That would be where running the FFT on that plotted data would help, as the employee from RLS cited: it would help you determine a good cutoff frequency for the filter. Also, because the motor is periodic, you don't need a windowing function, and there should be zero spectral leakage. Perfect FFTs are my jam!)
In this case the sensor center is the IC center. edit: some are some aren't.
@@jaro6985I’m pretty sure it’s not in the center. I own multiple AS5600L (same chip and form factor but you can change the I2C address) and after designing my own PCB for it and thus really studying the technical documentation I can with certainty say that those don’t have the center of the sensor in the center of the IC (which is really annoying and unnecessary). It’s off by roughly 0.16mm
@@OleBrouer you are correct for AS5600 but not for AS5047. 5600 is offset by 0.172mm. thanks for that.
Mathias... you never cease to amaze...!! Often, we forget how much of an electronics engineer you are!!
Love it. Anytime Lego can be used for (relatively) high precision tooling in a benchtop environment, it makes me happy.
I have even used it for silicone casting because you can take away the box piece by piece without destroying the workpiece
I ran across this same issue. We were driving a furnace loader with a stepper motor and battling with resonance. It turned out that the stepper motor position was not linear when micro-stepped. Our drive used two ROMs, one for cosine and one for sine to control the current going to each phase of the stepper motor. I created an adjusted version to correct the error. The motors ran smoother but the first step away from the pole was not very predictable. I only corrected for position under no load, we planned to also adjust detent torque, but ran out of time.
maybe its a good thing I can't tweak the microstep ramps in the controllers I have. That would be endless futzing around!
That’s exactly right: microstepping is a “guess”. The only really trustable position is on full steps. I read a few articles about the drivers that allow for microstepping calibration table, they point that when the load changes, the response curve from the motor is affected.
Those magnetic sensors are really good. Depending on the exact part number, you can also use them to emulate a quadrature encoder, and at start-up it will output exactly the right number of pulses for the starting position.
You had me at LEGO. Oh wait, that was the end.
Matthias as a compliment. "you are too smart" Thank you for sharing your world with us. I miss your previous location and adventures, but life moves ever forward.
This is a really great video, I have magnetic encoders built into the Odrive but I've always stuck to the CUI AMT212B encoders because I've been skeptical of magnetic encoders in VERY high precision applications I typically mess with them at. But this video actually shows a really great example of I think quite reasonable achievable accuracy given very high concentricity between the encoder and magnet. I very much like the way you visualized the encoder values in the rotary configuration as well as the linear application. Fantastic!
I just like to witness genius...
Anyone who thinks logically and has the desire to learn can do everything (and more) shown in this video.
I think the same thing
@@r1m.dog78 I have very severe Dyslexia and Dyscalculia. It ain't happening...
just an engineer
@@adacovskthat is true, but I've worked with engineers my whole career and I think he's very very good engineer.
I really like those AS5600 encoders and have used them in a lot of my projects. Like you noticed, the alignment of the magnet matters a lot. Also, the distance from the magnet to the chip matters. If I remember correctly the spec sheet calls out a distance of 0.5mm from the magnet to the top of the IC package. Great video!
Yes, I came here to point this out - the correct positioning is not in the centre of the IC.
@@cooperised the correct positioning is the center of the IC. Airgap depends on magnet strength and size.
@@jaro6985 Absolutely not universally true, though it may be for some devices of course. Check the datasheet for the specific device you're using. Some are marked with a dot to show the optimal centre of rotation.
Daaamn, you are good. I wish so much I'd have time to learn so much stuff as you know.
I've been a subscriber for over 10 years now and I am still impressed by how wide your knowledge is.
This is really interesting and nicely visualised 😊
Never too old to 'play' with Lego. Love it!
The lego had me laughing, thank you! Good stuff once again; now I have to go and see what Scott was doing. Good luck with your gear cutting, I have faith in your ability to work it out.
Jeez, Matthias, that's getting to be real fun (shh, and educational).
I learn much more from you than my engineering professor! 🤣
I appreciate that all your graphics are ascii :D
No words! Matthias is just as good as ever! True scientist!
Encoder designer here :) It is funny to watch using stepper motor as a reference for the encoder performance measurement. Right here you created the chicken & egg problem. TBH, your measurement of +/- 0.15 deg of error are quite spot on for a regular magnetic encoder or big stepper motor. Good job. Let me know if you need some other encoder types to continue playing with this technology :)
I ordered some other ones, but some advice could be useful. Email me.
Car manufacturers use magnetic angle sensors to determine wheel angle rotation. They have a main gear and some smaller satellite gears which are being measured. By choosing a smart divider between those gears one can use Verniers principle to calculate multiple rotations with the accuracy of the smallest gear.
I get similar results in my tests. The magnetic position vs step position is good up to about 800 s/rev. Another source of error is the drivers, with different varieties having different microstepping accuracy. I was going to do a test of stepper vs magnetic and optical encoders. That fell apart when I took the back off a $10 aliexpress optical encoder. It wasn’t an optical encoder at all but was a magnetic encoder.
it would be hard to make an optical encoder with enough resolution to test microstep accuracy
The encoder I have is 600 ppr or 2400 Quadrature transitions. I have it geared up about 4:1 so close to 10000 quadrature transitions per stepper revolution. I put the project aside when I found out it was magnetic.
Just checked an optical rotary encoder I purchased from AliExpress recently. Things weren't looking good when I realised it didn't actually say "optical" on the device or packaging, but was relieved to find it did actually use an optical mechanism, and even had an O-ring sealing the casing.
Hopefully I didn't introduce any dust in the couple of seconds it took for me to peek inside.
@@sircompoDo you have a link for your encoder?
VERY cool video! Yeah - most people assume microstepping goes perfectly. It is not linear. You can only trust the correct position of full steps. What happens between full steps varies a lot between each motor. I read that Trinamic has more expensive drivers that allow you to calibrate a microstepping curve… but I never had one to play with.
Half steps are also accurate, but anything in between might be off.
@@matthiasrandomstuff2221 I suggest you check this encoder > MPS MA630. It has an internal memory for calibration data, but you can achieve more accurate positioning with chepaer magnetic encoders too (MA302) , if you calibrate them and record calibration data into memory. Calibration involves very slow rotation of the shaft in microstep mode ( to allow settling down between steps ), and recording the difference between commanded position vs. encoder readout. Then compensate for that during your control loop. Also, when powering on a stepper, it will be in unknown position that may be anywhere between two poles, so you should energize the windings first to lock the rotor in a fixed position before starting any calibration. Othervise you will have random offset to your data ranging +- half step. Very high accuracy can be achieved with this method.
used as5600 for my final uni project. 3d printed a bracket to mount it nicely on the back of stepper, and used a kaman filter for any measurement noises. works pretty nice
I've been watching him for years and apart from his woodwork stuff I do no understand a word that he say's..........and that's honesty !
This is actually also really neat to find good stepper motors for 3D printers with more accuracy.
So cool. I love how you use ASCII graphics to represent the data.
I have one of those encoder boards in post. I now know how to get started. Thank you Mathias!
Thank you for this amazing video Matthias. I enjoyed every moment and gave me lots of ideas.
Nic z tego nie rozumiem ale uwielbiam oglądać Twoje filmy 😊
bro
brilliant
your knowledge an applications of graphs and console programs is beautiful
more of this! its very responsive, would love to see it keep up in a high speed control loop scenario
Blown away by Mattias yet again .. 🤯
At my work we make precision gears, and work in the sub-micron range for some tolerances. Every fraction of error matters!!
The lego build is hilarious 😂
if you are planning on cutting gears, then using a stepper motor to drive a turn table is a good solution. Turn tables have a significant gear reduction (worm gear) commonly 90:1. So the actual angle error of the turn table would improve the accuracy of 0.3 degrees on the stepper to 0.3/90 deg, Your program would need to keep track of the actual number of turns as well as steps of the stepper motor, as well as the gear ratio of the turn table.
If your plan was to cut gears with out a turn table you may also run into hold in place issues, unless you have a very strong motor.
I have worked with these encoders in FRC, and when you use a precisely machined part, you can get about a half a tenth of a degree of error but when they are even just 2-3 mms off, their accuracy goes down so much they aren’t worth using at all. The distance of the magnet to the encoder also matters to the mm. I bet if you had a lathe and made a shaft for the magnet to go into and attach it to a motor, you would have way more accuracy to less than a tenth of a degree.
It's a 12 bit encoder. It's resolution is only 0.09 degrees, so you're not going to get better than that.
Excellent video video and great sensor tests! Looks like these sensors can be used in lots of different projects..
I love your custom wooden parts for things like this. reminds me of before i had a 3D printer, I'd also carve little parts out of wood. very cool but also very time consuming
Fun stuff! You also have to consider the distance between the magnet and the encoder. There's a sweet spot where the sensitivity is best.
I understand exactly none of this, will never have any use for it, still watch the whole thing every time.
A heavy flywheel and some bearings and drive the magnet around this way. Then you can let it coast slowly to a halt and look at the noise from the magnetic encoder itself seeing how you reduce the other noise to bearing rumble and inertia.
Great video, thanks. I'd not considered these sensors before, but they look amazing.
watching thru the years, and seeing some evolution.. awesome..
This is amazing stuff! Btw, I think you could still manage to do a dividing head with one, if you gear it down enough so the motor is doing more steps per degree on the head.
Ofc, that adds in backlash, but as long as you end every move to a new position with a move in one fixed direction, it should cancel out.
You'd also need a way to lock the head after moves... Really what I'm saying is that I'd love to watch a build video of you doing that 😉
Get this man a 3d printer!
I really like the process of learning and the way you think. I want the same
Hey Matthias, if you're looking for good accuracy for you dividing head project I can recommend the AMT series of capacitive encoders from CUI. I retrofitted my telescope with AMT112S encoders, and with the 0.35 degree field of view I usually use, I always find my target object within half a radius of the center of the field of view, so they really do live up to the 0.2 degree specification they promise.
They are capacitive encoders with a captured but floating rotor. This obviously makes them less easy to install than the magnetic encoders (and they are definitely less cheap), but they are not position critical: even if the body of the encoder ends up misaligned to the rotor or the rotor has some radial runout (within reason, ~0.5mm allowable error), they still report correctly. My home-brew telescope retrofit was by no means perfectly accurate. If you want to mount them to a stepper as intended, they are actually very easy to use since that's what the included brackets are designed for.
The AMT112S is quadrature output and produces up to 16384 positions per rev (4096 quadrature cycles per rev), but I only used this model because of the limitations of the firmware I wanted to use and the size I had available for mounting: there are more convenient versions that have SPI or UART position output (AMT21 series).
There is a larger version that has slightly higher resolution, and also a larger 0.1" pitch connector (the small connector on the AMT112S was hard to obtain and assemble). But this is an older model and actually has worse overall stated accuracy, not sure how good they are.
I was originally attracted by the woodwork magic but have stayed for everything else, and of course, the woodwork.
I have learned so much from you over the years, keep up the good work!
Even the mounted magnet one can see the magnet wobble in the holder mounted on the shaft......
ideally even the motor shaft when in rotation is machined with a fine cut for "truness" before mounting the magnet holder.....similarly the holder is then machined..lastly the magnet is mounted...
This is normally the setup procedure for extremely accurate alignments...
Make sure of a really good fit (mating) btwn. shaft & hole & not an interference type fit...magnet face must also run true else it may contribute to errors due to magnetic field strength variation 😊
The big thing is if the error is repeatable or not and where you're accurate sensing is from. If you can use both a magnetic sensor and incremental encoder on the same motor you can use one to calibrate the other and remove any of the repeatable errors. This is one of the ways we're dealing with position errors found in resolvers at work.
Also, you should try tuning your drive current and take note of how much it affects your microstepping position accuracy. I expect there's a certain amount of offsets within each full step and the quality of the stepper as well as how well the current is tuned for said motor will make a difference.
oh, yeah, these hall effect sensors are quite impressive; we deal with quite a few arcade games which use magnetic encoders for sensing analog inputs in place of potentiometers and you can almost always notice immediately because of how much more stable and precise the inputs are
only issue with those tends to come when the magnet is mounted strangely or somehow gets rotated off from whatever axis it was placed in as a reference direction, because measuring something like up or down gets harder when the magnet you expect to be exactly level in exactly one direction gets spun 120 degrees out of axis :P
Love your videos, super interesting and straight to the point! I got PTSD seeing that wobble on the adapter holding the magnet hahaha. I was making a rotating platform with a nema17 for calibrating some angle measurement equipment and absolutely could not get the concentricity to be decent using 3d printed adapters.
I figured the lego would get me close enough, but no. Problem is, there's a fraction of a millimeter of play with the lego shaft in the lego holes, and that was enough to throw thigns off. If you can get consistent to a range of 2 degrees with one of those thingys, you are doing pretty good.
@@matthiasrandomstuff2221in astronomy, where those errors matter a lot, they use 2 motors torquing in opposite directions and move by adjusting the difference in torque between the two. Completely eliminates backlash and vibrations in at least one direction, possibly both, depending on where exactly you place the two actuators in the chain
ABSOLUTELY BEAUTIFUL!!!! THANKYOU FOR THE UPLOAD ❤❤❤
Very useful information. I have been thinking about using the magnetic encoders for a project.
Just put an additional angular encoder on a worm-drive or other low backlash gear reduction attached to the rotary divider. The primary encoder gives absolute orientation, the other gives high precision relative angular values. Just a thought to help feed the algorithm.
Love the lego bit at the end! Super cool!!
Without taking into account the positioning of the magnet or sensor, there is another variable here,
the stepper drivers are really not that accurate as you may think, they tends to have deviation from the ideal position,
in my field of work we do much higher microstepping that on these drivers (let's call it "continuous" microstepping), then, in the calibration phase, correction are made for each microstepping step, to verify the angle is actually right, once that is done, you ensure a VERY precise angle for the voltages provided to the coils.
You just ends up with a big voltage correction table that smooth it all.
Problem is here to have a very precise reference, but even without an ideal one, you can still improve the system.
my whole point was that micrstepping of the drivers isn’t accurately matched to the motor characteristics
@@matthiasrandomstuff2221Right, and even if that was the case, each stepper from the same manufacturer is slightly different.
For example each DC motor we use, from very reputable sources, are recalibrated in house, same issue
If you introduce a gearbox between your stepper motor and rotary table you can reduce the micro stepping error to a value in arcseconds. My tilting rotary table has a 90:1 gearbox on it.
Make sure you magnetically decouple the rotor of the stepper from the magnet at the tip of the shaft. The rotor will induce some magnetics onto the sense magnet. And since youre conducting sensitivty tests, this effect could be non negligible. You can get rubber couplings to do this
Glad to hear someone saying "eye squared see" instead of "eye two see" -- that drives me nuts.
Solid. Clever. Scintillating rhetoric, and by golly if it wasn't informative as well.
Thanks for the content.
Keep up the good work.
בס'ד
Some time ago i ordered some encoders (MagAlpha MA730),some magnets and a flux detector card... The data sheet recommended diametral magnetized ring magnets. Since they did not have the right size i ordered some similar magnets to experiment.
What i noticed with the flux detector card is that the ring magnets have a very clear line through the center where diametral disc magnets have an almost homogeneous magnet field around the middle...
I usually don't write a comment just to say I liked a video. But this is an exception. I liked the video.
its an exception that you liked this video? Hmmm...
@@matthiasrandomstuff2221 Not an exception in liking your videos. In fact I can't recall not liking one. An exception in commenting that I liked it. I need to get in the habit.
You will always amaze me !
now i want to do a project with magnets and hall effect encoders
I'm glad you made such a good demonstration of just how sluggish python is with this
Not really. Limited by I2C and console mostly. Python on its own would have iterated much faster.
Funny how you switched from measuring accuracy of that detector using your stepper motor to measuring accuracy of your stepper motor using that detector.
“Why don’t just plot that on a cartisian plane sort of as a vector”, exactly what I was thinking while watching this video sitting on my toilet
This was fun, and I subscribed. Thank you.
I always forget how accurate are Legos. That last demo was my favourite just for that
Great video! I'd be curious to see what your results are with higher quality magnetic encoders like the AS5047P or MT6701. The AS5600 is kind of the runt of magnetic encoders, its meant to be a replacement for analog potentiometers instead of an encoder for control applications. It also has effectively 10 bit resolution instead of the claimed 12 bit resolution if you factor in the noise from it, but other sensors intended for motor control can have much higher resolutions and tend to perform much better in dynamic applications, as people from the SimpleFOC library community have found.
Noise is quite small, no LSB noise to be seen
Nice! Very comprehensive. Thanks for sharing!
I didn’t understand any of this but still I watch.
If you're getting 0.3 degrees of error, would a gear reduction help with that? Like, turn the stepper motor 10 steps to get a single step on the other end of the reduction. Would that give you a 0.03 degree error on the other end?
Very cool, thank you for sharing this.
It's pretty unbelievable really how little of this video I understood.
Matthias, some of what you are observing is the inherent accuracy of the stepper motor construction, which I assume has to do with the accuracy of the effective angle of the windings with respect to the rotation axis. According to a supplier we use for our products, Lin Engineering, the industry standard is 1.5% accuracy for a 200 step (1.8 degree) motor, but they say their motors are 0.4% accurate for a 200 step motor. So this accuracy, like any engineering specification, is a parameter of the motor and one you can improve with a better (and probably more expensive) motor. You are probably also observing some of the encoder's inherent accuracy.
1.5% of what? On its own this is unitless number which doesn't apply to anything.
@@matthiasrandomstuff2221 1.5% step accuracy. So if the motor has 200 steps, 1.8 degrees per step, the full step location will be within 1.5% of 1.8 degrees (0.03 degrees) of the true position. Typical cheap stepper motors would have 5% step accuracy, or 0.09 degrees max error.
Presumably the angular error is reduced if geared down.
At 4'05'' the subs display "0.5" while you're saying "0.15"
Other than that, love your work, keep it up, cheers and thank you 😊
oops, fixed. I actually go over the auto captions to fix stuff, but just trusted that it got the number right there, cause I wasn't actually listening to the video while I did that.
You're videos are fasinating. Your mind is great at exploring a new thing in a very quantitative way! (e.g. I heard this, how can I prove or disprove it experimentally? My experiment has a lot of error, what are the source(s) of error? How can I eliminate, reduce or measure the error(s)?) Ridiculously cool!
that's literally the basics of the scientific method.
@@tennicktenstyl I know! And so many science UA-cam personalities don't use it at all! I had almost forgotten it. . . until I got here!
So satisfiying to see the end
Solution, use a set of gears to reduce to a tolerance you're happy with and ensure those gears are the zero backlash preloaded type.
Matthias, you drew the jellyfish UFO there! 😂
But really interesting how it works indeed!!!
Stay safe there with your family! 🖖😊
Would the spread be reduced if you use gear reduction like 1:10? You probably don't need the speed for cutting threads and closed loop steppers have speed to spare anyway. Really like seeing you play with this stuff :)
Makerbase makes an addon unit for converting dumb steppers to closed loop. Fully contained addition, fairly inexpensive too.
MakerBase ServoXXD
Insert stepper size in mm for XX
Pure engineering wizardry
Steppers seems like fun to play with. In my case i wan't to try track the movement of the stars. Also requires good precision.
It is a cogging torque. Stepper has 50 poles and every 4 steps rotor and stator are alighed creating a cogging force. You can feel it when rotaing the shaft by hand.
Legos too now!!!! Hells yeah. What's past S teir? Because this channel is there.
If I remember correctly, you can get the sensor status for errors. One of those is the magnet not being detected. I used it to reject the readings while in this state.
I didn't go for "no magnet error", I just read the magnet field magnitude, as covered in the video.
This is all new to me so I expect this idea to be wrong but what if you attach the encoder to a big gear and then that drives a small gear, does that mitigate the inaccuracy?
Great video very interesting....Could this board be used to make a wind vane direction sensor for a rc sailing boat. ?
Fitting the magnet to the vane so the wind direction is sensed by the board?
There's a couple of things I would try: storing the error (or trying to predict it in some other way) to compensate for it, and to have the magnet and sensor further away from the motor itself so the magnetic fields are smaller.
These magnetic encoders are usually attached to the back shaft of a stepper motor, sometimes just stuck on the shaft even though it is flush. Even other types of magnetic encoder are just mounted directly on the back of motors so moving the magnet and sensor further away likely doesn’t make enough of a difference to matter.
Yes i was wondering if the magnetic fields varying within the motor were affecting the sensor too.
For driving a dividing head with a motor I would argue you want a gear reduction anyway (preferably a worm gear due to it being self-locking), which would increase your angular resolution by the gearing ratio.