tatemazer / AcaiaArduinoBLE

Acaia Scale Gateway using the ArduinoBLE library for devices such as the esp32 and other Bluetooth-enabled Arduino compatible hardware.
MIT License
40 stars 6 forks source link

Felicita Arc Support #1

Closed baettigp closed 6 months ago

baettigp commented 7 months ago

Hi T'was I who asked about the possibility of felicita arc support on youtube. I don't have the experience to work with BLE devices yet, but an arduino nano 33 ble is next to me :) I managed to get wireshark to work with a nrf sniffer recently, but am not up to speed on using it yet... So I managed to grab one packet between the arc and the phone:

0000 00 1f 00 03 59 1d 02 0a 01 25 3d 00 00 c2 47 f2 0010 0c d6 be 89 8e 43 0c e8 c9 8d 08 53 5f e8 15 15 0020 86 15 00 9d 26 a5

Y %=ÂGò Ö¾C èÉS_è&¥

and one between my old phone and the arc:

0000 00 23 00 03 5a 1d 02 0a 01 25 28 00 00 08 49 f2 0010 0c d6 be 89 8e 04 10 e8 15 15 86 15 00 09 09 46 0020 45 4c 49 43 49 54 41 2c 47 9f

Z

%(Iò Ö¾è FELICITA,G

How do I extract the necessary information from here? (or filter so I only see the communication between the phone and the scale?)

I believe 5f:53:08:8d:c9:e8 is the Mac address of the felicita.

I'd be happy to learn more in order to assist you in getting more scales working :)

Pio

baettigp commented 6 months ago

I am a bit further

I sniffed with the NRF connect app and put different weights on the ` Service UUID: 0xFFE0 Value 0g: 01 02 2D 30 30 30 30 30 30 20 67 43 E3 4F 22 96 0D 0A 100.1 01 02 2B 30 31 30 30 31 30 20 67 43 58 51 22 96 0D 0A

100.2 g 01 02 2B 30 31 30 30 31 30 20 67 43 58 51 22 96 0D DA 200.3 01 02 2B 30 32 30 30 33 30 20 67 43 82 13 22 96 0D 0A 400.8 g 01 02 2B 30 34 30 30 38 30 20 67 43 A4 62 22 96 0D DA

601.2 g 01 02 2B 30 36 30 31 32 30 20 67 43 79 51 22 96 0D DA

-26.3 01 02 2D 30 30 32 36 33 30 20 67 43 95 4A 22 96 0D DA

-10.0 01 02 2D 30 30 31 30 30 30 20 67 43 95 4A 22 96 0D DA

.. .. PM kg cg Dg g dg ?? ??

`

01 02 seems to be the header 2D negative sign, 2B positive sign 3x x1000g 3x x100g 3x x10 g 3x x1g 3x x*0.1g 3x ? always stays 0 20-67-52 seems to stay xx-yy seems to be a checksum of some kind? 22 seems to stay 96, sometimes changes to 95 (result stable?) 0D-0A finish transmission?

More once I get around to it

baettigp commented 6 months ago

Graphefruit has analyzed the output of the felicita a bit more and implemented it in the android app beanconqueror: https://github.com/graphefruit/Beanconqueror/tree/master/src/classes/devices/felicita I am now trying to connect to the scale modifying your code.

tatemazer commented 6 months ago

Amazing, appreciate you helping out, Pio

baettigp commented 6 months ago

I have made a little bit of progress, the arduino serial monitor output is as follows: ` Scale Interface test

Starting init

Searching for FELICITA Arc

FELICITA

Connecting...

Connected

Discovering attributes...

Attributes discovered

1

ffe0

unable to subscribe to READ: Felicita ` (sorry for two newlines per line, otherwise everything is written in one line in the comment) It does connect to the scale, but somehow won't get anything back. I forked your repository and uploaded my work in progress: https://github.com/baettigp/Acaia_Felicita_ArduinoBLE I put in preprocessor flags in .h and .cpp to switch between ACAIA and FELICITA_ARC. Hope to get around to it more in the coming days...

baettigp commented 6 months ago

Ok, I have used chatgpt to get a code that gives me all the services for the acaia: 3_discoverServices.txt which yields:

Attributes Discovered Connected to device! Service: 1800 Characteristic: 2a00, Value: 46:45:4C:49:43:49:54:41 Characteristic: 2a01, Value: 00:00 Characteristic: 2a02, Value: 00 Characteristic: 2a03 Characteristic: 2a04, Value: 50:00:A0:00:00:00:E8:03 Service: 1801 Characteristic: 2a05 Service: 180a Characteristic: 2a23, Value: E8:15:15:00:00:86:15:00 Characteristic: 2a24, Value: 4D:6F:64:65:6C:20:4E:75:6D:62:65:72:00 Characteristic: 2a25, Value: 53:65:72:69:61:6C:20:4E:75:6D:62:65:72:00 Characteristic: 2a26, Value: 46:69:72:6D:77:61:72:65:20:52:65:76:69:73:69:6F:6E:00 Characteristic: 2a27, Value: 48:61:72:64:77:61:72:65:20:52:65:76:69:73:69:6F:6E:00 Characteristic: 2a28, Value: 53:6F:66:74:77:61:72:65:20:52:65:76:69:73:69:6F:6E:00 Characteristic: 2a29, Value: 4D:61:6E:75:66:61:63:74:75:72:65:72:20:4E:61:6D:65:00 Characteristic: 2a2a, Value: FE:00:65:78:70:65:72:69:6D:65:6E:74:61:6C Characteristic: 2a50, Value: 01:0D:00:00:00:10:01 Service: ffe0 Characteristic: ffe1, Value: 01 Disconnected from device. Device found. Trying to connect... Attempting to connect to 00:15:86:15:15:e8 Connected

and then after much coaxing I got some code which seems to subscribe to the weight characteristic, but never prints anything. only

Device found. Trying to connect... Connected to device! Subscribed to weight notifications. loop loop loop

5_weightnotificaton_subscribe.txt

Now I would be grateful for any help how to get the data.

The nrf sniffer app gives me the following, so I should be subscribed correctly (but am not seeing anything):

nRF Connect, 2024-02-06 FELICITA (00:15:86:15:15:E8) D 10:54:26.905 [Broadcast] Action received: android.bluetooth.device.action.ACL_CONNECTED V 10:54:26.964 Connecting to 00:15:86:15:15:E8... D 10:54:26.965 gatt = device.connectGatt(autoConnect = false, TRANSPORT_LE, preferred PHY = LE 1M) D 10:54:26.976 [Callback] Connection state changed with status: 0 and new state: CONNECTED (2) I 10:54:26.976 Connected to 00:15:86:15:15:E8 V 10:54:27.001 Discovering services... D 10:54:27.001 gatt.discoverServices() I 10:54:27.348 Connection parameters updated (interval: 20.0ms, latency: 0, timeout: 6000ms) I 10:54:27.587 Connection parameters updated (interval: 7.5ms, latency: 0, timeout: 5000ms) D 10:54:27.726 [Callback] Services discovered with status: 0 I 10:54:27.726 Services discovered V 10:54:27.734 Generic Access (0x1800)