# How To Sense Quick Neon Bulb Flashes w/Phototransistor

#### dl324

Joined Mar 30, 2015
15,511

Ron

Last edited:

#### djsfantasi

Joined Apr 11, 2010
8,790
My post #9 shows the dirt simple schematic I'm using. Too simple to work that is. I tried an Uno thinking it would be more real-time than the Raspberry Pi / Node Red application I started with.
Ok, but the schematic in post #9 won’t work necessarily with an Uno. The thresholds for an Uno are 0 up to 0.2 x Vcc = low. (0.5V 1.0V with 5V VCC). Vcc down to 0.7 x Vcc = high (3.5V and above for 5V VCC)

If your pull-up is to 3.3V, you’re in no man’s land and the Uno won’t be able to switch successfully. That is if post #9 is accurate.

AND, I want to see the actual code you are using in the Uno. When you modified the sample sketch, do you think you may have made a mistake? I do and I’m not being condescending. It’s just that I’ve programmed enough to know that there are an almost infinite number of ways an insidious bug can creep into your code.

EDIT: corrected silly math oops

Last edited:

Joined Jan 15, 2015
7,144
Ok, but the schematic in post #9 won’t work necessarily with an Uno. The thresholds for an Uno are 0 up to 0.2 x Vcc = low. (0.5V with 5V VCC). Vcc down to 0.7 x Vcc = high (3.5V and above for 5V VCC)
I need a channel check. I thought the thread starter was using a Rasbery Pi but now reading post #1 I do see mention of an Arduino. Now I see what I missed.
I tried an Uno thinking it would be more real-time than the Raspberry Pi / Node Red application I started with.
Well alrighty, the Uno would be 5 volt logic. The Pi would be 3.3 volt logic. So yes, with an Uno the logic in post #9 won't work unless the V+ is changed to 5.0 volts.

Ron

#### prairietech

Joined Mar 12, 2013
24
Yes the supply voltage to the phototransistor was changed to 5 volts on the Uno and 3.3 on the RPi.

#### Beau Schwabe

Joined Nov 7, 2019
130
As suggested this might be a voltage threshold level issue. Here is an AGC(Automatic Gain Control) that uses a Photo transistor in reverse bias mode. In reverse bias mode, the PN juction looks like a capacitor to the rest of the circuit that discharges (leaks) proportionally to the amount of light exposed to the PN junction. Another benefit using the Photo transistor in this mode is that you minimize the Miller effect because you don't have the gain of the transistor contributing to amplifying the input parasitic capacitance which could dampen (filter) very quick voltage spikes.

Reference: (Miller effect
https://circuitcellar.com/resources/quickbits/miller-effect/

#### djsfantasi

Joined Apr 11, 2010
8,790
Yes the supply voltage to the phototransistor was changed to 5 volts on the Uno and 3.3 on the RPi.
I’d measure the voltage between ground and the (Uno) GPIO pin output (and NOT connected to the Uno) while the photo transistor was dark and lit. Let us know what they are…

#### prairietech

Joined Mar 12, 2013
24
As suggested this might be a voltage threshold level issue. Here is an AGC(Automatic Gain Control) that uses a Photo transistor in reverse bias mode. In reverse bias mode, the PN juction looks like a capacitor to the rest of the circuit that discharges (leaks) proportionally to the amount of light exposed to the PN junction. Another benefit using the Photo transistor in this mode is that you minimize the Miller effect because you don't have the gain of the transistor contributing to amplifying the input parasitic capacitance which could dampen (filter) very quick voltage spikes.

Reference: (Miller effect
https://circuitcellar.com/resources/quickbits/miller-effect/

View attachment 280267
Thanks! I'll build this circuit hopefully this weekend and report back.

#### djsfantasi

Joined Apr 11, 2010
8,790
Thanks! I'll build this circuit hopefully this weekend and report back.
Before you do, please make the voltage measurements I suggested. If they aren’t what they should be, a pulse stretcher won’t work and you’d have wasted your time.

#### DickCappels

Joined Aug 21, 2008
9,624
Here is the spectral response of the Vishay phototransistor shown in post #21.

Orange covers about 600, so the transistor's response will be down to about 40% compared to the peak.

#### djsfantasi

Joined Apr 11, 2010
8,790
Here is the spectral response of the Vishay phototransistor shown in post #21.
View attachment 280591
Orange covers about 600, so the transistor's response will be down to about 40% compared to the peak.
is there a way to calculate the voltage output given this data? I think it’d be just as easy to measure the output directly. I still think the voltage is not high enough to be read as a high by the Arduino and has nothing to do with the pulse width.

In that case, another transistor could be used to provide a high enough level for the Arduino.

#### DickCappels

Joined Aug 21, 2008
9,624
You have to multiply the phototransistor's response as a function of wavelength times the intensity of the neon lamp as the wavelength varies.

Not practical for the most part. I would try it and go from there. There are always photomultiplier tubes and maybe in this case, ways to modulate the neon bulb so as to be detectable with less noise.

Joined Jan 15, 2015
7,144
is there a way to calculate the voltage output given this data? I think it’d be just as easy to measure the output directly. I still think the voltage is not high enough to be read as a high by the Arduino and has nothing to do with the pulse width.

In that case, another transistor could be used to provide a high enough level for the Arduino.
That would be my guess and neon lamps are not quite the picture of brilliance.

Ron

#### DickCappels

Joined Aug 21, 2008
9,624
Looking back at the first post in this thread, we are leaning over backwards to detect a 600 volt pule from an electric fence. I would seem much more efficient to sense a 1kv to 6 kv pulse than to try an note the glow of a neon lamp. I think we are on the wrong track.