Henglos IO
Built-in packages

IMU

An accelerometer + gyroscope on I2C — the MPU-6050 (GY-521) and its family (MPU-6500, MPU-9250), found by itself or picked in Model.

An accelerometer + gyroscope on I2C — the MPU-6050 (GY-521) and its family (MPU-6500, MPU-9250), found by itself or picked in Model. Read gives acceleration (g), rotation (°/s) and temperature, Orientation a steady pitch and roll, Tilt branches on which way it leans, Motion on whether it's still, moving or falling, and Calibrate zeroes it.

@henglosio/component-imuv1.0.0platform ^1.0.0
NodeKindWhat it does
ReadActionThe sensor's acceleration on each axis (g), rotation about each axis (°/s) and its temperature (°C).
OrientationActionPitch and roll in degrees, steady and quick at once — the gyro for quick turns, gravity to keep it from drifting.
TiltActionBranches on which way the sensor leans — Forward, Back, Left, Right, or Level within Threshold of flat.
MotionActionBranches on what the sensor is doing — Still, Moving (it accelerates or turns), or Free Fall.
CalibrateActionZeroes the sensor while it rests — for every action on the same chip: the gyro's drift at rest, and with Level the accelerometer too (lying flat).

Actions

Read

The sensor's acceleration on each axis (g), rotation about each axis (°/s) and its temperature (°C).

Settings

SettingTypeDefaultWhat it's for
SDA PinPin (digital out)GPIO21Required. Board pin wired to the sensor's SDA.
SCL PinPin (digital out)GPIO22Required. Board pin wired to the sensor's SCL.
ModelOne of: Auto, MPU-6050 (GY-521), MPU-6500, MPU-9250 / 9255AutoThe sensor's chip. Auto finds it by its ID — pick it when a clone answers with an ID Auto doesn't know (it then reads as an MPU-6050).
AddressOne of: Auto, 0x68 (AD0 low), 0x69 (AD0 high)AutoAdvanced. The sensor's I2C address — 0x68 with AD0 to GND or unwired (most modules), 0x69 with AD0 to 3.3 V. Auto tries both.
Accel RangeOne of: ±2 g, ±4 g, ±8 g, ±16 g±2 gAdvanced. The most acceleration it measures — ±2 g is the finest; raise it for hits and fast moves, which read as stuck at the top otherwise.
Gyro RangeOne of: ±250 °/s, ±500 °/s, ±1000 °/s, ±2000 °/s±250 °/sAdvanced. The fastest rotation it measures — ±250 °/s is the finest; raise it for quick spins.

Publishes

OutputTypeWhat it is
axfloatAcceleration along X (forward), in g. Lying flat at rest it's 0.
ayfloatAcceleration along Y (left), in g. Lying flat at rest it's 0.
azfloatAcceleration along Z (up), in g. Lying flat at rest it's 1 — gravity.
gxfloatRotation about X, in °/s — positive as the right side dips.
gyfloatRotation about Y, in °/s — positive as the front dips.
gzfloatRotation about Z, in °/s — positive turning left (counterclockwise from above).
temperaturefloatThe chip's temperature, in °C — a few degrees above the air around it.
modelanyThe chip found, as text — mpu6050, mpu6500 or mpu9250.

Orientation

Pitch and roll in degrees, steady and quick at once — the gyro for quick turns, gravity to keep it from drifting. Run it often (a loop): it builds on its last reading.

Settings

SettingTypeDefaultWhat it's for
SDA PinPin (digital out)GPIO21Required. Board pin wired to the sensor's SDA.
SCL PinPin (digital out)GPIO22Required. Board pin wired to the sensor's SCL.
ModelOne of: Auto, MPU-6050 (GY-521), MPU-6500, MPU-9250 / 9255AutoThe sensor's chip. Auto finds it by its ID — pick it when a clone answers with an ID Auto doesn't know (it then reads as an MPU-6050).
AddressOne of: Auto, 0x68 (AD0 low), 0x69 (AD0 high)AutoAdvanced. The sensor's I2C address — 0x68 with AD0 to GND or unwired (most modules), 0x69 with AD0 to 3.3 V. Auto tries both.
Accel RangeOne of: ±2 g, ±4 g, ±8 g, ±16 g±2 gAdvanced. The most acceleration it measures — ±2 g is the finest; raise it for hits and fast moves, which read as stuck at the top otherwise.
Gyro RangeOne of: ±250 °/s, ±500 °/s, ±1000 °/s, ±2000 °/s±250 °/sAdvanced. The fastest rotation it measures — ±250 °/s is the finest; raise it for quick spins.
Gyro WeightNumber (0 to 99.9)96Advanced. How much each reading trusts the gyro over gravity, in % — 0 to 99.9. Higher is smoother but corrects drift slower; 0 is gravity alone.

Publishes

OutputTypeWhat it is
pitchfloatFront up or down, in degrees — positive as the front (X) dips.
rollfloatSide to side, in degrees — positive as the right side dips.

Tilt

Branches on which way the sensor leans — Forward, Back, Left, Right, or Level within Threshold of flat. Split evenly: a diagonal goes to the side it leans most towards. A board connects 4 outputs of an action by default: leave one unconnected, or raise Outputs per action in Platform settings.

