Skip to content

A minimalistic current logger with a Web Interface. (ESP32)

License

Notifications You must be signed in to change notification settings

fabyr/esp32-current-logger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

esp32-current-logger

This is just a small project of mine designed to run on an ESP32. It will monitor the current flow over time and display a graph on its web interface.

Its preliminary purpose is to be used in electrolysis to count the number of electrons having passed through the medium. (Unit is Moles of Electrons)

Used libraries

Wiring

This software was tested on an ESP32-WROOM-32.

Required Modules:

  • A current sensor based on the ACS712-chip. (Or similar)
    • The sensor must be bidirectional and have its zero-point at half of VCC.
  • A SPI SD-Card module such as the HW-125.

SPI Pinout of the ESP32:

SPI PIN ESP32 PIN
MOSI GPIO 23
MISO GPIO 19
SCK/CLK GPIO 18
CS/SS GPIO 5 was used

Note: In my experience the HW-125 has to be powered by 5V in order to properly work.

Current Sensor Pin: GPIO35

Usage

The contents of the SdCard folder have to be at the root directory of the inserted sdcard.

After flashing your ESP32 it should be ready. Serial communication happens at 115200 baud. Line terminator is just a newline character \n.

The first thing necessary is to setup wifi using the wifi command:

wifi <SSID> <Password>

Referance of all available commands

(Also printable from the ESP32 using the command help)

Command Action
help Displays this help
wifi <SSID> <pwd> Sets WIFI SSID and password
printwifi Display Wifi settings
wifistatus Display Wifi status
setmes <interval> Set Graph measurement interval (in seconds)
getmes Display Graph measurement interval
setoff <voltage> Set current sensor output offset
setmul <factor> Set current sensor output coefficient
getcalib Display current sensor calibration values (offset and coefficient)
startcalib1 <count> <aref> Calibrate Offset (aref is applied current)
startcalib2 <count> <aref> Calibrate Coefficient (aref is applied current)

Calibration procedure

Use an external power supply which can be current limited. Supply a known amount of current through the current sensor.

Then use the startcalib commands to calibrate. Generally each of them only has to be performed once.

For example:

startcalib1 100 0

This will calibrate the offset when no current is applied. It will take record of 100 measurements and average them out. Afterwards a fitting offset will be calculated to bring the measured values closer the the real current that has been flowing (in this case 0).

startcalib2 100 5

This will find the correct multiplier so that the read value becomes the applied current (in this case 5 amps). Before the calibration has not finished do not change the applied current.

Screenshots

Start-Page

Startpage

Graph of a run

Graph

About

A minimalistic current logger with a Web Interface. (ESP32)

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published