digitaldanny / AudioEffectsGlove

A hand tracking glove that controls parameters of various audio effects.
1 stars 0 forks source link

Battery Charging Circuit - Prototype #41

Closed digitaldanny closed 3 years ago

digitaldanny commented 3 years ago

Describe the solution you'd like

Additional context Research for this circuit was completed in #25.

digitaldanny commented 3 years ago

Instead of using voltage regulators as constant voltage and constant current sources, I could use a current mirror for the constant current source.

digitaldanny commented 3 years ago

Parts list

Part Number Description Quantity
PRT-13853 3.7V 110 mA Li-ion Battery 1
LM339N Quad Linear Comparator 1
digitaldanny commented 3 years ago
digitaldanny commented 3 years ago

Originally, I was planning on using a direct comparison with the battery voltage and a 4.2V reference for switching between CC and CV circuits. The problem with direct comparison for a slowly changing voltage is that the comparator output will probably bounce around between low/high when the battery voltage gets to 4.2V. The Schmitt trigger action uses a comparator to produce stable level-crossing switches in contrast to the action of a straight reference comparison.

Using a Schmitt trigger, once the battery crosses the 4.2V threshold, it will switch to the CV circuit. The battery would have to drop to a much lower voltage level before the CC circuit is activated again (I'm thinking around 3.9V??). As shown in the simulation below, I have found values for R_offset, R1, and R2 on the op-amp's positive terminal that creates a Vutp = 4.2V and Vltp = ~3.9V. Ideally, I can use this circuit to control whether CC or CV circuits are connected to the battery.

4 2V Schmitt Trigger

digitaldanny commented 3 years ago

I'm testing the Schmitt trigger on a breadboard using a UA741CP general purpose op-amp. I am using potentiometers for R_off and Rb (in the LTSpice schematic above). Messing with those potentiometers, I can produce Vutp = 4.2V and Vltp = 3.9V. However, I'm having trouble getting Vout to swing between min and max output voltages. I'm assuming the positive feedback is keeping the high internal gain (A) from swinging the outputs high and low.

I would really like to be able to implement the Schmitt trigger with 1 op-amp since I think I will need 2 of them. However, I can probably solve this problem using an additional op-amp as a direct reference comparison. The output could swing high when the Schmitt trigger's Vout > 3V.

Vin (yellow) vs Vref (blue)

Schmitt Trigger - Vref

Vin (yellow) vs Vout (blue)

Schmitt Trigger - Vout

digitaldanny commented 3 years ago

Building a CCCV circuit with linear regulators

digitaldanny commented 3 years ago

Current Sense Amplifiers - YouTube

digitaldanny commented 3 years ago

Spice model seems to be working correctly. The Schmitt trigger correctly senses 3.7-4.2V thresholds, controlling some npn transistors to switch between the CC and CV circuits. The termination current sensing is working in simulation, but I am a little skeptical that it will work in practice. I did a low-side shunt resistor to remove the possibility of Constant Mode Rejection Ratio (CMRR). This StackExchange thread does a good job of explaining this issue. I will try breadboarding the circuit for high-side sensing to avoid the change in ground reference for the battery, but I will change back to low-side if my high tolerance (~5%) resistors are causing CMRR issues at the op-amp input.

Functional Charging Circuit - v1

digitaldanny commented 3 years ago

HW Prototype Parts List

Part | Quantity | Ordered?

These parts may not be needed, but I'm ordering them just in case.

digitaldanny commented 3 years ago

Modified the LTSpice simulation to show the battery voltage increasing with a logarithmic curve like it will in the real world. This has shown me that I have 3 issues with my current design.

Expected CV Current Output

digitaldanny commented 3 years ago

I think it might be possible to get rid of the voltage regulator in the constant voltage supply by using a voltage divider and voltage follower.

digitaldanny commented 3 years ago

(1) Built the Constant Voltage circuit on the breadboard. Had to redesign this circuit since I was seeing too much voltage drop across the npn transistors to meet the 4.2V requirement. Also ended up having to use one of my 2 rail-to-rail op amps for the output buffer. Redesign for CV circuit is below.

CCCV Redesign Schematic

I calculated what I believe the battery's min / max internal resistance will be in this stage by using Ohm's law on the max (55mA) / min (1.1mA) possible current draw. The formula I used is R = V/i.

R_batteryMin = 4.2V / 55mA = 76 Ohms. R_batteryMax = 4.2V / 1.1mA = 3.8k Ohms.

I tested the CV circuit's output with Rload ranging between the values calculated above. It is easily supplying 4.2V at anything above ~150 Ohms. Once the load drops to 76 Ohms, the output voltage is only around 4V instead of 4.2V. I don't think this will be a problem since the current draw should drop very quickly in this stage as the battery charges up.

(2) Also had to change the CC circuit design. The basic current mirror circuit would slowly rise over time (after ~10 seconds, it could rise by over 100 mV). Based on what I've read online, this is actually normal for current mirrors trying to output small currents. A possible fix for this is the Wilson Current Mirror, which uses 3 transistors. I went with another approach that uses 1 transistor, and it seems to be outputting ~500 mA for varying loads right now. Will do more testing tomorrow.

(3) I am concerned about 2 things in the current design..

digitaldanny commented 3 years ago

Seeing an issue I hadn't thought of before with the Schmitt trigger. The max output voltage for the LM324 is about 3.8V. When I decrease Roff1 enough to produce a Vupper = 4.15V, the output stays fixed (doesn't produce a Vlower). I think a possible solution is to divide the Vbattery voltage and sense for 2.1V-1.85V instead of 4.2V-3.9V. This allows the Roff1 value to be much larger.

Schmitt Trigger

digitaldanny commented 3 years ago
  • How will the CC circuit behave when the Schmitt trigger ranges from 0-3.5V instead of 0 - 5V (the Schmitt output will use the LM324, which can only swing from 0 - Vcc-1.5). I think the current mirror might not turn fully off in this case.

In test, this was actually problematic. As expected, the current was not switching on/off fully. I fixed this by adding a MOSFET with the Schmitt trigger on the gate that allows current to flow through when the gate voltage is above the Vthreshold.

  • Is it an issue to connect the CC and CV outputs directly? I'm not sure if the CC transistor and the CV FET will switch quickly enough to avoid breaking the lines. Maybe a small resistance or diode would be beneficial here?

Yes, this is problematic. The CC current would be max drawn by the OPA350's low output impedance. I was able to force the current flow direction with diodes D3 and D4.

image

New Concerns/Thoughts

digitaldanny commented 3 years ago

Updates:

digitaldanny commented 3 years ago
Circuit Truth Table Vbat Ibat Schmitt Thresh Circuit Mode
<4.2 V * --- 1 * CC
4.2 V >1.1 mA --- 0 0 CV
4.2V 1.1 mA --- 0 1 Disabled
digitaldanny commented 3 years ago

Updated CC-CV charger circuit schematic:

image