<div dir="ltr">Chip,<div><br></div><div>If your Vcc IS stable you can use it as a reference and convert your ADC reading of the battery voltage directly into a real voltage. But I would think that using the internal 1.1V reference would give you a more accurate measurement even if your Vcc drifts. An other issue for your application may be adjusting the battery voltage reading for temperature. The reference or the output of your buck-boost converter may change with temperature. At the same time, the useful capacity of your batter will definitely change with temperature. The link below has some charts but you may be able to get THE chart for YOUR battery from the manufacturer. </div><div><br></div><div><a href="http://www.houseofbatteries.com/custom-batteries-custom-lithium-polymer-c-1_67-l-en.html">http://www.houseofbatteries.com/custom-batteries-custom-lithium-polymer-c-1_67-l-en.html</a><br></div><div><br></div><div>Shane</div><div><br></div><div>Shane</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jan 27, 2015 at 1:57 PM, Shane Trent <span dir="ltr"><<a href="mailto:shanedtrent@gmail.com" target="_blank">shanedtrent@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Chip,<div><br></div><div>Here is the link for using a high-side P-FET to connect your battery voltage divider long enough to measure the voltage. This would let you use lower value voltage divider resistors for a more accurate measurement. </div><div><a href="http://jeelabs.org/2013/05/18/zero-power-measurement-part-2/" target="_blank">http://jeelabs.org/2013/05/18/zero-power-measurement-part-2/</a><br></div><div><br></div><div><br></div><div>I did a blog post on options for reducing voltage divider power consumption.</div><div><a href="http://fettricks.blogspot.com/2014/01/reducing-voltage-divider-load-to-extend.html" target="_blank">http://fettricks.blogspot.com/2014/01/reducing-voltage-divider-load-to-extend.html</a><br></div><div><br></div><div><br></div><div>You would still need to measure your internal 1.1V reference with your ADC so you can convert your ADC counts into millivolts. There may be a newer article on this but I do not have it bookmarked if there is.</div><div><a href="http://provideyourown.com/2012/secret-arduino-voltmeter-measure-battery-voltage/" style="font-size:12.8000001907349px" target="_blank">http://provideyourown.com/2012/secret-arduino-voltmeter-measure-battery-voltage/</a><br></div><div><br></div><div><br></div><div>Shane</div><div><br></div><div><br></div></div><div class="gmail_extra"><div><div class="h5"><br><div class="gmail_quote">On Tue, Jan 27, 2015 at 1:43 PM, Charles McClelland <span dir="ltr"><<a href="mailto:chip@mcclellands.org" target="_blank">chip@mcclellands.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div>Shane and all,</div><div><br></div><div>I am coming back to this after some time.  I have re-red your message below a few times and read the linked article and I want to make sure I am understanding this correctly.</div><div><br></div><div>Here is the problem I am looking to solve:  I am building a battery powered sensor that depending on the use case, could have battery packs supplying from 1.8 to 5.5V.  I then use a TI TPS63031 (which with Pete’s help we can now solder reliably despite the diabolical SON10 PowerPad packaging) a buck-boost regulator to provide up to 800mA at 3.3V.  This device will be one of those Internet of Things things so I want it to report its batter level so I know when it is time to go retrieve it and replace the batteries.  </div><div><br></div><div>I looked at the link below and decided that it may not relevant as it is solving for a problem I don’t think I have - that Vcc is not stable.  Not sure, so that is why I am reopening this thread.  </div><div><br></div><div>I am making one (large?) assumption, which I think makes my problem easier to solve:  That the TI buck-boost chip will do its best to do its duty to keep the voltage at 3.3V as long as the following are true: 1.8 <= Vin <= 5.5V, Imax <= 800mA, adequate filtering for noise and spikes in current.</div><div><br></div><div>If this assumption is correct, I think I could simply use one of the Analog In pins to do the measurement.  Right?</div><div><br></div><div>Also, I recall there was a discussion in one of our meetings about a circuit that would allow for dividing voltage without suffering constant current loss.  If you know of the link for that circuit, I would be interested.  I remember reading that as you increase the total resistance, you reduce that current loss but introduce potential error and the prospect of noise.  If the input impedance of the Arduino analog ports is 100M ohms, I am thinking that I can use the following:</div><div><span style="white-space:pre-wrap">       </span>- Put a 0.01uF capacitor between the Analog pin and ground to reduce noise (battery levels change slowly after all)</div><div><span style="white-space:pre-wrap">      </span>- Use the following resistors: Vbat to Analog 47k and Analog to ground 56k.  So when Vbat is 5.5V, Analog In should be 2.99V.</div><div><span style="white-space:pre-wrap">   </span>- 100k total resistance is 0.033mA or 5.5mAH over a week which is only 0.3% of my LiPoly battery’s capacity</div><div><span style="white-space:pre-wrap">    </span>- Vbat will then be = analogRead(Analog) * 6 (in mV) give or take percent or two </div><div><br></div><div>Am I thinking about this right?</div><div><br></div><div>Thanks,</div><div><br></div><div>Chip</div><span><font color="#888888"><div><br></div><div><br></div><br><div>
<div style="color:rgb(0,0,0);letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;word-wrap:break-word"><div style="color:rgb(0,0,0);letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;word-wrap:break-word"><div>Charles McClelland</div><div><a href="mailto:chip@mcclellands.org" target="_blank">chip@mcclellands.org</a></div><div><a href="tel:919-624-5562" value="+19196245562" target="_blank">919-624-5562</a></div><div><br></div></div><br></div><br><br>
</div>
<br></font></span><div><blockquote type="cite"><span><div>On Sep 19, 2014, at 10:10 AM, Shane Trent <<a href="mailto:shanedtrent@gmail.com" target="_blank">shanedtrent@gmail.com</a>> wrote:</div><br></span><div><span><div dir="ltr">Cool work Chip. I look forward to reading more about the project. <div><br></div><div>I wanted to pass along a trick that allows you to measure your battery voltage in a standard Arduino setup without requiring a voltage divider. In short, they use Vcc as the ADC reference (as usual) but measure the 1.1V internal reference to calibrate the ADC and then convert ADC counts to millivolts. Just using the 1.1V reference on the ADC would require a voltage divider to drop Vcc to less than the 1.1V ADC max limited by the 1.1V reference. I am using it with a Li-poly battery powered project and seemed pretty accurate. There is extra code to get the correct registers for several chips but it is pretty straight forward.<div><br></div><div><a href="http://provideyourown.com/2012/secret-arduino-voltmeter-measure-battery-voltage/" target="_blank">http://provideyourown.com/2012/secret-arduino-voltmeter-measure-battery-voltage/</a><br></div></div><div><br></div><div>Shane</div></div></span><div class="gmail_extra"><br><div class="gmail_quote"><span>On Fri, Sep 19, 2014 at 8:48 AM, Charles McClelland <span dir="ltr"><<a href="mailto:chip@mcclellands.org" target="_blank">chip@mcclellands.org</a>></span> wrote:<br></span><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><span>Glen and Rodney, yes the tradeoffs part is typically how things work - but not today. <div><br></div><div>I am not sure exactly what RTFM stands for but I have received this friendly advice in the past.  Well, when I looked at my FONA board’s instruction set, it turns out there is a function in Adafruit’s library to get the battery voltage.  So, looks like I am getting this functionality for “free”.</div><div><br></div><div>Once I saw this, I implemented the situation I described in yesterday’s post.  My trail counter now sends the current battery voltage when it reports the trail counts.  Event better, Ubidots (will do a writeup on them for the blog) will send me an email or text message when the battery voltage drops below a certain level.  While I am in the learning phase, I think this will be very helpful.</div><div><br></div></span><span><div>Here is what it looks like: <span><Screen Shot 2014-09-19 at 8.39.27 AM.png></span></div><div><br></div><div><span><Screen Shot 2014-09-19 at 8.46.52 AM.png></span></div><div><br></div><div><br></div></span><div><div><div>My next step is to add one more “widget” to send the signal strength (more discovery in the Adafruit library) at the beginning like I do with the GPS data.</div><div><br></div><div>Of course, the FONA board is not cheap - $39 - so I know I am paying for this functionality.  </div><div><br></div><div>Chip</div><div><div><div><br></div><div><br></div><div><br><div><div>On Sep 18, 2014, at 3:13 PM, Glen Smith <<a href="mailto:mrglenasmith@gmail.com" target="_blank">mrglenasmith@gmail.com</a>> wrote:</div><br><blockquote type="cite"><div dir="ltr"><div><div><div><div><div>Charles,<br><br></div>As you said in a previous email, "As with all things electronic, there is a trade off."<br><br></div>How much is it going to add to your BOM cost is the bottom line. Once the part is on board, measuring and transmitting the data is virtually free, and for your prototypes, can provide useful information. Bench testing batteries and extrapolating their lifetimes gets you close to an answer, but ambient conditions on your bench are a far cry from real world. Getting the metadata and watching it graph would be interesting to ME. But now we start down a slippery slope again - how does temperature affect that battery life? Let's add a temp sensor to your system... (Do I remember that there is a temperature sensor in the 328? Google says yes:<br><a href="http://playground.arduino.cc/Main/InternalTemperatureSensor" target="_blank">http://playground.arduino.cc/Main/InternalTemperatureSensor</a> ). So assuming that the 328 is sleeping most of the time, the die should be pretty close to the ambient temp inside your enclosure. Temperature might very well affect trail usage - so reporting that regularly might be useful for the primary function as well.<br><br></div>Collecting a graph of battery voltage and temp vs time may be of value for other projects that you come up with in the future. It may not be of much interest to Parks & Rec - except to know when a sensor may need maintenance. It might be nice if a sensor went unexpectedly off line to be able to look at the last reported voltage. If it is close to nominal, chances are something else happened. Close to the built in cut off voltage of the battery would lead me to suspect things are still intact, but have no juice.<br><br></div>Personally, I think I would add a spot for the component on the board, with a jumper setting or code support to know if it is populated. Early deployed units would be populated and the data watched. If I discovered that the data was boring, future units would lack the sensor.<br><br></div>Glen<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Sep 18, 2014 at 2:27 PM, Charles McClelland <span dir="ltr"><<a href="mailto:chip@mcclellands.org" target="_blank">chip@mcclellands.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">Rodney, <div><br></div><div>Agreed, it is overkill for my current non-connected sensor for exactly the reasons you state below.  I should have mentioned that this is for the GPRS based connected sensor which has much higher and more variable power demands.  </div><div><br></div><div>I was reading <a href="http://e2e.ti.com/blogs_/b/fullycharged/archive/2014/08/12/where-39-s-the-gauge-part-1.aspx?DCMP=fullyc&HQS=pwr-bms-gmap-wheresmygaugept1-fullyc-20140812-myti-en" target="_blank">this article</a> from the TI power folks who - unsurprisingly - thought that fuel gauges should be included in all battery designs.  I started thinking about how emotional this engineer was getting with words like “baffled”, “excited” and “flustered”.  I figured there must be something here.  Full disclosure - TI also sent me a sample of their <a href="http://www.ti.com/product/bq27410-g1" target="_blank">BQ27410-G1 Gas Gauge chip</a></div><div><br></div><div>I am planning on putting a connected sensor in the local Ulmstead park to measure vehicle traffic.  I was thinking about the “metadata” I could send with each transmission and I realized that including the battery voltage might be a good thing.  I could watch the battery levels and know when I needed to swing by the park to change the battery.  I am using the Sparkfun one you pointed out below so, it is not about under voltage but about remote monitoring.  Over time, I will probably get a sense of how long a battery lasts so perhaps this is just for the learning phase.  According to the RC blogs, cold weather can affect LiPO performance so, the battery life could change significantly as we go from Fall to Winter.</div><div><br></div><div>Does this make sense or am I making this more complicated than it needs to be?</div><div><br></div><div>Thanks,</div><div><br></div><div>Chip</div><div><div><br><div><div>On Sep 18, 2014, at 2:09 PM, Rodney Radford <<a href="mailto:ncgadgetry@gmail.com" target="_blank">ncgadgetry@gmail.com</a>> wrote:</div><br><blockquote type="cite"><div dir="ltr"><div><div>The subject of Lipo batteries and battery fuel guage were discussed at a previous TriEmbed meeting.  For your application, I think it is overkill as what you are doing is constant - wake up, take a measurement, log it, and go back to sleep - so you should be able to determine the length of time a charge will last without it.<br><br></div>The issue with Lipos is that you should not overuse them so they go undervoltage, but why not go with one with builtin overcharge, overcurrent and undervoltage circuitry built in, like this one from Sparfun:<br><br><a href="https://www.sparkfun.com/products/341" target="_blank">https://www.sparkfun.com/products/341</a><br><br></div>They have a variety of sizes from from 40mah to several thousand mah, so you could first test your circuit with the smaller unit, determine how long it will last, and be able to better extrapolate out how big of a battery you would need to last for the amount of time you would need between charges.<br><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Sep 18, 2014 at 1:11 PM, Charles McClelland <span dir="ltr"><<a href="mailto:chip@mcclellands.org" target="_blank">chip@mcclellands.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">Michael, <div><br></div><div>Thanks for taking a look at the power supply thread,  as my projects run on batteries, I have put some time into this.</div><div><br></div><div>Here are a few thoughts:</div><div><span style="white-space:pre-wrap">        </span>- Like you, my circuits draw a relatively small amount of current.  I developed these tests at a higher current so they would not take a month to run</div><div><span style="white-space:pre-wrap">   </span>- your current regulator (<a href="http://ww1.microchip.com/downloads/en/DeviceDoc/20001826C.pdf" target="_blank">MCP1700-3302E</a>) is Linear so it will dissipate - read waste - power equal to the product of the difference between Vin and Vout time current (Eqn 6-1 in data sheet)</div><div><span style="white-space:pre-wrap">        </span>- This is where I started but I decided to move to a switched power supply for three reasons:</div><div><span style="white-space:pre-wrap">            </span>- They are battery omnivores - since the <a href="http://www.ti.com/lit/ds/symlink/tps63030.pdf" target="_blank">TPS63031</a> is both boost and buck and is over 90% efficient over a large range (1.8-5.5Vin) - I can throw all sorts of batteries at it</div><div><span style="white-space:pre-wrap">              </span>- As they are more efficient, they should throw off less heat - potentially a big deal since I put them in a box and bury them</div><div><span style="white-space:pre-wrap">           </span>- This supply can handle from very small 25uA to 800mA currents</div><div><br></div><div>As with all things in Engineering, there are some trade-offs I had to accept:</div><div><span style="white-space:pre-wrap">     </span>- more expensive</div><div><span style="white-space:pre-wrap"> </span>- QFN packaging - ugh</div><div><span style="white-space:pre-wrap">    </span>- weird and exotic new component required - an inductor - no really!  There are a bewildering number of choices here!</div><div><br></div><div>Some suggestions:</div><div><span style="white-space:pre-wrap">  </span>- I would be happy to loan you my test rig which you could use to test your current power supply and compare it to the three I made.  </div><div><span style="white-space:pre-wrap">  </span>- I added the Excel spreadsheet with the full set of tests and results to the posting on the <a href="http://triembed.org/blog/?page_id=234" target="_blank">Triembed.org</a> site</div><div><span style="white-space:pre-wrap">     </span>- I could give you a TPS63031 breakout board so you could test the supply in your circuit without the pain of soldering - I have some extras</div><div><span style="white-space:pre-wrap">     </span>- You could look at commercial options such as the little breakout boards from Pololu - I have <a href="http://www.pololu.com/product/2122" target="_blank">one of these you could borrow</a> if you like</div><div><br></div><div>Hope this helps.  </div><div><br></div><div>BTW, my next step in my power supply obsession is to add a battery fuel gauge to the circuit so my Arduino can check it and so I could use LiPO batteries with more confidence.</div><div><br></div><div><br></div><div>Chip</div><div><br></div><div><br></div><div><br><div><div>On Sep 16, 2014, at 5:00 PM, <a href="mailto:triembed-request@triembed.org" target="_blank">triembed-request@triembed.org</a> wrote:</div><br><blockquote type="cite"><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important">MCP1700-3302E</span></blockquote></div><br></div></div><br>_______________________________________________<br>
Triangle, NC Embedded Computing mailing list<br>
<a href="mailto:TriEmbed@triembed.org" target="_blank">TriEmbed@triembed.org</a><br>
<a href="http://mail.triembed.org/mailman/listinfo/triembed_triembed.org" target="_blank">http://mail.triembed.org/mailman/listinfo/triembed_triembed.org</a><br>
TriEmbed web site: <a href="http://triembed.org/" target="_blank">http://TriEmbed.org</a><br>
<br></blockquote></div><br></div>
</blockquote></div><br></div></div></div><br>_______________________________________________<br>
Triangle, NC Embedded Computing mailing list<br>
<a href="mailto:TriEmbed@triembed.org" target="_blank">TriEmbed@triembed.org</a><br>
<a href="http://mail.triembed.org/mailman/listinfo/triembed_triembed.org" target="_blank">http://mail.triembed.org/mailman/listinfo/triembed_triembed.org</a><br>
TriEmbed web site: <a href="http://triembed.org/" target="_blank">http://TriEmbed.org</a><br>
<br></blockquote></div><br></div>
</blockquote></div><br></div></div></div></div></div></div><div><div><br>_______________________________________________<br>
Triangle, NC Embedded Computing mailing list<br>
<a href="mailto:TriEmbed@triembed.org" target="_blank">TriEmbed@triembed.org</a><br>
<a href="http://mail.triembed.org/mailman/listinfo/triembed_triembed.org" target="_blank">http://mail.triembed.org/mailman/listinfo/triembed_triembed.org</a><br>
TriEmbed web site: <a href="http://triembed.org/" target="_blank">http://TriEmbed.org</a><br>
<br></div></div></blockquote></div><br></div>
</div></blockquote></div><br></div></blockquote></div><br><br clear="all"><div><br></div></div></div><span class="HOEnZb"><font color="#888888">-- <br><div><div dir="ltr"><span style="color:rgb(0,0,0);font-family:HelveticaNeue-Light,'Helvetica Neue Light','Helvetica Neue',Helvetica,Arial,'Lucida Grande',sans-serif;font-size:16px">A blog about some of my projects.  <a href="http://fettricks.blogspot.com/" target="_blank">http://fettricks.blogspot.com/</a></span><br></div></div>
</font></span></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><span style="color:rgb(0,0,0);font-family:HelveticaNeue-Light,'Helvetica Neue Light','Helvetica Neue',Helvetica,Arial,'Lucida Grande',sans-serif;font-size:16px">A blog about some of my projects.  <a href="http://fettricks.blogspot.com/" target="_blank">http://fettricks.blogspot.com/</a></span><br></div></div>
</div>