Forums » Support

Back To Topics

Voltage Calculation

    • 5 posts
    January 20, 2016 12:27 AM CET

    So awesome.  Many thanks.

    • 178 posts
    January 19, 2016 3:52 PM CET

    ...the wiki page was also updated. Check it out!

    • 178 posts
    January 19, 2016 3:08 PM CET

    Hello Peter,

    Convert LE bytes to integer (C/JAVA): int adc = (((int)low) & 0xff) + ((((int)hi) & 0xff) * 256) Where "low" is the byte at the lower memory address, and hi is the byte at the higher memory address.

     

    Voltage is calculated as: (double)adc / 16.0 * 1.22 / 2047.0 * 11.0;

     

    Temperature is calculated as: (double)adc / 145.0067 * 1.22 - 160.0;

    • 5 posts
    January 19, 2016 4:11 AM CET

    This is driving me nuts :)

    In Scan Response -- 06 00 00 04 00 04 08 04 01 00 f0 45 07 02 b8 8b 6b 4c 99 b4 02 03 00
     
    Via ADC measurement ==> fc 45
     
    I assume the spec 'little endian' msb means
     
    ((( 0x45 & 0x0f ) << 8 ) | 0xfc ) / 16 * ( 1240/2047 ) == > 58.001954079140205
     
    Help Help?
     
    • 5 posts
    January 14, 2016 4:45 AM CET

    With reference

      https://social.sbrick.com/wiki/view/pageId/11/slug/the-sbrick-ble-protocol

    0F Query ADC

    I send 0F00 and read into 2 byte buffer values
    0x30 0x48

    So dec 48 and 72 -> 48 + ( 72 * 256 ) => 18480
    Document notes 
    The PSU voltage is dropped through a 10:1 voltage divider. VPSU = ADC / 16 * 1.24 / 2047
    = 18480 / 16 * 1.24 / 2047
    = 0.6996

    This value looks wrong.

    Measuring with multimeter I get 7.46v .. sbrick iphone app gives 7.43v

    Help? Am I doing something incorrectly ?


    This post was edited by Peter Childs at January 14, 2016 4:45 AM CET