Author Topic: Weathernode R1 Query  (Read 1596 times)

wile1411

  • Jr. Member
  • **
  • Posts: 54
  • Country: au
Weathernode R1 Query
« on: December 11, 2018, 06:56:37 AM »
I have a old R1 weathermote that I'm using to test the "solar sketch" that Felix has up on his blog in 2017. I'm liking this supercapacitor idea for an outdoor node or two and it helps that I'm finding it all a bit of fun.

I've removed the two SMD resistors for the voltage divider and replaced with 2x1M. This was done so I could measure the voltage for the 5.4V 15F SuperCap. DMM reads the SuperCap got up to 6.1V on a sunny day, but the old 10k+4.7k resistors topped out at 4.86V.
Side node: this is really looking gloriously kludged now as I used regular sized resistors on the breakout section of the weathermote and connected these to the the old SMD pads with component leg off-cuts.

I've also changed the BATT formula to the below code. This was after a lot of DMM testing to get everything lined up. Now I get the correct Voltage measurement while connected to the FTDI programmer as well as when connected to the charged superCap.
Code: [Select]
#define BATT_FORMULA(reading) reading * 0.0032219 * 2.004 
My query is around the values I'm seeing for the SuperCap voltage. It seems the lowest voltage I'm seeing is bottoming out at 3.32V. (I know it's still working as I'm still getting Temp readings. The recorded voltage level just gets stuck.

I'm just wanting to better understanding where this is being limited and what is preventing the measurement from going lower than this value.

Is this due to the p-MOSFET not having enough volts to allow power to the voltage divider section? (reminder that I'm using an old Weathermote R1)  If so - I take it the only way around this is to get a weathershield R2 which doesn't have the MOSFET? OR is there another kludge I can do to hack it so it will read the VIN power until it brown outs?
« Last Edit: December 11, 2018, 07:10:36 AM by wile1411 »

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6866
  • Country: us
    • LowPowerLab
Re: Weathernode R1 Query
« Reply #1 on: December 11, 2018, 01:09:41 PM »
When you replaced the resistors to make the divider a total of 3MEGs, that right there will likely give you a false reading on your DMM (due to DMMs internal resistance) when you measure the divider voltage.
The R1 with the mosfet had a much lower resistor ratio that would allow measurements with DMM while mosfet is closed (gate low).
The software ratio is theoretical based on the expected highest voltage, the values of the resistors used and what you expect to see (the division) at the point of measurement (where analog pin samples the divider).
« Last Edit: December 11, 2018, 05:12:35 PM by Felix »

wile1411

  • Jr. Member
  • **
  • Posts: 54
  • Country: au
Re: Weathernode R1 Query
« Reply #2 on: December 11, 2018, 04:59:29 PM »
You lost me there. I replaced the 10k and 4.7k with two 1MEG resistors. On the board I've removed the two directly below the 3v3 pin. I kept reading on the forums that if I want to monitor a higher battery voltage or in this case, capacitor voltage, I'd need different resistor values. The solar panel was charging the cap over 5V and I couldn't get a reading past 4.86V on that as it would exceed the max value with the set ratio.

Looking at the graph this morning, I see it now bottoms out at 3.28V. The 3.32V bottom I mentioned in the first post was what it was reading with the supplier resistors.

I changed the reference voltage ratio as I was reading 3.296v across the 3V3 and GND pins 3.296/1023=0.00322189638

For the voltage divider, both R1 and R2 were 1MOhm, so I figured the ratio is close to 0.5 and for a 6.1 max voltage, I wouldn't exceed the maximum pin voltage of 3.3V.

In software I set the MOSFET to permanently gate high during setup (commented out the flipping in the read Battery function) and then I measured the voltage across the pair and got 1.994V. Looking at just R2, I got 4.09V. That gave me a ratio of 4.09 /1.994 = 2.0512.

That got me close after plugging those numbers into the script. I was 0.4V off what the DMM was reading for the source voltage.

I them kept disconnecting and reconnecting between the Cap voltage and the USB connection until I found the ratio that gave the correct voltage for both sources, each time verified with a measurement with my DMM (Fluke 87 in case it matters).

Is this board destined for the bin?

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6866
  • Country: us
    • LowPowerLab
Re: Weathernode R1 Query
« Reply #3 on: December 11, 2018, 05:20:54 PM »
That got me close after plugging those numbers into the script. I was 0.4V off what the DMM was reading for the source voltage.

That's exactly what I meant about the DMM.
And BTW I thought you mentioned 1+2MEG initially but either way if you use resistors in the MEG range you might get invalid readings on a DMM if you try to measure the divider voltage.
It only makes sense to go to MEG resistors if you bypass the FET and wire the divider directly to your VIN/supercap - in which case you get a constant ~2uA or less drain. Otherwise you gotta flip the FET when you get a reading during live use. The DMM readings will be invalid (ie fake) with MEG resistors.

For a 1+1MEG ratio, you're basically at 0.5 of the actual voltage (with ideal 1MEG resistors) when you read it through the ADC, so it makes it easy.
Im assuming youre using a Moteino although you haven't mentioned it. That means at a 3.3V VCC you get a 1023 reading for 6.6V max, that's your theoretical input limit for the divider.
Just use 0.5 ratio with two 1MEG resistors divider, and you're good to go.

So no, I would not say its destined for the bin, but the SI7021 is aging and based on some past threads I would not recommend it for accurate reliable readings. I would at least compare it to some known good readings before relying on it.

wile1411

  • Jr. Member
  • **
  • Posts: 54
  • Country: au
Re: Weathernode R1 Query
« Reply #4 on: December 11, 2018, 05:33:01 PM »
Thanks for that. Am I right in understanding the bottoming out of the voltage reading is the mosfet? And that I need to bypass it anyway if I want to read V below 3.3v?
« Last Edit: December 11, 2018, 05:37:05 PM by wile1411 »

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6866
  • Country: us
    • LowPowerLab
Re: Weathernode R1 Query
« Reply #5 on: December 11, 2018, 05:48:40 PM »
No, the mosfet is just there to stop current draining in the voltage divider when you're not reading it (ie save a constant 1-2uA).
You enable the FET as shown in the WeatherShield R1 sketch.

The Moteino runs at 3.3V, this is an assumption in the formula to get the battery voltage. If you change that, and run from less, then you need another reference to determine your final voltage - ex the internal bandgap 1.1v voltage. So then instead of the known assumed 3.3V provided by the LDO, you have to take a VCC reading (unknown, less than 3.3v) and compare it to the internal known 1.1V reference (this is vaguely accurate but works ok for a battery reading). When you found your VCC, then you take an ADC reading of the divider, and calculate your final battery voltage using the formula with 0.5 multiplier (for your 1MEG+1MEG divider) and your VCC reading. I hope this makes sense.

wile1411

  • Jr. Member
  • **
  • Posts: 54
  • Country: au
Re: Weathernode R1 Query
« Reply #6 on: December 11, 2018, 09:50:22 PM »
I 'think' it's making sense to me. So as the (usually) stable VCC of 3.3 drops below that value, I need to take readings to parameterise it so it's not a constant 3.296 and calculate with the newly read value instead.

I read this post from WhiteHare a while back and it jumped out as what I think I need to do to get my values.

edit:

Thanks Felix! I'm reading below 3.3volt now.
Summary:
 - Reading above 5v, change voltage divider
 - Reading below 3.3, incorporate a reading of reference voltage into battery voltage formula

Poor solar mote isn't getting much power the last few days with all the rain we're getting.
« Last Edit: December 12, 2018, 04:16:53 PM by wile1411 »

wile1411

  • Jr. Member
  • **
  • Posts: 54
  • Country: au
Re: Weathernode R1 Query
« Reply #7 on: December 12, 2018, 09:04:13 PM »
Followup query on voltage dividers...
was there a particular reason the various divider ratios across the various repositories? Was that due to you using different batteries with different max voltages?

Code: [Select]
Github script                              Divider Ratio
---------------------------------------------------------
OLEDMote.ino                                 1.42
MailboxNotifier4_sender_withWeatherShield.ino 1.47
MightyBoostControl.ino                         1.47
MailboxNotifier.ino                         1.47
WeatherNode.ino                                 1.475
SonarMote_Parking.ino                         1.475
SonarMote_Parking_Sound_OLED.ino         1.475
SonarMote_DistanceTracker.ino                 1.475
MotionMote.ino                                 1.49
MightyHat.ino                                 1.51
« Last Edit: December 14, 2018, 06:26:11 AM by wile1411 »

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6866
  • Country: us
    • LowPowerLab
Re: Weathernode R1 Query
« Reply #8 on: December 13, 2018, 03:04:14 PM »
I can't remember if there was anything else involved but I have used different resistor ratios at various times.
I tried to standardize to 1M+(2M_100nF) in the past few years.