Connect with us

charging a supercap through a transistor

Discussion in 'General Electronics Discussion' started by mike wax, Oct 10, 2016.

Scroll to continue with content
  1. mike wax

    mike wax

    34
    2
    Oct 10, 2016
    monofull.png

    Hello anyone,
    i'm puzzled by this, please see the picture. i'm charging and discharging a supercap with an arduino and three transistors. the arduino continually measures the voltage across the cap. if Vcap goes over 2.56V it sets the transistors to drain the cap and if Vcap goes under 1V it sets them to charge the cap. so it just cycles up to 2.56V and down to 1V, up & down forever.
    but my stopwatch measurements are way off. when the switch is set to ground (position 1) the circuit completes a whole cycle (1 to 2.56 to 1) in 57s. when the switch is set to Q3 (position 2) the circuit completes the cycle in 40s, 30% faster than it's supposed to. it's just unreal.

    the code goes like this:

    switch is set to either 1 or 2

    1- power up
    2- set DIO_3 HIGH
    loop{
    4- check Vc
    5- if Vc < 1, set DIO_1 LOW, DIO_2 HIGH (charging). red LED on, yellow off
    6- if Vc > 2.56, set DIO_1 HIGH, DIO_2 LOW (draining). yellow on, red off
    }

    i power the circuit on, wait a minute for the cycle to stabilize, then measure the period. i used many online calculators. they all calculated to 57 +/- 1 second.
    when the cap is grounded through the Q3 transistor, the cycle invariably is 40 +/- 1 second.

    can someone tell me what i'm doing wrong?
    thanx, louie
     
  2. Harald Kapp

    Harald Kapp Moderator Moderator

    10,605
    2,368
    Nov 17, 2011
    It's not obvious to me. I have questions:

    How do you "check Vc"? I suppose you measure AIO_1-AIO_2, right? Have you compared the voltages on these lines for the 2 positions of the switch using a separate voltmeter (multimeter)?
    Are both parts of the cycle (charge/discharge) affected by the change in the switch's position in the same way or is there an difference (asymmetry, e.g. charge time is the same but discharge varies or vice versa)?

    The collector-emitter voltage of Q3 will introduce an offset compared to the switch being in position 1. This may also affect the measurement by the arduino.
     
  3. mike wax

    mike wax

    34
    2
    Oct 10, 2016
    thanx, no actually i haven't. i didn't even think of that, because on my first test, my stopwatch matched the calculated period so i assumed the arduino was making an accurate measurement of the cap voltage.

    yes there is an asymmetry. when it's connected through the transistor Q3, charging happens 34% faster and discharging happens 15% faster.

    i been rollin it around in my brain but i can't figure how the VCE could alter the value of VC like this.

    mike
     
  4. Harald Kapp

    Harald Kapp Moderator Moderator

    10,605
    2,368
    Nov 17, 2011
    Don't assume, verify :D The results may hint to the issue you're experiencing. Especially watch the voltage on AIO_2.

    How about this question?

    Nor do I. It's just an observation to be kept at the back of your mind. If you measure Vcap=V(AIO_1)-V(AIO2), see above remark, Vce is eliminated from the measurement.

    Sorry, I didn't make my intention clear. Let me try again: With the switch in position 1, you have a duty cycle DC1. With the switch in position 2, does the duty cycle change noticeably?
     
  5. BobK

    BobK

    7,682
    1,686
    Jan 5, 2010
    With the switch in position 1, the lower side of the capacitor is at ground and the emitter of Q3 is at Vc WRT ground. This will set up a current through Q2 based on Vc and the 15Ω resistor.

    When the switch is in position 2, and the cap is discharging there will be a drop of Vce of Q3 in addition to the voltage of the capacitor. So the voltage seen at the emitter of Q2 will be higher and the discharge will happen faster since it will draw more current.

    Bob
     
  6. mike wax

    mike wax

    34
    2
    Oct 10, 2016
    ok yeah the duty cycle TCHARGE/TTOTAL = 74.5% directly grounded, and 69.5% grounded thru Q3, and yes VC = AIO1 - AIO2. and i am intending to get a new voltmeter later today. thanx :)
     
  7. mike wax

    mike wax

    34
    2
    Oct 10, 2016
    i'm not following here. the emitter of Q3 is connected directly to ground so it should be at 0.

    well during the charging state DIO2 is set high so the base of Q2 is at 5V so there's not supposed to be any current thru Q2 at that point.

    D-OH! of course. i didn't figure that. that explains why it's discharging faster.

    i still don't get, though, why it would be charging nearly 30% faster than it's supposed to. maybe when i get a good voltmeter i'll get a clue. THANX.
     
  8. mike wax

    mike wax

    34
    2
    Oct 10, 2016
    well i assumed wrong. WAY wrong. the problem is the voltage across Q3. during charging VCE is about 40mV. when it starts to discharge, VCE drops to minus 800mV and slowly rises, while discharging, to -400mV, at that point it goes back to charging again and VCE stays around 40mV.
    so i guess it means the the resistance in one direction, RCE, is not the same as the resistance in the other direction, REC. this does make sense, since it's a BJT. VCE = 40mV and VEC = 800mV.
    so AIO2 = -800mV but the actual value that the input port is reading is 0, so the atmega chip isn't seeing the right voltage. i guess.
    that's quite a relief. but i still haven't solved the problem. is there another way to do this?
    thanx, mike
     
  9. mike wax

    mike wax

    34
    2
    Oct 10, 2016
    so i took another 2222a transistor and added it to the circuit at the exact same spot as the first one, only with the E and C reversed. now i have two Q3s connected together and facing each other like dancers to accomodate the current flowing in each direction. so the circuit works better but not much. i think i'll start another thread since the question has changed.
    thanx Harald :)
     
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day

-