Locate: Camera GNSS Geotagger & OLED Telemetry Module
Designed by Akshay Kaundinya | Temple Electronics (Rev 1)
Project Overview
Locate (developed under my personal hardware label, Temple Electronics) is a compact, battery-conscious external GNSS geotagger and real-time OLED telemetry display designed for Nikon cameras with the DC-2 connector. Commercial hot-shoe GPS units often suffer from slow cold-starts, lack live diagnostic displays, or drain the host camera's internal battery.
Locate solves this with an independent, self-powered architecture that automatically wakes when the camera is switched on, streams checksummed 4800-baud NMEA sentences ($GPGGA and $GPRMC) directly into the camera for EXIF geotagging, displays live satellite/accuracy metrics on a 128×32 OLED screen, and automatically cuts peripheral power after a 10-second power-down grace period.
Custom Hardware Architecture ("Locate" Rev 1 Schematic)
Following breadboard validation, the complete production electrical schematic (Locate.kicad_sch) was designed in KiCad 10.0. The custom board transitions from off-the-shelf development modules to a tightly integrated, ultra-low-quiescent-current surface-mount architecture:
Switched Main Rail & Always-On Backup
The main +3.3V system rail is driven by a TI TPS63001 (U3) buck-boost converter paired with a \(10\text{ }\mu\text{H}\) inductor (L1, MSS5131-103MLB). Its enable pin is tied directly to the camera's CUTOFF sense line (pulled down via \(100\text{ k}\Omega\) R9), physically shutting down the main \(3.3\text{V}\) rail when the camera is off. Simultaneously, a nanopower TPS7A0233 LDO (U4) generates an always-on +3.3VP sleep rail that sustains the NEO-M8U's backup memory and RTC (V_BCKP) for instant hot-starts.
Power-Path Charger & Fuel Gauge
USB-C power (J1, protected by a USBLC6-2SC6 ESD array U1 and Schottky diode D1) feeds a TI BQ25185DLHR (U2) linear charger with dynamic power-path management (SYS/VCC and +BATT) and an RGB status LED (D2). Precision state-of-charge tracking is handled by a Maxim MAX17260SETD+T (IC1) ModelGauge m5 fuel gauge measuring high-resolution current across a \(10\text{ m}\Omega\) sense resistor (R13) and communicating over I2C with an active-low ALERT interrupt.
u-blox NEO-M8U with Active Bias-T
Features the u-blox NEO-M8U (U5) module with Untethered Dead Reckoning (UDR) via its onboard 3D IMU. Configured for I2C communication (D_SEL tied to +3.3V). The RF input (RF_IN, Pin 11) connects to a U.FL antenna receptacle (J5) with an integrated active antenna bias-T network constructed from a \(10\text{ }\Omega\) current-limiting resistor (R16), \(47\text{ pF}\) RF bypass capacitor (C13), and ferrite bead (FB1) fed by VCC_RF.
ESP32-C3-MINI-1 & TRS Camera Link
Controlled by an ESP32-C3-MINI-1 (U6) with native USB D+/D- (GPIO19/GPIO18) for direct flashing, I2C bus (GPIO0/GPIO1 with \(10\text{ k}\Omega\) pull-ups R11/R12) connected to the 4-pin OLED header (J4), fuel-gauge ALERT input (GPIO2), and UART_TX (GPIO7). A 3.5mm TRS jack (J2, AudioJack3) interfaces with the camera cable: Tip carries UART_TX NMEA data, Ring receives the camera's CUTOFF wakeup signal, and Sleeve provides common ground.
| Designator | Component | Subsystem | Key Function in "Locate" |
|---|---|---|---|
| U6 | ESP32-C3-MINI-1 | Microcontroller | RISC-V MCU handling UBX I2C polling, NMEA synthesis, and OLED UI |
| U5 | u-blox NEO-M8U | GNSS Receiver | Untethered Dead Reckoning (UDR) GPS/GNSS receiver over I2C |
| U3 | TI TPS63001 | Main Power Path | 3.3V Buck-Boost regulator gated by camera CUTOFF signal |
| U4 | TI TPS7A0233PDQNR | Sleep Power Path | Ultra-low-\(I_Q\) 3.3V LDO maintaining +3.3VP backup rail (V_BCKP) |
| U2 | TI BQ25185DLHR | Battery Charger | 1A Li-Ion battery charger with autonomous power-path switching |
| IC1 | MAX17260SETD+T | Fuel Gauge | Coulomb-counting battery charge monitor with \(10\text{ m}\Omega\) sense (R13) |
| U1 | USBLC6-2SC6 | ESD Protection | TVS diode array protecting USB 2.0 D+/D- and VBUS lines |
Breadboard Prototyping & Firmware State Machine
Prior to freezing the custom PCB design, the complete hardware-software loop was validated on a breadboard prototype using a standard ESP32 development module, a SparkFun NEO-M8U breakout, and a 128×32 SSD1306 OLED screen (0x3C).
High-Side MOSFET Power Switching
On the prototype, peripheral power gating is controlled by an FQP27P06 P-channel MOSFET switching the \(3.3\text{V}\) supply rail to the OLED and GNSS receiver. A physical \(22\text{ k}\Omega\) pull-up resistor bridges the Source (\(3.3\text{V}\)) and Gate (GPIO 23).
- Early Boot Constructor: Uses
__attribute__((constructor))to pullGPIO 23 LOWimmediately on boot beforesetup()runs. - Zero-Leakage Sleep: Driving
GPIO 23 HIGHand entering deep sleep allows the \(22\text{ k}\Omega\) resistor to hold \(V_{GS} = 0.0\text{V}\), completely isolating peripheral quiescent draw.
Nikon NMEA 0183 Synthesizer & FIR Filter
While the ESP32 polls the NEO-M8U over I2C using the compact COM_TYPE_UBX binary protocol at 3 Hz, Nikon DSLRs/mirrorless bodies require standard 4800-baud serial NMEA sentences.
- Custom NMEA Generator: Converts raw UBX coordinates and UTC timestamps into
$GPGGAand$GPRMCstrings with dynamically computed hexadecimal XOR checksums overUART 2 (GPIO 17)every 500 ms. - 10-Tap FIR Battery Filter: Smooths ADC readings on
GPIO 36across a 10-sample circular buffer to eliminate voltage sag jitter on the OLED readout.
Key Engineering & Debugging Case Studies
Resolving Stack Overflow Watchdog Resets Upon Satellite Lock
Early firmware builds ran stably indoors during the "SCANNING" state but suffered immediate watchdog reboots the moment an outdoor satellite fix was acquired. Root-cause analysis revealed that heavy driver instances (SFE_UBLOX_GNSS and Adafruit_SSD1306) were being passed by value into the telemetry rendering helper function, exhausting the ESP32 task stack and corrupting heap memory during shallow copy destructors. Scoping the hardware objects globally resolved the crashes completely.
I2C Bus Deadlock Prevention & Cold-Rail Re-Initialization
Executing I2C display transactions inside hardware Interrupt Service Routines (ISRs) caused deterministic I2C peripheral lockups. The architecture was refactored into a non-blocking millis() state machine polling GPIO 14 with a 10-second hysteresis timer, reserving esp_sleep_enable_ext0_wakeup() strictly for waking from deep sleep. Additionally, because high-side power gating completely resets the SSD1306 internal charge-pump registers, explicit \(500\text{ ms}\) rail-stabilization delays and full bus re-initialization were added to the wakeup sequence.
Power Profiling & Parasitic Leakage Isolation
Disabling the ESP32 RF subsystems in firmware (esp_wifi_stop(), esp_wifi_deinit()) brought active consumption (MCU + NEO-M8U + OLED) down to \(\sim 100\text{ mA}\). During deep sleep, multimeter profiling confirmed \(0.0\text{V}\) across \(V_{GS}\) on the MOSFET, verifying complete peripheral cut-off. Identifying the remaining \(\sim 20\text{ mA}\) quiescent draw on the dev-board (caused by its onboard USB-UART bridge, linear regulator, and power LED) directly motivated the custom Locate Rev 1 PCB utilizing the TPS63001 hardware cutoff and TPS7A0233 nanopower sleep rail.
Prototype Firmware Implementation (C++ / ESP32)
locate_firmware.inoBelow is the complete prototype firmware implementing early MOSFET gate assertion, radio shutdown, 10-tap FIR battery filtering, UBX I2C navigation polling, OLED state rendering, and checksummed Nikon NMEA 0183 serial output:
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <SparkFun_u-blox_GNSS_Arduino_Library.h>
#include <WiFi.h>
#include <esp_wifi.h>
#include <esp_bt.h>
#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 32
#define OLED_RESET -1
Adafruit_SSD1306 display = Adafruit_SSD1306(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
SFE_UBLOX_GNSS myGNSS;
constexpr uint8_t FIR_TAPS = 10;
float voltageSamples[FIR_TAPS];
uint8_t firIndex = 0;
HardwareSerial NikonSerial(2); // UART 2 for Nikon GPS interface
constexpr uint8_t NIKON_TX_PIN = 17;
constexpr uint8_t NIKON_RX_PIN = 16;
// Energize high-side P-MOSFET as early as possible during boot
void __attribute__((constructor)) boot_first() {
pinMode(23, OUTPUT);
digitalWrite(23, LOW);
}
String addChecksum(String sentence) {
uint8_t checksum = 0;
for (int i = 1; i < sentence.length(); i++) {
checksum ^= sentence[i];
}
char hex[3];
sprintf(hex, "%02X", checksum);
return sentence + "*" + String(hex) + "\r\n";
}
void sendNMEA() {
char timeStr[15];
sprintf(timeStr, "%02d%02d%02d.00", myGNSS.getHour(), myGNSS.getMinute(), myGNSS.getSecond());
// Convert Latitude to NMEA ddmm.mmmm format
float latDecimal = abs(myGNSS.getLatitude() / 10000000.0);
int latDeg = latDecimal;
float latMin = (latDecimal - latDeg) * 60.0;
char latStr[15];
sprintf(latStr, "%02d%07.4f", latDeg, latMin);
char latDir = (myGNSS.getLatitude() >= 0) ? 'N' : 'S';
// Convert Longitude to NMEA dddmm.mmmm format
float lonDecimal = abs(myGNSS.getLongitude() / 10000000.0);
int lonDeg = lonDecimal;
float lonMin = (lonDecimal - lonDeg) * 60.0;
char lonStr[15];
sprintf(lonStr, "%03d%07.4f", lonDeg, lonMin);
char lonDir = (myGNSS.getLongitude() >= 0) ? 'E' : 'W';
float altMeters = myGNSS.getAltitudeMSL() / 1000.0;
// Build $GPGGA & $GPRMC Sentences for Nikon EXIF validation
String gpgga = "$GPGGA," + String(timeStr) + "," + String(latStr) + "," + String(latDir) + "," +
String(lonStr) + "," + String(lonDir) + ",1," + String(myGNSS.getSIV()) +
",1.0," + String(altMeters, 1) + ",M,0.0,M,,";
char dateStr[15];
sprintf(dateStr, "%02d%02d%02d", myGNSS.getDay(), myGNSS.getMonth(), (myGNSS.getYear() % 100));
String gprmc = "$GPRMC," + String(timeStr) + ",A," + String(latStr) + "," + String(latDir) + "," +
String(lonStr) + "," + String(lonDir) + ",0.0,0.0," + String(dateStr) + ",,,A";
NikonSerial.print(addChecksum(gpgga));
NikonSerial.print(addChecksum(gprmc));
}
void printInfo(float voltage) {
display.clearDisplay();
uint8_t numSats = myGNSS.getSIV();
display.setTextSize(1);
String s = numSats == 0 ? "UDR" : ("SATS: " + String(numSats));
s += " | ACC: " + String(myGNSS.getHorizontalAccEst() / 1000.0, 1) + " m";
display.setCursor((128 - (s.length() * 6)) / 2, 0);
display.print(s);
s = String(myGNSS.getLatitude() / 10000000.0, 5) + ", " + String(myGNSS.getLongitude() / 10000000.0, 5);
display.setCursor((128 - (s.length() * 6)) / 2, 10);
display.print(s);
s = String(myGNSS.getAltitudeMSL() * 3.28084 / 1000.0, 1) + " ft | " + String(voltage, 2) + "V";
display.setCursor((128 - (s.length() * 6)) / 2, 20);
display.print(s);
display.display();
}
void setup() {
WiFi.disconnect();
WiFi.mode(WIFI_OFF);
esp_wifi_stop();
esp_wifi_deinit();
constexpr uint8_t MOSFET_PIN = 23, WAKEUP_PIN = 14, BATTERY_PIN = 36;
constexpr uint32_t SLEEP_WAITING_PERIOD_MS = 10000, BATTERY_REFRESH_MS = 100;
esp_sleep_wakeup_cause_t wakeup_reason = esp_sleep_get_wakeup_cause();
pinMode(MOSFET_PIN, OUTPUT);
pinMode(WAKEUP_PIN, INPUT);
analogReadResolution(12);
analogSetPinAttenuation(BATTERY_PIN, ADC_11db);
digitalWrite(MOSFET_PIN, LOW);
delay(500); // Allow switched power rail to stabilize
Serial.begin(115200);
Wire.begin();
NikonSerial.begin(4800, SERIAL_8N1, NIKON_RX_PIN, NIKON_TX_PIN);
display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
display.clearDisplay();
display.setTextColor(SSD1306_WHITE);
display.setTextSize(2);
display.setCursor((128 - (8 * 12)) / 2, 10);
display.print(wakeup_reason == ESP_SLEEP_WAKEUP_EXT0 ? "RESUMING" : "STARTING");
display.display();
delay(500);
if (!myGNSS.begin()) {
display.clearDisplay();
display.setTextSize(2);
display.setCursor((128 - (8 * 12)) / 2, 10);
display.print("BOOT ERR");
display.display();
for (;;);
}
myGNSS.setI2COutput(COM_TYPE_UBX);
myGNSS.setNavigationFrequency(3);
uint32_t sleepMillis = millis(), voltageMillis = sleepMillis, dataMillis = sleepMillis;
float initialVoltage = analogReadMilliVolts(BATTERY_PIN) / 500.0;
for (uint8_t i = 0; i < FIR_TAPS; i++) voltageSamples[i] = initialVoltage;
float voltage = initialVoltage;
for (;;) {
if (myGNSS.getGnssFixOk()) {
printInfo(voltage);
if ((millis() - dataMillis) >= 500) {
sendNMEA();
dataMillis = millis();
}
} else {
display.clearDisplay();
display.setTextSize(2);
display.setCursor((128 - (8 * 12)) / 2, 2);
display.print("SCANNING");
display.setTextSize(1);
String s = String(voltage, 2) + "V";
display.setCursor((128 - (s.length() * 6)) / 2, 20);
display.print(s);
display.display();
}
// Camera power state monitoring & 10s deep-sleep grace timer
if (digitalRead(WAKEUP_PIN)) {
sleepMillis = millis();
} else if ((millis() - sleepMillis) > SLEEP_WAITING_PERIOD_MS) {
display.clearDisplay();
display.display();
digitalWrite(MOSFET_PIN, HIGH); // Gate off peripheral rail
esp_sleep_enable_ext0_wakeup((gpio_num_t) WAKEUP_PIN, 1);
esp_deep_sleep_start();
}
// 10-tap FIR moving average battery telemetry
if ((millis() - voltageMillis) > BATTERY_REFRESH_MS) {
voltageSamples[firIndex] = analogReadMilliVolts(BATTERY_PIN) / 500.0;
firIndex = (firIndex + 1) % FIR_TAPS;
float sum = 0;
for (float f : voltageSamples) sum += f;
voltage = sum / FIR_TAPS;
voltageMillis = millis();
}
}
}
void loop() {}