Maker Pro
Maker Pro

Flickering flame simulation with PIR motion sensor - mostly need help with transistor, I think

seanspotatobusiness

Sep 11, 2012
193
Joined
Sep 11, 2012
Messages
193


I have (what I think is) an old oil lamp that used to be my grandmother's which was converted to electric and it has a flickering flame bulb which I think uses neon. The problem is that the light is so dim that it's essentially useless and only serves as a decoration. I wish to use flickering LEDs to increase the light to a useful level. The lamp is in the hall and I only need it to produce enough light to get between the several rooms in my apartment connected by this hall.

1. LEDs
I intend to use these flickering red, orange and yellow 3 mm LEDs which I intend to run at 30 mA. The 3 mm LEDs are presumably preferable to the 5 mm LEDs because they'll dissipate the heat more effectively. I intend to grind and polish the LEDs flat or maybe with a convex cone so the distribute their light better. I will use between 14-30 LEDs and I'm not sure what the best colour mix would be.

2. Power supply

For the supply of power I intend to use something like this variable power supply set to 4.5 V with the LEDs wired in series, possibly with a low value resistor, depending on measurements of the output under a dummy load. Once everything is working, perhaps I can drip superglue onto the turning voltage selector so it never gets changed.

3. PIR sensor
To make the lamp switch on and off automatically I'd like to use a PIR sensor circuit of which there are three available on eBay which may be appropriate:
Adjustable Infrared PIR Motion Sensor Detector Module with Control Circuit Board

Pyroelectric Infrared PIR Motion Sensor Detector Module w. Control Circuit Board

Infrared PIR Motion Sensor Detector Security Module with Control Circuit Boad


All of these operate on between 4.5-20 V.

I think I favour the first one because it says something vague about a "photosensitive setting" and I would like it if the lamp only came on after daylight diminished. Specifically, it says to "use CDS (Defaut: included, not welded)". Google tells me a CdS is a light-sensitive resistor (which contains cadium which is harmful to the enivornment). Presumably they meant soldered instead of welded. Hopefully they can be clear about where exactly I'm meant to solder it (I'll ask now).

I've heard that cheap PIR sensors can be poor in performance. Does anyone know whether a "pyroelectric PIR" is likely to perform better? Or are they all puroelectric? I notice the second sensor has a cover with neat-looking hexagons! Neat though they are, I will probably go for the first for the light-sensitivity.

I think I could use two separate sensors to give a wider arc of movement detection, right? Would I need diodes to stop the logic output of one PIR going into the one which has not been triggered?

4. Transistor
Of course I will need some transistor to bridge the gap between the PIR sensor and the LEDs. I'm going to need help selecting one. I already happen to have two but I'm not sure if either are suitable:

IRF5305PBF MOSFETs
- but these seem to (if I read the specs right) specify a Vgs of 4 V and I don't think that's possible for me, right? I have no idea what I'm doing but according to my understanding, the gate voltage will be 3.3 V from the first PIR sensor and the source voltage will be 4.5 V so the Vgs will be -1.2 V?? Or will the 3.3 V from the PIR sensor be added on top of the 4.5 V input voltage so the gate voltage will be 7.8 V?
Also, what will the voltage drop be across the MOSFET?

BC337-25 NPN 500mA regular ole transistors - apparently the 'emitter-base voltage' for this is 5 V which is, I guess, even less appropriate?

I could find a different power supply (or set this one higher) if the transistor is going to drop some of my power supply voltage before it gets to the LEDs.

Could someone offer some assistance with this part so I can get this show on the road? The current will be 210-450 mA depending on how many LEDs I include, plus the drain from the motion sensors. Thanks!
 

cjdelphi

Oct 26, 2011
1,166
Joined
Oct 26, 2011
Messages
1,166
Eyes hurt...

These flickering leds 3mm probably require 20ma or so, there's a chip inside the led which creates the flickering

So i'm not sure if they can be run in series, maybe?
 

chopnhack

Apr 28, 2014
1,576
Joined
Apr 28, 2014
Messages
1,576
Eyes hurt...

These flickering leds 3mm probably require 20ma or so, there's a chip inside the led which creates the flickering

So i'm not sure if they can be run in series, maybe?

You actually do not need more than one flickering LED per group in series. See one of my old threads where I learned this.
So now you just have to make sure you have enough voltage to accommodate however many LED's in series to make up for their Vf. If the voltage will not be sufficient then you will just have to make another row of LEDs, again with one flickering at the beginning.

They will flicker randomly to each other and grinding down the domes will definitely scatter and soften the light.

Best of luck with your project!
 

seanspotatobusiness

