@sundberg84 I just finished my first battery sensor node based on the Easy PCB Rev 9. I have two questions i hope you can help me with:
The first is about the battery measurement. Because i didn't have a 0.1 uf lying around i used an 0.2 uf capacitor. I am using the following script to measure the battery.
//=========================
// BATTERY VOLTAGE DIVIDER SETUP
// 1M, 470K divider across battery and using internal ADC ref of 1.1V
// Sense point is bypassed with 0.1 uF cap to reduce noise at that point
// ((1e6+470e3)/470e3)*1.1 = Vmax = 3.44 Volts
// 3.44/1023 = Volts per bit = 0.003363075
#define VBAT_PER_BITS 0.003363075
#define VMIN 1.9 // Vmin (radio Min Volt)=1.9V (564v)
#define VMAX 3.0 // Vmax = (2xAA bat)=3.0V (892v)
int batteryPcnt = 0; // Calc value for battery %
int batLoop = 0; // Loop to help calc average
int batArray[3]; // Array to store value for average calc.
int BATTERY_SENSE_PIN = A0; // select the input pin for the battery sense point
//=========================
// Calculate the battery in %
float Vbat = sensorValue * VBAT_PER_BITS;
int batteryPcnt = static_cast<int>(((Vbat-VMIN)/(VMAX-VMIN))*100.);
Serial.print("Battery percent: "); Serial.print(batteryPcnt); Serial.println(" %");
Do i need to change anything in the formula? Because i getting reading around the 130%
Requesting temperature...DONE
Temperatuur : 26.62 Degrees C
11935 TSF:MSG:SEND,25-25-0-0,s=5,c=1,t=0,pt=7,l=5,sg=0,ft=0,st=OK:26.6
Battery percent: 131 %
Battery Voltage: 3.35 V
Sleep...
12945 MCO:SLP:MS=900000,SMS=0,I1=0,M1=1,I2=254,M2=1
12955 TSF:TDI:TSL
If i use the following method:
//----
// 1M, 470K divider across battery and using internal ADC ref of 1.1V
// Sense point is bypassed with 0.1 uF cap to reduce noise at that point
// ((1e6+470e3)/470e3)*1.1 = Vmax = 3.44 Volts
// 3.44/1023 = Volts per bit = 0.003363075
float batteryV = sensorValue * 0.003363075;
int batteryPcntNEW = sensorValue / 10;
Serial.print("Battery percent: ");
Serial.print(batteryPcntNEW);
Serial.println(" %");
//----
I am getting: (this is expected, because batteries are new)
Battery percent: 99 %
Sleep...
12945 MCO:SLP:MS=900000,SMS=0,I1=0,M1=1,I2=254,M2=1
12955 TSF:TDI:TSL
My second question is about casing: any tips on which case to use which fit your board and a battery pack? and is as small as possible? Do you perhaps have links of your favourite (Chinese) sellers?