A common component to many of my machine computerisations has been a quadrature encoder. I have always used optical encoders, all with A/B outputs, some also with index output, for applications that require position timing, such as the lathe ELS.
I also use these encoders extensively as MMI input sensors for display data entry, frequency tuning on radios, etc. So, I end up using lots of the darn things, and the costs become a little silly.. I tried making units, with slotted discs, etc, especially for the low pulse count applications, such as data entry, but it is just to finicky.
So, I decided to try a magnetic encoder – chips implementing this function abound these days, with some being really complex – a neat, simple device is the AS5147P datasheet here with a programmable output interface that can do all one would need – I use the ABI ( chan A, B and index) outputs, and these can be programmed to output from 256PPR to 1024PPR ( 4096 edges).
It can also output angles with 14bit resolution.
The device will easily cope with up to 28K rpm, is US$10.00 for one.
It uses a diametrically magnetized neo magnet, 8mm diameter, 3mm thick.
Programming is via SPI , easily done from any Arduino, and the device can be permanently programmed with your desired setup, so that it remains simply an encoder when you power it, with the SPI interface no longer needed.
It works very well indeed.
I knocked up a prototype to test, just used some PVC rod, with an Aluminium shaft holding the magnet
If higher performance ( speed..) is needed, bore out the ends of the PVC body shaft hole to take 2 x 6mm ID bearings..
26mm diameter PCB for the device:
PVC Body, the magnet in the shaft and the pcb assembled
Posted by Michael Gilligan on 06/09/2020 18:14:08:
…. being available from four Hall sensors and one rotating magnet.
The crux of it seems to be on page 10 of the datasheet.
The Hall sensors give a continually varying analogue output.
This is amplified, then goes through an A to D converter and then there is an inbuilt CORDIC that calculates the angular position.
I guess that for every 'tick' of the encoder, there must be a unique set of four values from the Hall sensors.
The headline cost of $10 seems good but how much value does the time to make the PVC housing, the magnet and PCB consume? And compare that to a 1024ppr encoder available from a source, which will be moderated if mentioned.
Posted by Michael Gilligan on 06/09/2020 18:14:08:
…. being available from four Hall sensors and one rotating magnet.
The crux of it seems to be on page 10 of the datasheet.
[…]
.
Thanks for that
Yes, I am sure you are correct … 'though it still boggles my mind to think of 1024 steps being extracted from four analog sensors on that physical scale.
The headline cost of $10 seems good but how much value does the time to make the PVC housing, the magnet and PCB consume? And compare that to a 1024ppr encoder available from a source, which will be moderated if mentioned.
I guess it depends on where you are and how easy it is to procure these things! Fedex/DHL 10 day shipping to me in Namibia varies between US$100 and US$150 from the USA, and about 70 to 80% of that from the UK. From China it is about 1/2 that, but this year I have had poor luck from that part of the world – shipments taking 2 to 3 MONTHS…and some shipments still outstanding since January…
In my world, I sometimes feel that, while most of the rest of you can go out and buy a balanced mixer at the local component store, I have to go out into my back yard, among the granite and quartz mountains, and dig out some Galena while keeping an eye open for a willing cat…
100 of those PCB's can be had for US$40.00. The chips are $7.00 ea for qty 100. I suppose I could do 50 of the housings and shafts in a day maybe?…
The concept is just neat and can easily be adapted to motor shaft ends, etc, without belts and the like.
Michael, exactly as was said – the 4 analogue outputs of the hall sensors are read and a fancy algorithm looks at the relative amplitudes/phase angles and computes the actual angular position of the shaft ( rather, the magnet..) From that it follows that the quadrature outputs are actual just an extension of the position determination. Some very smart design engineers out there, integrating all that into a $10 little chip!
Michael, exactly as was said – the 4 analogue outputs of the hall sensors are read and a fancy algorithm looks at the relative amplitudes/phase angles and computes the actual angular position of the shaft ( rather, the magnet..) From that it follows that the quadrature outputs are actual just an extension of the position determination. Some very smart design engineers out there, integrating all that into a $10 little chip!
Joe
.
Thanks, Joe … Whilst I can accept the explanation, I must admit it's more a matter of blind faith than actual comprehension
I really can't get my old head around the idea of the 'virtual pitch' of this encoder being whatever tiny circumference, divided by 1024
Posted by Michael Gilligan on 06/09/2020 21:51:27:
Thanks, Joe … Whilst I can accept the explanation, I must admit it's more a matter of blind faith than actual comprehension
I really can't get my old head around the idea of the 'virtual pitch' of this encoder being whatever tiny circumference, divided by 1024
MichaelG
Michael, perhaps this explanation is of some use? AS5147 operation – the pdf is oriented more toward the choice of magnet, but reasonably describes how the device works.
For the purposes of understanding its operation, I wonder whether it is helpful to draw the analogy between this device and some linear scales (Heidenhain and possibly Newall) that use a (n analogue) sinusoidal output instead of a quadrature pulse. The scales will resolve 1 um.
One big advantage of this sensor that struck me overnight is that it can be made into something with a very small length. If we have the end of the shaft as datum, all you need is the magnet thickness, the air gap, the chip height and PCB thickness.
I was dreaming of something that would go under my compound slide and feed into the DRO in the same way that a knee-quill adder box does on a mill.
this kind of sensors are used to control very accurate brushless motors in electric steering systems vor passenger cars and for steering angle sensors. I do not know it exactly ,but for a good motor control for silent working of the motor it have to be better than 360 steps per revolution. Based on the application the only problem I see by manufacturing to have it all accurate alligned in the middle position. otherwise there can be some wobbeling in the signal caused by a runout. This unit is ideal for homemade displacement senors.
Michael, maybe think of it in a different way. Imagine that the chip is a compass and the magnet the earth. We are quite blase about the idea that direction can be read to 1 degree from a compass scale, but the needle is doing exactly the same resolving of the magnetic field components as this chip. You could calibrate the compass to 0.1* and have a resolution of 3600 steps using a magnifier to read it. Or even have a vernier and read to 100th of a degree.
The same principle is used in the old "synchro resolver" system. This measured an angle with a rotor coil picking up a signal from two drive coils excited in phase quadrature, so the phase of the induced signal is essentially equal to the angle between the pickup coil and the "in-phase" stator coil. Analog Devices for one (used to?) make chips that could translate between the phase and a precision digital angle measurement.
This is also used in the Newall DRO system. The reference "scale" is a tube tightly packed with a row of precision steel balls, which is surrounded by a pair of pickups that are essentially differential transformers
( "LVDTs" ) excited in quadrature and generating sine and cosine signals that vary in relative amplitude depending on linear relative position. Though the ball diameter is say 5mm, a resolver can convert these into a micron-level position measurement.
The resolution all comes down to the number of bits used to digitise the amplitude measurement, so it's relatively easy in principle to resolve very small movements. The precision and accuracy however depends on many other factors, like the linearity of the sensors and A/D converters, electronic noise, geometry of the magnet and so on. Quite a lot of these depend on good design of the signal processing electronics in the chip. Given that the device will incorporate a processor and non-volatile memory, there is probably a calibration step in the manufacture where some parameters that affect accuracy and measured and compensation parameters stored.
Also think about your optical mouse: this can resolve a movement of 1/3000 inches for an LED type, or 1/15000 inches for a laser mouse, on any old desktop surface. The resolution in this case comes from the patterning of the optical sensor on the chip.
Michael, maybe think of it in a different way. Imagine that the chip is a compass and the magnet the earth. We are quite blase about the idea that direction can be read to 1 degree from a compass scale, but the needle is doing exactly the same resolving of the magnetic field components as this chip. You could calibrate the compass to 0.1* and have a resolution of 3600 steps using a magnifier to read it. Or even have a vernier and read to 100th of a degree.
[…]
.
Thanks for that, John … all generally understood and accepted
.
[quote] Posted by Michael Gilligan on 07/09/2020 08:03:59:
I am fine with the principle of operation, but; even as a microscopist, I find the ‘circular pitch’ of that virtual index wheel quite astonishing.
I calculate it as just under 6.75 microns … from a rotating magnet !
MichaelG.
[/quote]
.
It’s the mechanical dimensions, and the speed, that I find astonishing.
It would be extremely difficult to read a magnetic compass to a resolution [never mind accuracy] of one degree if it only measured 2.2mm diameter.
Probably pointless but if you put one on a stepper motor spindle and then examined results of microstepping and reading angle what would you get. Both relying on analogue interpolation to deliver quantised results.
One important point with this class of sensor is that the field sensng is ratometric between the sensors, not absolute. This means that changes to he total magnetic field do not affect operation. The relative positions of the sensors is accurately defined as they are all on a single piece of silicon.
I imagine the most critical properties are the alignment of the magnet and chip and how accurately the magnetic field is aligned in the magnet itself.
That's why I stuck to a circular construction – center is controlled to small enough tolerances quite easily. The placement of the chip on the board is not to difficult – I did it by centering the device pins on the PCB tracks, under a microscope. Final measurements on the microscope stage show that the IC body ended up centered within 0.06 mm of the pcb disc center. The datasheet indicates a 0.25degree non-linearity for a 0.25mm displacement, 1.5 degree for 1mm displacement, so not to difficult to get it fairly good.
If the PCB were assembled on a pick and place machine then the result is easier to control…
As to the accuracy of the actual magnetic field..best to buy a specified magnet from a reputable supplier!
I imagine the most critical properties are the alignment of the magnet and chip and how accurately the magnetic field is aligned in the magnet itself.
That's why I stuck to a circular construction – center is controlled to small enough tolerances quite easily. The placement of the chip on the board is not to difficult – I did it by centering the device pins on the PCB tracks, under a microscope. Final measurements on the microscope stage show that the IC body ended up centered within 0.06 mm of the pcb disc center. The datasheet indicates a 0.25degree non-linearity for a 0.25mm displacement, 1.5 degree for 1mm displacement, so not to difficult to get it fairly good.
If the PCB were assembled on a pick and place machine then the result is easier to control…
As to the accuracy of the actual magnetic field..best to buy a specified magnet from a reputable supplier!
Joe
That's not bad, more than enough for a control and probably as good as using a potentiometer for servo applications, obviously less ideal as a precision position sensor although you could easily calibrate it against a conventional rotary encoder.
Does it just give a quadrature output or can it give an absolute one as well?
Neil
Edit … once the printer is working you could print a jig to hold the IC central whilst you solder it. Another use for 3D printing – custom index wheels and (relatively low-resolution) opto encoders (I once made an absolute 4-bit rotary encoder by photocopying the design onto acetate, for a wind vane, I used IR diodes from two dead computer mice).
Neil, I think it is actually very good – If for example you were to use it for a spindle encoder for an ELS, it would be more than adequate at 0.5degree non-linearity. If used however as a 1:1 axial sensor on a rotary table, 0.5 degree error may not be acceptable..
What do you mean by absolute In terms of this device? It can give absolute angle in degrees from a calibrated zero point, give quadrature with a calibrated reference signal, and provide a 24bit PWM output related to angular position.
Regarding placing the IC in the center – I did make a automatic vacuum pencil that fits on my PCB engraver. The engraver also has a centering camera with cross hair, the idea being that I can engrave the PCB, and since the centre is then known, use the camera cross hair to center the pickup of the device and place it on the PCb with the vacuum pickup…If I were going to make a half a dozen…
Sorry to resurrect a somewhat old thread but I just found this and it seems pretty impressive and also nice and small. I also see that RS sell a board with one already mounted (including a magnet).
I do have a question… I'm looking for something that can tell me the rotational position of a shaft on power up. Can these things do that or must they first be rotated to a zero position in order to 'find themselves' after power up?
The AS504x series from AMS are angular position sensors – they give an absolute angle from power on. You would obviously need to align the magnet to the shaft so that the required angle is presented.
The AS5147 I used just outputs pulses – 4096 edges per rev, with one index pulse per rev.
I think something like the AS5040 will fit the bill… a resolution of 1/1024 of a turn which is probably a good deal more resolution than I need for this project.
I will buy one to experiment with in my next RS order.