Bluetooth Scale

Intro

ESP32 to read data from a Reflex bluetooth scale, and then send data to Webserver ESP.

It sends the data to the other ESP using the ESP Now protocol. I tried using the ESP's serial2 port, but it didn't work for some reason, didn't try to troubleshoot, esp now seems to work pretty well.

The advantage of using esp now is that everything is wireless, and this ESP can be anywhere, as long as its close enough to the scale to read its bluetooth data.

This project only works with an ESP32. It depends on a ESP32 bluetooth library, and I don't know how to read the bluetooth data without using this library since I just copied what an example program did.

One bug I just noticed is it doesn't detect if value is negative or positive, so negative numbers show up in positive in the shot data, and webpage.

Gitlab SW link

Reflex Scale

amazon link for reflex scale

I picked this scale by reflex, mainly for the size. Smallest one I found with bluetooth, to fit on my drip tray.

Turned into a good choice. Low price, fits in tray, and am able to read its bluetooth broadcasts and get the weight from it.

Its does feel kind of cheap, and isn't waterproof. But for the price, I can buy a bunch of them compared to the fancy bluetooth scales.

Bluetooth apps

I used these apps to figure out how to get the scale's bluetooth data.

Just Scale App (for the reflex scale)

https://play.google.com/store/apps/details?id=reflex.just.scale.smartchef&hl=en_US&gl=US


Android scanners. Used them to scan for data.

nRF Connect from Nordicsemi

LightBlue


There is LightBlue for iPhone but I only used android phone


Android bluetooth simulator to test with (I never tried it)

https://play.google.com/store/apps/details?id=io.github.webbluetoothcg.bletestperipheral


Getting Scale info

Install the Just Scale App, its one of the apps for the reflex scale.

Run the app, and pair to your scale, don't remember the exact procedure but it was easy. Make sure phone display shows same info as on scale.

Push the top left menu option (three horz bars) on the app, then make sure English, or correct language is selected. I always see some Chinese characters, its fine.

Turn on scale.

Scroll down to Scale Test, then select Launch Test

A different screen will start, showing the bluetooth information coming from the scale and any other bluetooth devices in range. Let run for a few seconds, then stop.

Scale is always sending the weight over bluetooth, many times a second.

Find lines similar to the screenshot below:

See the 4th line that starts with ca100f...

Weight is the 6 hex digits after the 02 and before 5A, close to beginning of string, so 000397

This weight number is in hex, convert to decimal, and you get decimal weight.
Multiply this by 0.01 to get weight in grams.

Converts to decimal 9.19 grams, which is what was on the scale.

You can see that on the line with weight_reading 919

I used the google Sheets program to convert.
If the hex value is entered into A2, then in B2 you can add this: =HEX2DEC(A2)

It will convert cell A2 to decimal. Then you just need to multiply it by 0.01 to get the grams value, should be what was on the scale.

LightBlue app screenshot below.

Note that the scale is named "SC02".

Connect does not work, I thought I would not be able to get bluetooth data because it would not connect to Lightblue, but it turned out not to matter.

For this data, the weight is hex 0007d2 which converts to decimal 2002. This was the weight on the scale.

ESP32 example program

My program used this example as a starting point. The example code was able to receive the bluetooth data, then I just had to figure out how to filter for the data I wanted, and extract the weight.


Start Arduino program, then go to
File>Examples>ESP32 BLE Arduino

Find and open BLE_Beacon_Scanner
It should be at the top

Install and run it.

Open Serial Monitor and turn on scale.

A bunch of data will scroll quickly. You can disconnect the USB cable to the ESP32 to stop scrolling, or uncheck autoscroll box in Serial Monitor.

Find lines similar to below. Bold data is the hex weight. You will see this same line many times. If the weight is unchanged, numbers should be the same, and I think the rest will be the same too.

Found another manufacturers beacon!

strManufacturerData: 19 [CA][10][F][5][2][0][D][6][5A][0][2][0][50][FB][19][87][E1][F7][68]

Data Layout

Weight data is in bytes 5,6 and 7 (1st byte is 0), in bluetooth data packet from scale

MS bit of byte 3 is sign bit. Byte 3 = 0x05 if positive (or 0x5), and 0x85 if negative number.