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

Shot doesn't stop on Linea Mini #5

Closed shithead-steve closed 5 months ago

shithead-steve commented 5 months ago

Using provided code on SEEED XIAO ESP32C3 with Lunar 2021. Connects to controller, but does say OLD Acaia scale, tare command is working, but it is not stopping the shot upon reaching programmed weight.

Looking for hook up diagram for non-connected linea mini.

tatemazer commented 5 months ago

Hi Steve, thanks for reporting these issues and I'm happy to hear it sounds like you're close to getting things working on your Linea Mini! Sorry for the frustration of these issues. Sorry I haven't uploaded the setup process, here is the document I've shared with the beta testers: https://docs.google.com/document/d/12jJd3h1aEx204DdCsBnsvcllPKxS1Sg0QoMZQ85VjPg/edit?usp=sharing

included in this document is the work-flow for your machine. You'll notice that when you hear the scale tare the second time (after 3 seconds), you want to return the paddle to the off position (the shotStopper can only turn on the switch, not turn it off).

as for the OLD issue, it seems that some Lunar 2021's use the same interface as the older lunars, since you are successfully taring. My only other concern would be that the measurements aren't correct. can you confirm that the weights printed out to the serial port are correct?

shithead-steve commented 5 months ago

Tate, thank you very much for the thorough response and that doc. At the moment I have been unable to get any weight to print to the serial monitor. This is what the serial monitor looks like on my end. I get the weight with the Acaia and Beanconquerer apps however. I think maybe it could be an issue with the dev board I'm using. I will order a Nano ESP32 and give that a try! image

shithead-steve commented 5 months ago

Tested the sketch with an Arduino Nano ESP32, and I'm getting the same behavior. I uploaded the bare minimum sketch, and it tares the scale, but does not do anything beyond that. Are the examples on the GH the same as the sketches loaded to the beta boards you shipped out?

tatemazer commented 5 months ago

Hmm this is very strange. As a sanity check, there is something I'd like to have you try to see exactly what the esp32 is attempting to connect to. can you please:

  1. run the example code ArduinoBLE/Central/peripheralExplorer
  2. check the serial monitor to determine the name of your device. In my case, it's called "CINCO531E83" but yours probably starts with something like "ACAIA..." or "PROCH..."
  3. paste that in line 51 to replace "LED"
  4. Once again run the peripheralExplorer and observe the serial monitor to determine the device services and characteristics. Please post that output here if you can, thanks!
shithead-steve commented 5 months ago

Tate, thank you for the continued support. I'm completely stumped, though I'm no engineer. The scale is brand new, and it is obviously capable of outputting weight data since it does it great with the Acaia and Beanconquerer apps. The ESP32 is also capable of taring the scale while running the shot stopper code, but it won't do anything beyond that.

To add, I have tried on both an M1 Mac as well as a PC, with clean installations of the arduino IDE to try and root out any issues there. Acaia confirmed with me that my scale is the latest production based on the SN.

Here is the serial monitor output after running that example sketch

'Bluetooth® Low Energy Central - Peripheral Explorer
Found 53:b8:5a:1f:f5:a8 '' 
Found d4:ad:fc:ff:05:1e 'GBK_H6159_051E' 
Found a4:c1:38:71:30:77 'ihoment_H6159_3077' 
Found 00:1c:97:1f:55:c6 'ACAIAL-C1F55C6' 1820
Connecting ...
Connected
Discovering attributes ...
Attributes discovered

Device name: ACAIAL-C1F55C6
Appearance: 0x0

Service 1800
    Characteristic 2a00, properties 0x2, value 0x41434149414C2D43314635354336
        Descriptor 2803, value 0x020500012A
        Descriptor 2a01, value 0x0002
    Characteristic 2a01, properties 0x2, value 0x0002
        Descriptor 2803, value 0x020700042A
        Descriptor 2a04, value 0x010001006400E204
    Characteristic 2a04, properties 0x2, value 0x010001006400E204
        Descriptor 2803, value 0x040900992A
        Descriptor 2a99, value 0x
    Characteristic 2a99, properties 0x4
