Moin
For my current long term project, a high resolution 3D printer I needed a high precise linear drive.
High resolution means using a UV curing resin and an old lcd projector.
More details will follow as soon as I can set up a proper project website for it.
My plan is to provide many parts of it as possible open source.
I could get my hands on cheap used motor with a attached gearbox and a trapezoidal-thread spindle.
On the down side, it's not stepper motor.
You need some kind of position feedback to drive it to a certain position.
Usually people use optical encoder disks and forked light barriers to measure the motor speed and calculate the position.
While being cheap and simple, this technique has two disadvantages :
- Machines like cnc mills or 3D printers are usually operated in rather dusty workshop environments.
As soon as your encoder disk gets dirty you might have wrong readings. So you have to keep it clean. - If mounted at the wrong position scattered light e.g. from your lamps can interfere with the measurements.
So you need to be careful there.
So I've been wondering whether there is no more robust solution.
After doing some research I found of course special modules for big industrial machines.
Which were of course expensive and overkill for my application.
Then I came across with the magnetic rotary sensors by austria microsystems (http://http://www.austriamicrosystems.com/).
Especially the AS5043 (http://http://www.austriamicrosystems.com/Products/Magnetic-Encoders/Rotary-Encoders/AS5043) looked promising.
The setup for this sensor is rather simple, you need a few external components and a neodym magnet that is attached to your motors axis.
Then the sensor is placed below the magnet.
Like in this illustration found on the austria microsystems website :

Since it uses the magnetic field neither dirt nor light will be a problem.
The sensor will output the angle of the magnet relative to a programmable starting position via analogue output or via a SSI-Style interface. (See the datasheet for details.)
With 10bit resolution it should be theoretically possible to measure the current angle in 0.35° steps.
I went ahead and requested some free samples with my .edu email-address.
The guys at austria microsystems were kind enough to send me 3 AS5043 and 3 AS5030 (similar part 8bit resolution).
Big thanks to them.
So I made myself a simple breakout board and started testing :
Etched and SurTin applied:

(http://http://sindri.sebastians-site.de/static/images/AS5043board/sensorboard_tin1.jpg)
Greencoat applied:

(http://http://sindri.sebastians-site.de/static/images/AS5043board/sensorboard_greencoat1.jpg)
Parts soldered :

(http://http://sindri.sebastians-site.de/static/images/AS5043board/sensorboard_final1.jpg)
As you can see I ripped of a track while drilling. I need better machinery for drilling my pcbs and the next version is going to have bigger tracks.

(http://http://sindri.sebastians-site.de/static/images/AS5043board/sensorboard_final3.jpg)
I used a special ribbon cable connector with locks, because I had some here and they are cool.
The only thing missing for testing was the right magnet.
I found those on ebay : 5x5x5mm Cubes.

(http://http://sindri.sebastians-site.de/static/images/AS5043board/magnets.jpg)
The datasheet suggests diametrical magnetized cylinders, but they are hard to get so I decided to try cubes first and they've been working fine so far.
Next I needed a way to mount the magnets a distance about 3-5mm above the chip.
The datasheet recommends other values here but I experimented until I got nice results for my magnets.
So I fired up my lathe for the mechanical parts.
A shaft made of aluminium with a magnet glued in :

(http://http://sindri.sebastians-site.de/static/images/AS5043board/motor-controller/shaft3.jpg)
Then I fitted the ball bearing into a piece of POM and mounted the PBC on it :

(http://http://sindri.sebastians-site.de/static/images/AS5043board/assembled1.jpg)

(http://http://sindri.sebastians-site.de/static/images/AS5043board/assembled2.jpg)

(http://http://sindri.sebastians-site.de/static/images/AS5043board/assembled3.jpg)

(http://http://sindri.sebastians-site.de/static/images/AS5043board/assembled4.jpg)
I have not yet tested the SSI output, but I could test the analogue output.
Using a good multimeter, I marked the positions with 2,00V 3,00V 4,00 and then turned until I had the same output again while checking the marks.
If there is an error, I need a better way to measure angels. You can't spot any misalignment with the naked eye.
Also I used my drilling machine to turn it really fast and monitored the analogue output with my oscilloscope.
The result was a nice regular sawtooth just as I expected.
I didn't get any good pictures of the waveform yet, since I only have analogue scope and taking photos of the tube can be a bit tricky.
I'll post them as soon as I can repeat the test.
A final note on aligning the axis, the magnet and the sensor:
The alignment seems to be less critical the stated in the datasheet.
A misplacement of 0.25mm seem to still work.
Next step : Testing SSI.
I'll release the kicad files for the pcb and cad files for the other parts, as soon as I have the time to clean them up.
A friend of mine, working with me on this project, knows how to do proper technical drawings, so I'll also ask him to look over the cad files.
I want them to be compliant to the standards, so if you can't fabricate the part yourself, you can give the drawings to professionals.
That's all so far I'll keep you updated.
Sebastian
/Edit : Updated the image urls for the new website and fixed 100 typos ....
Cool project. I would certainly enjoy hearing about your progress. I do wonder what you used for the 'green coat '?
Moin
I used green permanent markers for the green coating ... isn't that obvious ?
Just kidding ....
Actually Greencoat is product by the german company Bungard.
http://www.bungard.de/index.php?option= ... ng=english (http://www.bungard.de/index.php?option=com_content&view=article&id=118%3Abungard-green-coat&catid=18%3Aoberflaechen&lang=english)
I've never seen anyone else using it, maybe because its hard to obtain.
Watterott is one of the few shops who offers it http://www.watterott.com/index.php?page ... t&info=253 (http://www.watterott.com/index.php?page=product&info=253) .
You can solder through it easily in the first 2-4 day, after that period it is cured.
The cured coating is harder to solder through, so it acts similar to a solder mask.
It can't replace a real solder mask though, since it doesn't prevent the tin from flowing freely while not cured.
Also I tried to pack up the kicad files.
I used the kicad button for it, so I hope it took care of all the custom libs as well.
Can anyone check the project ?
AS5043board.zip (http://http://sindri.sebastians-site.de/static/downloads/AS5043board.zip)
It's all under CC-BY-SA (http://http://creativecommons.org/licenses/by-sa/3.0/) ...
Greetings
Sebastian
Well that green coat looks like one slick finish. The homebrew finishes I've seen use glass paint and toner method to protect areas that are to soldered. But with green coat being solderable and containing flux embedded in it would make it a real time saver.
Hi! Please note you can't rely on multimeter when using as5043 as this is absolute angle position sensor and it heavily depends on linearity. So you have to use a scope to check if the output is linear.
I will have time to read through the article a bit later, I have some more comments about magnet positioning, but I'm not sure by now you haven't taken on that already :-)
Update: Oops, I see you used a scope - my fault, too fast to comment :-)
On SSI: I've seen quite a few technics on the net - the IC works well on serial frequencies up to 6MHz no problem. I've been also using SPI myself, but as soon as STM32 (which I used as a main board) has a buggy SPI implementation (CS is not working how it is supposed to) and thus cannot provide DMA for quering the IC, I came up with another technique.
Loosing 1 bit of resolution (512 instead of 1024 marks per revolution), I'm very well off with... USART :-) Set it up as 9 bits with hw flow support, use RTS bit (or is that CTS? don't remember really) and set up DMA should you use an MC offering this feature - and you're good to go.
Moin
Some thoughts about the multimeter measurements :
I used my Simens B1041, not just some cheap hand multimeter.
Even though it's calibration expired in 2005 it's still more accurate the most of the stuff used by people out there.
The purpose of this test was not finding non linearities, but checking whether it was possible to get back to position given by
the encoders output.
Testing for linearity was of course done with a scope.
By the way scopes calibration also expired in 2005.
Also note that these were only rather simple tests, just to see whether the device is working at all.
I mean I don't have any real data, just some observations, nothing you can really analyse with mathematical means.
All I can say for sure atm. is that it looks good to me.
The real testing will be done as soon as SSI works.
About SSI and SPI:
I'm also going to (ab)use hardware SPI to read the AS5043.
My plan is to use a AT90USB162, so no DMA.
While comparing the signal diagrams for SPI in Atmels datasheet and for SSI in the AS5043, I noticed a smaller problem.
The AS5043 seems to need clock that is high in Idle stage and the bits will be shifted out on the positive clock edge.
That sounds very much like the SPI mode 3 in Atmel-speech.
Clock high on idle, data will be read on every rising edge.
And here comes the problem : The Atmel hardware SPI can read the miso pin only at a clock edge.
As I mentioned before that would be the rising edge for mode 3. So shifting out and reading would be done almost synchronous.
We all know, due to signal rise and fall times this will fail 90% of the time.
Therefore things are going to get hacky ....
I'm going to use mode 2: clock high and bits are read at the falling edge.
This leaves me with a different problem : I will read the first bit before the encoder has shifted it out.
The AT90USB162 SPI lets you read 8bit at once and I want to read all 16 bits from the encoder.
So the first byte will look like : 1 bit garbage then D9 to D3.
Reading the next 8bit will work fine since the 8th bit was shifted out on the last rising edge after reading the first 7.
The next 8 bit will look like : D2 to D0, OCF, COF, LIN, MAG INC, MAG DEC.
Everything after the D0-bit is status information needed in order to decide whether the measurement was valid.
But hey wait .... there is one bit missing. The 16th bit contains parity information.
It's need in order to verify that there was no error during transmission and since I want to do stuff right, I'll be of course checking the parity.
Here comes the hacky part:
The last bit will be already shifted out when I read the second byte.
All I have to do is manually check the miso pin state once.
The rest is simply bit shifting.
Also I won't be using the SS pin provided by the SPI module.
It goes high after reading 8 bit ... which will trigger a new measurement
Instead I'll use a normal IO pin for CS.
At least that's my current plan.
I have not tested it yet, but I've seen other people doing similar things on the net, so I'm optimistic.
Greetings
Sebastian
Oh Sebastian, I believe you are so overcomplicating it. First of all, if you don't have DMA, just drag the MC pins - quicker and no haead ackes.... If you want to go for SPI - do the rising edge. You will not get corrupted data - verified. SPI works great (set it up for word transfer length, not byte). And then of course when you played enough with those useless last bytes, come to the dark side - USART :-)
Yes, have a better look at the datasheet:
- After a minimum time tCLK FE, data is latched into the output shift register with the first falling edge of CLK.
- Each subsequent rising CLK edge shifts out one bit of data.
This means that you can read data on the rising edge - it's long been latched there - since the falling one.
Did you try assisted positioning? It seems that your construction doesn't allow for fine tuning?
Yes, have a better look at the datasheet:
- After a minimum time tCLK FE, data is latched into the output shift register with the first falling edge of CLK.
- Each subsequent rising CLK edge shifts out one bit of data.
This means that you can read data on the rising edge - it's long been latched there - since the falling one.
Yes it is latched out at that time, but it won't be shifted out until the first rising edge at CLK.
See figure 5 on page 6 in the datasheet.
Also it takes some time, to be precise t_DO_valid = 413ns until the data at DO can be considered valid.
So if you are doing a readout with 1MHz clock, that's about half of your clock period !
You suggested 6MHz ...
The datasheet clearly states under 19.6 Timing Characteristics on page 32 the the maximum read-out frequency is 1MHz.
Also 6Mhz * 4213ns = 2.487 means you have shifted out 2 and a half bit until the first one can be considered valid.
This might work due to the shift register being faster then expected by the manufacturer,
but I don't want to depend on that.
Just for reference : http://www.austriamicrosystems.com/cont ... 7/7220/495 (http://www.austriamicrosystems.com/content/download/1287/7220/495)
Did you try assisted positioning? It seems that your construction doesn't allow for fine tuning?
I think you refer to the operating mode called Alignment Mode in the datasheet.
Since I don't have a proper SSI interface no, but my construction allows moving the pcb by about 0.5mm in every direction.
3mm screws in 4mm holes. Simple but effective.
Greetings
Sebastian
Moin
Just a short update.
Here's the new release including all the mechanical parts, used to build the encoder.
AS5043board.zip (http://http://sindri.sebastians-site.de/static/downloads/AS5043board.zip)
While I didn't do much this time, Obi had a lot of omgwhythef*ckisthislinewrong-fun trying to get the cool SolidEdge drawing into something the rest of us can read.
So the credit for the cad stuff goes to him.
SolidEdge is the tool used at our university, so we decide to use the academic edition which is free for students.
While no time learning a new software was required, we had a lot of fun exporting the parts, to DXF and PDF.
Finally it seems to have worked, but I'm afraid we'll still need to tweak our CAD - workflow further.
Greetings
Sebastian
Hi!
Just wanted to show my take on the AS5043.
Double sided PCB by Seed, Voltage regulator onboard,
one LED for power on, the other for magnetic range output.
Nice chip indeed but I am strugling with the digital output. Someone posted code for the arduino and a similar Austria Microsystems chip but this will influence the analog output.
Regards,
Michael
[attachment=0]
more pics
Moin
Nice board.
The led at the magregn pin is a cool idea. I somehow forgot about it totally.
No mounting holes and round, are you going to put it inside a motor/servo ?
[quote author="Wildweasel"]
Nice chip indeed but I am strugling with the digital output. Someone posted code for the arduino and a similar Austria Microsystems chip but this will influence the analog output.
[/quote]
Influences it in what way ?
Does it write something to the chip that change the config of that output ?
You could try my code, but I used plain C on an atmega32.
Connect CLK to SCK, MISO to DO, CS to SS.
Don't connect MOSI anywhere.
void AS5043_setup(void) {
// Set MOSI and SCK, SS/CS output, all others input
DDRB = (1<<PB5)|(1<<PB7) | (1<<PB4);
// Enable SPI, Master, set clock rate fck/16
SPCR = (1<<SPE)|(1<<MSTR)|(1<<SPR0) | (1<<CPOL);
// double spi speed for fck/8
SPSR |= (1 << SPI2X);
// Set SS/CS
PORTB |= (1 << PB4);
}
void AS5043_readout(void) {
uint16_t data;
//CS low
PORTB &= ~(1 << PB4);
// Write a dummy byte
SPDR = 0xFF;
while(!(SPSR & (1<<SPIF)));
// Read value
data = SPDR >> 1;
SPDR = 0xFF;
while(!(SPSR & (1<<SPIF)));
data = SPDR << 7;
// 15 bit read so far
// Get Parity info ... check not implemented yet
if(PINB & (1 << PB6)) {
}
else {
}
// CS high
PORTB |= (1 << PB4);
}
I hope this woks since I copied only the relevant parts from a bigger sourcecode.
For detailed description what this code does, see my postings about ssi with spi above.
Greetings
Sebastian
By pure chance I picked up a bunch of these chips about a week before the original article showed up on DP, so this board design might be handy, thanks. :)
Hi Sebastian!
I used code from this guy and did just a quick test with his setup.
If I remeber right the code polls the digital output every second and during the poll the analog output went down.
http://www.youtube.com/watch?v=gXewDdlUT_Q (http://www.youtube.com/watch?v=gXewDdlUT_Q)
This PCB is going to be a position sensor for a motorcycle gearbox since the setup doesn't require any sort of bushing where oil could leak out. I happens that the shift drum got a 6mm hole on the front side where the magnet fits perfectly. I use the magnets mentioned in the pdf manual.
One downside is that you need to position the sensor board to have the output show around 0V in the first gear.
Have you tried to program the chip itself?
I will give your code a try
Cheers,
Michael
Moin
[quote author="Wildweasel"]
Have you tried to program the chip itself?
[/quote]
Unfortunately I haven't had the time to implement programming yet and I won't have much time for this project at the moment.
So I'm afraid it will take some time until I can show you some code for programming.
I'm not even sure, if the avr spi can be hacked so it can be used for programming.
About the analogue ouput low when using ssi thing :
I might be able to test what the analogue output of my chip does while using ssi later this week.
I'll post the results.
Greetings
Sebastian
That's an interesting solution. I've got some links that you'll find interesting. I'll post them in 24 hours or so.
Here are some sites that I've come across on my travels which might be of interest to you:
Dead simple hall effect pot replacement (http://http://www.mycockpit.org/forums/showthread.php/22267-Dead-simple-hall-effect-pot-replacement)
Linear variable differential transformers (http://http://www.mikesflightdeck.com/lvdts/lvdts.html)
MLX90333 Triaxis Monolithic 3D Position Sensor Hall Effect IC (http://http://tinyurl.com/6nqcs4f)
Hey, danke for your this project.
I got a few of those as samples here and never got around to make a board for them.
But i noticed that when i try to open the files on eagle latest version i get an error
Error:
line 1, column 1: Start tag expected.
[quote author="jandetlefsen"]Hey, danke for your this project.
I got a few of those as samples here and never got around to make a board for them.
But i noticed that when i try to open the files on eagle latest version i get an error
Error:
line 1, column 1: Start tag expected.
[/quote]
Which version of eagle do you use? version 5 cannot read version 6 files.
Be warned version 6 converts your files to the new format. THis is one of thhe reason we stick to version5 for now.
ah that's probably it. i heard about new file format but didnt think about when installed latest on new laptop. thanks.
I've just finished modifying two 1501MG servos for coninuous rotation and adding AS5043 incremental encoders to them:
http://dccharacter.blogspot.com/2012/06 ... on_30.html (http://dccharacter.blogspot.com/2012/06/modifying-servo-for-continuous-rotation_30.html)
Thanks for the followup. Great documentation and really cool hack.
Moin ...
... I've got a really really late follow up post, so first of all sorry for reviving this thread.
Having worked on this encoder for a year (interleaved with my various other projects) I can now finally announce the release of version 1.3.
In the source code repository of our 3D printer project you can download now:
- Kicad files (http://http://sindri.sebastians-site.de/hg/sindri/file/encoder_release_1.3/hardware/AS5043-encoder) for the board
- C sources (http://http://sindri.sebastians-site.de/hg/sindri/file/encoder_release_1.3/firmware/AS5043_tests/) to interface with the A5043 using SSI for ATmega microcontrollers
- Plans (http://http://sindri.sebastians-site.de/hg/sindri/file/encoder_release_1.3/hardware/AS5043-encoder/chasis/lathe) for fabricating the mechanical parts using a lathe
- Plans (http://http://sindri.sebastians-site.de/hg/sindri/file/encoder_release_1.3/hardware/AS5043-encoder/chasis/3Dprint) for fabricating the mechanical parts using a 3DPrinter (not yet tested)
- Better tests (http://http://sindri.sebastians-site.de/MagneticRotaryEncoder/Accuracy) to confirm the encoders accuray
Additionally I've written an article with all the details about the development and the current version of this encoder in our wiki (http://http://sindri.sebastians-site.de/MagneticRotaryEncoder).
The encoder is listed on tindie (http://https://www.tindie.com/designs/detail/LongHairedHacker/sindri-magnetic-rotary-encoder/) as an open design as well.
You should really check their blog posting (http://http://blog.tindie.com/tindie-launches-open-designs-and-kickbacks.html) about open designs and kickback.
It sounds like a cool idea to me.
I'm also planning to sell populated encoder boards on tindie in the near future.
To get started I set up a fundraiser (http://https://www.tindie.com/products/LongHairedHacker/sindri-magnetic-rotary-encoder-1/) there.
It will help me to test my process from ordering parts to shipping the populated boards,
so I can make sure everything works smoothly before doing it on regular basis.
On the other hand it helps me raising some money for making the next batch of boards.
So if you always wanted to play with the AS5043 this is you chance to get your hands on a cheap board.
Greetings
Sebastian