Ends on Forward, Back, Left, Right, Level — or Fallback when it can't run.

Settings

SettingTypeDefaultWhat it's for
SDA PinPin (digital out)GPIO21Required. Board pin wired to the sensor's SDA.
SCL PinPin (digital out)GPIO22Required. Board pin wired to the sensor's SCL.
ModelOne of: Auto, MPU-6050 (GY-521), MPU-6500, MPU-9250 / 9255AutoThe sensor's chip. Auto finds it by its ID — pick it when a clone answers with an ID Auto doesn't know (it then reads as an MPU-6050).
AddressOne of: Auto, 0x68 (AD0 low), 0x69 (AD0 high)AutoAdvanced. The sensor's I2C address — 0x68 with AD0 to GND or unwired (most modules), 0x69 with AD0 to 3.3 V. Auto tries both.
ThresholdNumber (1 to 90)20How far it has to lean to count, in degrees from flat — 1 to 90. Below it, Level.

Publishes

OutputTypeWhat it is
pitchfloatFront up or down, in degrees — positive as the front dips.
rollfloatSide to side, in degrees — positive as the right side dips.
leanfloatHow far from flat, in degrees, whichever way.
tiltanyWhich way it leans, as text — forward, back, left, right or level.

Motion

Branches on what the sensor is doing — Still, Moving (it accelerates or turns), or Free Fall.

Ends on Still, Moving, Free Fall — or Fallback when it can't run.

Settings

SettingTypeDefaultWhat it's for
SDA PinPin (digital out)GPIO21Required. Board pin wired to the sensor's SDA.
SCL PinPin (digital out)GPIO22Required. Board pin wired to the sensor's SCL.
ModelOne of: Auto, MPU-6050 (GY-521), MPU-6500, MPU-9250 / 9255AutoThe sensor's chip. Auto finds it by its ID — pick it when a clone answers with an ID Auto doesn't know (it then reads as an MPU-6050).
AddressOne of: Auto, 0x68 (AD0 low), 0x69 (AD0 high)AutoAdvanced. The sensor's I2C address — 0x68 with AD0 to GND or unwired (most modules), 0x69 with AD0 to 3.3 V. Auto tries both.
Accel RangeOne of: ±2 g, ±4 g, ±8 g, ±16 g±2 gAdvanced. The most acceleration it measures — ±2 g is the finest; raise it for hits and fast moves, which read as stuck at the top otherwise.
Gyro RangeOne of: ±250 °/s, ±500 °/s, ±1000 °/s, ±2000 °/s±250 °/sAdvanced. The fastest rotation it measures — ±250 °/s is the finest; raise it for quick spins.
Accel ThresholdNumber (0.01 to 4)0.15Advanced. How far from gravity (1 g) the acceleration has to stray to count as Moving, in g — 0.01 to 4.
Gyro ThresholdNumber (1 to 1000)20Advanced. How fast it has to turn to count as Moving, in °/s — 1 to 1000.

Publishes

OutputTypeWhat it is
accelerationfloatThe total acceleration, in g — 1 at rest (gravity), near 0 falling.
rotationfloatHow fast it turns, in °/s, about any axis.
motionanyWhat it's doing, as text — still, moving or free fall.

Calibrate

Zeroes the sensor while it rests — for every action on the same chip: the gyro's drift at rest, and with Level the accelerometer too (lying flat). Goes out Fallback, changing nothing, if it moved while measuring.

Settings

SettingTypeDefaultWhat it's for
SDA PinPin (digital out)GPIO21Required. Board pin wired to the sensor's SDA.
SCL PinPin (digital out)GPIO22Required. Board pin wired to the sensor's SCL.
ModelOne of: Auto, MPU-6050 (GY-521), MPU-6500, MPU-9250 / 9255AutoThe sensor's chip. Auto finds it by its ID — pick it when a clone answers with an ID Auto doesn't know (it then reads as an MPU-6050).
AddressOne of: Auto, 0x68 (AD0 low), 0x69 (AD0 high)AutoAdvanced. The sensor's I2C address — 0x68 with AD0 to GND or unwired (most modules), 0x69 with AD0 to 3.3 V. Auto tries both.
SamplesNumber (10 to 500)100Advanced. Readings averaged, 5 ms apart — 10 to 500. 100 takes half a second.
LevelOn / offLying flatThe sensor is lying flat — zero the accelerometer too, so flat reads exactly (0, 0, 1 g). Off: only the gyro.

Publishes

OutputTypeWhat it is
gx_offsetfloatThe gyro's X reading at rest, now subtracted — °/s.
gy_offsetfloatThe gyro's Y reading at rest, now subtracted — °/s.
gz_offsetfloatThe gyro's Z reading at rest, now subtracted — °/s.
ax_offsetfloatThe accelerometer's X offset, now subtracted — g.
ay_offsetfloatThe accelerometer's Y offset, now subtracted — g.
az_offsetfloatThe accelerometer's Z offset (its reading flat minus 1 g), now subtracted — g.

On this page