Sep 11, 2012
193
Joined
Sep 11, 2012
Messages
193
Thank you for this refinement! I will use just one flickering LED in each row.

I want to add a small complication to my circuit in that I want the LEDs to fade on and off initially, a little bit more like an actual flame coming on. I've prepared the following circuit diagram using the power supply set to 6 V. The filling of the capacitor slows the turning on/off of the transistor:


hTuz5Ww.png


How much voltage will drop across the transistor? I think I won't need any resistors to protect the LEDs because their Vf is 1.8-2.2 V each so three will handle 5.4-6.6 V.

Edit: I think I can use the 2N2222 transistor and I'm pretty sure I won't need any resistors to protect the LEDs since they're rated 1.8-2.2 V each anyway and with the transistor there they'll presumably be getting <2 V each.

I have a bunch of salvaged electrolytic capacitors (the ceramics are too hard to find specs for). How about 6.3 V 2200 uF? I also have some 10 V and 16 V but since the signal output is 3.3V, 6.3 V should be enough, right?
 
Last edited:

seanspotatobusiness

Sep 11, 2012
193
Joined
Sep 11, 2012
Messages
193
After some more calculation, I think the capacitance should be lower. Here's an updated schematic:
oxK3S7i.png


I just need to know the voltage drop over the 2N2222 when it's fully open with 6 V and ~210 mA. Is it negligible? Edit: Yes, the drop will be between 0.3-1.0 V between 150-500 mA so there's no need for resistors in this arrangement (good; I hate those things!) although the drop is not negligible.

The show is now on the road. I wonder what will be the first thing to go wrong...
 
Last edited:

cjdelphi

Oct 26, 2011
1,166
Joined
Oct 26, 2011
Messages
1,166
That won't produce a dimming effect, the capacitor current will just enter through base straight to emitter, it just go off quickly
 

cjdelphi

Oct 26, 2011
1,166
Joined
Oct 26, 2011
Messages
1,166
I'd use a darlington and a 10f combo with a resistor in series to base
 

seanspotatobusiness

Sep 11, 2012
193
Joined
Sep 11, 2012
Messages
193
Yeah, I made a mistake with my design. Thanks for catching that!

Does 10F mean 10 uF or 10mF? Not 10 whole farads, right? How does a darlington transistor do this differently? Thanks again.
 

cjdelphi

Oct 26, 2011
1,166
Joined
Oct 26, 2011
Messages
1,166
Sorry i meant 10uf in a darlington pair arrangement (in collector out emitter to the base of the 2nd npn (which is where your circuit starts)

That way, the cap can slowly discharge through the transistor giving a fade
 

cjdelphi

Oct 26, 2011
1,166
Joined
Oct 26, 2011
Messages
1,166
I don't think the saturation is high enough for all those leds, juat from experience, the gain is around 300 for a 2n2222

So 5/7000 is 0.0007142857ma x 300
0.2142857143 amps

Ah 3v for a pi! Even less current!

I should know what simulator it is, i just designed it for you! Every Circuit for chrome/ios/android
 

cjdelphi

Oct 26, 2011
1,166
Joined
Oct 26, 2011
Messages
1,166
Screenshot_2016-04-05-23-16-00.png

Probably slightly different between operating systems, but there's a vast wealth of circuits to look at and learn on there
 

seanspotatobusiness

Sep 11, 2012
193
Joined
Sep 11, 2012
Messages
193
I don't think the saturation is high enough for all those leds, juat from experience, the gain is around 300 for a 2n2222

So 5/7000 is 0.0007142857ma x 300
0.2142857143 amps

Ah 3v for a pi! Even less current!

I should know what simulator it is, i just designed it for you! Every Circuit for chrome/ios/android

Thanks. A pi? Do you mean a Raspberry Pi? I'm not using one of those but the output from my sensor is 3.3 V. Is what what you mean?
 

cjdelphi

Oct 26, 2011
1,166
Joined
Oct 26, 2011
Messages
1,166
I just recall seeing 3volts mentioned after calculating it with 5v
 

cjdelphi

Oct 26, 2011
1,166
Joined
Oct 26, 2011
Messages
1,166
Including diode drop, it has to be more than 7k, anyway you'll see
 

seanspotatobusiness

Sep 11, 2012
193
Joined
Sep 11, 2012
Messages
193
Thanks again. I don't think the transistor in the simulation is working right though. If I give a base-emitter voltage of 2.6 V, the transistor still doesn't fully open? This isn't right for a 2N2222 is it?
 

cjdelphi

Oct 26, 2011
1,166
Joined
Oct 26, 2011
Messages
1,166
It is right yes

You need to place the leds between the 6v rail to the collector of the transistor exactly like the way i did it in my circuit i posted
 
Top