Inclinación de una palé con un MPU-9250: cálculo de cabeceo y balanceo, y por qué se descartan mis muestras sin procesar
Traducido del English por IA ·
Fundador de una startup, logística, muy nuevo en sensores, así que tened paciencia conmigo.Queremos saber si una palé se volcó en un camión. Prototipo: ESP32 + MPU-9250 (acelerómetro, giroscopio, magnetómetro) sujeto a una palé, enviando a Hermetry por MQTT. Mi plan era enviar todo en bruto y calcular los ángulos más tarde: 9 valores, 50 veces por segundo, un mensaje por muestra:
{"ax": 0.02, "ay": -0.01, "az": 0.99, "gx": 0.4, "gy": -0.2, "gz": 0.1, "mx": 21.3, "my": -4.8, "mz": 40.1}
Dos problemas. La pestaña de telemetría solo muestra una fracción de las muestras, y tras uno o dos minutos el registro del dispositivo indica que la sesión se cerró con rate_limit. Y no tengo ni idea de cómo convertir estos números en cabeceo, balanceo y guiñada. ¿Puede Hermetry calcularlo a partir de los valores brutos, o debo hacerlo en el ESP32?
Startup founder, logistics, very new to sensors so please bear with me.
We want to know if a pallet tipped over in a truck. Prototype: ESP32 + MPU-9250 (accelerometer, gyro, magnetometer) strapped to a pallet, sending to Hermetry over MQTT. My plan was to send everything raw and work out the angles later: 9 values, 50 times a second, one message per sample:
{"ax": 0.02, "ay": -0.01, "az": 0.99, "gx": 0.4, "gy": -0.2, "gz": 0.1, "mx": 21.3, "my": -4.8, "mz": 40.1}
Two problems. The telemetry tab only shows a fraction of the samples, and after a minute or two the device log shows the session closed with rate_limit. And I have no idea how to turn these numbers into pitch, roll and yaw. Can Hermetry compute that from the raw values, or do I do it on the ESP32?
Traducido del English por IA ·
+1, ¿y cuál es la diferencia entre pitch, roll y yaw? 😅
+1, also what’s the difference between pitch, roll and yaw? 😅
Traducido del English por IA ·
Podrías calcularlo en un flujo con un bloque Script, que tiene Math. Pero 50 mensajes por segundo no llegarán a ese punto de todos modos.
You could compute it in a flow with a Script block, it has Math. But 50 messages a second won’t get there anyway.
Traducido del English por IA ·
Calcula en el ESP32. Así es como hago alarmas de inclinación en pivotes de riego.Los descartes: por defecto, un perfil de dispositivo permite 10 mensajes de telemetría por segundo y 200 puntos de datos por segundo. Tú envías 50 mensajes y 450 puntos por segundo, así que la mayoría se confirma y se descarta, y un dispositivo que sigue superando su límite ve cerrada su sesión. Eso es el rate_limit del registro. Consulta MQTT para ver la tabla.Los ángulos, también para roberts.r: el roll es la rotación alrededor del eje largo de la paleta, el pitch alrededor del eje corto, y el yaw es el rumbo de la brújula. Solo con el acelerómetro, cuando la paleta está quieta:
float roll = atan2(ay, az) * 180 / PI;
float pitch = atan2(-ax, sqrt(ay * ay + az * az)) * 180 / PI;
En un camión en movimiento, el acelerómetro también registra frenadas y golpes, así que mézclalo con el giroscopio (filtro complementario, aproximadamente 98 % giroscopio, 2 % acelerómetro) o usa una biblioteca de filtro Madgwick, que además usa el magnetómetro para el yaw.Luego envía lo que necesitas, no el flujo sin procesar: cada 10 s el roll/pitch actual, más un mensaje inmediato cuando la inclinación supere, por ejemplo, 30°:
{"roll": 2.1, "pitch": -0.8, "tilt_max": 3.4}
tilt_max es la mayor inclinación registrada desde el último mensaje, así que un pico breve entre mensajes no se pierde. Con una regla de alarma sobre tilt_max > 30 basta.
Compute on the ESP32. I do tilt alarms on irrigation pivots this way.
The drops: a device profile by default allows 10 telemetry messages per second and 200 data points per second. You send 50 messages and 450 points a second, so most of it is acknowledged and dropped, and a device that keeps breaking its limit gets its session closed. That’s the rate_limit in the log. See MQTT for the table.
Angles, for roberts.r too: roll is rotation around the pallet’s long axis, pitch around the short axis, yaw is the compass heading. From the accelerometer alone, when the pallet is still:
float roll = atan2(ay, az) * 180 / PI;
float pitch = atan2(-ax, sqrt(ay * ay + az * az)) * 180 / PI;
In a moving truck the accelerometer also sees braking and bumps, so blend it with the gyro (complementary filter, about 98 % gyro, 2 % accel) or use a Madgwick filter library, which also uses the magnetometer for yaw.
Then send what you need, not the raw stream: once every 10 s the current roll/pitch, plus an immediate message when the tilt passes, say, 30°:
{"roll": 2.1, "pitch": -0.8, "tilt_max": 3.4}
tilt_max is the biggest tilt seen since the last message, so a short tip between messages is not lost. An alarm rule on tilt_max > 30 is then all you need.
Traducido del English por IA ·
No cuente con el yaw dentro de un remolque de acero. El magnetómetro se desvía por el acero; vimos errores de 40°. El roll y el pitch son lo que necesita para detectar que «se ha volcado» de todos modos.
Don’t count on yaw inside a steel trailer. The magnetometer gets pulled around by the steel, we saw 40° errors. Roll and pitch are what you need for «tipped over» anyway.
Traducido del English por IA ·
Cambié a un filtro complementario en el ESP32 y envío un mensaje cada 10 s con tilt_max; ya no hay pérdidas ni sesiones cerradas. Volqué a mano el palé de prueba en el almacén: tilt_max 78 y la alarma saltó en el mismo segundo. Descarté el yaw como dijo ciaranwalsh55, porque no paraba de saltar en el remolque.
Changed to a complementary filter on the ESP32 and a message every 10 s with tilt_max, no more drops or closed sessions. Tipped the test pallet by hand in the warehouse: tilt_max 78 and the alarm fired within the same second. Dropped yaw like ciaranwalsh55 said, it was jumping around in the trailer.
- Debes estar registrado para responder a este debate.
Únete a la conversación
Inicia sesión para preguntar y responder, dar me gusta a las publicaciones útiles y marcar la respuesta que resolvió tu problema. Cada aportación suma puntos y niveles.