Service 1801
Service 1820
    Characteristic 2a80, properties 0x14
        Descriptor 2902, value 0x0000
Service 180f
    Characteristic 2a19, properties 0x12, value 0x64
        Descriptor 2902, value 0x0000
Service 180a
    Characteristic 2a25, properties 0x2, value 0x303030
        Descriptor 2803, value 0x021700272A
        Descriptor 2a27, value 0x4254412D43313031302D32
    Characteristic 2a27, properties 0x2, value 0x4254412D43313031302D32
        Descriptor 2803, value 0x021900262A
        Descriptor 2a26, value 0x53444B20322E332E30
    Characteristic 2a26, properties 0x2, value 0x53444B20322E332E30
        Descriptor 2803, value 0x021B00282A
        Descriptor 2a28, value 0x462D536E6F775265782D5350532D76303039
    Characteristic 2a28, properties 0x2, value 0x462D536E6F775265782D5350532D76303039
        Descriptor 2803, value 0x021D00292A
        Descriptor 2a29, value 0x456E7A7974656B
    Characteristic 2a29, properties 0x2, value 0x456E7A7974656B
        Descriptor 2803, value 0x021F00502A
        Descriptor 2a50, value 0x303031433937
    Characteristic 2a50, properties 0x2, value 0x303031433937

Disconnecting ...
Disconnected
tatemazer commented 5 months ago

Thanks, this looks identical to the pre-2021 lunar that I tested a while ago. I will have access to one on Friday to perform some regression testing to see if there may have been a bug introduced since I last tested that scale.

shithead-steve commented 5 months ago

That's strange that a brand new scale shows pre-2021 behavior. I may order another one and see if that works any differently.

tatemazer commented 5 months ago

I've tested a pre 2021 lunar on version 2.0.0 with no issues. I'll also test a 2021 lunar soon

shithead-steve commented 5 months ago

I've tested a pre 2021 lunar on version 2.0.0 with no issues. I'll also test a 2021 lunar soon

That's strange. My scale is definitely a 2021. I will re-upload the sketch and try again. I also ordered another scale to see if that one works.

Are you running the code exactly as it is on the GitHub?

shithead-steve commented 5 months ago

Hey Tate, just wanted to give a quick update. I received another Lunar today, and the sketch recognizes it as a new Lunar. It prints the weight, sends tare command successfully, etc. I have gotten the brew by weight to work using the Version 1 shot stopper sketch. With version 2, everything works, but it is not stopping the shot when reaching the weight.

I tried setting lines 31 and 45 to 36, but it still doesn't stop the shot. How is the goal weight set for V2?

Thanks! Matt

tatemazer commented 5 months ago

Happy to hear the new scale is working. Assuming you already set MOMENTARY to false, I'd assume the setpoint is defaulting to 255 (0xFF) since your eeprom probably hasn't initialized. I've pushed v2.0.1 to default to 36g, and added a note on how to set the weight over BLE. Please let me know if that resolves your issue, thanks for reporting!

shithead-steve commented 5 months ago

Thanks Tate! I uploaded the new sketch, and it shows up in Lightblue, albeit not every time, but when I select it in the app, I get a timeout message and it never connects.

The code works though! I'm just unable to connect through lightblue to change the target.

tatemazer commented 5 months ago

great we are getting closer! did you try LightBlue while the scale was connected or disconnected? I've noticed it works best while the scale is connected, since the BLE isn't spending as much time searching for the scale.

shithead-steve commented 5 months ago

great we are getting closer! did you try LightBlue while the scale was connected or disconnected? I've noticed it works best while the scale is connected, since the BLE isn't spending as much time searching for the scale.

So I reloaded the sketch using my PC, and it appears to be working now! It connects in LightBlue (iOS) and I am able to write new values, and the serial monitor reflects those changes.

I have had issues uploading sketches to ESP32 dev boards in the past with my Mac, not sure what the deal is there.

tatemazer commented 5 months ago

heck yeah this is amazing! now to replace the lightblue app with something that isn't quite as overwhelming... 😅