While programming our Lego Boost set (using the Lego Boost App on iPad) I noticed that the distance sensor seemed to give inaccurate triggers. To try to confirm this, I connected the move hub to my computer and used node-poweredup to read out the sensor.

The results surprised me: the max reading I get (the furthest it registers an object) is 157mm. Also the steps are rather big, it always goes in steps of 25mm.

Is this normal range of the distance sensor? Or is it possible that ours has an issue (I wiped the sensor clean with a dry cotton cloth and reconnected it to the Move Hub)?

1 Answer 1


The sensor reports two UInt8 bytes, one in inches (i.e. 0 ... 255, but capped at the maximum range of 10") and one in "inverse fractional inches" (i.e. 1/255 ... 1/1). The actual code is:

    var inches = Double(bytes[5])
    let invFracInches = bytes[7]
    if invFracInches != 0 {
        inches += 1 / Double(invFracInches)

Your software will be converting inches to mm/cm for metric locales - here in UK it practically reports in integer inches (thus the step is 25.4mm) from its maximum range of 10", then once below 6" it starts to report 0.5" steps, below 3" it will report 0.33" then 0.25" steps. In principle it should be able at short range to discern quite small steps.

  • Thanks, so it should register from 254mm. I'll have a second look if I can ever get that distance. Commented Apr 21, 2022 at 4:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.