Project Overview & Difficulty Rating
Building a raw high-frequency wireless power transmitter from scratch involves dangerous high-voltage switching and complex impedance matching. For a practical, bench-safe wireless electricity project, the best approach is to pair an off-the-shelf inductive charging module with a smart microcontroller monitor. This project builds an ESP32-based safety and telemetry node that monitors the DC voltage, current, and coil temperature of a 5V/1A inductive link, automatically killing the transmitter via a MOSFET if the receiver is removed or thermal limits are exceeded.
By the end of this guide, you will have a functional inductive link that outputs serial telemetry and protects itself from the two most common failure modes in DIY wireless power: receiver misalignment (causing transmitter coil overheating) and receiver-side short circuits.
Hardware BOM & Pin Mapping
Do not substitute the logic-level MOSFET with a standard BJT or a non-logic-level FET like the IRF520; the ESP32's 3.3V GPIO cannot fully enhance a standard gate, leading to thermal destruction of the transistor.
| Component | Exact Variant / Part Number | Function | Approx. Cost |
|---|---|---|---|
| Microcontroller | ESP32-WROOM-32 DevKit V1 (30-pin) | ADC, I2C, and GPIO control | $6.00 |
| Current/Voltage Sensor | INA219 GY-607 Breakout (0.1Ω shunt) | I2C DC power telemetry on receiver | $3.50 |
| Wireless Power Modules | 5V 1A Inductive Charging Pair (e.g., XKT-408 TX / XKT-301 RX) | Magnetic resonance / inductive link | $8.00 |
| MOSFET | IRLZ44N (N-Channel, Logic-Level) | Low-side switching for TX coil ground | $1.50 |
| Thermistor | 10K NTC (3950 B-value) + 10K Pull-up | Transmitter coil temperature monitoring | $1.00 |
| Flyback Diode | 1N5819 Schottky (or 1N4007) | Inductive kickback protection | $0.20 |
Pin Mapping Table
| ESP32 GPIO | Target Component | Wire Color / Note |
|---|---|---|
| 3V3 | INA219 VCC, NTC Pull-up | Red |
| GND | Common Ground Plane | Black |
| GPIO 21 (SDA) | INA219 SDA | Yellow (I2C) |
| GPIO 22 (SCL) | INA219 SCL | Blue (I2C) |
| GPIO 34 (ADC) | NTC Thermistor Divider Midpoint | Green (Input only) |
| GPIO 25 | IRLZ44N Gate (via 100Ω resistor) | Orange |
Step-by-Step Build & Wiring
Follow these steps exactly. Skipping the flyback diode in Step 3 will result in the ESP32 resetting or the MOSFET exploding due to inductive kickback when the coil is switched off.
- Prepare the Receiver Side: Solder the receiver coil to the RX module pads. Connect the RX module's 5V and GND outputs to the
VINandGNDpads of the INA219 breakout. Connect the INA219VOUTto your dummy load (e.g., a 5Ω 5W power resistor or a USB breakout board). - Wire the I2C Bus: Connect the INA219 SDA/SCL to ESP32 GPIO 21 and 22. The GY-607 breakout usually includes 10K pull-up resistors, but if your I2C bus acts erratic, add external 4.7K pull-ups to 3.3V.
- Wire the Transmitter & Flyback Diode: Connect the 5V supply to the TX module's positive pad. Connect the TX module's negative pad to the Drain of the IRLZ44N. Connect the Source to system GND. Critical: Solder the 1N5819 diode in reverse-parallel across the TX module's power pads (cathode to 5V, anode to Drain) to clamp the voltage spike when the MOSFET turns off.
- Gate Drive & Thermistor: Connect GPIO 25 to the IRLZ44N Gate through a 100Ω series resistor (prevents GPIO ringing), and add a 10K pull-down resistor from Gate to GND to ensure the coil stays off during ESP32 boot. Tape the 10K NTC thermistor directly to the center of the transmitter coil using Kapton tape. Wire it as a voltage divider with a 10K pull-up to 3.3V, feeding the midpoint to GPIO 34.
Complete ESP32 Firmware
This firmware targets the ESP32-WROOM-32 DevKit V1. It requires the Adafruit_INA219 and Adafruit_BusIO libraries installed via the Arduino Library Manager. It includes hardware-safe error handling: if the I2C sensor drops out, the transmitter is immediately disabled.
#include <Wire.h>
#include <Adafruit_INA219.h>
// --- PIN DEFINITIONS ---
#define PIN_MOSFET_GATE 25
#define PIN_NTC_ADC 34
// --- THRESHOLDS ---
#define MAX_TEMP_C 65.0 // Shutoff if coil exceeds 65C
#define MIN_CURRENT_MA 50.0 // Shutoff if receiver is removed (no load)
#define I2C_CHECK_INTERVAL 5000 // ms between I2C health checks
Adafruit_INA219 ina219;
// Steinhart-Hart coefficients for generic 10K NTC (3950)
const float R1 = 10000.0; // Pull-up resistor
const float Vcc = 3.3;
const float B = 3950.0;
const float R0 = 10000.0;
const float T0 = 298.15; // 25C in Kelvin
void setup() {
Serial.begin(115200);
pinMode(PIN_MOSFET_GATE, OUTPUT);
digitalWrite(PIN_MOSFET_GATE, LOW); // Ensure TX is OFF during init
// Initialize I2C and INA219
if (!ina219.begin()) {
Serial.println("[FATAL] Failed to find INA219 chip");
// Enter infinite safe state
while (1) { delay(1000); }
}
ina219.setCalibration_16V_400mA(); // Optimize resolution for low-power RX
Serial.println("[OK] INA219 initialized. Enabling TX coil.");
digitalWrite(PIN_MOSFET_GATE, HIGH);
}
void loop() {
// 1. Read NTC Thermistor
int raw_adc = analogRead(PIN_NTC_ADC);
float Vout = (raw_adc / 4095.0) * Vcc;
float R_ntc = R1 * (Vout / (Vcc - Vout));
float tempK = 1.0 / ((1.0 / T0) + (1.0 / B) * log(R_ntc / R0));
float tempC = tempK - 273.15;
// 2. Read INA219 Telemetry
float shuntvoltage = ina219.getShuntVoltage_mV();
float busvoltage = ina219.getBusVoltage_V();
float current_mA = ina219.getCurrent_mA();
float loadvoltage = busvoltage + (shuntvoltage / 1000);
// 3. Safety Interlocks
bool fault = false;
String fault_reason = "";
if (tempC > MAX_TEMP_C) {
fault = true;
fault_reason = "Thermal Runaway (TX Coil > 65C)";
}
if (current_mA < MIN_CURRENT_MA && millis() > 3000) {
fault = true;
fault_reason = "Receiver Removed (No Load)";
}
if (ina219.success() == false) {
fault = true;
fault_reason = "I2C Bus Failure / Sensor Dropped";
}
if (fault) {
digitalWrite(PIN_MOSFET_GATE, LOW);
Serial.printf("[FAULT] %s. TX DISABLED.\n", fault_reason.c_str());
delay(5000); // Lockout for 5 seconds before retry
digitalWrite(PIN_MOSFET_GATE, HIGH);
Serial.println("[INFO] Resetting TX coil...");
} else {
Serial.printf("[OK] V:%.2fV I:%.1fmA T:%.1fC\n", loadvoltage, current_mA, tempC);
}
delay(250);
}
Debugging: I2C Sensor Failures & Thermal Runaway
The most common point of failure in this build is the I2C communication dropping out due to electromagnetic interference (EMI) generated by the high-frequency switching of the wireless power transmitter. If your serial monitor outputs the exact error string: [FATAL] Failed to find INA219 chip, the ESP32 has halted to protect the circuit.
The First Three Things to Check
- Verify I2C Pull-ups: Use a multimeter to check resistance between SDA/SCL and 3.3V. You should read ~4.7K to 10K ohms. If the GY-607 breakout lacks populated pull-ups, the high-frequency EMI from the TX coil will easily corrupt the I2C clock edges.
- Check Address Collision: Run an I2C scanner sketch. The INA219 GY-607 defaults to
0x40. If you bridged the A0 pad on the board to change the address, the Adafruit library will fail to find it unless you pass the new address toina219.begin(0x41). - Inspect Ground Loops: Ensure the INA219 GND and the ESP32 GND share a single, thick common ground wire back to the power supply. Thin jumper wires carrying return current from the TX module will cause ground bounce, resetting the INA219's internal logic.
Ranked Causes for Intermittent Dropouts
- Cause 1 (60%): EMI from TX Coil. Fix: Move the INA219 and ESP32 at least 5cm away from the transmitter coil, or shield the I2C wires with braided copper tied to GND.
- Cause 2 (25%): Voltage Sag on 3.3V Rail. Fix: The ESP32's onboard AMS1117-3.3 regulator can overheat if the WiFi radio is active while powering the I2C bus. Add a 100µF ceramic capacitor across the INA219 VCC/GND pins.
- Cause 3 (15%): Bad Solder Joints on Shunt. Fix: Reflow the 0.1Ω surface mount shunt resistor on the INA219 board. A cracked joint causes the chip to read infinite resistance and drop off the bus.
Extending and Simplifying the Build
How to Simplify: If you only need a basic wireless charger without telemetry, strip out the INA219 and ESP32 entirely. Connect the TX module directly to a 5V USB supply, and wire a simple 5V relay in series with a physical limit switch on the receiver housing. This reduces the BOM to under $10 but removes thermal protection.
How to Extend: To scale this to a 12V/50W higher-power inductive link, replace the IRLZ44N with a dedicated high-side gate driver (like the TI DRV8701) and swap the INA219 for an ESP32-compatible isolated current sensor like the ACS712-30A. You will also need to implement PID control in the firmware to dynamically adjust a PWM signal that tunes the resonance frequency, compensating for coil misalignment.
Wireless Electricity Project FAQ
How does a wireless electricity project transfer power through solid objects?
Inductive power transfer relies on magnetic fields, not electric fields. Magnetic flux lines pass through non-ferromagnetic materials (like wood, plastic, glass, and skin) with virtually zero attenuation. The only materials that block or degrade the transfer are conductive metals (which generate eddy currents and heat) or ferromagnetic metals (which shunt the magnetic field). This is why you can power a receiver coil embedded inside a 3D-printed PLA enclosure without any loss in efficiency.
What is the maximum efficiency I can expect from a DIY wireless electricity project?
For a basic, untuned single-coil inductive link at 5V/1A, expect 40% to 60% end-to-end efficiency. The remaining 40-60% of energy is lost as heat in the copper windings (I²R losses) and in the high-frequency switching MOSFETs on the transmitter board. To push efficiency above 85%, you must build a series-resonant tank circuit using high-Q Litz wire and precision tuning capacitors to match the exact resonant frequency of both coils.
Can I use this ESP32 monitor for a Qi-standard wireless electricity project?
No. The Qi standard (managed by the Wireless Power Consortium) requires complex digital ping protocols, amplitude-shift keying (ASK) backscatter communication from the receiver to the transmitter, and strict foreign object detection (FOD) timing. Off-the-shelf 5V DIY modules use simple high-frequency oscillators (typically 110kHz to 200kHz) without any digital handshake. While this ESP32 monitor can measure the raw DC output of a Qi receiver board, it cannot decode the Qi protocol or safely manage a Qi transmitter's ping sequence.
Why does my transmitter coil get hot when no receiver is present?
When a receiver coil is absent, the transmitter's oscillator continues to drive the primary coil. Without a secondary coil to absorb the magnetic energy and reflect it back as a load, the energy is dissipated entirely as resistive heat in the transmitter's copper windings and the driving MOSFETs. This is exactly why the MIN_CURRENT_MA safety interlock in the provided firmware is critical: it detects the sudden drop in load current and shuts off the gate drive, preventing the transmitter from melting its own housing.






