Neu: Die KI-Firewall überwacht die gesamte Plattform und erklärt jeden Vorfall in einfachen Worten. So funktioniert es

Pallet tilt from an MPU-9250: computing pitch and roll, and why my raw samples get dropped

Pallet tilt from an MPU-9250: computing pitch and roll, and why my raw samples get dropped

Gelöst 5 5

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?

Still waiting for the gateway to reconnect.
♥ 0

+1, also what’s the difference between pitch, roll and yaw? 😅

Timestamps in UTC or it didn't happen.
♥ 1

You could compute it in a flow with a Script block, it has Math. But 50 messages a second won’t get there anyway.

♥ 0

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.

Akzeptierte Lösung♥ 3

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.

♥ 1

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.

Still waiting for the gateway to reconnect.
♥ 2
Ansicht von 6 Beiträgen – 1 bis 6 (von insgesamt 6)
  • Du musst angemeldet sein, um auf dieses Thema antworten zu können.

Mitdiskutieren

Melde dich an, um Fragen zu stellen und zu beantworten, hilfreiche Beiträge mit „Gefällt mir“ zu markieren und die Antwort zu kennzeichnen, die dein Problem gelöst hat. Jeder Beitrag bringt Punkte und Stufen.

Teilen