• I have a hobby project where my puck.js sends accel data:

    Puck.on("accel", function (a) {
      var accel = a.acc;
      accel.name = "acc";
      var gyro = a.gyro;
      gyro.name = "gyro";
      var magnitude = {}
      magnitude.name = "mag";
    
      console.log(JSON.stringify(accel));
      console.log(JSON.stringify(gyro));
    
      magnitude.value = Math.sqrt(accel.x * accel.x + accel.y * accel.y + accel.z * accel.z);
      console.log(JSON.stringify(magnitude));
    

    Then I have a python script that uses bleak to connect to the puck, and listen for that console output, which I then pass along to another toy program.

        print ("Connecting to puck " + puck_device.address)
        async with BleakClient(puck_device.address)  as client:
            await client.start_notify(UUID_NORDIC_RX, uart_data_received)
            await asyncio.sleep(100000000.0)  # Keep the connection alive
        await ws_server.wait_closed()
    

    This all works fine for a while, but i've noticed that after a few minutes the speed of the accel data i'm getting starts to slow down, and eventually the connection drops.

    Any suggestions on what might be happening? I looked into trying to do this by purely advertising the IMU data and not making an actual two way connection, but it doesn't look like I get a very high frequency signal that way. Just a few updates per second, and I need closer to 10 updates per second.

    Thanks! p.s. i'm new to BLE so might be doing this a bit backwards.

About

Avatar for DrewS @DrewS started