The Gy521 module accepts a voltage of 3 to 5V, which is necessary to develop at 5V and then navigate to 3.7V having possibly retouched the parameters.
The Gy521 module accepts a voltage of 3 to 5V, which is necessary to develop at 5V and then navigate to 3.7V having possibly retouched the parameters.
The doc of the MPU6050 is scary with 120 control registers at first glance. In fact all these registers have a correct default value for our use, except one, necessary to wake up the circuit. Two other registers will be commented on later.
The doc of the MPU6050 is scary with 120 control registers at first glance. In fact all these registers have a correct default value for our use, except one, necessary to wake up the circuit. Two other registers will be commented on later.
@ -56,7 +56,7 @@ Control theory uses beautiful mathematics and professional tools like MathLab an
We have to program the Witty with that constant idea: keep the soft compact and fast.
We have to program the Witty with that constant idea: keep the soft compact and fast.
Let us suppose, as for traditional balancing robot, we want to keep the Witty vertical. vertical. If he leans forward, he must be advanced. If the speed is proportional to the error (the angle) one has a setting P for proportional.
Let us suppose, as for traditional balancing robot, we want to keep the Witty vertical. vertical. If he leans forward, he must be advanced. If the speed is proportional to the error (the angle) one has a setting P for proportional.
An effort, friction, the fact that Pegasus is not balanced initially, can prevent reaching the desired position; it's the static error. We add to correct a fraction of the integral of the error, therefore the sum of the differences between the desired position and the successive positions. It's component I, integration.
An effort, friction, the fact that Pegasus is not balanced initially, can prevent reaching the desired position; it's the static error. We add to correct a fraction of the integral of the error, therefore the sum of the differences between the desired position and the successive positions. It's component I, integration.
@ -71,7 +71,7 @@ Kp and Ki are constants that will have to be determined experimentally, in the a
To reduce the noise of the sensors, it is necessary to average and there are three simple ways to average, plus very complex techniques. The simple average sums up e.g. 4 measurements and gives a result 4 times less often, which is obviously not favorable. The sliding average measure the average of the previous 4 measures.
To reduce the noise of the sensors, it is necessary to average and there are three simple ways to average, plus very complex techniques. The simple average sums up e.g. 4 measurements and gives a result 4 times less often, which is obviously not favorable. The sliding average measure the average of the previous 4 measures.
Weighted average give a weight to the stored measures, so it is possible to react faster or slower to the last measure, and get something like a low pass or high pass filter. See the web for details.
Weighted average give a weight to the stored measures, so it is possible to react faster or slower to the last measure, and get something like a low pass or high pass filter. See the web for details.
(our old document in French: [Moyenne.pdf](https://www.didel.com/Moyennes.pdf)).
(our old document in French: [Moyenne.pdf](https://www.didel.com/Moyennes.pdf)).
@ -99,7 +99,9 @@ itgr += v8;
```
```
## Test Environment and useful Functions
## Test Environment and useful Functions
<table><tr><td>
![xyz1](images/xyz1.png?raw=true "XYZ")
![xyz1](images/xyz1.png?raw=true "XYZ")
</td><td>
The AcZ component is horizontal and will play the main role in the algorithm.
The AcZ component is horizontal and will play the main role in the algorithm.
The GyX value can be integrated to give the angle or directly used as a derivative of the acceleration. It is very parasitized and it is necessary to use a suitable filter.
The GyX value can be integrated to give the angle or directly used as a derivative of the acceleration. It is very parasitized and it is necessary to use a suitable filter.
We simplify the problem if we consider only AcZ. At reset, the robot is stationary in the desired position and the initial values after filtering are stored.
We simplify the problem if we consider only AcZ. At reset, the robot is stationary in the desired position and the initial values after filtering are stored.
The same pfm value is given for both engines. The consequence is that Pegase will slowly turn on itself. It will involve GyY, but without compass, there will always be drift.
The same pfm value is given for both engines. The consequence is that Pegase will slowly turn on itself. It will involve GyY, but without compass, there will always be drift.
@ -118,7 +122,7 @@ A P setting will check the quality of the Kp parameter signals. Then we add the
### Debugging Tools
### Debugging Tools
The TerSer.h library is used instead of the Serial library. The memory space is greatly reduced and the display of insignificant zeros avoids the ziz-zag displays which prevent the evolution of the variables from being clearly visible.
The TerSer.h library is used instead of the Serial library. The memory space is greatly reduced and the display of insignificant zeros avoids the ziz-zag displays which prevent the evolution of the variables from being clearly visible.