Author Topic: Moteino R4 + TH02 + 2000mah = 2 years  (Read 1407 times)

nodesync

  • NewMember
  • *
  • Posts: 4
Moteino R4 + TH02 + 2000mah = 2 years
« on: January 14, 2019, 11:38:27 PM »
I've created a TH02 daughter board for the Moteino and have two running for 2 years on a single charge to a 2000mAh LIPO.  The Moteino is a stock R4 with a RFM69 433Mhz transceiver; I've dialed down the radio to use a lower baud.  These have been transmitting temperature, humidity, dewpoint, and volts in one minute intervals during the 2 years.  I'm using the LowPower library, using a spare pin to power the TH02 and using digitalWrite HIGH/LOW to turn it on/off.

Using a simple multimeter to measure the volts of the battery:
1/15/17 4.19v --> 1/14/19 3.64v  readVcc() reports 3.24v
1/14/17 4.18v --> 1/14/19 3.65v  readVcc() reports 3.26v

It is odd that the Moteinos report different volts via the standard readVcc() and it's been this way the whole time.  Not sure why there would be a 0.02v difference???

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6866
  • Country: us
    • LowPowerLab
Re: Moteino R4 + TH02 + 2000mah = 2 years
« Reply #1 on: January 15, 2019, 09:10:42 AM »
Using a simple multimeter to measure the volts of the battery:
1/15/17 4.19v --> 1/14/19 3.64v  readVcc() reports 3.24v
1/14/17 4.18v --> 1/14/19 3.65v  readVcc() reports 3.26v

It is odd that the Moteinos report different volts via the standard readVcc() and it's been this way the whole time.  Not sure why there would be a 0.02v difference???
Can you explain in more detail?
What is readVcc(), something you made or you use from a stock sketch somewhere?
How do you actually read voltage, from a hardware standpoint? Do you use a voltage divider from the battery - if so what are the resistor values?
I would not sweat over a 20mV difference, that's pretty good actually.

nodesync

  • NewMember
  • *
  • Posts: 4
Re: Moteino R4 + TH02 + 2000mah = 2 years
« Reply #2 on: January 15, 2019, 08:44:51 PM »
I'm using the following function to read the voltage of the Motenio:

Code: [Select]
int readVcc() {   // return vcc voltage in millivolts
  long result;
  byte saveADMUX;
  //  Read 1.1V reference against AVcc
  ADMUX = _BV(REFS0) | _BV(MUX3) | _BV(MUX2) | _BV(MUX1);
  delay(2);             // Wait for Vref to settle
  ADCSRA |= _BV(ADSC);  // Convert
  while (bit_is_set(ADCSRA, ADSC));
  result = ADCL;
  result |= ADCH << 8;
  result = 1126400L / result; // Back-calculate in mV
  int t = (int)result;
  ADMUX = saveADMUX;  // restore it on exit..
  return t;
}

Reading the voltage of the battery was done via a multimeter at the JST pins.

Jason

  • Jr. Member
  • **
  • Posts: 57
Re: Moteino R4 + TH02 + 2000mah = 2 years
« Reply #3 on: January 16, 2019, 12:39:54 AM »
See page 314 of the data sheet for the Atmel 328 and you will find the internal reference voltage, aka the band gap voltage specification is that it is 1.0V min to 1.2V max 1.1V typical.

This is the internal reference voltage you are using for the ADC reference.  Since there is a little discrepancy, I would suspect your bandgap voltage is not exactly 1.1 V.

I recall reading elsewhere that the band gap voltage varies from chip to chip, but is pretty stable.  So if one wants the most accurate results, one needs to measure/calculate the band gap voltage of the device in question and account for that in software.

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6866
  • Country: us
    • LowPowerLab
Re: Moteino R4 + TH02 + 2000mah = 2 years
« Reply #4 on: January 16, 2019, 07:23:24 AM »
1) I would not expect the bandgap to be very precise.
2) You are reading the VCC (3.3V from Moteino onboard LDO) using bandgap reference?
Then you're not really reading the battery voltage, correct?
Although if the VBat drops beyond 3.3V, the LDO will use more current and there will be an accelerated drop in voltage since the LDO is not designed to "pass through" very efficiently, without regulation.

nodesync

  • NewMember
  • *
  • Posts: 4
Re: Moteino R4 + TH02 + 2000mah = 2 years
« Reply #5 on: January 16, 2019, 09:16:21 PM »
I'm using this method as a "cheap fuel gauge" - when the voltage supplied by LDO starts to drop below 3.23v, I send out a warning message and increase the time between data payloads.  The delta increases as the volts drop.

 
See page 314 of the data sheet for the Atmel 328 and you will find the internal reference voltage, aka the band gap voltage specification is that it is 1.0V min to 1.2V max 1.1V typical.

This is the internal reference voltage you are using for the ADC reference.  Since there is a little discrepancy, I would suspect your bandgap voltage is not exactly 1.1 V.

I recall reading elsewhere that the band gap voltage varies from chip to chip, but is pretty stable.  So if one wants the most accurate results, one needs to measure/calculate the band gap voltage of the device in question and account for that in software.

Thanks for the info - that's likely the cause of the variance.  Will likely need rework the function to account for this.