Hi all!
I am working on monitoring the electric conssumption of a machine. I do it with Circuit Setup SSP Energy Meter (which includes an ESP32 and an ATM90E32) sampling every 50ms. I am sending data via MQTT to a Raspberry Pi, and storing it for further analysis, for what I am using a Python script and SQLite.
Now I'm working with other (possibly faster) communication alternatives such as the Serial port, SPI or probably I2C.
My question is: Is there any way of sending data through (for example the Serial port which I think is the easiest to start with) in a format like this?:
day / month / year - / hour / minute / second / milisecond
I can do it in the Python script but I think it would be more accurate to keep the time of the measurement and not the time of data storage. The code fragment for the Serial port is this one:
#define ESP32
#include <ArduinoJson.h>
#include <WiFi.h>
#include <WiFiClient.h>
#include <PubSubClient.h>
#include <SPI.h>
#include <ATM90E32.h>
Serial.println("Voltage 1: " + String(voltageA) + "V");
Serial.println("Current 1: " + String(currentCT1) + "A");
Serial.println("Current 2: " + String(currentCT2) + "A");
Serial.println("Active Power: " + String(realPower) + "W");
Serial.println("Power Factor: " + String(powerFactor));
Serial.println("Harmonic Power: " + String(eic.GetTotalActiveHarPower()) + "W");
Serial.println("Reactive Power: " + String(eic.GetTotalReactivePower()) + "var");
Serial.println("Apparent Power: " + String(eic.GetTotalApparentPower()) + "VA");
Serial.println("Phase Angle A: " + String(eic.GetPhaseA()));
Serial.println("Chip Temp: " + String(temp) + "C");
Serial.println("Frequency: " + String(freq) + "Hz");
I can provide the full code if needed, but I don't think it's necessary.
Thanks for your time and help.