WeatherShield low power

Started by Jim111, February 15, 2015, 01:23:56 PM

TomWS

#15
Quote from: rosswakelin on May 26, 2015, 03:27:31 AM
Hmmm, this explains a lot.

I started off with Motes and ds18b20 sensors, powered from a 9V PP9 battery.  I was getting months of battery life.
I "upgraded" to the weathershield, and now my battery life is less than two weeks.

Recommendations?
Are you still powering your Mote from a 9V battery?  If so, it's no wonder that the battery life is so short. 

Weathershield can NOT be powered from a 9V source due to it's 'switchable' battery monitor.  With a 9V source, the PMOS transistor is ALWAYS biased on and, as a result, you're pulling a constant 3.5mA from your battery (2.8mA due to the 1.5K+1K gate network, and 1.3mA due to the 4.7K that is overdriving the A7 pin).  And this increased power is just due to this circuit alone.  You'd have to modify or, at least, remove the battery monitor circuit and it's associated resistors to use the Weathershield with Vin=9V.

Tom



kalbanowski

Huh, just noticed this thread as I was going to post something similar. I'd been seeing much higher than expected power usage due to the voltage measurement circuit, and intended to do some detailed analysis to figure out what was going on, but the hard work has already been done. :-)

Since I'm running these off of 4 AA, I'm going to exceed the threshold voltage even with the described modification. For me, the Weathershield proto area works out quite well to put on a transistor to fully switch the measurement circuit; pull the pin from the connecting header on A3 (so it is disconnected from the Moteino), then I put in a BC547 with a 1K bias resistor from A2, which now switches the circuit.

There's an associated problem for me with the measurement: the voltage divider doesn't provide enough range for these cells (max of 4.8V, as I recall).

It occurs to me now that I might as well put my own divider in the proto area, easier than switching around the SMT resistors to adjust the existing divider.

Felix, I'm not sure what to suggest for the Weathershield; in a sense it already supports the modifications I need for higher voltage operation (due to the proto area). A note on the product description page mentioning the voltage 'limit' would be nice.

If I were to make a suggestion for a 'V2', at the moment it would just be to ask that VIN and A0-A3,A7  had convenient pads next to the proto area, and the built in voltage circuit had some cuttable links to allow it to be disabled.

Ideally, yes, I'd like it to support low-power measurement for the full Moteino regulation range.

In any case, this is a cool board, the sensors are great and I do have the thing running at ultra low power. I'm trying out environmental sensor nodes based on the Weathershield, and a Weathershield/Moteino sandwich makes a lovely form factor, much tidier than breadboarding everything. Nice stuff. I just now need a case with some appropriately positioned vents.

TomWS

#17
Quote from: kalbanowski on May 27, 2015, 01:10:54 PM
Huh, just noticed this thread as I was going to post something similar. I'd been seeing much higher than expected power usage due to the voltage measurement circuit, and intended to do some detailed analysis to figure out what was going on, but the hard work has already been done. :-)

Since I'm running these off of 4 AA, I'm going to exceed the threshold voltage even with the described modification. For me, the Weathershield proto area works out quite well to put on a transistor to fully switch the measurement circuit; pull the pin from the connecting header on A3 (so it is disconnected from the Moteino), then I put in a BC547 with a 1K bias resistor from A2, which now switches the circuit.

There's an associated problem for me with the measurement: the voltage divider doesn't provide enough range for these cells (max of 4.8V, as I recall).

It occurs to me now that I might as well put my own divider in the proto area, easier than switching around the SMT resistors to adjust the existing divider.

Felix, I'm not sure what to suggest for the Weathershield; in a sense it already supports the modifications I need for higher voltage operation (due to the proto area). A note on the product description page mentioning the voltage 'limit' would be nice.

If I were to make a suggestion for a 'V2', at the moment it would just be to ask that VIN and A0-A3,A7  had convenient pads next to the proto area, and the built in voltage circuit had some cuttable links to allow it to be disabled.

Ideally, yes, I'd like it to support low-power measurement for the full Moteino regulation range.

In any case, this is a cool board, the sensors are great and I do have the thing running at ultra low power. I'm trying out environmental sensor nodes based on the Weathershield, and a Weathershield/Moteino sandwich makes a lovely form factor, much tidier than breadboarding everything. Nice stuff. I just now need a case with some appropriately positioned vents.
To my mind, a switch to control a battery measurement is unnecessarily complicated/power consuming.  I generally use very high value resistors with a 0.01uF cap at the analog input pin to handle the capacitive load when the analog mux is switched over.  You can keep the current below 1uA and still get reliable readings.

I almost always use a 3.3M resistor from the analog pin to ground and then tailor the upper resistor to match the intended battery supply.  So, for example, with the cited case of 9V, I'd use a 6.8M resistor which gives me an almost direct reading in 10mV units at the ADC (10.10 volts would be full scale 1023 reading).  For the 4AAs, I'd use 2.7M and 6.0V would be full scale 1023 counts (actually I'd probably allow for some margin and use 3.3M, but you get the idea).  For a 5V supply I use 1.8M and can divide the ADC value by 2 to get 10mV units.

Last I checked, this comes to 1uA of current without any hassle...

For the Weathershield you can remove the transistor and the two gate resistors, jumper the Drain and Source pads, and replace the divider resistors appropriately.  I think you'll find that an 805 cap will piggy back nicely on the resistor.

Tom
PS: I agree it's a cool board.   

joelucid

Couldn't agree more about the battery measurement without switch. In fact you don't even need the capacitor if you call analogRead twice as described for example here: http://forum.arduino.cc/index.php?topic=169000.10;wap2

That's the approach I'm using (also with huge resistors). I generally like to use as few hardware components as possible esp since I don't create custom PCB's.

Felix

Good points and suggestions, thanks TomWS for actual numbers. When I switch to passives only I will need to fight the other camp who wants the switch because a constant drain of *anything* bothers something in their brain  ::)

TomWS

#20
Quote from: Felix on May 28, 2015, 07:33:07 AM
...I will need to fight the other camp who wants the switch because a constant drain of *anything* bothers something in their brain  ::)
Yes, I can understand that, after all, in the 9V case, with 1uA constant drain, the battery life will be reduced by a factor of 1/565000...
It just occurred to me that those who are REALLY concerned about every last uA won't (or shouldn't) be using Vin anyway...

@Joelucid, if you are willing to do multiple analogRead()s or only have the one ADC input and can leave the mux selecting the single source, yes, you can get away without some buffering on the input.  In my case, I always measure VCC in addition to the divider so that I can accurately scale the divider input (VCC is not always 3.3V  ;)

T

Felix

A dedicated battery monitor chip might be an alternative. But I'd have to do the research to pick one, cost might be magnitudes more, and the protocol to read it might be another learning barrier. I think the resistor + 0.1uF method works fine, I usually stayed below 1Meg so far but your findings are promising.

joelucid

If you go the large resistor route you could add battery monitoring to the regular Moteino design. Given the huge resistance you wouldn't be sacrificing an analog input: If an application needs the pin for other purposes the input would easily overpower the divider output. Obviously you'd have to size the resistors to enable the full possible VIN range, but that would still be enough to detect a dying battery.

It would be really useful to have battery monitoring part of the basic package, esp with the battery focus of Moteino!

Felix

While Moteinos are battery friendly they were not specifically designed for exclusive battery operation, hence I did not include a monitor onboard. We would be huge debate on the forum about the implementation, the resistors chosen, people would complain that it doesn't work for them and they want different values/range covered, or they want jumpers to disable it, or they want it on a different analog pin or this or that and it never ends.
Hence monitors were offered in separate boards like the MotionMote, PowerShield, and WeatherShield. Also some of these boards have proto areas where you can make your own if you'd like.
Over time I have received a ton of great suggestions to include all kinds of features in the basic package, all tempting. Looking at the big picture, it's really hard to satisfy all the needs. Moteino will likely stay largely the same over its existence. I think addon boards is where such options are more feasible and appropriate. It's separation of concerns.

TomWS

I have to agree with Felix on this one, which pin would you use?  What divider resistor would you use?  A filter cap would be required to my mind, but then this would eliminate the possibility of using the pin as a GP pin for some other purpose.  Adding the three components external to Moteino isn't really a problem, even on a standalone config. 

Along these lines, even adding the components manually to a WeatherShield would be less of a problem than the current implementation.

Tom

joelucid

#25
I just built a water thermometer for the lake at the weekend house today. It could all be so simple. I have wireless boot and I bought a water resistant DS18B20. So I would only need to solder 4 pins: vin, gnd, and 2 wires for the sensor and program wirelessly. Easy. The board would be completely flat.

Instead I have to solder on the headers, do a ISP programming of the bootloader, add a board to add the vin measurement divider etc. etc. This makes it complicated and much larger than it really needs to be. Or I could purchase PowerShield and double the cost of the project.

I used 3 megaohm : 6 megaohm today since I'm planning to use a 9v battery.

Here's how it would work for everybody:

Use 1 : 6 megaohm to cover the whole range of the voltage regulator which is clearly the general purpose range. Use A7 which doesn't interfere with digital in/outputs. Don't use a cap - not needed just call analogRead twice. Layout the board such that if somebody doesn't like it they can sever the connection between divider and A7 - similar to the USB adapter.

The atmega328p allows me to measure vcc natively. So really the need for the voltage divider originates from the fact that the Moteino comes with a voltage regulator and vcc breaks down very rapidly in the end. Just view the divider as part of the power system of the Moteino and it really belongs in the basic package.

