• every console.log may trigger new BLE packet(s), typical BLE packet is 21 bytes, if your device running python can negotiate higher MTU then puck can send 50 bytes in one packet. How fast packets can be sent depends on connection interval https://www.espruino.com/Reference#l_NRF_setConnectionInterval and how many packets in one connection interval can devices handle, some can do more than one, some can do only one packet per connection interval

    I would try to

    • use only one console.log - possibly more packets can be send in one interval or more data together can be sent in less packets (may or may not make a difference)
    • minimize data (just array of numbers instead of complex json structures) - less packets
    • make connection interval shorter (beware that smaller values drains battery more)

    if it starts to slow down it can be issue on both sides, on puck side the data may be generated faster than can be sent or some idle mode kicks in. Ther is such mode for BLE connection (see setConnectionInterval linked above) but if data is sent all the time it should not be triggered, not sure if there is something for accelerometer too - possibly not, you can just set sensible rate here https://www.espruino.com/Reference#l_Puck_accelOn

    BTW if the flow of data is steady and relatively fast the connection is indeed better than simple advertising

About

Avatar for fanoush @fanoush started