Capsicum

🫑 Retrofit a wired doorbell to add WiFi and make it connected 🔔

power 16340
wireless WiFi
mcu ESP32-C3
ongoing since Oct 2023

Power overview

Power source

1200mAh Rechargeable 16320 battery

Battery life

1.12 year

Charging duration

??? hours
Plug in a USB-C cable to charge the battery.

Power tree schematic

Edit power_tree_drawio.xml at draw.io.

Power Tree schematic

Power consumption

Using nRF Power Profiler PPk2, the power consumption of the PCB can be measured. Follow a simpler ESP32-C3 dev board tutorial to learn how to use PPK2.

Measure power consumption with nRF PPK2

Power consumption with no optimisation

The average power consumption of the PCB no optimisation:

  • with 2 power LEDs
  • no firmware optimisation
  • radio is on

The average power consumption is:

  • 3.87mA in deep sleep mode
  • 25.69mA for 30s during the timeout after the bell is pressed and the Ding Dong sound is played
  • 31.94mA for 34s during the entire cycle of the bell press and going to sleep
  • 70.62mA for 6s during the Ding Dong sound

Download nRF PPK2 file

Demo power consumption graph with no optimisation

Power consumption with optimisation

Firmware and hardware optimisation can be done to reduce the power consumption:

  • remove the power LEDs, TX and RX LEDs
  • optimise the firmware to turn off the WiFi and radio as soon as the function is done: WiFi.disconnect(true); and WiFi.mode(WIFI_OFF);
  • optimise the firmware to not blink the user LED

The average power consumption of the PCB with optimisation:

  • 73.04uA in deep sleep mode
  • 17.11mA for 30s during the timeout after the bell is pressed and the Ding Dong sound is played
  • 24.93mA for 34s during the entire cycle of the bell press and going to sleep
  • 63.99mA for 6s during the Ding Dong sound

Download nRF PPK2 file with no LED

Download nRF PPK2 file with no LED and radio/WiFi Demo power consumption graph with optimisation

Battery life calculation

Based on the above values, the battery life can be calculated with this python code:

Estimated battery life: 410.14 days or 1.12 years

# Constants
number_of_doorbell_rings = 5  # Number of doorbell rings per day

battery_capacity_uAh = 1200000  # Battery capacity in µAh, converted from 1200mAh
consumption_high_uA = 24930  # High consumption in µA, converted from 32mA
consumption_low_uA = 73  # Low consumption in µA
high_consumption_duration_s = 34  # Duration of high consumption in seconds
total_day_seconds = 86400  # Total seconds in a day

high_consumption_duration_s = high_consumption_duration_s * number_of_doorbell_rings  # Multiply by the number of doorbell rings

# Calculate the total consumption in µAh for each period
high_consumption_total_uAh = consumption_high_uA * high_consumption_duration_s / 3600  # Convert seconds to hours
low_consumption_duration_s = total_day_seconds - high_consumption_duration_s
low_consumption_total_uAh = consumption_low_uA * low_consumption_duration_s / 3600  # Convert seconds to hours

# Calculate the total average daily consumption in µAh
average_daily_consumption_uAh = high_consumption_total_uAh + low_consumption_total_uAh

# Calculate the battery life in days
battery_life_days = battery_capacity_uAh / average_daily_consumption_uAh
# Calculate the battery life in years
battery_life_years = battery_life_days / 365

# Echo out the values
print(f"Estimated battery life: {battery_life_days:.2f} days or {battery_life_years:.2f} years")

Battery measurement simulation

The battery measurement circuit is simulated in Falstad.

$ 1 0.000005 5.023272298708815 78 5 50 5e-11
172 224 240 176 240 0 7 0 3.3 0 0 0.5 Gate Voltage
w 352 224 352 176 1
f 288 240 352 240 33 1.5 0.02
R 352 176 352 144 0 0 40 4.2 0 0 0.5
c 224 240 288 240 0 0.1 0.000999999998577626 0.001
r 288 192 336 192 0 1000000
w 336 192 352 192 0
w 288 192 288 240 0
g 352 352 352 368 0 0
r 352 256 352 304 0 100000
r 352 304 352 352 0 100000
w 352 304 256 304 0
o 2 64 0 4099 0.001220703125 0.00009765625 0 2 2 3

With a p-channel MOSFET, when the gate voltage is 0V or LOW, the battery voltage is measured. When the gate voltage is 3.3V or HIGH, the battery voltage cannot be measured.