Programmers guide to the Half Decent Scale


  • Over bluetooth, these commands should be sent as binary

  • Over USB and Wifi, these commands should be sent as Hex strings

  • Also see the older Decent Scale API Docs. The Half Decent Scale is compatible with that command set, but adds a substantial number of new commands

  • A python library is also available

  • Javascript apps and weighing library (supporting Bluetooth, USB and Wifi!)


New 'heartbeat' feature solves connectivity issues with Android 9 and older.

  • Apps need to send a 'heartbeat' at least every 5 seconds, or the bluetooth connection will be dropped
    • The heartbeat command to send to the scale is: “03 0a 03 ff ff 00 0a”
  • Why does this feature exist?
    • Older Android versions have a problem where bluetooth connections are kept to devices, even though the app no longer has the connection.
    • The heartbeat resolves that problem, and is the same approach Decent took with bluetooth on the DE1, to resolve the same issue.
  • Older apps that are unaware of the heartbeat feature, will automatically disable the heartbeat requirement
    • when they send the LED ON bluetooth command, with the 6th byte in that command set to 00
    • or the TARE command with that last byte as 00.
  • Apps that want to use the heartbeat feature (and it's highly recommended),
    • should send 01 as the last data byte of the LED ON command, for example: “03 0A 01 01 00 01 08”
    • should also send 01 as the last data byte of the TARE command, for example: “03 0F 01 00 00 01 0C”
    • These variants of the LED ON and TARE commands will not have any negative effect on older Decent Scales, which don't have the heartbeat feature.
  • DE1 users should upgrade to the NIGHTLY de1app dated April 11 or newer

Commands that HDS can receive(v2.5.8)

03 0F TARE (with checksum) (please read the note above regarding the heartbeat feature)

03 0A 00 Turn off oled

03 0A 01 Turn on oled (please read the note above regarding the heartbeat feature)

03 0A 02 Power off

03 0A 03 00 Exit power mode, normal oled brightness

03 0A 03 01 Enter power mode, lowest oled brightness

03 0B 00 Timer stop

03 0B 02 Timer reset

03 0B 03 Timer start

03 1A 00 Manual Calibration

03 1A 01 Smart Calibration

03 1B WiFi OTA

03 1D 00 Set sample to 1

03 1D 01 Set sample to 2

03 1D 02 Set sample to 4

03 1E 00 00 Hide Menu

03 1E 00 01 Show Menu

03 1E 01 00 Hide About info

03 1E 01 01 Show About info

03 1E 02 00 Hide debug info

03 1E 02 01 Show debug info

03 1F Reset

03 20 00 Disable Weight via USB

03 20 01 Enable Weight via USB

03 22 Send Battery voltage data once


Weight:

data = modelByte;

data = 0xCE;  // Type byte for weight stable

data = weightByte1;

data = weightByte2;

data = 0x00;

data = 0x00;

data = calculateXOR(data, 6);  // Last byte is XOR validation


Button event:

data = modelByte;

data = 0xAA;  // Type byte for weight stable

data = buttonNumber;//1 for O button, 2 for ▢ button

data = buttonShortPress;//1 for short press, 2 for long press

// Fill the rest with dummy data or real data as needed

data = 0x00;

data = 0x00;

data = calculateXOR(data, 6);  // Last byte is XOR validation


Power off event:

data = modelByte;

data = 0x2A;

data = buttonNumber;

data = buttonShortPress;

data = 0x00;

data = 0x00;

data = calculateXOR(data, 6);  // Last byte is XOR validation


Battery Voltage:

data = modelByte;

data = 0x22;

data = voltageByte1;

data = voltageByte2;

data = 0x00;

data = 0x00;

data = calculateXOR(data, 6);  // Last byte is XOR validation


Debugging via USB

You can connect a USBC cable and used a program such as Serial with settings of 115200,8,N,1 to watch the scale in operation. This makes debugging extremely easy.


#programmer #api #bluetooth #wifi #usb


  • German: Programmierer-Leitfaden zur Half Decent Scale
  • French: Guide pour les programmeurs de Half Decent Scale
  • Spanish: Guía para programadores de Half Decent Scale

    Updated 2025/02/26