Low power BLE data logging

Welcome to the forum.

Here are a few tips for your project

  • I recommend avoiding floating point for characteristics and for public interfaces in general. There are multiple floating point formats so your code will be less portable. The BLE SiG has shown how to do this better by using integer with a known exponent. Here is an example I posted a while ago that shows how and a few other useful things.

https://forum.arduino.cc/t/bluetooth-communications/902610/2

  • The Arduino Nano 33 IoT is not designed for low power BLE apps. The NINA module also supports WiFi and therefore is more power hungry than pure BLE solutions can be. The Arduino Nano 33 BLE with the nRF52840 is likely a better choice. There have been discussions about low power in the past. Have a look trough the Nano 33 sub forums. Google works nicely with site:arduino.cc filtering everything else.

  • The power circuit of the Arduino is not optimal for low power. On the Arduino Nano 33 BLE it can be disabled. Then you can use a 3V battery directly. Your 3.7V battery will not work because the voltage is too high.

BLE does not transmit data at the application level. When you update a characteristic in a peripheral/server device you just update internal data and that is it. The central/client decides when it wants to read data. Your sketch needs to talk to the BLE module on a regular basis to ensure it reacts to communication outside. So, if you sleep then only for very short amounts of time.

  • You must not use delay to control the flow of your application. Delay should only be used once in your code to make use of sleep when you are certain that you can do it. Otherwise avoid delay, while or waiting for things. Make sure your loop runs as often as possible. Handle timing by using millis() and status variables. This will ensure your communication stack can be called as often as necessary.