# voltage sensor

Discussion in 'General Electronics Chat' started by IAN-H, Nov 12, 2017.

1. ### IAN-H Thread Starter New Member

Nov 12, 2017
8
2
I am diabetic and have rigged up a injection pen holder to light up an led when I use the pen. At the mo a battery feeds a capacitor to light the led when I lift he pen. This then slowly fades away over 15min approx. How can I add a small circuit to kill the led after a set period i.e. half hour. I assume something like a voltage sensor, but what do I know?
Ianh

2. ### Dodgydave AAC Fanatic!

Jun 22, 2012
7,515
1,240
xox likes this.

Nov 12, 2017
8
2

4. ### IAN-H Thread Starter New Member

Nov 12, 2017
8
2
Thanks for the quick reply DodgyDave! Is it possible for you to draw a circuit diagram to give me more of an idea.
Ianh

5. ### Dodgydave AAC Fanatic!

Jun 22, 2012
7,515
1,240
Here is a 555 timer circuit upto 10 mins...
just increase the 220uF capacitor and 2M7 resistor for longer times.
So for 30mins(1800 seconds) try 1000uF and 3M3 resistor.

Last edited: Nov 12, 2017
xox likes this.
6. ### crutschow Expert

Mar 14, 2008
19,754
5,525
Getting 30 minutes with a 555 timer is problematic because of the leakage current of large electrolytic capacitors.
Better to use the a CD4060 timer, as Dd originally mentioned.

Edit: To elaborate on the capacitor leakage problem, a data sheet for a Chinese made electrolytic from Jameco electronics states the leakage current is .
Thus for a 1000μf, 6V capacitor, the leakage would be .01*1000μf*6v = 60μA maximum.
At 5V, that corresponds to 5/60μA = 83kΩ.
This means that the charge resistor must be lower than that value for the capacitor to charge to the applied voltage, worst-case.

Last edited: Nov 12, 2017
xox, absf and RichardO like this.
7. ### ian field AAC Fanatic!

Oct 27, 2012
6,205
1,117
The CR values dodgydave mentions relate to the high capacitance and resistance needed for such a long time period - with capacitance that large, leakage can become significant. resistance that large have issues with tolerance and stability.

You could go for the hybrid approach by running a 555 at a much easier to manage few kHz and divide that down. 32768kHz is the lowest easy to get crystal and it takes a few divider stages to get where you want.

The pcb from a travel alarm clock is another option that needs a lot less divider stages adding on.

Some people try to show off by coding a PIC or AVR to do what a 555 does - for what you want to do, there's nothing wrong with that approach.

8. ### wayneh Expert

Sep 9, 2010
14,784
5,274
I'm confused about what you want. Do you want the LED to stay fully lit for 30 minutes, versus the slow fade over 15 minutes you currently have? Why would you want more than, say, one minute?

9. ### ian field AAC Fanatic!

Oct 27, 2012
6,205
1,117
The TS comes across as not realising that simple circuitry can run the LED fully on for a set period.

10. ### IAN-H Thread Starter New Member

Nov 12, 2017
8
2
Hi Wayne, yes I want the led to stay on for 30mins to show I've used the pen
Ianh

wayneh and GopherT like this.
11. ### wayneh Expert

Sep 9, 2010
14,784
5,274
In that case I think it's worth trying the FET circuit linked by @Dodgydave in #2. It's a lot simpler than using an IC like the 555 or 4060. It won't be an accurate timer but I doubt that matters.

12. ### AnalogKid AAC Fanatic!

Aug 1, 2013
7,033
1,991
Please post a schematic of your circuit, so we can see when the capacitor is charged and how it manages to power an LED for 15 minutes.

ak

13. ### IAN-H Thread Starter New Member

Nov 12, 2017
8
2
simple schematic,battery, capacitor and led in parallel with a switch in the lead between the battery and cap. When you lift the pen the switch closes charging the cap for around 20 secs. When pen is replaced switch is open so led runs of the capacitor. The led gives a strong light for +/- 15mins then fades slowly away, bit like me!

14. ### AnalogKid AAC Fanatic!

Aug 1, 2013
7,033
1,991
Is there any current limiting between the battery and the capacitor? If not, how can it take 20 seconds to charge up? Is it a supercap?

Also, why doesn't the LED clamp the max capacitor voltage to 2 V?

Is there any current limiting between the capacitor and the LED? If not, how can the capacitor run the LED without the LED burning up?

15. ### IAN-H Thread Starter New Member

Nov 12, 2017
8
2
Hi, the capacitor is a supercap EECS0HD104V CMOS Memory Back-up 0.1F PANASONIC normally used for back up on cameras/phones etc. the led has a built in resistor so is rated for 12v.

16. ### neonstrobe Well-Known Member

May 15, 2009
73
12
Hi
Electrolytic capacitors are no good at all for long time delays - as mentioned in post #6. For long delays you need to use conventional plastic dielectric (polyXXX). I've used 22uF with 1G for really long delays. Fr 30mins you need a time constant of about 1800s so a 22uF with 100M resistor will work. It will need to charge (or discharge) for just under its time constant.
I would use a JFET or MOSFET to buffer the ouput. A 2N7000 might work. It has a max. gate leakage current of 10nA, which may affect the timing slightly, but in practice should be lower, and will act as a source follower approx. Vt (2V) behind the capacitor voltage. I would then use a Schmitt trigger using a differential input stage so that the other side can compare with a preset voltage, which you can adjust to set the 30 mins. The LED can be operate from the Schmitt output. That should need say two NPN transistors for the diff pair and a PNP to drive the LED.

17. ### AnalogKid AAC Fanatic!

Aug 1, 2013
7,033
1,991
In post #1 the LED is on for 15 min running on the cap only; battery power is completely off. For it to stay on for 30 min, that means ditching the supercap and going with a 30 min. timer circuit driving the LED at full brightness for the entire 30 minutes, after which the timer circuit still is powered but its output is off. Is this what you are after? If so, what about a flashing LED? Flashing would cut the LED power by 95%.

This would be a low power counter circuit based on the CD4060 mentioned above. The pen holds it in reset; removing the pen lets it run. One of the outputs drives the LED, or a small MOSFET to drive the LED if you want more brightness. Another, higher order output is fed back to inhibit the internal oscillator, causing the circuit to freeze with the LED off.

Hmmm - another question - If the pen is replaced before the 30 minutes are up, should the circuit stop immediately of continue for the rest of the timing cycle?

ak

Last edited: Nov 14, 2017
18. ### IAN-H Thread Starter New Member

Nov 12, 2017
8
2
The pen is out for a short time, enough time to do inject This appear to allow the build up in the condenser to do it's job. I don't like the idea of the circuit being live all the time. A flashing led would drive me crazy early in the morning.

19. ### AnalogKid AAC Fanatic!

Aug 1, 2013
7,033
1,991
What is the reason for having the LED on for 15-30 minutes?

ak

Last edited: Nov 15, 2017

Nov 12, 2017
8
2