This is not a completed project from my perspective, but the project to date may be useful to others. I don't really have any questions at this time, so "Completed Projects" seemed like a good enough, albeit loose fit.
As a septuagenarian, I don't get excited over anything much anymore, except maybe gadgets. Lately, I have been interested in angle sensors. I started with a simple accelerometer, which worked well for angles relative to Earth, but it is not so good for angles between parts of a moving object, like a robot. Then I looked at capacitative sensors. That is what is used for the DRO's on my machines, but they are expensive. Finally, I tried magnetic angle encoders. Long story short, I am surprised they work at all, but they seem to work well, are simple, and cheap.
This report is about an exploratory project of the AMS5048A (PWM and SPI output) magnetic sensor. For a practical device, you will need to make refinements. For my giggles, I bought the development board (AS5048A-AB-1.0-ND), which came with the sensor installed and decoupling capacitors. In addition, I got a little dial with a magnet attached that snaps into the board and properly positions the magnet (RMH05-DK-XX-ND). You can buy the sensor alone, but if you do a cost analysis on materials alone and your labor $1.00/hour, you may decide to go the route I took. I have given the DigiKey part numbers. Mouser stocks the same items. I wrote a simple program to look at the PWM output (attached). It is a very crude first draft.
This photo is overexposed to show the LCD values. Top line is the counts for the high value (T2H in the program) and the lower value is the total period (T3H in the program). Both values are in Hex and are not corrected for the PWM signal overhead (about 7 to 10 counts, respectively), which is explained in the datasheet.
Initial testing used a 12F683 at 8 MHz and a Parallax serial LCD. I just approximated the dial positions and got uncorrected values of for 1/4, 1/2, and 3/4 clockwise turns of the K'nob of : 295°, 201°, and 113°, respectively. There was roughly a (-20)° offset, and applying that, my corrected values would be: 275°, 181°, and 93°, respectively. That was just by eye. Of course, either the SPI or I2C interface will probably give better numbers. My next step is to change the MCU to a 12F1840 at either 18 MHz or 32 MHz. I do have a rotary index for cutting gears on my mill, but it is still packed for moving. So, I cannot easily give a more precise estimate of the device's accuracy.
Nevertheless, I have attached the assembly program used. The schematic is also attached. Pin 7 (GPIO,0) is the output to the Parallax serial display, and Pin 5 (GPIO,2) is the PWM input from the sensor to the MCU.
Regards, John
Edit1: 03.20.15 Fixed a typo in the T1CON binary to make pre-scale 1:1 as intended
I apologize for the lousy looking Assembly file. If you load it into MPLAB with the settings shown (Tabs=5, Gitter = 4 and Page =80), it will look better. I tried to export as a pdf, but couldn't.
Edit2: 03.23.15 Added schematic.
As a septuagenarian, I don't get excited over anything much anymore, except maybe gadgets. Lately, I have been interested in angle sensors. I started with a simple accelerometer, which worked well for angles relative to Earth, but it is not so good for angles between parts of a moving object, like a robot. Then I looked at capacitative sensors. That is what is used for the DRO's on my machines, but they are expensive. Finally, I tried magnetic angle encoders. Long story short, I am surprised they work at all, but they seem to work well, are simple, and cheap.
This report is about an exploratory project of the AMS5048A (PWM and SPI output) magnetic sensor. For a practical device, you will need to make refinements. For my giggles, I bought the development board (AS5048A-AB-1.0-ND), which came with the sensor installed and decoupling capacitors. In addition, I got a little dial with a magnet attached that snaps into the board and properly positions the magnet (RMH05-DK-XX-ND). You can buy the sensor alone, but if you do a cost analysis on materials alone and your labor $1.00/hour, you may decide to go the route I took. I have given the DigiKey part numbers. Mouser stocks the same items. I wrote a simple program to look at the PWM output (attached). It is a very crude first draft.
This photo is overexposed to show the LCD values. Top line is the counts for the high value (T2H in the program) and the lower value is the total period (T3H in the program). Both values are in Hex and are not corrected for the PWM signal overhead (about 7 to 10 counts, respectively), which is explained in the datasheet.
Initial testing used a 12F683 at 8 MHz and a Parallax serial LCD. I just approximated the dial positions and got uncorrected values of for 1/4, 1/2, and 3/4 clockwise turns of the K'nob of : 295°, 201°, and 113°, respectively. There was roughly a (-20)° offset, and applying that, my corrected values would be: 275°, 181°, and 93°, respectively. That was just by eye. Of course, either the SPI or I2C interface will probably give better numbers. My next step is to change the MCU to a 12F1840 at either 18 MHz or 32 MHz. I do have a rotary index for cutting gears on my mill, but it is still packed for moving. So, I cannot easily give a more precise estimate of the device's accuracy.
Nevertheless, I have attached the assembly program used. The schematic is also attached. Pin 7 (GPIO,0) is the output to the Parallax serial display, and Pin 5 (GPIO,2) is the PWM input from the sensor to the MCU.
Regards, John
Edit1: 03.20.15 Fixed a typo in the T1CON binary to make pre-scale 1:1 as intended
I apologize for the lousy looking Assembly file. If you load it into MPLAB with the settings shown (Tabs=5, Gitter = 4 and Page =80), it will look better. I tried to export as a pdf, but couldn't.
Edit2: 03.23.15 Added schematic.
Attachments
-
14.4 KB Views: 59
-
19.2 KB Views: 85
Last edited: