tatemazer / AcaiaArduinoBLE

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

Acaia Lunar 2021 "ACAIAL" bug #9

Open David-Swain opened 6 months ago

David-Swain commented 6 months ago

Acaia Lunar 2021 running 1.0.016 connected to Rancilio Silvia Pro with shotstopper with AcaiaArduinoBLE 2.2.2 installed with Momentary Switch selected (

-Lunar connects to Acaia APP on apple iPhone and shows scale weight and the app tares the scale. -LightBlue shows "Arduino" peripheral nearby (Not Shotstopper) -Selecting Arduino and Advertisment data shows "shotStopper" -Selecting "write value" shows a HEX input box (to change weight you need to input the g in HEX format, is this correct?

THE ISSUE -Lunar connects to Arduino via BLE - connection light on. -Depress momentary Brew button - scale tares and beeps - shot commences. -Shot runs on until monentary switch is pressed a second time then stops - scale retains final weight. -re-pressing brew switch re-tares the scale and so on. -No weight data is streaming to the Arduino despite the Arduino connecting to the Lunar. -Weight data IS streaming to the Acaia APP so the scale IS working and transmitting correctly.

Below is the monitor sequence for : -Arduino is on and looking for scale, which is off. -scale switched on and handshakes to the arduino - "connecting" -Button is then pressed and the shot started. -No streaming data etc. -Finallly scale is switched off again.

Screenshot 2024-05-27 at 10 34 20 PM

tatemazer commented 6 months ago

Hi David,

Sorry to hear you're having this issue.

What model Arduino are you using?

As for the hex input value, are you seeing something different from the screenshot on the manual? You should be able to change the format of the numbers.

It seems the board may not be parsing the weight packets correctly. Could you please re-run the code with debug mode turned on? This way we can see all the data that the scale is sending out.

tatemazer commented 6 months ago

It appears the shotStopper code has a bug which is causing it to mis-identifying the scale ( Old-Version Acaia Detected in the log. We should be seeing "New Version").

I just saw your email. In order to turn on debug mode, simply set DEBUG (line 41) to true.

David-Swain commented 6 months ago

Hi Tate

My lightblue app shows different results to what you show in your manual. Screen shots attached below. In summary :

-Lightblue first screen shows "Arduino" not "shotStopper" in the peripheral list (I only have 1 Arduino so this is the shotStopper) -Selecting "Arduino" i get "connected" and can select "Advertisment Data" -Selecting "Show" on advertisement data reveals - "Device is connected", Local Name "shotStopper" etc. -At the bottom of the page I can select "Properties : Read Write" -When this is selected I can see "Read Values" and "Write Values".
-Read Values shows as HEX 0x28 (40 Decimal which is what I set it to deliver) -Selecting "Write Values" gives me a HEX input box!

This is nothing like your manual and I have no idea why this is the case!! Lightblue is the latest version as I only downloaded it for this project!

IMG_9474 IMG_9476 IMG_9477

David-Swain commented 6 months ago

The Arduino I am using is a Nano ESP32-S3. 512KB Ram, 8MB Internal flash & 16MB External flash memory.

IMG_9371

tatemazer commented 6 months ago

@David-Swain Thanks for these updates. This morning I noticed that the UI is slightly different on iOS devices so I added a new series of screenshots to the manual to reflect this. What you're seeing on your end looks correct. Primarily note that you can change from HEX to unsigned Int by hitting "HEX" in the top right corner of the screen when you are looking at the read/write characteristic.

Have you been able to flash the board with DEBUG set true? If so, please attach the log output here so we can troubleshoot. thanks again

David-Swain commented 6 months ago

Hi Tate -Noted re the HEX/unsigned Int toggle. -Flashed board with DEBUG. Output below 👍 Screenshot 2024-05-28 at 11 55 06 PM

David-Swain commented 6 months ago

Also here for a start/Stop using the brew button 👍 Screenshot 2024-05-29 at 12 05 53 AM

tatemazer commented 6 months ago

Thanks @David-Swain this is very helpful. It looks like we are fortunately communicating with the scale ok, but the firmware is erroneously filtering out the data packets that we want.

Could you please try another test for me. we are very close to a solution:

  1. Open the AcaiaArduinoBLE.cpp file. On my PC it's located in C:\Users\Tate\Documents\Arduino\libraries\AcaiaArduinoBLE

  2. Find line 219

  3. Replace the 10 here with a 17 as show: image

  4. save and reflash the board, and please attach the same debug info you attached above in anther comment.

This may cause the board to crash eventually but will at least give me everything I need to know to solve the problem.

thanks again!

David-Swain commented 6 months ago

Hi Tate - Happy to Help : )

-Line 219 changed to 17 and reflashed to Arduino.
-I pulled a couple of shots. Scale Tare's but the shot continues to run on as before.

Serial logs below :

Screenshot 2024-05-29 at 9 09 57 AM

Screenshot 2024-05-29 at 9 10 30 AM

tatemazer commented 6 months ago

@David-Swain Thanks. sadly that's not what I was hoping for. I was hoping we would start seeing the data packets coming through. Lets try one more thing:

  1. please revert the change you made previous.
  2. instead add this line below line 215: Serial.println(l); This way we can see the lengths of all the data packets without attempting to read them. attempting to read more packets seems to break the communication. image

could you please try this once more? no need to pull any shots. we just need to see if the scale is connecting to the Arduino correctly. we especially want to see the log entries after the notification request write successful message.

thanks again

David-Swain commented 6 months ago

Latest (I'm getting the hang of this now)

Screenshots of the recoding & the output below.
After "notification request write successful, 3: 0xEFDD08 comes up and then nothing therafter!!

Screenshot 2024-05-29 at 10 21 00 AM

Screenshot 2024-05-29 at 10 24 28 AM

David-Swain commented 6 months ago

Ran the startup again and the data continued to stream as attached :

Screenshot 2024-05-29 at 9 39 55 PM

SongKeat2901 commented 6 months ago

Will you be able to check what is your current firmware? You might want to update to latest firmware.

tatemazer commented 6 months ago

@David-Swain you should be ok with v1.0.016, but checking for an update wouldn't hurt, if you dont mind, thanks

David-Swain commented 6 months ago

Hi Tate. v.1.0.016 is the latest firmware acording to thwe Acaia APP. I've re installed this firmware version twice today....just to double check!
I have also, checked my scale is an AL008 (2021) which is the newer version that firmware V.1.0.016 is meant for.
It shouldn't be showing as "Old Version detected" in the log!

tatemazer commented 6 months ago

@David-Swain thanks for checking on that. I'm sorry to say that I'm not sure if there is much else I can test from my end without getting my hands on one of these scales. I might recommend continuing to tinker with the connection process in the code to see if we can get over this hurdle. Sadly it seems that there are a few different versions of the lunar 2021 and this one works a bit differently. I'll continue doing my research to see if there's anything else I can learn