You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/encoders/ma735/README.md
+20-6Lines changed: 20 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# MA735 SimpleFOC driver
2
2
3
-
This is based on the [MA730](https://github.com/simplefoc/Arduino-FOC-drivers/tree/master/src/encoders/ma730) driver in SimpleFOC, with some tweaks to support the unique registers and options of the MA735. It is a inferior, but less expensive chip after all.
3
+
This is based on the [MA730](https://github.com/simplefoc/Arduino-FOC-drivers/tree/master/src/encoders/ma730) driver in SimpleFOC, with some tweaks to support the unique registers and options of the MA735. It is a little bit inferior, but less expensive chip after all. The advantage however of this chip (besides cost) is that resolution is inversely proportional to reading speed, ranging from 9-13 bit resolution and 64us to 16ms read times.
4
4
5
5
6
6
## Hardware setup
@@ -42,6 +42,16 @@ void setup() {
42
42
}
43
43
```
44
44
45
+
Set some registers before start
46
+
```c++
47
+
voidsetup() {
48
+
sensor1.init();
49
+
50
+
// Note that with this driver there is a write check so registers are not written to if the value is the exact same. Other drivers do not have a write check, and you can easily wear out the NVM every time the code is run. 1,000 cycles max.
51
+
sensor1.setResolution(10.0);
52
+
}
53
+
```
54
+
45
55
Here's how you can use it:
46
56
47
57
```c++
@@ -57,14 +67,18 @@ Here's how you can use it:
57
67
// get the angle, in radians, no full rotations
58
68
float a2 = sensor1.getCurrentAngle();
59
69
60
-
// get the raw 14 bit value
61
-
uint16_t raw = sensor1.readRawAngle();
62
-
63
70
// get the field strength
64
71
FieldStrength fs = sensor1.getFieldStrength();
65
72
Serial.print("Field strength: ");
66
73
Serial.println(fs);
67
74
68
-
// set pulses per turn for encoder mode
69
-
sensor1.setPulsesPerTurn(999); // set to 999 if we want 1000 PPR == 4000 CPR
75
+
//get the calculated resolution from FilterWindow register
76
+
float res = sensor.getResolution();
77
+
Serial1.print("Resolution: ");
78
+
Serial1.println(res);
79
+
80
+
//get the calculated update time in micro seconds from the FilterWindow register
0 commit comments