5912

When we are developing some devices, often, the current consumption is a key point. Here, I made a "modern" device which measure voltage and current, showing it on graphic way as well as upload to a cloud

Some times ago, I developed 2 versions of a similar devices here: https://www.elektormagazine.com/labs/display-charge-and-discharge-current-wide-range
This tool was monitoring current consumption and voltage from a battery to the device to monitor. With an ESP8266 option, it can upload the data to thingspeak.
Here,  wanted to do something more "fashion", more modern with a graphic and touch interface. My previous graphic screen project was "1980" style following my son's comment... 

Hardware wise, I use a full module ESP32S3 with 2.8'' capacitive touch screen. This module is quite easy to source and all the documentation is available here:
2.8inch ESP32-S3 Display - LCD wiki: https://lcdwiki.com/2.8inch_ESP32-S3_Display#top
On one external port, I2C one, I connected a board with the INA219 to measure the current and the voltage.
There is also a battery connector and a way to measure the voltage through an ADC. A charging IC is existing to recharge the battery (I replaced the resistance sense from 3.3k to 1.5k to have 600mA charging current).

Software:
For the first time in all my projects, I wanted to try to do an touch interface. It was completely new and challenging, so, I used a lot IA to help me (Microsoft Copilot) on all the steps.
There is now, with the current version (V14...), several features. Quite stable but not perfect yet.
It has been developed on Arduino V2.3.7. The graphic environment used LVGL V8.3.10. This is important because there are many changes between different version of the library. It is quite painful and honestly, I should have move to PlatformIO which is managing must better all of this.

Features:
-  5 screens:
1) Live data screen (voltage and current in double axis)
2) Recorded data screen (after the record button is activated)
3) Dashboard screen with display of the live values, average, min and max
4) Setting screen: Can choose the scale of the voltmeter and amperemeter, sampling period and timescale on the screen 1 and 2., period of upload to the cloud.
5) Wifi and SD card screen

Screen 1-3 can be change by vertical swap.
Screen 4 is from a button from the Dashboard screen
Screen 5 is a vertical swipe from Screen 4

A zoom with 2 fingers is implemented (timescale changes) for screen 1 and 2.

Wifi can be selected and save in the NVS zone and 2 predefined SSID/Password can be recorded in the software.

The cloud upload is using the free version of AdafruitIO.

On the main screen (live data screen 1), there are Wifi icon (color different if connected or not), Cloud connected or not, internal battery level icon.

The recorded screen is using some tables (voltage and current), with 20000 points, on rolling basis. The points are recorded following the sampling choice. A "drag" gesture is implemented on this screen to navigate all along the dats recorded.

A button can save all the recorded points to an SD card file. 

The average, min and max are defined from the time the device is in recording mode (there is a red blink dot on the top right). They are not linked to the recorded tables.

Consumption of the device optimization:

 As I wanted to be a portable tool, I wanted to be able to record days of data without charging it.
Without optimization, the consumption is around 200mA.
Several possibilities for that:
1) The easier one, turn off the backlight after some second. Here, I use 30 sec. 20mA saving.
2) the loop() task is schedule with a delay(5) : 5ms, needed for LVGL.  Delay is using  full CPU. Usualy, we can use either lightsleep or full deepsleep.
3) Reduce the speed of the CPU

For the point (1), the backlight is switch off after a fix tempo. It will switch On again when tap on the screen.

For solution (2), full deepsleep is not an option as we'll loose all the data from the memory (we cannot put all in the RTC memory). Lightsleep seems a good solution. However, the result is unstable, and there are some beside effect: No more Serial.print possible, and SW download complicated (serial port is deactivated in lightsleep). So far, I cannot find a lightsleep soluion stable for hours. The benefit should have been 60mA less with the backlight off.

For solution 3,  I make it simple: If no backlight, CPU speed reduce to 80Mhz (anyway cannot see the screen). If backlight is on, CPU is full speed 240Mhz. The gain is 30mA.

Currently, with a 1500mA battery, there is around 6-7h autonomy (lower than the theoretical). 

Casing:

On thinkkercad, a compact casing was developed. Can add the IN219 board, a on/off switch. Still need to add a top casing.

How to use:

I solder a small PCB with XH2.54mm connectors, female and male, with 2 pin to measure the current one one pin for the voltage (the black on the pictures).
After connection, the live screen will show the real measurement. From the setting scree, select the sampling time, upload data period. Back to the dashboard, tap the REC box to record the data (button becomes RED) and Cloud button (if you want upload to AdafruitIO), which becomes RED as well. That's all.

Conclusion on Feb 7th, 2026:

After weeks of this software development, even with the help of Copilot (or Perplexity sometimes), it is not a magic solution. It helps a lot, I learnt a lot on such LVGL and object structure software. It needs many many iterations, often the IA proposal has some missing and mislead the investigation.