MPU-9250 ile palet eğimi: pitch ve roll hesaplama ve ham örneklerimin neden düştüğü
Yapay zekâ tarafından English dilinden çevrildi ·
Startup kurucusuyum, lojistik alanındayım, sensörler konusunda çok yeniyim, lütfen sabırlı olun.Bir paletin kamyonda devrilip devrilmediğini öğrenmek istiyoruz. Prototip: bir palete takılmış ESP32 + MPU-9250 (ivmeölçer, jiroskop, manyetometre), MQTT üzerinden Hermetry’ye veri gönderiyor. Planım her şeyi ham olarak göndermek ve açıları sonra hesaplamaktı: her örnek için bir mesajla, saniyede 50 kez 9 değer:
{"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}
İki sorun var. Telemetri sekmesi yalnızca örneklerin bir kısmını gösteriyor ve bir iki dakika sonra cihaz günlüğü oturumun rate_limit nedeniyle kapandığını gösteriyor. Ayrıca bu sayıları pitch, roll ve yaw değerlerine nasıl çevireceğimi bilmiyorum. Hermetry bunu ham değerlerden hesaplayabilir mi, yoksa ESP32 üzerinde mi yapmalıyım?
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?
Yapay zekâ tarafından English dilinden çevrildi ·
+1, ayrıca pitch, roll ve yaw arasındaki fark nedir? 😅
+1, also what’s the difference between pitch, roll and yaw? 😅
Yapay zekâ tarafından English dilinden çevrildi ·
Bunu bir akışta Script bloğuyla hesaplayabilirsiniz, Math desteği var. Ama saniyede 50 mesajla bu zaten oraya ulaşamaz.
You could compute it in a flow with a Script block, it has Math. But 50 messages a second won’t get there anyway.
Yapay zekâ tarafından English dilinden çevrildi ·
Hesaplamayı ESP32 üzerinde yapın. Sulama pivotlarında eğim alarmlarını bu şekilde yapıyorum.Düşürmeler: bir cihaz profili varsayılan olarak saniyede 10 telemetri mesajına ve saniyede 200 veri noktasına izin verir. Siz saniyede 50 mesaj ve 450 nokta gönderiyorsunuz, bu yüzden çoğu onaylanıp düşürülüyor ve limitini sürekli aşan bir cihazın oturumu kapatılıyor. Logdaki rate_limit budur. Tablo için MQTT sayfasına bakın.Roberts.r için de açılar: roll, paletin uzun ekseni etrafındaki dönüş; pitch, kısa eksen etrafındaki dönüş; yaw ise pusula yönü. Palet hareketsizken yalnızca ivmeölçerden:
float roll = atan2(ay, az) * 180 / PI;
float pitch = atan2(-ax, sqrt(ay * ay + az * az)) * 180 / PI;
Hareket halindeki bir kamyonda ivmeölçer frenleme ve sarsıntıları da algılar; bu yüzden onu jiroskopla harmanlayın (tamamlayıcı filtre, yaklaşık %98 jiroskop, %2 ivmeölçer) ya da yaw için manyetometreyi de kullanan bir Madgwick filtre kütüphanesi kullanın.Sonra ham akışı değil, ihtiyacınız olanı gönderin: roll/pitch değerini her 10 saniyede bir, ayrıca eğim örneğin 30° değerini geçtiğinde anında bir mesaj göndererek:
{"roll": 2.1, "pitch": -0.8, "tilt_max": 3.4}
tilt_max, son mesajdan bu yana görülen en büyük eğimdir; böylece mesajlar arasındaki kısa bir uç kaybolmaz. Ardından tilt_max > 30 üzerinde bir alarm kuralı yeterlidir.
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.
Yapay zekâ tarafından English dilinden çevrildi ·
Çelik bir römorkun içinde yaw (sapma) değerine güvenmeyin. Manyetometre çelik tarafından çekilip saptırılıyor, biz 40° hata gördük. “Devrilme” için zaten ihtiyacınız olan şey roll ve pitch.
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.
Yapay zekâ tarafından English dilinden çevrildi ·
ESP32 üzerinde tamamlayıcı filtreye geçtim ve tilt_max ile her 10 saniyede bir mesaj gönderiyorum; artık düşme veya kapanan oturum yok. Depoda test paletini elle devirdim: tilt_max 78 oldu ve alarm aynı saniye içinde devreye girdi. ciaranwalsh55’in dediği gibi yaw’ı çıkardım, römorkta sürekli zıplıyordu.
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.
- Bu konuyu yanıtlamak için giriş yapmış olmalısınız.
Sohbete katılın
Soru sormak ve yanıtlamak, yararlı gönderileri beğenmek ve sorununuzu çözen yanıtı işaretlemek için oturum açın. Her katkı puan ve seviye kazandırır.

