Mbili thingspeak

Dear all,

Did use the example and up-loaded data from thp to thingspeak.
Being a bit confused on how to upload battery level readings as well.
I know its a simple thing but can not do it please help.

Thanks

Have a look at the createDataURL() method in the example.

This method is responsible for constructing the submission to ThingSpeak.

If you want to use the same syntax approach you should define LABEL5 as “field5”, near the top of the sketch. ThingSpeak supports up to eight fields.

Then add:

url += String(OTHER_SEP) + String(LABEL5);
url += String(LABEL_DATA_SEP) + String(XXXX);

at the end of that method before the ‘return’ statement. Replacing XXXX with the battery reading value.

battery voltage
#define ADC_AREF 3.3
#define BATVOLTPIN A6
#define BATVOLT_R1 4.7
#define BATVOLT_R2 10

rtc.convertTemperature();
int temp = rtc.getTemperature();

int mv = getRealBatteryVoltage() * 1000.0;

float getRealBatteryVoltage()
{
uint16_t batteryVoltage = analogRead(BATVOLTPIN);
return (ADC_AREF / 1023.0) * (BATVOLT_R1 + BATVOLT_R2) / BATVOLT_R2 * batteryVoltage;
}
So where xxxx is mv I suppose?

Yeah, or you can call the function directly:

url += String(OTHER_SEP) + String(LABEL5);
url += String(LABEL_DATA_SEP) + String(getRealBatteryVoltage() * 1000.0);