Skip to content

ESP32-based wireless battery monitor for trail cameras. Voltage sensing + LoRa telemetry with deep sleep power optimization.

License

Notifications You must be signed in to change notification settings

Gustavo-Blois/trail-cam-battery-monitor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

Trail Camera Battery Monitor

Wireless battery monitoring for a trail camera that doesn't expose battery info anywhere accessible.

The Problem

I have a trail camera (embedded Linux) that I wanted to monitor remotely. Problem: there's no way to check the battery level without physically going there.

First attempt was to find it through the UART interface - found the pins, connected at 115200 baud, got boot logs and system output, but no battery info anywhere.

So I extracted the firmware and analyzed it with Ghidra looking for battery-related functions. Found that battery monitoring exists internally but it's not exposed to any external interface. Would need to modify the kernel to access it, which seemed like way more trouble than it's worth.

The Solution

Just measure the voltage directly and send it via LoRa.

Hardware

  • ESP32 with LoRa (Heltec board)
  • Voltage divider connected to the battery
  • Reads voltage through ADC, converts to percentage, transmits

Why LoRa

  • Long range (the camera is far from my house)
  • Low power (important for battery operation)
  • Simple protocol

How It Works

  1. ESP32 wakes up from deep sleep
  2. Takes 30 ADC readings and averages them (noise reduction)
  3. Converts the reading to battery percentage
  4. Sends via LoRa: "The Battery is XX%"
  5. Goes back to deep sleep for 10 minutes
  6. Repeat

Power consumption is minimal - deep sleep draws ~10µA, and it's only active for a few seconds every 10 minutes.

Battery Calibration

I figured out these thresholds by watching when the camera would shut down and when it would turn back on:

767+ → 100%  (full charge)
71580%
65250%
61525%
50510%   (critical)
<5050%    (shutdown imminent)

The camera actually shuts down around ADC reading 409 and won't turn back on until it charges to about 557.

Files

  • src/battery_monitor.ino - ESP32 code

Setup

You need:

  • HC801a Camera
  • Heltec ESP32 LoRa board
  • Arduino IDE with Heltec support
  • A LoRa receiver to get the data

Clone this, open the .ino file, upload to the board. Don't forget to connect the voltage divider to your battery and make sure it doesn't exceed 3.3V at the ADC pin.

Config

Main things you might want to change in the code:

  • RF_FREQUENCY - LoRa frequency (915 MHz by default)
  • ADC_PIN - which pin you're using (GPIO1 default)
  • Sleep interval - currently 10 minutes in esp_sleep_enable_timer_wakeup()

What I Learned

  • UART debugging and protocol analysis
  • ESP32 deep sleep modes
  • LoRa configuration
  • That sometimes the simple solution (just measure voltage) is better than the "proper" one (modify the kernel)

Future Ideas

Protocol to protect against replay attacks for receiver.

About

ESP32-based wireless battery monitor for trail cameras. Voltage sensing + LoRa telemetry with deep sleep power optimization.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages