This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

WEBENCH® Tools/EK-TM4C123GXL: how can i measure battery level in my tm4c123gh6pm

Part Number: EK-TM4C123GXL
Other Parts Discussed in Thread: TM4C123GH6PM, , BQ24210

Tool/software: WEBENCH® Design Tools

Dear Experts,

now i am working with tm4c123gh6pm based EK-TM4C123GXL evaluation kit, and i was powered up with 4*1,2V AAA battery, then i want to measure the battery level but i had a confusion in this circuit, anyone can help to find the solution for measuring battery level.

can i use voltage divider for measure the battery level through ADC or i will move to any battery monitor ic's which is best for that.

now my 4 AAA battery given 5V output, each battery is 1.2v and 1200mah

  • It depends on how accurately you want to measure the voltage. A simple voltage divider will allow you to scale the voltage in half so that you can measure it with an A to D input pin. Unfortunately the voltage divider will create a leakage path that will slowly discharge your batteries. You can connect the lower end of the voltage divider to a GPIO pin instead of GND and then drive that GPIO pin low only when taking the A to D measurement. You will loose some accuracy because of a small offset caused by the low side driver of the GPIO pin, but it should be accurate enough to determine that the batteries are getting too low. Also keep in mind, that the  A to D is impacted by the Vdda (reference) voltage. When your battery voltage drops to the point that your regulator can no longer provide 3.3V, the A to D will no longer be accurate.

  • Bob Crosby said:
    You can connect the lower end of the voltage divider to a GPIO pin instead of GND and then drive that GPIO pin low only when taking the A to D measurement.    You will lose some accuracy

    Beyond 'Losing Accuracy' - that 'GPIO' when  (removed from ground) - 'Subjects the MCU's ADC pin to, 'Full Battery Voltage!'    (which likely exceeds the MCU's input specification)

    In fact that, 'Selective Ground Switching'  of various - even multiple (bottom side) resistors - proves quite valuable & effective.    It must be insured though - that any/all voltage levels presented to the 'MCU' (or other device) remain (at ALL times) w/in spec...    The method described earlier provides level protection - but  'ONLY briefly!'  (when & while the ADC is being engaged.)    That's not desired...

    Instead - a method must be developed to 'Open the battery's 'undivided voltage' path' to the ADC - to prevent (unwanted) battery drain.   Certain 'elemental'  transistor-based RC networks avoid the 'dead times' (while the MCU is starting up) - and may themselves be (properly) bypassed by a GPIO - yet only when 'SAFE & NEEDED!'

    Note too - it is our experience that  Alkaline AAA (or AA) cells produce 1V5 as  'normal/fresh' terminal voltage.    NiMh cells come closer to the poster's 1V2 observation - and offer 'Recharge benefits.'    As the current output of the AA cell substantially exceeds that of the AAA - unless size is absolutely critical - the AA proves a superior choice.   (usually both AA & AAA are similarly/identically priced - yet the AA  cells produce higher output power - will last far longer (under identical op. conditions - thus deliver higher value!)

  • Dear cb1_mobile,

    thanks for the reply and Sorry for the delayed answer, you said AA is best compare than AAA, i am not aware about the battery powered MC's, so i don't know the connections and all, if you can kindly send me the schematic for connect AAA rechargeable battery to my tiva C and how to monitor the voltage level and how can i recharge the battery with 12v adapters,  thank you.

  • My friend - (still) unknown is your battery type!   From your past description of 1V2 (1.2V) Terminal Voltage - it may be assumed that yours is a NiMh chemistry - rechargeable battery.   Is that correct?

    I have justified the advantages of such 'AA sized cells over AAA.'    (i.e. more power, longer battery life, same cost ... AAA's sole advantage is smaller size - yet you 'pay the price' in increased charging need & activity.

    Li-Ion battery - much newer - is far more efficient than either of these (older) battery chemistry types - and warrants your consideration.   Note too that a 'single' Lithium-Ion cell yields a terminal voltage of ~4.2V when freshly charged - dropping to ~3.6V during (much) of its use.   (You must regulate the voltage Down from that 4.2V level - to the MCU's required 3V3.)    The cost of a single Lithium-Ion cell (may) be less than your (assumed)  FOUR  NiMh batteries - and the Lithium-Ion cell is likely to provide increased current (thus longer life between charges) - another benefit.

    I believe that furnishing a schematic (now) - when your battery is still (much) unknown - makes little sense.

    How did you choose a 12V 'Adapter' as a Re-Charge Solution?   You must reduce that voltage substantially to Re-Charge - and that will generate (unnecessary heat) which may stress components.

    Do note that (in my opinion) there is a (slight) error in Bob's posting.   He has directed you to, 'Deploy  the  GPIO Ground Circuit' - but ONLY - when you seek to 'Measure the Battery Voltage!'   Does not that mean - that the ADC Input will see your (near) 'FULL Battery Potential' - MOST of the time?   And that cannot be good.    Perhaps Bob may note this comment - and advise...

  • CB1,

    Thank you for pointing out this potential issue. If the full battery voltage stays below the maximum Vin of the GPIO pins on this device (5.5V), we should be OK. However, as you anticipated and I did not, the original poster later requested information about recharging circuits. As it is likely that the during recharge the supply voltage exceeds the 5.5V limit, my suggestion to use a GPIO pin to turn off the voltage divider is a bad one. A discrete circuit with a breakdown voltage higher than the charging circuit can provide (with additional safety margin) is called for.

    Surya has an additional related post: https://e2e.ti.com/support/power-management/f/196/p/820456/3035683#3035683 which I have pushed to the battery charger team. 

    You have a lot more experience in the field battery charging circuits than I. I appreciate your inputs. 

  • Bob,

    Thank you - indeed, 'Small Tech Firm SURVIVAL' necessitates such (beyond the MCU) - Real-World Design Experience & Problem-Solving...  

    And exactly  as you so well noted - 'Anticipated Problem Arrivals.'   (that is perhaps my key role - in training eager yet (mainly) young & less experienced Tech Staff!)

    You were (further hindered) as our poster did NOT expressly declare that his App was (likely) to involve, 'Charging.'   My pick-up of the '1V2 per cell output level'  - signaled/drove that recognition.   (1V5 of course - is the 'expected level' of a, 'Non-Re-Chargeable' (likely Alkaline) cell...)

    The (proper) protection of (both) the electronic system AND the 'highly flammable' modern batteries IS 'Non-Trivial' - and should not be attempted w/out  'Full Awareness & Exhaustive Safe-Guards!'     (i.e. KIDZ  (i.e. Non-Posters) - DO NOT - 'Try this at home!)     

    At most all of the 'giant firms for whom we consult' - when such Re-Charging & Lithium-Ion Batteries are 'in play' - there are ALWAYS, 'Metal Fire Buckets' ... widely dispersed - and ready (and waiting) for the inevitable 'Smoldering & "Board ON FIRE"' - brought on by (any one of numerous) potential mistakes!    

    It should be noted that this, 'Re-Charging Challenge' proves so severe - that (almost) ALL of the Cordless, Power-Tool Vendors - produce Chargers which ONLY ... Accept the Batteries 'When removed from the Tool' - thus avoiding 'over-or transient voltage damage' to the 'Rest of the electronics.'    (they (may) have some justification as the Battery Connector penetrates far up w/in the Tool - complicating the application of charging voltage.)   (and of course - I do not believe that - is (not) their 'solution' - (really) ... that of  Avoidance?)

  • Dear friend,

    thanks for your reply and i want to develop the power supply for re charge my device(TivaC Uc based) battery . that power supply design must support solar input instead of dc adapter, can you please suggest the idea to complete that, 

    1. which battery is suitable for that (lithium ion battery is ok for that)

    2. which regulator or dc to dc converter IC is suitable for chare my battery with DC adapter and Solar(at time any one of them).

    3.in my home some days solar can't generate the output that why i ask the design support solar and DC input features. if the design support solar and DC i can charge the battery when solar does not perform well.

    4. if that design is possible, can i connect the device power pin directly to the battery charging terminal.

    5. Solar panel 5v link: https://www.banggood.in/5V-10W-Portable-Solar-Panel-Slim-Light-USB-Charger-Charging-Power-Bank-Pad-p-1297325.html?rmmds=buy&cur_warehouse=CN

    6. Dc adapter 5v 2A

  • And back now to our 'Dear Friend,'

    Staff/I believe it best to, 'Tune our Response to that of the client.'     As your response took '9 days' - we'll (try) to match that!     With such (long) time passage - staff must  'Re-Read your thread's history' - as short-term memory has clouded.     This of course places added time & effort burden upon my staff - and your talented Vendor agents.     Perhaps the implications of such unexplained, 'long-term silence' is something you (may) wish to consider...

    As your post has now, 'Strayed (very) FAR from the MCU' - perhaps redirecting it to a, 'Forum more suited to: Batteries, DC-DC Converters, & Solar' - makes great sense.

  • This is beyond my area of expertise. I am transferring your question to the battery management IC people at TI.

  • Bob,

    May this humble reporter note that - while submerged - at/around Catalina's sandy bottom - our device detected multiple exhibits of  your 'diverse expertise.'    (that 'Lone-Star' logo is hard for (even) the flow of salt-water - to thoroughly 'erode and/or dissolve'!)  

    Hard to imagine those Tech Areas 'escaping' your interest and/or mastery...

  • Hi surya,

    If you want a 1S LiIon battery charger that is capable of using either a 5V low impedance adapter or a higher impedance solar cell, I suggest reviewing http://www.ti.com/tool/TIDA-01556 which charges directly from a 5V adapter but needs host software to find the MPPT of the solar panel.

    Regards,

    Jeff 

  • Dear Jeff,

    thanks for your reply and suggestions then this  http://www.ti.com/tool/TIDA-01556  design kit cost is around 7000/INR but i want to make low cost 1A current support solar charger for my tiva c kit and also it support battery charging that's all. 

    with regards 

    surya

  • Surya,

    If you solar panel MPP is  >4.2 but < 7V you might consider the BQ24210 linear charger. 

    Regards,

    Jeff