GameWithPixels / DiceFirmware

Pixels dice firmware code.
MIT License
15 stars 1 forks source link

Update battery voltage lookup table #26

Open obasille opened 2 years ago

obasille commented 2 years ago

Current values were calibrated for a battery type that isn't used anymore.

The current values are stored in voltages and levels in battery_controller.cpp. Those values are use by LookupChargeLevel(). We need another set of voltages+levels for for LookupChargeLevel() to use when the battery is charging.

obasille commented 2 years ago

To have logs enabled in only one file, add #define NRF_LOG_ENABLED 1 on top of that file and change firmware_debug: DEBUG_FLAGS += -DNRF_LOG_ENABLED=1 to 0 in the Makefile

obasille commented 2 years ago

To light up LEDs, either play an animation endlessly or call LEDs::setPixelColors() with all LEDs set to white for example.

obasille commented 2 years ago

I've added a new screen to the Toolbox that connects to a die and has a button to get the battery level. This is on the "central" branch, not "main".

https://github.com/GameWithPixels/PixelsToolbox/blob/central/src/screens/StatsScreen.tsx

obasille commented 1 year ago

@David-Chernis Please do the following:

  1. Generate graphs of how voltage evolves across time for a few dice with at least 2 set of data per die, for both charging and discharging setup. As a bonus please also add a couple discharging graphs with LEDs off so we can have a look at the power consumption of the board when there is a BLE connection.

  2. Using python, write a script that take as input all the CSV or the spreadsheet (of either charging or discharging setup) files with the battery measurements.

    
    for each data set:
    create remainingTimeTable with:
    x = voltage
    y = remainingTime = maxTime - time at voltage

create averageRemainingTimeTable: for voltage from minRoundedVoltageAcrossAllRuns to maxRoundedVoltageAcrossAllRuns with steps of 0.1V: x = voltage y = average remainingTime across each remainingTimeTable (ignoring those that don't have a value) yError = difference between max and min remainingTime across each remainingTimeTable (ignoring those that don't have a value)

plot the average and error graphs.



Run the script for both charging and discharging set of CSV / spreadsheet files.