+ Reply to Thread
Page 1 of 4 1234 LastLast
Results 1 to 20 of 67

Thread: Magnetic Encoder Project (AS5055)

  1. #1

    Default Magnetic Encoder Project (AS5055)

    Edit: See post #15 for latest video of single encoder. See post #23 for video of two encoders in 4-wire daisy-chain mode.

    I'm working on learning how to read the input from astriamicrosystems' AS5055 chip.

    Graham Stabler had suggested these type of encoders as a substitute for a potentiometer.

    I purchased a set of their evaluation boards (and some chips) from Digi-Key.

    The chip has several different ways it can communicate (all of them are SPI).

    The three wire, read only method looked the easiest so I tried it first.

    The evaluation board didn't come with a magnet or other encoder hardware. Here's a picture of the board.

    Click image for larger version

Name:	AS5055Board120316a.png
Views:	201
Size:	471.8 KB
ID:	90805


    I layered a few boards of expanded PVC together in order to sandwich in a set bearings. I attached a pair of axially magnetized magnets to the end of a carbon fiber rod with some PolyMorph. I held the shaft in place with some more PolyMorph with a couple of washer to smooth out the rotation some.

    Here's a picture of my contraption.



    My M2.5 nylon bolts weren't long enough to go through all three layers of expanded PVC and still reach to the bottom of the PCB so I had to start the bolt from the bottom layer of the boards. I used a couple of additional bolts to secure the layers together. It shouldn't come as a surprise the readings from the encoder flucutated a lot with this setup. I have some sample magnets arriving today that should let me build a more stable rig (the magnets should be diametrically magnetized instead of axially magnetized).

    Even with the fluctuation, it was fun to see the read out from the encoder. The encoder ouputs a 12-bit value. My current setup can't take advantage of the sensors full resolution.

    Here's a video of the sensor in action. I'm using a QuickStart board to read the sensor and sending the data to a little 7-segment display. The output should range from 0 to 4095.

    Edit: See post #15 for latest video (it's a lot better than this video).



    The big advantage magnetic encoders have over pots or other encoders is they don't wear out. I suppose the bearings or some other part of the hardware could wear out but the magnet/chip interface is contactless.

    Here's a close up of the magnet suspended above the encoder.



    This is a paid job (software only). I will likely be able to release the code I write sometime in the future (hopefully soon) but for now, I can't post it.

    I think this sensor has a lot of potential. One possible application would be a continuous rotation servo that provides position feedback.
    Attached Thumbnails Attached Thumbnails Click image for larger version

Name:	AS5055Hardware120319a.png‎
Views:	1759
Size:	825.4 KB
ID:	90806   Click image for larger version

