Hello everyone, I am currently working on a DIY drone. I have coded the part where it can measure the the Roll, Yaw and Pitch. However, I do not have a setup to move the drone at precise angles and read the angle calculated by the drone. This can be done on only one axis to start with.
What I need to do is: set the drone at a specific angle, record the actual angle, record the angle calculated by the drone and compare them. No, I cannot just place the drone over a wall and using markings to see the angles. I want the drone to continually rotate so I can simulate the effect of linear acceleration on the accelerometer.
My first idea was to have a wooden rod with a bearing in the middle connected to a support frame. On the bearing, I would connect a high quality potentiometer with the rotary part connected to the wooden road. So, when the rod is moved manually, the potentiometer value is changed, and the signal is fed trough a voltage divider to an analog pin. Then, the analog pin is red, ad the analog value is mapped to convert it to the actual angle of the rod. This setup is very difficult to build, I do not discard the idea but I am looking for something simpler.
Another idea I had is to use a high quality servo motor to turn the rod. The issue is that when I give the signal to turn the rod, it will not move to that position instantaneously, therefore, I will not accurately measure the real position of the rod. Maybe it is possible to move the rod by hand and use a code to read the position of the servo motor shaft, I am not sure if there is a servo motor that can return the position of the shaft. I tried using servo.read on a micro servo SG90 connected to Arduino, but it does not work as the value does not change if I spin the shaft by hand.
I am totally open to new approaches to solve my problem. Please provide your precious time to help me prepare the setup.
Hello @jremington, when the accelerometer are stationary, the data read is accurate. When the drone would be moving, there would be an extra force acting on the drone apart from gravity. These forces will provide inaccurate accelerometer data. I want to have the drone rotate with the rod, this will apply forces to the accelerometer (which I can detect via software). These forces are conceptually treated as "linear acceleration".
Hello @cedarlakeinstruments , That is a very nice piece of equipment. using a motor will introduce lag between the actual position and the control signal. but I will consider it for future.
There are IMUs with built-in sensor fusion algorithms that will provide acceleration-compensated angle data. MPU-6050 is an example. It's obsolete now, but there are newer versions.
"Linear acceleration" is an inaccurate and misleading term, loosely defined as acceleration produced by forces other than gravity.
The gyro can be used in sensor fusion algorithms to partially compensate for the errors in yaw, pitch and roll induced by rotation, but cannot help compensate for the errors induced by acceleration due to brakes, motors and the like.
You still haven't explained the actual problem you are trying to solve.
Hello @cedarlakeinstruments , that is the exact sensor I am using!!!! Was not aware that it already has a data processing on board feature. Will have a look into that, but it still does not solve the issue of me wanting to verify those angle measurements.
Hello @jremington, I am trying to see if the angles calculated by the ESP32-S2 connected to a MPU6050 are accurate. This will then be used used as the algorithm to find orientation for a DIY drone. This is the real problem I am trying to solve, I have no idea if the roll pitch, yaw angles I read are accurate, if not, how much is the error. I hope this gives a more clear idea of what I am trying to do.
Hello @jremington yes, what you have said is all correct. Now I want to see the angles while the drone is moving, therefore I do not want to fix it stationary at certain angles and get the reading. I wanna see the calculated readings while the drone is moving along with the real position of the drone.
@jremington Ideally it has to be a transducer. One idea was to use a potentiometer, when the wooden rod turns, it would turn the pot. I would then always read the analog value and convert it into degrees. i.e. 0V from the voltage divider with the pot could be located at 0 deg, then 2.5V would be 90 deg, then 5V would be 180 deg. It is very easy to design a voltage divider to achieve that and is very easy to map the reading from the analog read to the actual angle (map function itself should be enough to do that).
The idea is that the angle read always comes from the potentiometer which is fixed to the wooden road. No heavy calculation required to find the angle, just an analogread and scaling. This would give a very accurate value, low computationally expensive, extremely reliable. The only issue with this is having the mechanical skills to be able to do it which I am currently lacking. I can do it, but it would take me quite a bit of time and effort.