Friday, January 18, 2013

Using LM317T to simulate LIPO battery

I have a few battery operated devices (rechargeable) that I wouldn't mind using only connected to a power source. So I started to find a way to replace a LIPO cell with a power supply. The first (and easiest) answer to this problem is using a LM317 as a power source.
Typical LM317T usage circuit
So I started looking around for how I might build a circuit. I found a lot of information online and started building it. Before this, I still needed to know what the needed voltage is. A standard LIPO cell is rated at 3.7V.

Thinking that this is the max voltage I wanted to target 3.5V to be on the safe side. Creating the needed circuit is simple, I found a lot of resources like this one. I set out to build this and going for a safe build (meaning that a 10ma minimum current draw is needed) I used a value for R1 of 220 ohms (216 measured with meter). You will only get output from the LM317 if there is at least a 10ma load on the output.


Using the formula I ended up using a 330 ohms resistor for R2. The one I have is about 323 ohms that made my voltage be somewhere around 3.43. This is a bit low but I figured it would work.
So this is my finished 3.5ish V power source.

LM317T 3.5Vish volts output
LM317 3.5V regulator
LM317 3.5V regulator back view

Testing the device, the safe way. I need a 5V power supply that won't damage anything and a way to connect the header pins to power. It's a good thing that I have a 5V rechargeable battery and a USB to header pins cable. This is how I test my device with the help of a voltmeter.

Testing of LM317T 3.5V regulator
The voltmeter says that the output is about 3.43V which is where I expected it to be. Powering up a device with this reveals that there is a problem, the device signals a low battery alert (some devices may have features disabled or not perform well when there is not enough power). This is the point (late, I know) when I search for information on the actual voltage of the LIPO cells. Shockingly I was wrong.

The voltages for a LIPO cell should be around these values:
  • 4.2V for a fully charged battery
  • 3.7 for a battery around 80% charge left
  • others I don't need
Since a LIPO battery should not be drained more than 80% to avoid damage it is now obvious that I need to aim for a higher voltage.

And now the fun begins! I replaced my R2 with a 370 ohms. I got a voltage of 3.52. That is strange since a 330 ohms one should have gave me that voltage. Maybe my resistor is bad, anyway I go for a 390 ohms one that should fix the problem. Voltage is up to 3.63. This is not good. I again change my resistor to a 410 ohms one. Still the same voltage.

Then it hit me. The voltage drop might be causing this! And indeed after again changing R2 to 390 ohms and using a variable transformer set to 12V I get the needed 3.87V.

So getting somewhere around 4V from the LM317T using a 5V input is not doable. You can do this however using simple components like resistors and other stuff but I wanted to have a fixed output voltage that does not depend on the input voltage.

When I started this I knew that the differences between the input and output would be small and the LM317 would not generate too much heat (it didn't even heat up to the touch). But now I would be probably powering the circuit from 12V so I heatsink is definitely needed.

The regulator works (with 12V input) and the device does not show a low battery signal anymore.

Since I started using a lot of these header pins to connect different components, I started using a black marker to mark the base of one of the pins to easily know in the future which is the GND pin. You can almost not see it here:
Marked GND pin on the LM217T voltage regulator circuit
I had a few interesting finds along the way, maybe it will help others.
Enjoy!

No comments:

Post a Comment