Name:	AS5055Hardware120319b.png‎
Views:	1738
Size:	159.0 KB
ID:	90807  
    Last edited by Duane Degn; 05-15-2012 at 11:05 PM.

  2. #2

    Default Re: Magnetic Encoder Project (AS5055)

    Software is now available.

    See post #34 for details.
    Last edited by Duane Degn; 05-26-2012 at 10:04 PM. Reason: Added Software

  3. #3

    Default Re: Magnetic Encoder Project (AS5055)

    2 of 3 reserved.

  4. #4

    Default Re: Magnetic Encoder Project (AS5055)

    3 of 3 reserved.

  5. #5
    StefanL38's Avatar
    Location
    northern part of Hessen (Germany)
    Posts
    2,122

    Default Re: Magnetic Encoder Project (AS5055)

    Hi Duane,

    cool that you are working with this magnetic encoder.

    the people from 01mechatronics (the website does no longer exist) developed a small board for "super-modifying" RC-servos
    http://code.google.com/p/zosupermodified/

    maybe it is useful to look into their code which is GNU GPL

    I would love to see somebody writing code for the propeller-chip to read out these devices
    best regards
    Stefan

  6. #6

    Default Re: Magnetic Encoder Project (AS5055)

    Duane,

    Really interesting, and great use of Polymorph. Thanks for sharing.

    The values on the display are steadier than I would have expected for such a setup. Any idea what kind of response time is possible (rpm etc)?

  7. #7

    Default Re: Magnetic Encoder Project (AS5055)

    Duane
    You mentioned getting different magnets. What was your source for the replacement magnets. I have a couple of sample chips I want to experiment with.
    Jim

  8. #8

    Default Re: Magnetic Encoder Project (AS5055)

    Quote Originally Posted by StefanL38 View Post
    the people from 01mechatronics (the website does no longer exist) developed a small board for "super-modifying" RC-servos

    I would love to see somebody writing code for the propeller-chip to read out these devices
    Thanks Stefan.

    The "Super-Modified" servos look like they use a AS5145 chip. Those have some extra features like quadrature output and PWM output. They also cost more ($9 in quantity of 100). The AS5055 cost about $5 if you buy 100 at a time.

    The AS5055 has the same 12-bit resolution and I think the smaller size of the AS5055 would make it easier to use as a pot replacement in a servo.

    When you say "I would love to see somebody writing code for the propeller-chip to read out these devices" are you referring to the Super-Modified board or the encoder I'm working on?

    I plan to make a small board using these AS5055 chips and once I do, I'll be free to release the code. I doubt I'll be able to get a board designed and made before the upcoming Expo since I'm trying to get some other projects that are further along finished to bring with me for "show and tell".

    These AS5055 chips can be daisy-chained together which should make using a bunch of them not use a lot of pins (it will require four Propeller pins). In daisy-chain mode, each chip doesn't require a separate chip select pin as is usually required by SPI devices. The daisy-chain does reduce the frequency each chip can be read since they are all read one after the other.

  9. #9

    Default Re: Magnetic Encoder Project (AS5055)

    Quote Originally Posted by Tubular View Post
    Duane,

    Really interesting, and great use of Polymorph. Thanks for sharing.

    The values on the display are steadier than I would have expected for such a setup. Any idea what kind of response time is possible (rpm etc)?
    Thanks Tubular.

    Yeah, I wasn't expecting rock solid performance from my blob of parts. I was really pleased to get it working as well as it did with this setup.

    The PASM code takes 56us to read from the device.

    I don't know how many rpm it could read. I think once you're trying to measure rpm above a certain point, you'd be better off with just a single hall-effect sensor since the position within the rotation would no longer be very important.

    I think these sensors would work well with a servo as Stephan suggested. I think it would be really cool to be able to know the position of a continuous rotation servo with better than 0.1 degree of accuracy. I'm pretty sure this sensor could be read fast enough to monitor the speed of even the fastest CR servos.

  10. #10

    Default Re: Magnetic Encoder Project (AS5055)

    Quote Originally Posted by RS_Jim View Post
    Duane
    You mentioned getting different magnets. What was your source for the replacement magnets. I have a couple of sample chips I want to experiment with.
    Jim
    Jim,

    I think you'll want magnets that are diametrically magnetized. I think the recommended size is 6mm diameter and about 2.5mm thick.

    I had requested some magnet samples from austriamicrosystems. The sample that looks like it will work the best (it's the size I mentioned above) has a part ID of 990600037. The samples were sent FedEx. I'm sure the shipping cost them much more the magnets.

    I haven't mounted the new magnet yet. It should let me build a more stable rig. I'll likely use 3/8" plexiglass as the support structure for the encoder this time.

  11. #11
    StefanL38's Avatar
    Location
    northern part of Hessen (Germany)
    Posts
    2,122

    Default Re: Magnetic Encoder Project (AS5055)

    Hi Duane,

    When you say "I would love to see somebody writing code for the propeller-chip to read out these devices" are you referring to the Super-Modified board or the encoder I'm working on?
    The main thing is to have propeller-code to read the encoder at all. I guess the SPI-protocol is the same for AS5145 and AS5055. Is this right?
    I think SPI will be faster than reading PWM. Would a DC-servo-control need quadrature-output
    or could it work on just 12bit values with looking at increase / decrease the values to conclude clockwise/counterclockwise rotation?

    best regards
    Stefan

  12. #12

    Default Re: Magnetic Encoder Project (AS5055)

    Have you seen this

    I use these on my robot motors.

    I dont rember if they are 10 bit or 12?

    You think the chips are expensive wait till ya price the 3mm radial magnets.

    http://reprap.org/wiki/Magnetic_Rotary_Encoder_1.0

  13. #13

    Default Re: Magnetic Encoder Project (AS5055)

    Quote Originally Posted by StefanL38 View Post
    I guess the SPI-protocol is the same for AS5145 and AS5055. Is this right?
    I think SPI will be faster than reading PWM. Would a DC-servo-control need quadrature-output
    or could it work on just 12bit values with looking at increase / decrease the values to conclude clockwise/counterclockwise rotation?
    I haven't read enough of the AS5145 datasheet to know if they are read the same way the AS5055 chips are read.

    I don't think you'd need quadrature output. I think seeing the 12-bit value change would be enough to know the direction of rotation.

    Reading the SPI output is kind of trivial (so many things are once you know how). A couple of years ago I would have been lost trying to read from this chip but since I've worked on other SPI projects, this one isn't too hard.

    I can release the code once I have gerber files for making a board with this chip (part of the deal that was worked out with the person paying me to do this).

    I'm hoping to take advantage of the small size of this chip and make a little board to take the place of a servo's pot.

  14. #14

    Default Re: Magnetic Encoder Project (AS5055)

    Quote Originally Posted by jdolecki View Post
    Have you seen this

    I use these on my robot motors.

    I dont rember if they are 10 bit or 12?

    You think the chips are expensive wait till ya price the 3mm radial magnets.

    http://reprap.org/wiki/Magnetic_Rotary_Encoder_1.0
    Those encoders use a AS5140 chip which is the 10-bit sibling of the AS5145.

    The AS5055 has a recommended magnet size of 6mm diameter. Smaller magnets will work by the output wont be as linear as the angle of rotation changes.

  15. #15

    Default Re: Magnetic Encoder Project (AS5055)

    I received the sample magnets yesterday. Today I tried to figure out a good way to rigidly mount one. I didn't use PolyMorph at all this time.

    I used a piece of scrap plexiglass as the main structure of the encoder.

    Click image for larger version

Name:	AS5055Hardware120320b.png
Views:	93
Size:	448.2 KB
ID:	90852

    I used a M5 nylon bolt for the encoder shaft and as the magnet holder.

    Click image for larger version

Name:	AS5055Hardware120320c.png
Views:	1248
Size:	420.5 KB
ID:	90853

    I milled a hole slightly smaller than the magnet in the head of the bolt. I was pleasantly surprised I was able to press fit the magnet into the hole on my first attempt. The milling was all done on a drill press. Any holes wider than 11/64" had to be made by repeatedly plunging the bit (I did use a milling bit) into the work piece.



    I milled out an area for the bolt head around the 5mm central hole. You can see the encoder chip through the 5mm hole in the picture above.

    Here's a picure of the two encoders side by side.



    As you can see, this second encoder is much more rigid than my first attempt.

    While this new encoder was a lot more stable than my first attempt, the last digit of the display still flickered different values. I used a running average algorithm to see if I could filter the output with software. I was amazed at the difference the software filter made.

    Here's a video showing off the new hardware and software.



    Initially the filtering algorithm had trouble when the encoder was close to the 4,095 to 0 transition. I ended up using a second set of numbers to computed the average when the reading was near this transition. I added 4,096 to the low values before averaging them.

    There's a lot of fine tuning that could be done with the software filter but it's working well enough now for my to continue on and get the SPI daisy-chain mode to work.

    So far this project has been a lot of fun.
    Attached Thumbnails Attached Thumbnails Click image for larger version

Name:	AS5055Hardware120320a.png‎
Views:	1692
Size:	1.12 MB
ID:	90851   Click image for larger version

Name:	AS5055Hardware120320d.png‎
Views:	1623
Size:	689.2 KB
ID:	90854  

  16. #16
    StefanL38's Avatar
    Location
    northern part of Hessen (Germany)
    Posts
    2,122

    Default Re: Magnetic Encoder Project (AS5055)

    Duane,

    how do you keep the magnet in a constant distance to the chip? On the picture I can't see anything that has this function.
    best regards
    Stefan

  17. #17

    Default Re: Magnetic Encoder Project (AS5055)

    Quote Originally Posted by StefanL38 View Post
    Duane,

    how do you keep the magnet in a constant distance to the chip? On the picture I can't see anything that has this function.
    best regards
    Stefan
    I pulled on the bolt as I turned it clockwise.

    Counter-clockwise movement makes the bolt push against the top of the plexiglass.

    I considered adding a thrust bearing and a couple of nuts to hold the bolt up but I wanted to get back to working on the software and the current version of the hardware works good enough for testing.

    I also tested a 1/16" magnet today. It fit in the center of the philips "X" on the head of the bolt without needing to modify the bolt at all. The encoder could read the position of the little magnet just fine. Its output wont be as linear as the larger magnet though.

    I'm just about ready to test my daisy-chain software.

  18. #18

    Default Re: Magnetic Encoder Project (AS5055)

    Given the way the sensor works (ratiometric reading of X and Y field components, i.e. atan2(Y, X) ), I doubt that it would be sensitive to the Z-axis distance of the magnet, which affects only the common-mode response.

    -Phil

  19. #19

    Default Re: Magnetic Encoder Project (AS5055)

    Quote Originally Posted by Phil Pilgrim (PhiPi) View Post
    Given the way the sensor works (ratiometric reading of X and Y field components, i.e. atan2(Y, X) ), I doubt that it would be sensitive to the Z-axis distance of the magnet, which affects only the common-mode response.

    -Phil
    You're correct. The datasheet says the magnet should be 0.5mm to 2.0mm above the chip. The Propeller can still read the magnet's rotation when it's touching the chip. I haven't tested to see how far away the magnet can be. I think when the magnet is father away from the sensor, the sensor is more susceptible to noise. Using a metal shaft (even non-ferrous metals) to hold the magnet could also cause noise problems.

  20. #20

    Default Re: Magnetic Encoder Project (AS5055)

    Duane

    If you get a chance I'd be really interested whether a "longer" magnet would still give reasonable results. I'm thinking something like a horseshoe magnet which has an "open" centre and side. ie you would still have the magnetic flux cutting across the sensor surface but the pole ends of the magnet further out

    I guess you could test with 3 or 4 of your magnets end to end, with minimal flux escaping where the middle ends connect.

+ Reply to Thread

Similar Threads

  1. Magnetic encoder object
    By Graham Stabler in forum Propeller 1 Multicore Microcontroller
    Replies: 2
    Last Post: 02-24-2010, 06:33 PM
  2. New Magnetic Rotary Encoder find
    By kf4ixm in forum General Discussion
    Replies: 3
    Last Post: 02-12-2010, 08:54 PM
  3. Absolute Magnetic Encoder
    By Aleks in forum Propeller 1 Multicore Microcontroller
    Replies: 37
    Last Post: 07-09-2009, 04:45 AM
  4. sculpture project question with a magnetic switch?
    By markmcleod50 in forum General Discussion
    Replies: 4
    Last Post: 10-06-2004, 09:13 PM
  5. Magnetic or photoeye encoder?
    By Armored Cars in forum Robotics
    Replies: 2
    Last Post: 08-21-2004, 11:04 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts