|
1 | 1 | # MagAlpha library |
2 | 2 | Arduino library for the MPS MagAlpha magnetic angle sensor. |
3 | 3 |
|
4 | | -Supports MagAlpha 3rd generation Sensors. MagAlpha sensor detects the absolute angular position of a permanent magnet, typically a diametrically magnetized cylinder on the rotating shaft. |
| 4 | +## About |
| 5 | +MagAlpha sensor detects the absolute angular position of a permanent magnet, typically a diametrically magnetized cylinder on the rotating shaft. |
5 | 6 |
|
6 | 7 | For more information on the MagAlpha sensor family: |
7 | 8 | * [MagAlpha Product Overview](http://www.monolithicpower.com/Products/Position-Sensors/Products-Overview) |
8 | 9 | * [MagAlpha Support Materials](http://www.monolithicpower.com/Design-Support/Position-Sensors-Design-Support) |
9 | 10 |
|
10 | | -Check [Arduino SPI library reference page](https://www.arduino.cc/en/Reference/SPI) for the SPI signal connections. |
| 11 | +## Supported sensors |
| 12 | +Supports all 3rd generation MagAlpha magnetic angle sensors from [Monolithic Power Systems](https://www.monolithicpower.com/). |
| 13 | + |
| 14 | +| Applications | Part Numbers | |
| 15 | +| ------------| ------------ | |
| 16 | +| Turning knob applications (potentiometer replacement) | MA800, MA820, MA850 | |
| 17 | +| Rotary encoders (optical encoder replacement, Servo motors, ...) | MA702, MA704, MA710, MA730 | |
| 18 | +| Position controlled motor drivers (FOC, ...) | MA302, MA310 | |
| 19 | +| Motor commutation (hall switches replacement) | MA102 | |
11 | 20 |
|
12 | | -| Warning | |
13 | | -| ------- | |
14 | | -| Unlike most Arduino & Genuino boards, the MagAlpha runs at 3.3V. Even if the I/O can tolerate 5V, check that the voltage applied to VDD is at 3.3V. Applying a voltages higher than 3.3V to the VDD pin could damage the sensor.| |
15 | 21 |
|
| 22 | +## License |
16 | 23 | Written by Mathieu Kaelin for Monolithic Power Systems. |
17 | | -MIT license, all text above must be included in any redistribution |
| 24 | +MIT license, all text above must be included in any redistribution. |
| 25 | + |
| 26 | + |
| 27 | +## Connections |
| 28 | +### Power supply |
| 29 | +| Arduino | MagAlpha | |
| 30 | +| -------- | -------- | |
| 31 | +| GND | GND | |
| 32 | +| **+3.3V** (Not 5V)| VDD | |
| 33 | + |
| 34 | +| Warning | |
| 35 | +| :-------: | |
| 36 | +| Unlike most Arduino & Genuino boards, the **MagAlpha runs at 3.3V**. Even if the I/O can tolerate 5V, check that the voltage applied to VDD is at 3.3V. **Applying a voltages higher than 3.3V to the VDD pin could damage the sensor**.| |
| 37 | + |
| 38 | +### Serial communication |
| 39 | +All MagAlpha have a SPI communication interface. Some sensors like the MA702 also have an additional SSI (2-wire) interface. |
| 40 | + |
| 41 | +#### SPI (4-wire interface) |
| 42 | +| Arduino | MagAlpha | |
| 43 | +| -------- | -------- | |
| 44 | +| MOSI | MOSI | |
| 45 | +| MISO | MISO | |
| 46 | +| SCK | SCLK | |
| 47 | +| any available digital pin (default: pin 0) | CS | |
| 48 | + |
| 49 | +#### SSI (2-wire interface) |
| 50 | +| Arduino | MagAlpha | |
| 51 | +| -------- | -------- | |
| 52 | +| MISO | SSD | |
| 53 | +| SCK | SSCK | |
| 54 | + |
| 55 | +#### Arduino SPI pin mapping |
| 56 | +| Arduino / Genuino Board | MOSI | MISO | SCK | CS | Voltage Level | |
| 57 | +| ----------------------- | ---- | ---- | ---- | :---: | ------------- | |
| 58 | +| Zero | ICSP-4 | ICSP-1 | ICSP-3 | defined by the user, any digital pin (default: pin 0) | +3.3V | |
| 59 | +| MKRZero | 8 | 10 | 9 | defined by the user, any digital pin (default: pin 0) | +3.3V | |
| 60 | +| MKR1000 | 8 | 10 | 9 | defined by the user, any digital pin (default: pin 0) | +3.3V | |
| 61 | +| 101 | 11 or ICSP-4 | 12 or ICSP-1 | 13 or ICSP-3 | defined by the user, any digital pin (default: pin 0) | +3.3V | |
| 62 | +| Due | ICSP-4 | ICSP-1 | ICSP-3 | defined by the user, any digital pin (default: pin 0) | +3.3V | |
| 63 | +| Uno or Duemilanove | 11 or ICSP-4 | 12 or ICSP-1 | 13 or ICSP-3 | defined by the user, any digital pin. **Default pin must be changed because pin 0 is also used by the Serial port**. (use pin 7 for example) | +5V | |
| 64 | +| Mega1280 or Mega2560 | 51 or ICSP-4 | 50 or ICSP-1 | 52 or ICSP-3 | defined by the user, any digital pin (default: pin 0) | +5V | |
| 65 | +| Leonardo | ICSP-4 | ICSP-1 | ICSP-3 | defined by the user, any digital pin (default: pin 0) | +5V | |
| 66 | + |
| 67 | +Check [Arduino SPI library reference page](https://www.arduino.cc/en/Reference/SPI) for more information on the SPI signal connections. |
| 68 | + |
| 69 | +## Setup |
| 70 | +Install the library directly from within the Arduino IDE by using the Library Manager (Sketch => Include Library => Manage Libraries...). |
| 71 | + |
| 72 | +It is also possible to import the library Zip file (check release tab) from the Arduino IDE (Sketch => Include Library => Add .ZIP Library...). |
18 | 73 |
|
19 | | -Place the MagAlpha library folder in your arduinosketchfolder/libraries/ folder. |
20 | | -You may need to create the libraries subfolder if its your first library. Restart the IDE. |
| 74 | +The library can also be manually installed by copying the MagAlpha library folder in your arduinosketchfolder/libraries/ folder. You may need to create the libraries subfolder if its your first library. Restart the IDE to see the library. |
21 | 75 |
|
22 | | -You can also check this tutorial on Arduino library installation: |
| 76 | +Check this tutorial on Arduino library installation for more information: |
23 | 77 | * [All About Arduino Libraries](http://learn.adafruit.com/adafruit-all-about-arduino-libraries-install-use) |
0 commit comments