Commit 33d33be1 authored by Jake Read's avatar Jake Read
Browse files

finish htm week

parent d3ef6b18
...@@ -8,7 +8,7 @@ I want an encoder! Encoders<sup>1</sup> read position, generally by counting 'ti ...@@ -8,7 +8,7 @@ I want an encoder! Encoders<sup>1</sup> read position, generally by counting 'ti
Then, you add the ticks together to get your position. In order to detect direction, a technique called 'quadrature' is used: Then, you add the ticks together to get your position. In order to detect direction, a technique called 'quadrature' is used:
![quadrature-basically](https://gitlab.cba.mit.edu/jakeread/mkencoder/raw/master/images/quadrature-basically.jpg) ![quadrature-basically](https://gitlab.cba.mit.edu/jakeread/mkencoder/raw/master/images/quadrature-basically.png)
Super simple, very neat. Here's picture of a *fancy* encoder: Super simple, very neat. Here's picture of a *fancy* encoder:
...@@ -34,7 +34,7 @@ angular resolution = 360 / (((PI x D)/pole_length) x 160) ...@@ -34,7 +34,7 @@ angular resolution = 360 / (((PI x D)/pole_length) x 160)
Of course, I have to set the circumference equal to an integer value of magnets. I wrote a quick spreadsheet for this, and get that w/ a Diameter ~ 100mm (where the gearbox currently stands) I can get 0.017 deg/step with a 2.4mm pole pair, and ~ 0.03 deg/step with a 4mm pole spacing. Nice. Of course, I have to set the circumference equal to an integer value of magnets. I wrote a quick spreadsheet for this, and get that w/ a Diameter ~ 100mm (where the gearbox currently stands) I can get 0.017 deg/step with a 2.4mm pole pair, and ~ 0.03 deg/step with a 4mm pole spacing. Nice.
![rough spreadsheet](https://gitlab.cba.mit.edu/jakeread/mkencoder/raw/master/images/spreasheet-resolution-approx.png) ![rough spreadsheet](https://gitlab.cba.mit.edu/jakeread/mkencoder/raw/master/images/spreadsheet-resolution-approx.png)
Now, this is not so straightforward. The important thing to remember is that **Resolution != Accuracy** - while I have ~ 0.03 deg / step, those steps are not exactly mapped perfectly in a circle. I will actually be referencing magnets that are glued in place - so my glueing and magnet placement would have to be *perfect<sup>4</sup>* for Resolution to = Accuracy. In addition, not all magnetic fields will be identical, etc. Now, this is not so straightforward. The important thing to remember is that **Resolution != Accuracy** - while I have ~ 0.03 deg / step, those steps are not exactly mapped perfectly in a circle. I will actually be referencing magnets that are glued in place - so my glueing and magnet placement would have to be *perfect<sup>4</sup>* for Resolution to = Accuracy. In addition, not all magnetic fields will be identical, etc.
...@@ -154,6 +154,34 @@ Ok I got this mostly together - made one mistake, where the motor floats a bit b ...@@ -154,6 +154,34 @@ Ok I got this mostly together - made one mistake, where the motor floats a bit b
Before I get into the meat of programming interrupts etc for this, I'm going to first get some voltage on this board alone and scope the lines to see that I am getting (1) the voltage I want out of the magnetic-field sensing pin, and (2) the ticks I want on the ABI lines. Before I get into the meat of programming interrupts etc for this, I'm going to first get some voltage on this board alone and scope the lines to see that I am getting (1) the voltage I want out of the magnetic-field sensing pin, and (2) the ticks I want on the ABI lines.
So, pretty upsetting. I am getting the bad magnetic field warning from the AS5304. The Index is High while A and B are low (the warning) and the output from the CAO (analog magnetic field indicator) is low, around 1.1 volts, meaning that I have a magnetic field that is way too strong.
![datasheet-cao](https://gitlab.cba.mit.edu/jakeread/mkencoder/raw/master/images/datasheet-cao.jpg)
And my scope trace:
![scope-sad-cao](https://gitlab.cba.mit.edu/jakeread/mkencoder/raw/master/images/scope-sad-cao.jpg)
And setup:
![scope-to-check-cao](https://gitlab.cba.mit.edu/jakeread/mkencoder/raw/master/images/scope-to-check-cao.jpg)
In some sense, I should have anticipated this, and in hindsight I really should have read the datasheet in more detail, where I'm sure it outlines the required magnetic field strength...
Yep, there it is
![datasheet-magfield](https://gitlab.cba.mit.edu/jakeread/mkencoder/raw/master/images/datasheet-magfield.jpg)
So lesson learned - I really should have gotten into this beforehand, but it looks like I have *way* too much magnetic field - 13500 Gauss at the magnet pole and the AS5304 wants only to see 10 to 60 mT (milliTesla) - I have 1350 mT. Whoop!
## NEXT TIME
I think the best way forward, with all things considered, is to go bones deep <i class="em em-swimmer"></i> and get two Hall Effect Sensors, read those, and do the signal processing. It's a much more interesting project this way, etc.
I may make a last-ditch attempt at the easy route, with skinnier magnets and a bigger spacing between the encoder and the ring.
All I want is more time.
## Programming, Measurements & Corrections ## Programming, Measurements & Corrections
I want to be like Sam. Sam measures *everything* and he does it really beautifully. This is some of the functionality I really want to be able to bring into mods - the ability to quickly pull test data out of systems, do computation with it, and learn. I want to be like Sam. Sam measures *everything* and he does it really beautifully. This is some of the functionality I really want to be able to bring into mods - the ability to quickly pull test data out of systems, do computation with it, and learn.
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment