JorgePe / BOOSTreveng

Reverse engineering the LEGO BOOST Hub
MIT License
168 stars 35 forks source link

Improve docs #24

Closed undera closed 7 years ago

undera commented 7 years ago

Here are my findings after intense experimenting with device. I'd love to get more sniffed traffic samples to improve this. Sorry, I don't have Boost App to do it myself, none of my devices support this app.

JorgePe commented 7 years ago

Thanks, great work. The bump count mode is interesting because I also found a similar mode a few days ago with the WeDo 2.0 tilt sensor. I've been out o country at VMworld and only took the two WeDo 2.0 sensors with me, will post my findings later (yours are much more interesting). Also the 3-axis mode... I wonder why doesn't the LEGO App use it if it is there? The color-distance sensor also came to my mind yesterday morning while cleaning my library code.

JorgePe commented 7 years ago

@undera I tried the tilt sensor mode 0x02 and 0x04 (3-axis simple and precise) but I still don't see yaw readings. With the Move Hub horizontal, rotating it left or write doesn't change anything. What command do you use?

undera commented 7 years ago

When I use my Python library, the below code works perfectly, producing 3 values:

    def cb_log(val1, val2=None, val3=None):
        log.info("V1:%s\tV2:%s\tV3:%s", val1, val2, val3)

    hub = MoveHub()

    hub.tilt_sensor.subscribe(cb_log, TILT_MODE_FULL)
    sleep(10)
    hub.tilt_sensor.unsubscribe(cb_log)

From logs I see command sent is 0a01 413a 04 0100 0000 01 where:

JorgePe commented 7 years ago

Yes, I'm using that command. But when I put my BOOST Move Hub on a flat surface and spin it around, I only get values on this range: val1 = 01..03 val2 = 00..ff val3 = 40..41 Those variations are too small, there is no way to get yaw data from these readings. They do change if I move on the other two axis but then what's the meaning of the 3 bytes for just 2 axies? 3 nibbles (12 bits) for each?

undera commented 7 years ago

Hm, I guess this is nature of 3-axis sensor in space with 1 direction of gravity - you can't tell yaw in this setup. You need to turn it 90 degrees in any direction, then try looking if rotation of hub will show up smoothly in third parameter.