Designing an ESP32 Based Wattmeter: a Beginner's Guide to Sensor Based Product Design
by Iqbal Samin in Circuits > Electronics
1434 Views, 11 Favorites, 0 Comments
Designing an ESP32 Based Wattmeter: a Beginner's Guide to Sensor Based Product Design
Most sensor projects stop at getting a reading on a screen. Hook up a current sensor to an Arduino, display the number, done. And that works, but it's barely scratching the surface of what a sensor can actually do.
The core philosophy of this build is different: how do you take a simple voltage and current sensor and engineer it into something genuinely powerful? Not by buying expensive components, but by being smart about architecture, calibration, and connectivity.
The Problem: The 4-Multimeter Mess
I design DC-DC converters and fly RC airplanes, which means accurately measuring wattage and energy is absolutely critical on my workbench. To calculate the efficiency of a custom buck converter, I needed to know the exact power going in and the exact power coming out — simultaneously. That meant hooking up four separate multimeters at once just to measure input and output voltage and current. I ended up mastering the art of holding the probes like chopsticks. And even then, most off-the-shelf RC wattmeters give awful readings at low currents, so half the time the data wasn't even trustworthy.
The Solution
By pairing a precision 24-bit ADC with an ESP32 microcontroller, I built a device that captures highly accurate sensor data across a massive dynamic range. And because of the ESP32's WiFi, these wattmeters are designed to work in pairs — one on the input of a circuit, one on the output, communicating in real-time to automatically calculate and graph efficiency values. No chopsticks required.
My name is Prithul, and in this guide I'll walk you through my entire thought process: defining requirements, designing the schematic, routing a precision PCB, modeling a 3D printed enclosure, and writing the firmware (vibe-coding included). In the spirit of the Sensors Contest, I'll focus heavily on how to get the most accuracy out of your physical sensors.
So let's get building!
Supplies
Before we dive into the design process, here is a quick look at the components and tools required to bring this device to life. But your device may have a completely different purpose and components so I will explain how to pick the right components in later steps.
Core Electronics & Power:
- ESP32 Module: The brains of the operation. This microcontroller packs the processing power needed for our calculations and handles the WiFi networking.
- Measurement ICs & Sensors: A precision 24-bit ADC, paired with 5 mΩ and 100 mΩ shunt resistors. These are the core sensors that allow for our highly accurate, selectable-gain architecture.
- OLED Screen: A crisp, high-contrast display for our onboard hierarchical menu and real-time data tracking.
- Power System: The device is powered by two 1000 mAh batteries wired in series. This provides a nominal 7.4V, which the linear regulators bring down to the required 5V and 3.3V logic levels.
- Battery Charger: Since the batteries are internal, you will need a separate 2S battery charger module to safely charge the 7.4V pack.
- Connectors: PCB-mounted XT60 connectors (both male and female). Since this device measures power from batteries and DC-DC converters, we need robust, high-current connectors to handle the load.
- Custom PCB: A huge thanks to JLCPCB for sponsoring the professionally manufactured PCBs for this build! Details on the PCB and schematic design is in later steps.
Fabrication Tools & Hardware:
- 3D Printer & Filament: An absolute must-have for rapid prototyping and printing the final custom enclosure.
- 2-Part Silicone: A fantastic, flexible material great for casting custom, tactile push-buttons for our 3-button navigation system (Set/Enter, Up, Down).
- Hardware: An assortment of screws and fasteners to firmly mount the PCB and secure the two halves of the 3D-printed shell together.
- Bench Tools: A good soldering station for assembling the SMD components and connectors, and a standard screwdriver for the final mechanical assembly.
Defining Your Sensor Requirements
When engineering a sensor project from scratch, it's easy to want to throw in every cool technological feature possible. But I’ve learned that a truly great project must prioritize the real users and their actual data-gathering problems. Which in my case, was myself, fellow electronics hobbyists, and hardware engineers.
Before jumping into your schematic drawing software, sit down and think about your target users. It could be a good idea to go around your community and ask them about their biggest pain points when using existing standard measurement equipment. Combine their honest feedback with your own personal experiences to draft a list of core requirements that your final sensor device must fulfill.
For my wattmeter project, I drafted a strict list of primary requirements:
- Current Range: 0 to 30A
- Voltage Range: 0 to 50V
- Dynamic Range Accuracy: The sensor must accurately measure both heavy, high-power loads and fairly low-currents without losing precision. Most AliExpress wattmeters seriously struggle in this realm, providing awful readings at low currents, as many RC hobbyists would agree. I aimed for precision down in the milliamps range, and up to 30A. The same applies for the whole voltage range of 0.1V to 50V.
- Environmental Stability: It will be used in varying temperatures (especially in a hot field), so thermal drift cannot be allowed to ruin the analog sensor calibration done in room temperature.
- Data Logging and Automation: Long-term battery tests can take hours or days. We need a way to log the sensor data seamlessly to perform automatic calculations (i.e., battery capacity or power supply efficiency). An important feature is to back up in the cloud so that a sudden power failure (imagine the battery runs out) doesn't mean losing all that hard work.
- Portability & Readability: It needs to be battery-powered, have a small form-factor, and be easily readable. An ergonomic hand-held design would be a massive bonus!
A note on building innovative products:
If you're building something that does not already exist, or perhaps has a special feature that does not exist in anything else, I recommend a slightly different approach to finalizing your core features. It's important to quickly test your brand new idea, and validate that there is a real need for it, or it even solves the problem you're trying to solve. For this reason, it's best to build a quick and dirty prototype on a breadboard or perfboard, with a minimal or no enclosure, and test in real-life, possibly with real users. You'd be surprised how often validating your idea saves time down the road. This is an idea from The Lean Startup book.
Choosing the Architecture and Selecting Components
With your core requirements locked in, it's time to engineer the architecture and select the components. The rule of thumb: pick your main ICs first, then consult their datasheets to figure out exactly which smaller supporting components you need around them.
Here's how I translated my requirements into actual hardware:
- A Clever Dual-Shunt Design: This one hit me in the shower. It is hard to use single-shunt resistor to accurately measure both 100mA and 30A. The dynamic range is just too wide. My solution: place a low-resistance shunt (5mΩ) and a high-resistance shunt (100mΩ) in series, with a MOSFET that automatically bypasses the 100mΩ shunt at high currents. Two shunts, one device, full range.
- Finding the Right ADC: After years of watching electronics videos and digging through forums, I knew I wanted a precision 24-bit ADC. I prioritized chips with strong community support and open-source libraries. If something breaks, you want Stack Overflow (or your favorite LLM, same thing) to have the answer. The ADS1256 checked every box: commonly available as an Arduino-friendly module, well-documented, and proven in the wild.
- Beating Thermal Drift: Heat physically changes a resistor's resistance, and voltage output of a typical voltage regulator. This silently ruins your calibrated readings. To combat this, I chose a dedicated precision voltage reference IC, the ADR4525 (2ppm/°C), paired with low-thermal-drift resistors (20ppm/°C for the shunts, 10ppm/°C for the voltage divider). The lower the ppm rating, the less the component induces errors with temperature, keeping your calibration solid in real-world conditions.
- The Main Innovative Feature - sensors that talk to each other: Here's where things get really exciting. The ESP32-S3 isn't just the brain of one wattmeter. It allows two of them talk to each other. One unit on the input, one on the output, communicating in real-time via WiFi to automatically calculate and graph DC-DC converter efficiency. This is the feature I'm most proud of, and it only became possible by choosing a microcontroller with built-in WiFi.
- Modules Over Bare Chips: Rather than designing a bare ESP32 onto the PCB (which requires complex RF antenna design), I went with the Lolin S3 Mini module — instant WiFi, free USB-C port, no RF design headaches.
- The Display: An SH1106 128x64 OLED. OLED displays pixels emit their own light, keeping readings crisp and readable even in direct sunlight.
💡 Beginner Tip: When searching for your sensor IC, don't just look for the best specs. Look for strong community support — forums, tutorials, open-source libraries. A slightly less optimal chip you can actually debug beats a "perfect" chip with zero community resources when you are getting started.
Designing the Circuit Schematic
With the architecture mapped out, it's time to translate those ideas into an actual circuit. Staring at a blank schematic for the first time can be genuinely overwhelming — there are thousands of ADCs, regulators, and microcontrollers out there, and picking the wrong one early can cascade into a painful redesign. Here's how to approach it:
- Source Smartly and Stay on Budget: Skip DigiKey and Mouser for your initial search — they'll blow a hobbyist budget fast. I relied heavily on LCSC's advanced filtering tools, spending hours narrowing down by spec until I found the perfect balance of cost and performance.
- Prioritize the Sensor IC Above Everything: Your ADC or sensor chip is the heart of the entire design — get this right first, and everything else follows. Look for chips with strong open-source library support and an active community. I chose the ADS1256 precision 24-bit ADC for exactly this reason.
- Use Datasheet "Typical Application" Circuits as Your Base: For every single IC, open the datasheet and find the "Typical Application" schematic. This is the manufacturer's own recommended starting point — use it. From there, you select your supporting passives (capacitors, resistors) based on the datasheet's guidance. It takes a lot of the guesswork out of component selection.
- Plan Power Safely: Since this device measures RC batteries and DC-DC converters, I chose PCB-mounted XT60 connectors rated for the full 30A load, and an external 2S battery charging module rather than trying to tap the ESP32's USB-C port to balance-charge a 7.4V series pack. (Always handle high-capacity lithium batteries with extreme care!)
- TVS Diodes - Lifesaver: When plugging and unplugging high-current connectors like XT60s, voltage spikes and static discharge are a real threat to sensitive electronics. A TVS diode sits across your power input and acts like a pressure relief valve, invisible during normal operation, but the moment a spike arrives, it clamps it before it reaches your circuit. Cheap, tiny, and potentially board-saving. Don't skip them.
- Analog and Digital Don't Mix Well: When mixing a noisy digital brain (ESP32) with a highly sensitive analog sensor (ADS1256), keep them on completely separate voltage rails using low-noise linear regulators. Sprinkle decoupling capacitors next to the power pins of every IC — this is non-negotiable for precision measurement.
- Add Solder Jumper Pads: This has saved me multiple times on past PCBs. Add physical solder jumper pads across key sections of your board. If you need to bypass or reconnect a part of the circuit during testing, you can simply desolder the jumper instead of cutting copper traces or scrapping the board entirely.
Ask the Community!: Analog electronics can feel like black magic. Having no EE degree (yet!), I knew I had to get a second opinion before sending anything to fabrication. Especially because I was ordering PCB assembly, meaning the board had to work first time. Posting my schematic drafts to r/AskElectronics, r/esp32, and the EEVBlog forum was one of the best decisions I made. One community member pointed out that I needed C0G/NP0 capacitors in the signal path, since other MLCC types introduce microphonic noise from shock and vibration, which would have silently wrecked my readings. I had no idea. The community of hardware engineers out there is incredibly generous, and I cannot recommend this step enough
Form Factor Planning
Translating a schematic into a physical printed circuit board (PCB) is where your project really starts to take shape. However, immediately routing traces after finishing your schematic is not always the best idea. Here are some steps on how to approach the physical layout before drawing a single electrical line:
- Think About Form Factor First: Before routing, you need to think about the physical shape of your final product. I actually recommend starting this mental thinking during the schematic or architecture phase. By thinking about how the user will hold and interact with the device, you can have a basic idea of the overall shape of the PCB and where the major components must go.
- Strategically Find Place for the Components: Once I had a blank board, I simply placed my major components in their rough physical locations without routing them. I knew I wanted this wattmeter to be operated with one hand, so I placed the three navigation buttons (Set/Enter, Up, Down) in a convenient spot where my fingers would naturally rest. I also knew the device would carry massive currents, so I placed the XT60 input and output connectors as close together as physically possible to minimize voltage drop and heat buildup inside the case.
- The Early CAD Check: With the components placed randomly on the board, I only placed the XT60 connectors, buttons, and display roughly where I wanted them to be. Then I exported a rough 3D model and brought it straight into Fusion. I quickly mocked up an enclosure around it to make sure the device would actually look and feel good in the hand. At this point, I went back and forth between the PCB and 3D model a few times to adjust the board dimensions and component placements. Once I confirmed this physical layout was perfect, I was finally ready to lock the components in place and start the actual PCB routing.
I made the same mistake of immediately routing my PCB while trying to think of a good shape for it, and ended up with a square PCB that I never built, and had to redesign from scratch. So having in mind a form factor and a general sense of where you want the main components to be will save you a lot of time and help your PCB fit your aesthetic and ergonomic needs.
Routing the PCB
With the form factor locked in and the major components placed, it is time to connect everything. There are way too many rules in electronics when it comes to placing your components and routing traces among them to cover in this short tutorial. Power, heat, noise and a lot of other things are usually taken into consideration, and you will learn these rules with experience or through a proper educational channel. However, here is a basic guide on routing a board that handles sensitive sensor data and high power safely:
- Place the Critical Components First: When placing the rest of the components on the board, always prioritize the most important parts. Keep noisy digital brains far away from sensitive analog components or sensors. If you have temperature sensitive components (like a temperature sensor) and heat generating components, it's important to keep them away. For my project, I completely isolated the precision 24-bit ADC, the delicate voltage reference IC, and the dual shunt resistors at the top, OLED in the middle, and the ESP32 WiFi module and power circuit at the bottom to ensure maximum accuracy.
- Route for Power: Standard thin traces will simply melt under heavy loads. Because I placed my XT60 connectors close together during the form factor planning, it was easy to create massive, short copper pours (polygons) for the main 30A input and output paths. I also intentionally removed the solder mask over these high-current tracks so I could add thick layers of solder to them later. Additionally, I used a lot of "via" to improve current handling capabilities. Here is a simple calculator to find out how many via you need for your design.
- Ground Planes: A poor grounding strategy will ruin the accuracy of most sensors. Always use a solid copper ground plane at least on one layer of your board. To protect my mixed-signal design, I created completely separate analog and digital ground planes (AGND and DGND), tying them together at only one single, strategic point near the ADC to eliminate noisy ground loops. This is a debated technique though and I only found that out after ordering the PCB. I highly recommend watching this video to understand the concept of ground loops better.
- Sprinkle in Test Points: While routing, make sure to drop small exposed copper pads, called test points, on critical data lines and voltage rails. Trying to probe a tiny surface-mount pin with a chunky multimeter probe is a nightmare. Adding dedicated test pads across the board made verifying the regulators and ADC analog lines incredibly easy during the initial phase. It can also be helpful to take notes on which test points you have and what voltage they are supposed to read for complicated PCB designs.
Find me EasyEDA Design Here: https://oshwlab.com/prithul/precision-watt-meter_copy
Designing the 3D Printed Enclosure & Custom Buttons
No electronic project or product is complete without a polished enclosure. Here is a step-by-step approach to designing a custom 3D printed shell that fits your electronics perfectly in just a few tries:
- Import and Build Around the Board: When designing a custom case, never start from a blank slate and guess the dimensions using a physical ruler. Always import the 3D model (STEP file) of your completed PCB into your mechanical CAD software and build the shell directly around it. I imported my finished wattmeter board and designed the shell tightly around it. Since I already had a plan for position of the buttons and cutouts, it was a fairly easy process. Start by drawing just a rectangle with the minimum possible clearance, and extrude it to the minimum possible height so that all the components fit in. Leave a multiple of 0.4mm for the wall, as it will lead to a strong shell with complete number of printed lines. I chose 2mm for a durability.
- Don't forget tolerances!: Your enclosure might need to accommodate different cutouts like screens, buttons, and USB/other connectors. Because 3D prints shrink slightly as it cools, always leave a 0.2mm to 0.3mm tolerance gap around your cutouts and parts so the final print doesn't interfere with your components. For this project, I projected the outer faces of OLED screen, XT60 input/output connectors, three-buttons on the side, and the USB-C ports. Then I added a 0.2mm offset and extruded out the cutouts. It's a good idea to spend extra time at this step if you care about wasting filament and time.
- Silicone Buttons: Hard 3D printed plastic buttons feel really clunky, rattle around, or get stuck in their cutouts. For a much more professional, premium feel, I designed a negative mold of the buttons, 3D printed it, and cast the buttons using flexible 2-part silicone. I chose a contrasting color and used a syringe to push the silicone into my mold that I screwed together. Don't forget to apply some petroleum jelly or grease to help the silicone not get stuck in the mold/ The buttons turned out to have a soft, durable feel, and gives decent tactile feedback when pressing them.
- Virtual Assembly and Renders: Before firing up the 3D printer for a multi-hour print, try doing a full assembly of your case, PCB, battery, and screen in your CAD software. I forgot to model the batteries with their real dimensions and they ended up fitting really tight on my first print. So it's wise to model every component, put them in their place in the enclosure, and check for interference.
I have attached a 3D modeling timelapse video and you can view/edit my original design below.
Coding the Firmware & Local UI
Hardware is only half the battle. The software is what actually turns your sensors into useful tools. Here is how I approached building the feature-rich firmware for this project.
- Coding Environment: If you are still on the standard Arduino IDE for ESP32 projects, migrate to PlatformIO. It is used in both hobby and industrial projects, and gives you vastly better library management, a cleaner project structure, and a really efficient workflow. I personally love how quickly it compiles my codes, since it only compiles the parts of coded that have changed. Definitely worth the one-time setup cost.
- Vibe Coding!: I vibe-coded the vast majority of this firmware, including the entire responsive Web UI, and it was amazing for getting structure and UI parts written up and running fast. That said, deep level hardware is where vibe-coding struggles. The calibration constants per gain and shunt, the timing architecture, the Google API setup, etc. needed manual work and testing with real-life values. LLMs can get you 80% of the way there, but that you need some understanding of what you're making for the last 20%.
- The OLED Made the code Tricky: Here is a debugging story. Early in development, my ADC readings were inconsistent and occasionally weird negative/insanely large values were being shown. After a lot of head-scratching, I found out it's the OLED rendering code running on the same core and introducing timing delays between samples. The fix was moving the ADC sampling to its own FreeRTOS task pinned to a dedicated ESP32 core, completely isolated from the UI, web server, and MQTT handling on the other core. Sample jitter directly shows up as noisy energy calculation. The firmware even has a guard that logs a warning to the serial monitor when ADC timing slips, because this is a real problem, not a theoretical one.
- Library for the UI: Building nested hierarchical menus on a small OLED from scratch is a nightmare. The GEM (Good Enough Menu) library was a lifesaver and saved me a ton of time. I highly recommend it.
- Plan the UI Before You Code It: Before writing a single line of UI code, I spent time studying existing wattmeters for inspiration. I looked at Keysight's professional bench instruments for their clean information hierarchy, and at small AliExpress commercial wattmeters for how they handle a cramped screen. I thought carefully about which values actually matter at a glance — what needs to be in a large font, what can be small, how many decimal places are useful vs. just noise. That research, mixed with my own personal taste from years of working with test equipment, shaped the entire local UI layout. It sounds like a small detail, but taking an hour to look at what professionals do before touching your code will save you a lot of back-and-forth redesigning later.
- Feature Breakdown: Here is what the firmware actually does:
- Real-Time Measurements: Voltage, current, power, energy (Wh), charge (mAh), peak/minimum tracking, elapsed time, and dynamic voltage drop compensation (taking burden voltage into account).
- Web Dashboard: A clean web UI with real-time data and live graphs.
- Data Logging: Configurable MQTT publishing for smart-home integration, plus automatic logging to Google Sheets.
- Precision Calibration: Separate calibration profiles for each PGA gain setting and both shunt resistors, handling offset, gain, and range-switch thresholds.
- Under the Hood: OTA firmware updates, mDNS hostname resolution, and LittleFS for storing the web interface files on-device.
Check Out the Code & Ask Questions! The full open-source code is on my GitHub. If you are replicating this or building your own sensor project and hit a wall, drop a comment below. I love discussing this stuff and reply as fast as I can!
The IoT Magic: Web Interface & Data Logging
Adding a screen to a sensor is great, but wireless connectivity can really level up your sensor projects. By serving a full web dashboard over WiFi, every phone, tablet, or laptop in range becomes a giant, high-resolution display for the wattmeter. This keeps the device small and cheap, while being really powerful. Here are some details on the IoT features:
- Serve Locally, Work Anywhere: The web interface is hosted directly on the ESP32 using LittleFS — no cloud dependency, no internet required. It works on your bench, and it works at the RC flying field. WebSockets push live data updates at 1Hz, so the dashboard feels like a real instrument. Additional settings that are hard to do on the small display (like OTA update) can be configured into the web UI.
- Live Graphing: I used Plotly.js for live, zoomable, and pannable graphs with a scrolling 10-second time window, with a graph for Voltage, Current, and Power. Each parameter can be shown and hidden at any time, and there is a built-in image download button. It's just a great library for adding graphs to your web interface with ease.
- UI Philosophy: The dashboard is designed for active monitoring under real test conditions. Critical metrics are large and centered, peak values are cleanly separated. You should be able to read the most important number at a glance without hunting for it.
- Google Sheets Logging: For long battery tests that run hours or days, a sudden power failure shouldn't erase everything. The firmware can automatically log into Google Sheets at custom intervals, so your data is safe even if something goes wrong mid-test.
- The Mesh Logging System: This is the feature that started this entire project. When two wattmeters are on the same network, they can discover each other. From the mesh menu on either device, you designate one as the master — it begins receiving live readings from the other unit wirelessly in real-time. The master's web dashboard now displays two full sets of Voltage, Current, and Power readings side by side. When logging is enabled, both devices' data streams are written to the same Google Sheet, with an additional efficiency column calculated automatically from the input and output power values. One wattmeter on the input of your DC-DC converter, one on the output, and you have a complete, automated efficiency measurement system. No need for four multimeters. No holding probes like chopsticks.
A Quick Masterclass on Sensor Calibration
Hardware and software are complete, but a sensor tool is only as good as its calibration. Before diving in, here is something worth appreciating: at the heart of almost every sensor is an Analog-to-Digital Converter (ADC). Temperature sensors, pressure sensors, load cells — they all funnel through an ADC eventually. So while this step uses a wattmeter as the example, everything here applies directly to any sensor project you build.
The key insight is that buying expensive low-tolerance components does not automatically equal accurate readings. What matters more is understanding some of the main errors in sensor data and designing a system that handles each one.
Error #1 — Offset Error
An offset error is a fixed error that exists even when nothing is connected. Your sensor reads 0.3A with zero current flowing. The fix is simple: disconnect all inputs, measure the ADC reading, and store that value as a variable. Subtract it from every future reading so that you get 0. Done.
Error #2 — Gain Error
A gain error is a scaling error. It gets worse as the measured value increases. Let's say your meter reads 10.1V when the actual voltage is 10.0V. To fix it, we add a correction factor and multiply it with the data always. In this case, the correction factor would be 0.99, so that we get 10.1*0.99 = roughly 10V.
This is why a basic calibration requires two points: a zero point to fix the offset, and a span point to fix the scaling. One point alone cannot correct both.
Error #3 — Drift
Drift is the slow, invisible change in your sensor readings over time. It can show up in different ways based on your sensor type: aging of components, temperature fluctuations, mechanical wear, or chemical contamination etc.
Thermal drift is mostly handled in hardware. This is exactly why I chose low-ppm components back in Step 2. The other types are handled by simply recalibrating every 6 to 12 months, or after extreme temperature exposure. For highly demanding applications, adding a temperature sensor and actively compensating in firmware is also an option. Some sensors do this internally too.
Error #4 — Non-Linearity
This is the most common error. Real sensors are not perfectly linear across their full range — the relationship between input and output bends slightly at different points. My go-to solution for this is piecewise calibration: instead of fitting one correction factor across the entire range, you break the range into segments and calibrate each one separately. For example, within the PG16 gain range (0 to 312.5mV), I can add three calibration points at 100mV, 200mV, and 300mV, creating three locally accurate linear segments. This is especially powerful if your sensor or ADC has no PGA and one gain setting covers the whole range — piecewise calibration is your best tool for squeezing accuracy out of a non-ideal ADC reading curve.
PGA Auto-Ranging on Voltage Measurement
One of the most useful features of the ADS1256 is its Programmable Gain Amplifier. Think of it like a zoom lens for small voltages. When measuring a 50V rail, the ADC pin sees around 2.245V after the divider, which is perfectly readable with 2.5V being the maximum voltage (Voltage reference).
But measuring a 1.2V AA battery means the ADC pin only sees around 54mV. At gain 16, the full-scale range drops to 312.5mV, and suddenly that 54mV signal uses a much larger portion of the ADC's range (17.28% instead of 2.16%). This gives us dramatically better resolution and accuracy. The firmware automatically selects the best gain setting for the current measurement and applies the correct calibration constants for that specific gain, since each amplifier stage has its own subtle characteristics and drift behavior. A drawback is though that this method is slightly slow. So a manual gain could be selected by the user if the voltage/current measurement is supposed to be in a certain range. Probably a feature to be added later?
Dual-Shunt Auto-Ranging
The same philosophy applies to the current measurement side. The 5mΩ and 100mΩ shunts have their own calibrated offset and gain values. I did not use PGA based gains in this case, since the accuracy was already good enough without it. The firmware automatically selects the appropriate shunt and its matching calibration constants based on the measured current, giving the best possible accuracy across the full 0 to 30A range without any manual intervention.
On a sidenote: this dual-shunt design has a big vulnerability. If there is sudden current spike, and the MOSFET does not switch the 100mΩ shunt out of the circuit, the 100mΩ shunt can burn. It happened to me. But there will be an option in the menu to only use the 5mΩ shunt to avoid this issue.
Burden Voltage Compensation
When measuring current with a shunt resistor, there is always a small voltage drop across it, called the burden voltage. For efficiency measurements on the output side of a converter, this matters. Because the device under test is actually receiving slightly less voltage than your meter is reporting. The firmware compensates for this dynamically by calculating the burden voltage from the live current reading and adding it back to the output voltage measurement. This is a classic trap for young players. So I have added toggle-able option in the menu, which can be turned on when the wattmeter is on the input side of a system.
Read The Fine Manual
The ADC we are using comes with additional features like self-calibration and onboard calibration registers that I am using in my code. I highly recommend taking the time to read through your sensors datasheet and utilize all available features to make the best out of it.
Validating Sensor Readings
After implementing all of this, I validated the readings against calibrated lab multimeters across multiple points spanning the full voltage and current range. The results confirmed that smart software calibration on standard-tolerance, low-drift hardware genuinely delivers lab-grade accuracy — without lab-grade component prices.
That is the real payoff of a well-designed calibration architecture. You are not buying accuracy. You are engineering it.
Enjoy the Process and Learn
And that’s it! From a shower-time idea to a fully functioning, lab-grade precision meter that I truly enjoy using for myself every time.
I hope this build log has shown you that a simple sensor doesn't have to stay as simple. With the right architecture, careful calibration, and a bit of creative thinking about connectivity, you can engineer basic sensors into something genuinely powerful. But honestly, the device itself is almost secondary. The real reward is everything you pick up along the way. Everything from the troubleshooting, the community advice that saves your design at 2 AM, your PCB satisfyingly clicking into place in the enclosure. That's what sticks with you long after the project is done.
So don't rush it. Enjoy every step of the process, and treat every mistake as a free lesson.
Thank you for following along on this design journey. If you build your own wattmeter, or if this guide inspired you to take your own raw project idea and design it into something polished, I'd genuinely love to hear more in the comments below.
Happy building!