Now if somebody needs a special implementation, or a cap, or finer resolution etc. Fine, let them add their own circuit on an add-on board.

Then I would only need to convince Felix to preburn my bootloader for my Moteinos  ;)

Joe

DPBaker

I bought 8 moteino boards & 8 weathershields, putting each of them in rooms in the house, 1 outside and 1 in the fridge! Just doing some experiments to see if I can determine patterns of behaviour and maybe generate alerts if the behaviour changes. I do notice humidity in the bathroom sensor jumps up 10% within 1 minute when someone takes a shower so should be possible to detect these kinds of activities.

The systems are powered from 9V batteries as they are in locations that don't have powerpoints nearby and I want them to be unobtrusive so they are in small plastic boxes. I did manage to log temp, humidity & pressure for a week or 2 but now have some questions:

1) I am using the code obtained here but always get a battery reading of 1023.
    pinMode(A3, OUTPUT);
    digitalWrite(A3, LOW);
    battV=analogRead(A7);
    pinMode(A3, INPUT);
I posted a related question on May 16th when I was powering the system off USB and hadn't tested on 9V but then I was getting a reading of 966. With 9V it seems the battery detection isn't working, or at least not like I thought it would. Anyone know why? I did read somewhere about a resistor being changed from 1k to 10k and as I bought the boards recently I would assume I have the newer boards which should have fixed any problem? Or will the battery detection just not work with a 9V input as it is? If not, what changes could I make?

2) Out of 8 systems, 3 stopped working about 1 week after the battery went flat. I still have 5 going after about 2 weeeks but I assume they won't run a lot longer. I see a posting from TomWS saying "Weathershield can NOT be powered from a 9V source due to it's 'switchable' battery monitor.  With a 9V source, the PMOS transistor is ALWAYS biased on" but I am also a bit confused by that - isn't the A3 enable/disable & the new resistor supposed to fix that?
I want to try increasing the battery life as much as possible so would like to understand this more and make whatever change is needed.

3) Anyone have any experience modifying the weathershield one step further to turn the whole board off when not in use? I am (with the present version at least) measuring every 1 minute and am trying not to poll less often than this as I will miss events. In fact I was thinking of adding a light sensor to the unit in the fridge and including light readings but I guess most people don't leave the fridge open for a whole minute so if I could get better battery life then I would even experiment with 30 seconds updates. Looking at the specs for the si7021 it seems that giving it 5 seconds to settle down before taking the reading might be plenty so I could have the board turned off until 5 seconds before the readings are needed.

TomWS

Quote from: DPBaker on June 19, 2015, 11:50:04 PM
<snip>
The systems are powered from 9V batteries
I've commented elsewhere on using 9V batteries - very energy inefficient unless you need a voltage above 5V.

I think you should read the thread on the Weathermote thoroughly.  Here are the high points that you should understand:

1. The resistor 'fix' to A3 enable only hid the problem if your Vin is between 3.3V-5V.  It completely fails on any voltage above 6V.
2. Understand how the ADC works, specifically how the reading is a ratio of (Ain/Aref)*1023, where Aref is typically, but not always, 3.3V.
3. The thread discusses appropriate resistors to use if you do have a 9V battery.  You need to replace the onboard resistors for such a high Vin.
4. The Weathermote circuitry is such very low current that it's probably less than 1% of your sleeping budget in the ideal case.  Given that your batteries are dying in days tells me that you have some work to do before you are close to the ideal case.  Net: it is not necessary to 'turn off' the Weathermote.
5. Are you powering down (ie sleeping) between measurements? 

Tom

DPBaker

1,2, & 3 - Thanks for the info. There is a lot going on in this topic with discussion of just using resistor divider, additional transistor and just changing the resistor values in the existing circuit - mention of also changing the resistor for the FET pullup as well. So, I just want to make sure I am not getting confused.

Only 3 of the batteries have died in less than 2 weeks, but here in Asia isn't not uncommon to get fake or used batteries sold as new so wouldn't surprise me if the actual lifetime is much higher - the other 5 are still going ok although until I get the voltage reader working I can't really monitor to see the battery decline. Could measure with voltmeter but I don't really want to disturb the sensors while I am collecting good data.

I am sleeping between readings. My multimeter might not be accurate but as far as I can tell I am drawing 23mA when system is on for a few seconds every minute and about 0.4uA in between readings.

Good news re the weathershield having such low current though, so at least I can eliminate that.

I think I will place an order for some battery holders for 3 x AA cells and see how that goes - at least then I don't have to mess with the battery monitor circuitry and can just concentrate on code for the time being.

TomWS

Quote from: DPBaker on June 20, 2015, 11:28:06 PM
<snip>
I think I will place an order for some battery holders for 3 x AA cells and see how that goes - at least then I don't have to mess with the battery monitor circuitry and can just concentrate on code for the time being.
That's a good practical approach.

Tom