Akku Messung

This commit is contained in:
hans-jurgen 2024-07-03 15:09:00 +02:00
parent d0338e356c
commit 5bea8a527d
2 changed files with 6 additions and 4 deletions

View File

@ -1,7 +1,7 @@
#include <Arduino.h>
const float MinimalSpannung = 2.85;
float koa = 0.984326019;
float korectur = 0.8870;
char floatString[15] = {0};
float AKKU;
@ -12,7 +12,7 @@ float getBattery(float kor = 1.000)
return 3.05;
#endif
float valA0 = analogRead(A0);
valA0 = valA0 * 3.7; // (R1 + r1 + r2) / r2
valA0 = valA0 * 5.9; // (R1 + r1 + r2) / r2
// r1 und r2 Spannungsteiler
// r1 = 270k, r2 = 100k
// Spannungsbereich = 5.2 Volt

View File

@ -28,7 +28,8 @@ PubSubClient client(espClient);
//#include <mess_BMP280.h>
#include <mess_BME280.h>
#include <mess_Ub.h>
//#include <mess_Ub.h>
#include <mess_Ub_old.h>
#include <messADS1115.h>
@ -100,8 +101,9 @@ void setup() {
initADS();
#endif
if (!F_ADS1115 == true){
AKKU = getBattery(); // ca. 170 ms
AKKU = getBattery(korectur); // ca. 170 ms
Serial.println("ALTE UB MESSUNG:");
Serial.println(AKKU);
}
else{
MessungADS();