I just ordered some PCBs for these chips. I should be able to release the code in about 10 days.
@Jim, I found the 5055 will work with a wide variety of magnets. I think the problem with using the wrong sized magnet is the reading isn't completely linear though out the rotation of the magnet.
@JakoGerber, I saw your "Visitor Message". I'm using the 4-wire mode both with and without daisy chaining. As I mentioned above, I'm relatively close to releasing the code.
I plan to purchase a bunch (100) or these chips and I hope to be able to sell relatively inexpensive boards to use them.
I'm very unsure about the best way to connect to these boards. The daisy-chain feature is nice but it introduces problems with a wiring harness since some of the wires need to terminate on the board while others start on the board. Using two connectors per board solves these problems but the connectors are likely to take up a lot of board real-estate.
I'm currently thinking of using a single 2x5 IDC connector with a 10-wire ribbon cable. Two of the wires will need to be cut after each connection with a board. By alternating the wires cut, I think I can get away with just the one connector per board and still use the daisy-chain feature.
I've been designing PCBs for these chips. I've posted the various PCB designs in this thread.
I receive a notice from BatchPCB Thursday (May 17) that my first boards have been shipped. I'm hoping they will arrive Monday. Once I get these encoders working with the PCB, I will likely release the software (this is part of my agreement with Kirk). My guess is, I should be able to post the files on Tuesday or Wednesday of this coming week.
If any of you have suggestions on board layouts, I hope you'll share them either here or in the PCB thread.
I will likely hold off submitting a new PCB order until after I've tested these first few I've had made.
One addition I'm planning on some of the new boards is an on-board microcontroller to take care of the SPI communication. Hopefully, I'll be able to make a board that could be easily used with a Basic Stamp or Arduino via asynchronous communication.
I couldn't resist adding a Propeller to one of my boards. I've always thought it would be cool to have a Propeller inside a servo. I think I have a board with an encoder and Propeller that would be small enough to fit inside a servo, I just doubt it will be a very practical application for either the encoder or the Prop.
I finally received my PCBs from BatchPCB. And they work!
This is my first every PCB made by a fab house. I know a lot more about PCB design now than when I submitted these PCBs to be made. Fortunately I know enough to design a functioning PCB for the AS5055 chip.
Here's a picture of three populated boards, two unpopulated boards and one of the PCBs made by AMS.
The PCBs I made have connectors on both sides of the board to make it easier to daisy-chain them. The yellow wire on the far right board made the necessary connections on the last board of a daisy-chain. There are also holes to mount pins to use with a jumper if you didn't want to connect wires on the last device in the chain.
I've had several people ask about the software for these AS5055 chips. Kirk Fraser had agreed to let me post the since I've successful made a PCB for the chip (part of our agreement to release the code).
The code is set up to use a single chip. Multiple chips can be used by changing the "_ChainDevices" constant.
'' Set the constant "_ChainedDevices" to the number of devices that
'' are to be monitored in daisy-chain mode.
_ChainedDevices = 1
I'm personally very pleased with the way the software filter turned out. The 4,095 to 0 transition is now nice and smooth.
If any of you use this object, I hope you let me know.
There are demo boards for these chips at Digi-Key (IIRC they're about $50), I hope to have some boards with these chips on them available to sell in about a month (hopefully for much less than the Digi-Key price).
If there is some board configuration you'd like to see, make sure and let me know either here on this thread or on the PCB thread in the General Discussion forum. I'm particularly interested in hearing people's opinion about mounting holes and connection options.
I doubt I'll have more of these particular boards made. I don't like having to use so many pins on the connectors.
BTW, these little chips make soldering a smt Prop seem like a cakewalk. I've had many more failed attempts at soldering them (the AS5055 chips) than successfully soldered boards.
One thing I've learned from these PCBs is to have a solder paste stencil made if you've got tiny smt chips in your design.
These are really cool little sensors, I'm hoping to figure out a way to make then easier to incorporate into robotic projects.
Duane- what are the small parts on the back side of the pcb on the lower right board in the picture?
Don,
Those are just solder pads for passives. The silver color of the pads didn't show up with the lighting used to make the photo.
Here's another picture of the back of the board.
An apnote by AMS suggests using 100nF caps on each I/O line and a 120ohm resistor on the MISO line if your going to use long wires to communicate with these sensors.
I added pads so the noise reducing capacitors and resistor could be added to the I/O lines. Since I haven't yet used long wires with these boards, I didn't populate the caps. I only added a resistor on the MISO line (a solder jumper would have also worked if the noise reduction isn't needed) and I added a single decoupling cap on the pads meant for two different capacitors. I realized after the boards were made, I placed the resistor for the power supply filter on the VDDp supply instead of the VDD line. Since I'm using a single power source for both VDD and VDDp, I bypassed the unneeded resistor pads by using the decoupling cap as a jumper. I'm using a 3.3V microcontroller so I don't need two separate supplies. So far, it looks like these work okay without a power supply filter.
The VDDp can receive a lower voltage than VDD if you're using a low voltage uC to communicate with this sensor. I believe the logic lines use the VDDp voltage which can be as low as 1.8V (and up to VDD). VDD needs to be between 3.0V and 3.6V.
I will probably test these encoders using long wires. I'll test them without the caps first and then add the caps to see it they improve the sensors ability to communicate over long wires.
Duane,
I downloaded your code to try on my own chip, so far no joy. When I put a parallax USB scope on it, I see the ss & sclk, as the same width. I was expecting to se about 12 clocks for one chip select. Ok, back to the drawing board, as I have not had time to run a debugger on the asm code.
Jim
Duane,
I downloaded your code to try on my own chip, so far no joy. When I put a parallax USB scope on it, I see the ss & sclk, as the same width. I was expecting to se about 12 clocks for one chip select. Ok, back to the drawing board, as I have not had time to run a debugger on the asm code.
Jim
Jim, What board are you using? Does your board work with other code/uC?
I'm pretty sure I tested the version I uploaded. You'll need to make sure all the wires are correctly connected. I think I have a wiring diagram in the object I posted. I'll check to make sure (I know I made one with the Propeller Font).
Which USB scope did you use? The Parallax scope I have only has time divisions down to 50us. At 50us it will miss the individual clock pulses.
Try changing the PLL to one and run at 5MHz, the scope will have any easier time catching the clock pulses.
I've used this code with my own boards I've had made and the AMS boards and it works for me. Kirk Frasure has also used it with an AMS board.
I'd really like to see this code work on your board so I hope you'll keep me updated.
Edit: I don't think the code I uploaded has the schematic in it. I'll upload code with the schematic soon.
Here's how I hooked up my AMS board when using a single encoder.
Adapterboard Connections For a Single Board
3.3V Vdd
 ┌─────────────────────
┣──────┤VDDp ┌•┐ JP1 Jumper set for 4-wire mode
└──────┤VDD └•┘ 3W-4W
┌──────────────┤GND •
│ P8 ───────┤INT/
│ P9 ───────┤MOSI ┌•┐ Int_EN/
│ P10───────┤MISO └•┘ Jumper used to indicate
│ P11───────┤SCK INT/ pin is used
│ P12───────┤SS/
│ └─────────────────────

Vss
I'll add this diagram and the one showing daisy-chaining to the code I posted.
If you're not using an AMS demo board, the 4-wire mode jumper connects the "mode" pin on the chip to 3.3V. The "Int_En" jumper connects the "Int_En" pin to ground.
I'm pretty sure I have code to read the encoder in 3-wire, read only, mode. I don't think I have the software filter added to the 3-wire code. If anyone wants to try it let me know.
Duane,
My chip is the as5040 with a max clock of 1 MHz. I will add a clock delay to slow the clock and I have to add a low out on init to the pgm pin.
Will retry with my mods and get back to you.
I still need to find some diametric magnets without a minimum order of 50-100.
Jim
Duane,
My chip is the as5040 with a max clock of 1 MHz. I will add a clock delay to slow the clock and I have to add a low out on init to the pgm pin.
Will retry with my mods and get back to you.
I still need to find some diametric magnets without a minimum order of 50-100.
Jim
You could also try using a slower clock setting on your Prop instead of slowing the clock pulse (which shouldn't be hard anyway).
What board are you using. My program assumes certain jumpers have been set. I'll be glad to tweak the program for you if it's needed. Just let me know what needs to be different.
If you don't want to run the Prop with a slower clock, let me know if you'd like help slowing the clock in PASM. It should only require a few nop statements here and there.
If you find a good price on 100 magnets, let me know. I'm looking for 100 or so and I'll gladly sell you a few at the same price. I believe to get a nice linear output from the sensor, the magnets need to be at least 6mm in diameter.
I haven't tested how they compare with my round diametric magnets, but I think 0.25" square magnets should work with these sensors.
BTW, the three diametric round magnets I have were samples from AMS. If you only need a couple, you can get them from AMS and they'll send them to you next day air.
I got my chips as samples from ams. My board is a 16 pin smt breakout board from sparkfun. I don't think I will have an issue with the clock delay in pasm. Just need time to implement it.
Thanks for the magnets link. I'll ask them for a quote.
I just looked at the datasheet for the AS5040. It's a lot different than the AS5055. The position bits aren't in the same place within the data packet and there are a bunch of other differences.
I think it's safe to say my code isn't compatible with the AS5040 as it is now.
I think my software filter would would work with a some adjustment with the 10-bit encoder values which might be a good reason to try to adapt my code to use with AS5040 chips.
I think I have an AS5040. I might try adapting the code so I could use the chip (I'm not sure when).
Duane,
I will have to get the 5055 data sheet and compare them. I have an idea as to how to download the 16 data bits and parse them before I pass the result back to the hub. May not get anything done this week as I have to work an extra day.
Jim
Interesting topic ! i'm working on the same chip..as5055.. and I'm having always the same response after a READ COMMAND (implemented via 4 wire SPI) ..
The data package read in the meanwhile of a NOP execution is 0x0003 ... This means that the two error flags are both 1 ...
I'm using a cylindric magnet mounted in horizontal position because it is drilled in a rotating shaft ... i'll make a picture if you want.. but with or without the magnet the respones doesn't change...
I've implemented the SPI write in this way :
This might not be the best place to get help with your code. This is the Propeller chip forum.
What kind of magnet are you using? Most cylindrical magnets are axially magnetized. You'll want a diametrically magnetized magnet to use with this sensor.
A "0x0003" return value does mean there is an error. The last bit is the parity bit, there's only one error bit.
It's difficult to read your code since the forum software doesn't keep your formatting unless you use code tags.
I'd rather not debug C code in this thread. If you post your formatted code in the sensor forum, I'll have a look at it. Your problem might just be the magnet you are using.
When you post your code, use code tags. Here 's link to instructions on posting code.
It will help if you tell me how you have your sensor wired (which jumpers are set). Some information about your sensor board would be helpful (did you make it yourself or did you purchase it?). Also, let us know what processor you are using.
Hi Duane...first of all thank you for your time..
I've resolved some errors due to the timing communication (clock_h and clock_l) and now I can send command message correctly but i have problem on MISO read form the microC...
My micro is a renesas H8.. and i'm working with diametrically mag. magnet.. I see the string change with a lot of noise on the last 7 bitsof the 12 angular data bits (according to the INL error of +/-1.5 degree)...
However...my question now is this... how do you implemented the read..? Or better.. do you read every single bit on the MISO everytime that you write a command or only after the READ ANGLE command ?
I'm trying to read the angle in this way
1) nop
2)write read angle command
3)read from miso
every step is composed of: enable CS, some delay, 16 clock period (16 bit) , delay and unable..
I do a software reset before I start reading. I just set the MOSI pin high to write 0xFFFF as I read sixteen bits. I throw out the first read.
I check for an error bit and and shift the reading two to the right to get the position value.
Have you tried the 3-wire mode. I used the 3-wire mode to start with since it's a little easier than 4-wire mode.
Are you using the IRQ pin? My code waits for the IRQ pin to go low before reading from the chip.
Here's some sample C code in the document "AS5055_Adapterboard_Operation_Manual_v1_1.pdf". It should be available from the ams download section.
I notice in the datasheet there's a "clear error" command but when I encounter an error I just preform another software reset and the sensor works fine. I find if I use a good magnet with a rigid holder, I get very few errors.
My present code ignore the parity bit. I might add the parity check when I use the sensor in noiser environments.
Do you have access to a logic analyzer? I could post some logic traces of a good read if you think it would help.
What kind of AS5055 board are you using. There's mention of a power filter in the datasheet, if you're using your sensor in a noisy environment you might need to add a power filter close to the Vdd pin.
I had some noise, but just a on the last couple of bits. Averaging the readings seemed to clean up the reading completely.
When the sensor is stationary, I use an average of 64 readings in the displayed value. If the sensor is moving (a value change of 8 or more will trigger the moving filter), I only average 16 readings.
I had to write some extra code to keep track of values are they appoached the 4095 to 0 transition since an average here doesn't do much good.
All these software filters end up taking memory and time. This works fine for a hand turned sensor but a sensor on the end of motor shaft would require different filtering.
I do a software reset before I start reading. I just set the MOSI pin high to write 0xFFFF as I read sixteen bits. I throw out the first read.
I check for an error bit and and shift the reading two to the right to get the position value.
Have you tried the 3-wire mode. I used the 3-wire mode to start with since it's a little easier than 4-wire mode.
Are you using the IRQ pin? My code waits for the IRQ pin to go low before reading from the chip.
Here's some sample C code in the document "AS5055_Adapterboard_Operation_Manual_v1_1.pdf". It should be available from the ams download section.
I notice in the datasheet there's a "clear error" command but when I encounter an error I just preform another software reset and the sensor works fine. I find if I use a good magnet with a rigid holder, I get very few errors.
My present code ignore the parity bit. I might add the parity check when I use the sensor in noiser environments.
Do you have access to a logic analyzer? I could post some logic traces of a good read if you think it would help.
What kind of AS5055 board are you using. There's mention of a power filter in the datasheet, if you're using your sensor in a noisy environment you might need to add a power filter close to the Vdd pin.
I had some noise, but just a on the last couple of bits. Averaging the readings seemed to clean up the reading completely.
When the sensor is stationary, I use an average of 64 readings in the displayed value. If the sensor is moving (a value change of 8 or more will trigger the moving filter), I only average 16 readings.
I had to write some extra code to keep track of values are they appoached the 4095 to 0 transition since an average here doesn't do much good.
All these software filters end up taking memory and time. This works fine for a hand turned sensor but a sensor on the end of motor shaft would require different filtering.
Hi Duane,
I notice that my error was due to a configuration error of the MISO pin ... now I can read the angle correctly but I have a strong error on the read angle: with shaft blocked I see the angle changing of 3-4° ...
Answering to your question :
1)I'm not using the /INT because I haven't any other pin available...But I see it on the oscilloscope and I found that it is generated after the nop after the read angle command...but I'm reading the miso during this last nop..
2)i don't have a logic analyzer but a 4 ch. DSO.. if you can post me some traces it's great !
3)I'm using the adapter board provided from the AS
4) I have noise...but not only on the last two bit.. but on 7 LSB .. after an 8 samples average I get a +/- 0.5° accuracy
I think that I have to check the read after the INT clear... and surely add some average.. and at last check the magnet...
I tried to add picture of the hole structure..but I had problem on the upload..tried .png and .jpeg lower than 1Mb.. but nothing...However the magnet is diametrically magnetized with d=2mm, h=4mm B=12200Gauss, material: 35M.
Another question... When I read the angle data after the read command I have:
| 15 | 14 | 13 12 ...... 2 | 1 | 0 |
AL_HI AL_Low DATA EF PAR
When I start to read the angle I get AL_HI = AL_Low= 0 ..after some read and turned the shaft the AL_HI become 1 while AL_low stay down...
Another problem is that i always have the EF=1 ... even if I find a good angle mesaurement..
I'm still not using the INT/ and reading after the read ..during a NOP...
No, I haven't asked for a quote yet. I was going to try to figure out the differences between their different magnetic material so I'd know which magnets to ask about. I just now checked their site (so I could ask for a quote before replying) and it appears to be down right now.
Did you ever get prices for their magnets? If you don't know the prices of these magnets, then I'll ask for a quote as soon as I can access their site.
I keep hoping the 0.25" square magnets will work well with these encoders. According to the literature, a square magnet should have the same effect on the sensor as a round magnet that will fit inside the square. So a 0.25" square magnet should work as well as 0.25" diameter magnet.
I think the main reason to use a round magnet instead of a square magnet is because round holes are easier to drill than square holes which make round magnets easier to mount.
If there's a big price difference between two shapes of magnets, I might try to figure out ways of mounting the square ones. Now, where did I put my square drill bit?
Marco,
Sorry for not posting any logic traces yet. It turns out I don't have any recorded traces of good communication with the chips. I tend to save sessions of non-working code more than when the code is working correctly (since I don't need to analyze the working traces).
I have my LA out to use with another project, so I'll use it (probably today) to capture some fresh traces of the AS5055.
Here are some traces of the Prop reading from the AS5055 chip.
This first trace is an shows the timing between reads. I think my software filters low down the reading.
This trace shows I'm reading from the sensor at about 1KHz.
I had the magnet rotated so it was right at the 4,095 to zero transistion. The software filter is has to make some extra calculations when the encoder readings are near the roll over point so the average doesn't end up being close to 2,047.
Here are some "close ups" of the individual traces.
The first reading of the three shown in the above trace had the value of 4,095.
($3FFC shifted right two bits is $FFF which is 4,095 base 10.)
The next reading was "1" followed by "0". I wasn't moving the magnet while taking these readings but I was using my first rig which isn't as rigid as my second rig.
I then turned the magnet about 180 degrees and took a second set of readings.
Here's a reading of "2,050".
I noticed the reading frequency increased from 1.02KHz to 1.56KHz.
It looks like it should be possible to read from these sensors at about 5KHz. It might be difficult to make decissions about the data at that speed but it's good to know how fast these sensor can be read.
I see that you haven't mistake on the communication : you have 0x3ffC and 0x2008 which means that the EF bit is 0 in both cases.
I get your same capture but in all my data I get EF=1 and Alarm High=1 (bit 1 and 15 of the Read package)...
I tried to read without the magnet and I get the same results..
I 've fixed the issue of the measure near 0° (or 360°) using a vectorial average... You have to average sen(alfa) and cos(alfa) of the angle..Not only the angle.. Have you tried this approach?
Interesting thread. I sampled a few of the AM chips and soldered them to some breakout boards, but I never got around to trying them out. I did however try out an Avago AEAT-6010-A06 (http://www.avagotech.com/pages/en/motion_control_encoder_products/magnetic_encoders/aeat-6010-a06/) which doesn't specify the chip used, but the specs lead me to believe it's an AM chip, or at least compatible. I grabbed a fairly large potentiometer from radioshack, ripped it apart and used the frame to mount to the AEAT base, and flipped the shaft around and mounted the magnet to it. I whipped up some spin code and it worked fine. Definitely more expensive than just the AM chips, but they're a lot more convenient. Attached are some pics of the setup.
I am working on Same project but I have purchased AS5045. I want to connect it with Arduino UNO 3. Someone told me to use only 3 pins. Is that correct ? I want to get the position\angle of a DC motor from AS5045.
AS5045 Pin Uno pin Name
10 13 SCLK
11 10 SS
9 12 DO
I am working on Same project but I have purchased AS5045. I want to connect it with Arduino UNO 3. Someone told me to use only 3 pins. Is that correct ? I want to get the position\angle of a DC motor from AS5045.
AS5045 Pin Uno pin Name
10 13 SCLK
11 10 SS
9 12 DO
I think I have an AS5045 chip and I've looked at the datasheet, but I haven't used the chip yet and I don't know enough about them to feel comforable in giving advice about how to connector them with an Arduino.
I know the AS5055 can be used in 3-wire mode (as shown in the first video of this thread).
I have a bunch of magnets now(100). I haven't been spending time on this project lately.
I've learned a couple of things, one is I hate soldering this type of IC package. I have a board I was planning on making with an ATTiny on it. I originally planned to use a similar package as these encoders for the ATTiny. After seeing how hard these encoders are to solder, I've decided to use a package with leads (probably like the EEPROMS on the Prop Protoboard).
I've been procrastinating finalizing my PCBs since I know I'll want to make sure and have a stencil made at the same time which makes messing up even more expensive.
I'll publicly set a goal of submitting a new PCB by the end of the day on December 10th.
My current plan is to have several different sized boards. Some will be about the same size as asm's demo board and others will hopefully be small enough to fit in a servo. I also plan to make a board with an ATTiny on it and use a UART to transmit positions on a serial line (only one data line per board).
Hopefully I'll have some to sell at the beginning of the year.
Just to say I've just received an AS5035, which has standard incremental encoder outputs (A, B, index) and after a long and
contorted process(*) of soldering it onto a SSOP breakout board I've got it working - it does 64 cycles per rotation (256 edges
per rotation) and runs from 5V or 3.3V
BTW the AS5035 seems to work nicely even after 2 reflow and numerous hand soldering attempts!
The AS5134 looks interesting too - athough its 5V only it has v. flexible connection options:
The AS5134 can be connected to an external controller in several ways as listed below:
Serial 3-wire R/W connection
Serial 3-wire Read-only connection
Serial 2-Wire connection (R/W Mode)
Serial 2-Wire Differential SSI connection
1-Wire PWM connection
Analog output
Quadrature A/B/Index output
Brushless DC Motor Commutation Mode
Daisy Chain Mode
(*) I dropped the chip twice into boxes of stuff, long search with a torch!, and 3 attempts to get the soldering right, then I put the
breakout board down and lost it for 20 minutes - a personal worst I believe!
Duane,
Got the magnets, thanks. I have been playing with them and your software all afternoon with mixed results. I am reading from the chip but had to 0 out your error routine as I was always getting an error. Do you have a version of the software that only reads a single channel and not the daisy chain? Some of my problem comes from not having a stable mount for the magnet so I have to correct that but I am also having issues with the fact that your software is for the 5055 and my chip is the 5040.
Jim
Yes, I think I have some three wire SPI code some place. I'll try to find.
I very rarely get errors with setup I use but I've heard from others who repeatedly get error messages. I believe the error messages are produced when the magnet and encoders aren't mounted in the optimal geometry.
BTW, I've tried submitting one of my four layer encoder boards to a PCB fab house without luck. While I've submitted several two layer designs for other projects, my four layer designs continue to produce error messages from the submission software. I'm waiting to hear back on what the problem my be in my design.
I'll look for the three wire code and post it when I find it.
Comments
@Jim, I found the 5055 will work with a wide variety of magnets. I think the problem with using the wrong sized magnet is the reading isn't completely linear though out the rotation of the magnet.
@JakoGerber, I saw your "Visitor Message". I'm using the 4-wire mode both with and without daisy chaining. As I mentioned above, I'm relatively close to releasing the code.
I plan to purchase a bunch (100) or these chips and I hope to be able to sell relatively inexpensive boards to use them.
I'm very unsure about the best way to connect to these boards. The daisy-chain feature is nice but it introduces problems with a wiring harness since some of the wires need to terminate on the board while others start on the board. Using two connectors per board solves these problems but the connectors are likely to take up a lot of board real-estate.
I'm currently thinking of using a single 2x5 IDC connector with a 10-wire ribbon cable. Two of the wires will need to be cut after each connection with a board. By alternating the wires cut, I think I can get away with just the one connector per board and still use the daisy-chain feature.
I receive a notice from BatchPCB Thursday (May 17) that my first boards have been shipped. I'm hoping they will arrive Monday. Once I get these encoders working with the PCB, I will likely release the software (this is part of my agreement with Kirk). My guess is, I should be able to post the files on Tuesday or Wednesday of this coming week.
If any of you have suggestions on board layouts, I hope you'll share them either here or in the PCB thread.
I will likely hold off submitting a new PCB order until after I've tested these first few I've had made.
One addition I'm planning on some of the new boards is an on-board microcontroller to take care of the SPI communication. Hopefully, I'll be able to make a board that could be easily used with a Basic Stamp or Arduino via asynchronous communication.
I couldn't resist adding a Propeller to one of my boards. I've always thought it would be cool to have a Propeller inside a servo. I think I have a board with an encoder and Propeller that would be small enough to fit inside a servo, I just doubt it will be a very practical application for either the encoder or the Prop.
This is my first every PCB made by a fab house. I know a lot more about PCB design now than when I submitted these PCBs to be made. Fortunately I know enough to design a functioning PCB for the AS5055 chip.
Here's a picture of three populated boards, two unpopulated boards and one of the PCBs made by AMS.
The PCBs I made have connectors on both sides of the board to make it easier to daisy-chain them. The yellow wire on the far right board made the necessary connections on the last board of a daisy-chain. There are also holes to mount pins to use with a jumper if you didn't want to connect wires on the last device in the chain.
I've had several people ask about the software for these AS5055 chips. Kirk Fraser had agreed to let me post the since I've successful made a PCB for the chip (part of our agreement to release the code).
AS5055Demo120526a - Archive [Date 2012.05.26 Time 15.21].zip
The code is set up to use a single chip. Multiple chips can be used by changing the "_ChainDevices" constant.
I'm personally very pleased with the way the software filter turned out. The 4,095 to 0 transition is now nice and smooth.
If any of you use this object, I hope you let me know.
There are demo boards for these chips at Digi-Key (IIRC they're about $50), I hope to have some boards with these chips on them available to sell in about a month (hopefully for much less than the Digi-Key price).
If there is some board configuration you'd like to see, make sure and let me know either here on this thread or on the PCB thread in the General Discussion forum. I'm particularly interested in hearing people's opinion about mounting holes and connection options.
I doubt I'll have more of these particular boards made. I don't like having to use so many pins on the connectors.
BTW, these little chips make soldering a smt Prop seem like a cakewalk. I've had many more failed attempts at soldering them (the AS5055 chips) than successfully soldered boards.
One thing I've learned from these PCBs is to have a solder paste stencil made if you've got tiny smt chips in your design.
These are really cool little sensors, I'm hoping to figure out a way to make then easier to incorporate into robotic projects.
Don,
Those are just solder pads for passives. The silver color of the pads didn't show up with the lighting used to make the photo.
Here's another picture of the back of the board.
An apnote by AMS suggests using 100nF caps on each I/O line and a 120ohm resistor on the MISO line if your going to use long wires to communicate with these sensors.
I added pads so the noise reducing capacitors and resistor could be added to the I/O lines. Since I haven't yet used long wires with these boards, I didn't populate the caps. I only added a resistor on the MISO line (a solder jumper would have also worked if the noise reduction isn't needed) and I added a single decoupling cap on the pads meant for two different capacitors. I realized after the boards were made, I placed the resistor for the power supply filter on the VDDp supply instead of the VDD line. Since I'm using a single power source for both VDD and VDDp, I bypassed the unneeded resistor pads by using the decoupling cap as a jumper. I'm using a 3.3V microcontroller so I don't need two separate supplies. So far, it looks like these work okay without a power supply filter.
The VDDp can receive a lower voltage than VDD if you're using a low voltage uC to communicate with this sensor. I believe the logic lines use the VDDp voltage which can be as low as 1.8V (and up to VDD). VDD needs to be between 3.0V and 3.6V.
I will probably test these encoders using long wires. I'll test them without the caps first and then add the caps to see it they improve the sensors ability to communicate over long wires.
I downloaded your code to try on my own chip, so far no joy. When I put a parallax USB scope on it, I see the ss & sclk, as the same width. I was expecting to se about 12 clocks for one chip select. Ok, back to the drawing board, as I have not had time to run a debugger on the asm code.
Jim
Jim, What board are you using? Does your board work with other code/uC?
I'm pretty sure I tested the version I uploaded. You'll need to make sure all the wires are correctly connected. I think I have a wiring diagram in the object I posted. I'll check to make sure (I know I made one with the Propeller Font).
Which USB scope did you use? The Parallax scope I have only has time divisions down to 50us. At 50us it will miss the individual clock pulses.
Try changing the PLL to one and run at 5MHz, the scope will have any easier time catching the clock pulses.
I've used this code with my own boards I've had made and the AMS boards and it works for me. Kirk Frasure has also used it with an AMS board.
I'd really like to see this code work on your board so I hope you'll keep me updated.
Edit: I don't think the code I uploaded has the schematic in it. I'll upload code with the schematic soon.
Here's how I hooked up my AMS board when using a single encoder.
I'll add this diagram and the one showing daisy-chaining to the code I posted.
If you're not using an AMS demo board, the 4-wire mode jumper connects the "mode" pin on the chip to 3.3V. The "Int_En" jumper connects the "Int_En" pin to ground.
I'm pretty sure I have code to read the encoder in 3-wire, read only, mode. I don't think I have the software filter added to the 3-wire code. If anyone wants to try it let me know.
My chip is the as5040 with a max clock of 1 MHz. I will add a clock delay to slow the clock and I have to add a low out on init to the pgm pin.
Will retry with my mods and get back to you.
I still need to find some diametric magnets without a minimum order of 50-100.
Jim
You could also try using a slower clock setting on your Prop instead of slowing the clock pulse (which shouldn't be hard anyway).
What board are you using. My program assumes certain jumpers have been set. I'll be glad to tweak the program for you if it's needed. Just let me know what needs to be different.
If you don't want to run the Prop with a slower clock, let me know if you'd like help slowing the clock in PASM. It should only require a few nop statements here and there.
If you find a good price on 100 magnets, let me know. I'm looking for 100 or so and I'll gladly sell you a few at the same price. I believe to get a nice linear output from the sensor, the magnets need to be at least 6mm in diameter.
I haven't tested how they compare with my round diametric magnets, but I think 0.25" square magnets should work with these sensors.
BTW, the three diametric round magnets I have were samples from AMS. If you only need a couple, you can get them from AMS and they'll send them to you next day air.
I had found some magnets will go revisit the source and let you know.
Jim
Ps. http://www.dextermag.com/Diametric-Disc-Magnets-Encoder
Thanks for the magnets link. I'll ask them for a quote.
I just looked at the datasheet for the AS5040. It's a lot different than the AS5055. The position bits aren't in the same place within the data packet and there are a bunch of other differences.
I think it's safe to say my code isn't compatible with the AS5040 as it is now.
I think my software filter would would work with a some adjustment with the 10-bit encoder values which might be a good reason to try to adapt my code to use with AS5040 chips.
I think I have an AS5040. I might try adapting the code so I could use the chip (I'm not sure when).
I will have to get the 5055 data sheet and compare them. I have an idea as to how to download the 16 data bits and parse them before I pass the result back to the hub. May not get anything done this week as I have to work an extra day.
Jim
Interesting topic ! i'm working on the same chip..as5055.. and I'm having always the same response after a READ COMMAND (implemented via 4 wire SPI) ..
The data package read in the meanwhile of a NOP execution is 0x0003 ... This means that the two error flags are both 1 ...
I'm using a cylindric magnet mounted in horizontal position because it is drilled in a rotating shaft ... i'll make a picture if you want.. but with or without the magnet the respones doesn't change...
I've implemented the SPI write in this way :
void spi_write_byte_dv(uint8 buffer) //scrivi comando
{
uint8 i;
for( i=0; i<8; i++)
{
if (buffer & 0x80) //write on mosi
{
mosi_h();
}
else
mosi_l();
buffer <<= 1;
clock_h(); //clock high and low
ritardo_dv(TSCK);
clock_l();
ritardo_dv(TSCK); //onda quadra...sommo i due ritardi
}
}
// that is called twice for write 16 bit command:
void send_comando_dv(uint16 comando)
{
static uint8 bb;
bb = (comando >> 8) & 0xFF;
spi_write_byte_dv(bb); //invio i bit 15 - 8
bb= comando & 0xFF;
spi_write_byte_dv(bb); //invio i bit 7 - 0
}
In the main I call this function :
static try_as5055(void){
/* T(1)=> Invio il comando READ ANGLE. Il dato ricevuto sulla MISO
This might not be the best place to get help with your code. This is the Propeller chip forum.
What kind of magnet are you using? Most cylindrical magnets are axially magnetized. You'll want a diametrically magnetized magnet to use with this sensor.
A "0x0003" return value does mean there is an error. The last bit is the parity bit, there's only one error bit.
It's difficult to read your code since the forum software doesn't keep your formatting unless you use code tags.
I'd rather not debug C code in this thread. If you post your formatted code in the sensor forum, I'll have a look at it. Your problem might just be the magnet you are using.
When you post your code, use code tags. Here 's link to instructions on posting code.
It will help if you tell me how you have your sensor wired (which jumpers are set). Some information about your sensor board would be helpful (did you make it yourself or did you purchase it?). Also, let us know what processor you are using.
I've resolved some errors due to the timing communication (clock_h and clock_l) and now I can send command message correctly but i have problem on MISO read form the microC...
My micro is a renesas H8.. and i'm working with diametrically mag. magnet.. I see the string change with a lot of noise on the last 7 bitsof the 12 angular data bits (according to the INL error of +/-1.5 degree)...
However...my question now is this... how do you implemented the read..? Or better.. do you read every single bit on the MISO everytime that you write a command or only after the READ ANGLE command ?
I'm trying to read the angle in this way
1) nop
2)write read angle command
3)read from miso
every step is composed of: enable CS, some delay, 16 clock period (16 bit) , delay and unable..
Do I miss something..?
Thank you again..
Marco
I do a software reset before I start reading. I just set the MOSI pin high to write 0xFFFF as I read sixteen bits. I throw out the first read.
I check for an error bit and and shift the reading two to the right to get the position value.
Have you tried the 3-wire mode. I used the 3-wire mode to start with since it's a little easier than 4-wire mode.
Are you using the IRQ pin? My code waits for the IRQ pin to go low before reading from the chip.
Here's some sample C code in the document "AS5055_Adapterboard_Operation_Manual_v1_1.pdf". It should be available from the ams download section.
I notice in the datasheet there's a "clear error" command but when I encounter an error I just preform another software reset and the sensor works fine. I find if I use a good magnet with a rigid holder, I get very few errors.
My present code ignore the parity bit. I might add the parity check when I use the sensor in noiser environments.
Do you have access to a logic analyzer? I could post some logic traces of a good read if you think it would help.
What kind of AS5055 board are you using. There's mention of a power filter in the datasheet, if you're using your sensor in a noisy environment you might need to add a power filter close to the Vdd pin.
I had some noise, but just a on the last couple of bits. Averaging the readings seemed to clean up the reading completely.
When the sensor is stationary, I use an average of 64 readings in the displayed value. If the sensor is moving (a value change of 8 or more will trigger the moving filter), I only average 16 readings.
I had to write some extra code to keep track of values are they appoached the 4095 to 0 transition since an average here doesn't do much good.
All these software filters end up taking memory and time. This works fine for a hand turned sensor but a sensor on the end of motor shaft would require different filtering.
Hi Duane,
I notice that my error was due to a configuration error of the MISO pin ... now I can read the angle correctly but I have a strong error on the read angle: with shaft blocked I see the angle changing of 3-4° ...
Answering to your question :
1)I'm not using the /INT because I haven't any other pin available...But I see it on the oscilloscope and I found that it is generated after the nop after the read angle command...but I'm reading the miso during this last nop..
2)i don't have a logic analyzer but a 4 ch. DSO.. if you can post me some traces it's great !
3)I'm using the adapter board provided from the AS
4) I have noise...but not only on the last two bit.. but on 7 LSB .. after an 8 samples average I get a +/- 0.5° accuracy
I think that I have to check the read after the INT clear... and surely add some average.. and at last check the magnet...
I tried to add picture of the hole structure..but I had problem on the upload..tried .png and .jpeg lower than 1Mb.. but nothing...However the magnet is diametrically magnetized with d=2mm, h=4mm B=12200Gauss, material: 35M.
Another question... When I read the angle data after the read command I have:
| 15 | 14 | 13 12 ...... 2 | 1 | 0 |
AL_HI AL_Low DATA EF PAR
When I start to read the angle I get AL_HI = AL_Low= 0 ..after some read and turned the shaft the AL_HI become 1 while AL_low stay down...
Another problem is that i always have the EF=1 ... even if I find a good angle mesaurement..
I'm still not using the INT/ and reading after the read ..during a NOP...
Really thanks for the help...
Marco
Any word on the magnets?
Jim
Jim,
No, I haven't asked for a quote yet. I was going to try to figure out the differences between their different magnetic material so I'd know which magnets to ask about. I just now checked their site (so I could ask for a quote before replying) and it appears to be down right now.
Did you ever get prices for their magnets? If you don't know the prices of these magnets, then I'll ask for a quote as soon as I can access their site.
I keep hoping the 0.25" square magnets will work well with these encoders. According to the literature, a square magnet should have the same effect on the sensor as a round magnet that will fit inside the square. So a 0.25" square magnet should work as well as 0.25" diameter magnet.
I think the main reason to use a round magnet instead of a square magnet is because round holes are easier to drill than square holes which make round magnets easier to mount.
If there's a big price difference between two shapes of magnets, I might try to figure out ways of mounting the square ones. Now, where did I put my square drill bit?
Marco,
Sorry for not posting any logic traces yet. It turns out I don't have any recorded traces of good communication with the chips. I tend to save sessions of non-working code more than when the code is working correctly (since I don't need to analyze the working traces).
I have my LA out to use with another project, so I'll use it (probably today) to capture some fresh traces of the AS5055.
Here are some traces of the Prop reading from the AS5055 chip.
This first trace is an shows the timing between reads. I think my software filters low down the reading.
This trace shows I'm reading from the sensor at about 1KHz.
I had the magnet rotated so it was right at the 4,095 to zero transistion. The software filter is has to make some extra calculations when the encoder readings are near the roll over point so the average doesn't end up being close to 2,047.
Here are some "close ups" of the individual traces.
The first reading of the three shown in the above trace had the value of 4,095.
($3FFC shifted right two bits is $FFF which is 4,095 base 10.)
The next reading was "1" followed by "0". I wasn't moving the magnet while taking these readings but I was using my first rig which isn't as rigid as my second rig.
I then turned the magnet about 180 degrees and took a second set of readings.
Here's a reading of "2,050".
I noticed the reading frequency increased from 1.02KHz to 1.56KHz.
It looks like it should be possible to read from these sensors at about 5KHz. It might be difficult to make decissions about the data at that speed but it's good to know how fast these sensor can be read.
Thank you for the captures !!
I see that you haven't mistake on the communication : you have 0x3ffC and 0x2008 which means that the EF bit is 0 in both cases.
I get your same capture but in all my data I get EF=1 and Alarm High=1 (bit 1 and 15 of the Read package)...
I tried to read without the magnet and I get the same results..
I 've fixed the issue of the measure near 0° (or 360°) using a vectorial average... You have to average sen(alfa) and cos(alfa) of the angle..Not only the angle.. Have you tried this approach?
Marco
AS5045 Pin Uno pin Name
10 13 SCLK
11 10 SS
9 12 DO
I know the AS5055 can be used in 3-wire mode (as shown in the first video of this thread).
Sort of.
I have a bunch of magnets now(100). I haven't been spending time on this project lately.
I've learned a couple of things, one is I hate soldering this type of IC package. I have a board I was planning on making with an ATTiny on it. I originally planned to use a similar package as these encoders for the ATTiny. After seeing how hard these encoders are to solder, I've decided to use a package with leads (probably like the EEPROMS on the Prop Protoboard).
I've been procrastinating finalizing my PCBs since I know I'll want to make sure and have a stencil made at the same time which makes messing up even more expensive.
I'll publicly set a goal of submitting a new PCB by the end of the day on December 10th.
My current plan is to have several different sized boards. Some will be about the same size as asm's demo board and others will hopefully be small enough to fit in a servo. I also plan to make a board with an ATTiny on it and use a UART to transmit positions on a serial line (only one data line per board).
Hopefully I'll have some to sell at the beginning of the year.
contorted process(*) of soldering it onto a SSOP breakout board I've got it working - it does 64 cycles per rotation (256 edges
per rotation) and runs from 5V or 3.3V
But more importantly I found just the right magnets for many of these chips (6mm by 2.5mm sideways field) at
www.supermagnete,de http://www.supermagnete.de/eng/S-06-2.5-DHN
BTW the AS5035 seems to work nicely even after 2 reflow and numerous hand soldering attempts!
The AS5134 looks interesting too - athough its 5V only it has v. flexible connection options:
(*) I dropped the chip twice into boxes of stuff, long search with a torch!, and 3 attempts to get the soldering right, then I put the
breakout board down and lost it for 20 minutes - a personal worst I believe!
Got the magnets, thanks. I have been playing with them and your software all afternoon with mixed results. I am reading from the chip but had to 0 out your error routine as I was always getting an error. Do you have a version of the software that only reads a single channel and not the daisy chain? Some of my problem comes from not having a stable mount for the magnet so I have to correct that but I am also having issues with the fact that your software is for the 5055 and my chip is the 5040.
Jim
I very rarely get errors with setup I use but I've heard from others who repeatedly get error messages. I believe the error messages are produced when the magnet and encoders aren't mounted in the optimal geometry.
BTW, I've tried submitting one of my four layer encoder boards to a PCB fab house without luck. While I've submitted several two layer designs for other projects, my four layer designs continue to produce error messages from the submission software. I'm waiting to hear back on what the problem my be in my design.
I'll look for the three wire code and post it when I find it.