Monday, March 16, 2026

ESP32-S3 Based Logger (2)

 The ESP32-S3 logger went together very easily.  I bought modules that contained the functions I needed. These modules included :

  1. ESP32-S3 Dev kit for the main controller
  2. A Micro SD module for to receive the logged data into readable files.
  3. A DS3231 Real Time Clock (RTC), a battery backed up clock to supply a time stamp for data entries
  4. An OLED module (128x64, 0.9") for displaying current data.
  5. An INA226 current sense module for measuring high side battery current, either output current to the load or input current from the charger.
  6. An ADS1115 4 channel 16 bit analog to digital converter (ADC) for precision measurement of battery voltage for logging.  
For bringing up the board I started by bringing up the ESP32-S3. Then adding modules one at a time.  ChatGPT turned out to be very nice for this phase.  For the controller, I asked it to give me a "Hello World" test program. Starting with that program, I worked through some version issues by simply pasting the Arduino IDE error messages in the ChatGPT chat and letting it correct the code. 

For each module, I requested from ChatGPT the optimal wiring assignments and a test program to check the modules. The modules on the I2C bus were very easy to bring up, the wiring on the Micro SD module SPI was slightly more complicated but all the same, not a real challenge.

Using modules has several advantages over building the functions directly from IC and ancillary components. The modules are already design tested and have only to be plugged into the breadboard. 

To complete a schematic of the full logger it is generally necessary to generate circuit symbols and footprints to put into the local libraries, but that task goes quickly.   Figure 1 shows a schematic of the whole logger.  

As can be seen the wiring is very simple.   After creating all the module footprints, the starting layout is given in the figure below.

The board as drawn is 3.5" by 5.5".   However I have a couple of things I'm thinking about before finalizing the layout: 
  1. Add connection to a module that will mount at the battery terminals. On the module will a 10 milliohm current sense resistor and a PMOS load shutoff switch.  So I need to add the wiring and connectors for that change.  
  2. I will also add some protection circuity and connectors for the four analog channels
  3. Add a connections for a battery temperature sensor. 
  4. Add protection and connection for 8 general purpose DIO lines to the controller.
So there's still some work to be down before ordering a board. 

In the meantime I'm going to be working out how to archive this project on GitHub.

To be continued....



 

Saturday, March 7, 2026

ESP32-S3 Based Logger (1)

 I have revised the April 2024 logger concept, the breadboard of the unit is shown in Figure 1 below.


Figure 1. Logger V2 breadboard.

This time around I used ChatGPT extensively to advise for which modules to include, their wiring, and to write all the required ADE sketches.  I switched from the using the ESP32 Dev Kit to a ESP32 S3 Dev Kit.  The old ESP32 wasn't all that bad but the S3 unit is easier to use and is a later version.  The main modules used are: 
  • ESP32 S3 Dev Kit: used so far for control of sensors, logging and control of OLED display
  • SPI microSD module: used to record time, battery voltage, and battery current once per second. Data is recorded into a csv file.
  • SSD1306 OLED display:  used to display current battery voltage and current, and current time.
  • DS3231 Real Time Clock module:  used to generate time stamps for data points
  • ADS1115 16-bit ADC: used to measure battery voltage
  • INA226 current monitor: used to measure high-side batter current.
So far I've used the unit in conjunction with my UC2906 based charger, along with my dummy load and SLA battery to record a couple of battery charge and discharge curves. 

Figure 2.  SLA battery 0.95A discharge curve

Figure 2 shows the discharge curve using a 13.5 ohm load (nominal 888 mA load).  The current was constant at about 0.95 amp.  Voltage started to fall precipitously at approximately 4.25 hours.  The discharge experiment was halted after 4.4 hours when battery voltage dropped below 11.3V.  Note the noise free quality of the data.  Approximately 4.1 AH of charge was removed, giving (7.2-4.1)/7.2 = 43% capacity remaining. 



Figure 3 shows the measured charge curve following the previous discharge curve.  Note that the current curve is negative, in accordance with the assumption of positive current coming out of the battery and negative current going into the battery.

  1. In the first hour the charger was turned off.  Discharged voltage was approximately 12.2V. 
  2. At about 1.2 hours the charger is turned on and goes into the bulk (constant current) phase.  The current is set to 0.64A.  This phase lasts about 5 hours. 
  3. At about 6.4 hours the charging goes into the absorption phase (constant voltage).  In this phase the current tapers toward zero.   For the UC2906 the transition from this phase to float phase occurs at Imax/10, in this case Imax is 0.64A.  The actual transition occurred at 0.069A. 
  4. At about 11.5 the charger entered the float phase, dropping the float voltage to 13.5V.  Initial float charge current was 0.025A.  Integrating the current curve using Excel yields a total of 4.4AH charged into the battery.