Save calibration data to ESP32 during manufacturing

innomkr
Posts: 7
Joined: Wed Sep 22, 2021 4:29 am

Save calibration data to ESP32 during manufacturing

Postby innomkr » Fri Jul 29, 2022 11:54 am

Hello everyone,

I am working on a smart plug with power measurement features. I use ESP32-C3 and ADE7953 for power measurement.

During development it turned out that calibration constants must be calculated for each and every device.

We have designed a custom calibration device with an accurate reference meter and phantom loads.

Now I am looking for the best way to run the calibration procedure and save the calculated constants to each ESP32-C3.

I have written a python program which communicates with the esp32 over uart, the energy meter and controls the different loads. The python program takes a measurement from both devices(our plug and reference meter) and calculates these constants. Then the constants are sent over uart to esp32 and saved in the NVS.

During normal operation, the smart plug reads the values from the nvs right after boot and assigns them to variables which are after that used for proper calculation of voltage, current, power etc.

What do you think of my approach and can you suggest me a better one?

ESP_Sprite
Posts: 9582
Joined: Thu Nov 26, 2015 4:08 am

Re: Save calibration data to ESP32 during manufacturing

Postby ESP_Sprite » Sat Jul 30, 2022 2:43 am

That sounds about how I would do it. If you also want to use your NVS for other things (like WiFi credentials etc) it may be useful to create a 2nd NVS partition used solely for the calibration parameters, so these don't get lost if somehow the main NVS gets corrupted or you do a factory reset by entirely erasing the main NVS.

Who is online

Users browsing this forum: No registered users and 195 guests