Intelligent battery-pack

I’m considering using Ruuvitag as a base of intelligent underwater battery-pack for diving. The idea is to use it to report health-status of the pack by measuring individual cell-voltages with ad-converter. Moisture sensor can indicate if there are any leaks in seals and temperature sensor can monitor battery temperature.

Secondary purpose would be to function as a switch for light-output and heater, adjusting heater power with pwm. I will attach piezo-disk to Ruuvitag to work as a beeber and maybe as a switch too. I’m planning to study if accelerometer can be used as a ‘tap’ / ‘shake’ switch to control outputs.

It might also be nice to have BLE-Stack operational to be able to change settings more easily with GATT. I have previous experience about TI sensortag, and think I don’t have a time to implement that from the scratch.

I took the official weather-station firmware as a base, compiled and installed it successfully. I also tried to increase the frequency of the main-loop, but It does not seem to scale up for my needs. I’d like to have at least 20ms cycle-time for my own stuff. Next step would be to utilize second timer for that purpose.

Does anyone knows if there are some documentation about weather station app and Nordic SDK, indicating which hardware resources are reserved and what kind of latency requirements there are to serve bluetooth LE functionality?

Is it better to use timer services offered by Nordic SDK, or use plain HW.

Also if someone have better alternative for a base app, I’d gladly hear about it. Since I have more than 300Wh of battery capacity, power consumption in active mode is no problem. I’d still like to have low power storage-mode, but communication is not needed to work then.

While you probably could run the main loop at 20 ms, the BLE transmissions are capped to 100 ms while advertising in unconnectable mode.

You could take a look into Ruuvi master for GATT profile, connectable beta-version was published yesterday. Easiest point for implementing BLE GATT control would be in ruuvi_examples/ruuvi_firmware/ble_services/application_service_if.c , function “static void nus_data_handler(ble_nus_t * p_nus, uint8_t * p_data, uint16_t length)”. You’ll get the data sent via Nordic UART service there.

I’d recommend writing the fw from scratch, maybe taking examples from test_drivers as a base.

Thank you for quick answer. I will look the GATT-Profile beta fw.
Is it possible to use it same time with non-connectable advertising mode?
Main use would be to easily and reliably show cell-voltages, moisture and temperature.

If I recall correctly, it’s possible to send out advertisements with data while the gatt connection is established. It requires some extra work though, and it might be easier to send the advertisement data via GATT.

Generally the flow would be:

  1. Beacon sends data in advertisement and is in connectable mode
  2. Application connects to beacon, beacon stops advertising
  3. Application and beacon communicate data and control messages
  4. Application disconnects
  5. Beacon starts advertising