Forums » Support

Back To Topics

Reading out WeDo 1.0 motion detector with sbrick+ from linux

    • 167 posts
    January 24, 2019 5:02 PM CET

    Hello Heiko,

    there's a bug in the code that handles voltage measurement setup readback. As a workaround, try "2d00" instead of "2d" (This will stop working once we fixed this bug).

    To measure the voltage, use channel "01", that's the "C2" lead on port "A".

    Cheers,

    Tamas

    • 1 posts
    December 23, 2018 2:20 PM CET

    I would like to read out the WeDo 1.0 motion detector from linux on raspberry pi (Raspbian GNU/Linux 9 (stretch)). I use the gattool for the bluetooth connection to sbrick plus.

    connection and motor control is working, as well as reading out temperature and voltage.

    But I am not able to read out the motion detector values. I measured voltage directly at the motion detector and read out that the voltage is changing on C1 pin at the lego connector depending on the distance.

    Reading out the distance using the sbrick software is working fine.

    Accourding to the documentation of the BLE sbrick protocol (https://social.sbrick.com/wiki/view/pageId/11) I did the following:

    (1) Set up periodic voltage measurement on channel 00:
    gatttool -b device-ID -i hci1 --char-write-req --handle=0x001a --value=2c00

    Using value 2d to read out the voltage measurement setup delivers no value

    gatttool -b device-ID -i hci1 --char-write-req --handle=0x001a --value=2d
    gatttool -b device-ID -i hci1 --char-read --handle=0x001a

     

    (2) Query ADC for voltage mesurement on channel 00

    gatttool -b device-ID -i hci1 --char-write-req --handle=0x001a --value=0f00
    gatttool -b device-ID -i hci1 --char-read --handle=0x001a

    This delivers value: 00 00

    Value does not change no matter what distance on motion detector.

     

    Any help/ suggestions would be highly appreciated.