# Looking for help with this laser detection circuit

#### zirconx

Joined Mar 10, 2010
145
I'm working on garage parking system. When my car enters the garage, it will break a laser beam that is shooting across the entry to the garage. When the car is far enough in that it un-breaks the laser beam, I'll sound a chime or light sequence or something to let me know that I'm at the perfect distance to stop (maximum space ahead of the car). I plan to use an ardunio. So my first step is building a laser detector circuit that the arduino will be able to read high/low to know the presence of the laser.

I was able to turn on an LED when the laser hits the phototransistor. But it fades in and out, it's not a clear on/off. So I added an optocoupler, thinking this would act as a relay and give me a clean on/off signal. It's better, and it got better still when I added a pull down resistor on the input (R3). Before I added that, the LED was on softly all the time from ambient light.

FYI The led resistor and the optocoupler resistor are around 200 ohms. It seems to make no difference what value I give them in the simulator. The pull down resistor is 4k. The power supply is 5v.

Suggestions for improvement?

More explanation below:

no light to the phototransistor

full light to the phototransistor

voltage on the LED anode is shown on the oscilloscope. No light hitting the sensor gives a reading around 3.5v When the maximum amount of laser light is shown into the sensor, it reads around 1v. When shooting the laser across the garage door, of course there will be less light entering the sensor than in this test.

#### zirconx

Joined Mar 10, 2010
145
A 4.7k pull up from +5v to the LED anode brought the signal up to 5v when there is no light. So that gives me a clear no-light/HIGH signal.

Now I just need to work on getting a clear LOW when there is light. Maybe I should use a transistor in between the phototransistor and the optocouple? So that even a little bit of light fully turns on the optocouple?

I plan to mount the phototransistor at the bottom of a 3 inch PVC tube, so that very little ambient light makes its way to the sensor. I pack the bottom of the tube with bubble wrap, to act as a prism, so less precise aiming of the laser is necessary.

#### iimagine

Joined Dec 20, 2010
501
You had the phototransistor connected wrong...

Your pics show that you are using emitter follower configuration (the figure on the right) . You have to connect the emitter of the phototransistor to the 4n35 pin 1 (Anode) then the other end of the resistor to ground. No pull up or down since you dont have any base pin.

#### zirconx

Joined Mar 10, 2010
145
You had the phototransistor connected wrong...
View attachment 183092
Your pics show that you are using emitter follower configuration (the figure on the right) . You have to connect the emitter of the phototransistor to the 4n35 pin 1 (Anode) then the other end of the resistor to ground. No pull up or down since you dont have any base pin.
I'm not sure what you are saying. I do have the emitter of the phototransistor connected to pin 1 of the 4n35. I did as you suggested and moved the resistor to "the other end", to ground. But the result is the same.

#### iimagine

Joined Dec 20, 2010
501
I did as you suggested and moved the resistor to "the other end", to ground
One end of the resistor connect to pin 1 the other end to ground; pin 2 connect to ground too.

#### Blue Wolf

Joined Jun 20, 2019
17
Try modulating the laser pulse...you wouldn't even need a laser. Use an IR emitter with a collimated beam modulated to 38khz with a 555. 38khz modulated receivers are a dime a dozen (there is one to be scavenged in almost every TV set in existence) or cheap as chips to buy online. Put the receiver behind a light shield to reduce ambient false triggering (although the modulation should do that pretty well anyway) and Bob's your uncle!

#### JohnInTX

Joined Jun 26, 2012
4,629
If you go the LED route I would consider using an off the shelf IR detector like the Vishay TSOP series. They have all of the filtering, demodulation, AGC etc. built in for a buck or two.

Most of the detectors are for remote control applications so they expect a pulsed, modulated LED. The modulation is to get through the internal filtering so ambient light is not a problem. The Arduino PWM should be OK to generate the carrier frequency 30-50KHz or whatever the detector wants.

You can gate the LED from another pin for the now-modulated pulses. Enable the PWM, look for the logic signal from the detector. Rinse and repeat.

I've used the technique a lot and it works like a hose.

Good luck!

Last edited:

#### Blue Wolf

Joined Jun 20, 2019
17
Good advice JohnInTX. I always like to build from scratch but that's my idiosyncracy (why I prefer monolithic mc's to Raspberry Pi's!). I have however bought, for next to nothing, a factory built setup when I was lazy and happened to run an electronics store so it was just too easy.

If you do go the laser route please ensure you place it at a height, and in a location, so no animals (including the bipedal type) such as pets, kids, partners, buddies or yourself can accidentally look straight into the beam...this can be unhealthy!!