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