# How to detect the duty cycle of a laser pointer

Our assignment is to design an analog parking lot access system. A laser pointer will represent the car, and an ID detector will check if the laser's duty cycle is 20%. I designed the circuit that will give the laser an input voltage in the square waveform with a duty cycle of 20%, and I was planning to design a detector that will detect the average energy of the laser, but since the laser will be a vehicle (which means it will be moving) the light energy that it will send to the detector will change with time, so the detector MUST check its duty cycle, not the average energy.

This is the circuit that will generate a square wave with a duty cycle of 20%

The components we are allowed to use are: +/-25 V output of DC power supply, any types of resistors, capacitors, inductors, diodes, LEDs, LDRs, op-amps, transistors

So, any ideas on how to make a circuit that will be activated with an input that has a duty cycle of 20%?

Update:

Just wanted to let you know, thanks to your answers I managed to design something that works perfectly!

The LDR detects the laser and causes the first Op-Amp into positive saturation with the same duty cycle as the incoming laser, then it's low-pass filtered (thanks to @transistor and @helloworld922) and since the duty cycle I'm looking for is 20% I compared this value to see if it's lower than 3 Volts and greater than 2 Volts, and then summed the outputs of the comparators to see if both comparators are in positive saturation. I think this one should do quite well.

• Lovely schematic but there's no caption on the schematic or explanation of what it's supposed to do. What should be the input has a sideways ground symbol on it and no legend. No legend on the output either. Commented Dec 20, 2015 at 0:46
• So far it's just a random circuit to me - where does the photodetector go or am I being blind? Commented Dec 20, 2015 at 0:47
• Sorry I forgot to add it, but the circuit is actually the circuit that generates a square wave with a duty cycle of 20%
– neko
Commented Dec 20, 2015 at 0:48
• What kind of accuracy are you looking for? Commented Dec 20, 2015 at 1:43
• @NesliKöse, delighted you got it to work with your own figuring out (after a few pointers from here) without being handed a complete solution. Judging by your update you now have a very good understanding of each block of the final circuit. Commented Dec 23, 2015 at 20:48

The first component you're going to need is some way to receive the laser signal. You say you have LDR's, so design a circuit which uses one of these and outputs some voltage level corresponding to the input light.

As you've stated, variable input signal strength is a problem. That seems to imply that you want something digital, where signals above a certain level are registered as "on", and signals below a certain level are registered as "off". Something like a 1-bit analog to digital converter would do this, so think of how you would design something like this. This will give you a consistent level for "on" and "off".

Once you have received the PWM signal from the laser into your circuit as a digital signal with a known level, just low-pass filter it until you get close enough to a DC level. The DC value gives a direct indication of the duty cycle because you've already removed the variable signal strength problem.

The last step is to detect if the correct DC value (a.k.a. duty cycle) has been received. Something like a window comparator should do the trick.

I'll leave the details of how to design each of these components to you. Feel free to ask questions if you get stuck on any of these.

• I am having trouble with converting the digital signal which was levelled off to a DC level. Since we use +/- 12V for the saturation voltages of the opamps, the on level of the digital signal will be +12 and off level will be -12, so if the duty cycle is %20, the average voltage of the signal will be -7.2 V, but how exactly am I supposed to convert the signal into its average DC value? (I am not familiar with low-pass filtering)
– neko
Commented Dec 20, 2015 at 1:35
• I'm sure Google can help you with a simple low-pass filter design. Just choose the cutoff frequency much smaller than the PWM frequency. Commented Dec 20, 2015 at 1:39
• Probably easier if you limit yourself to positive voltages with the digital signal. e.g., 0% -> 0 V, 100% -> +10 V. Makes the circuits and the maths easier. Commented Dec 20, 2015 at 7:40

This will give you some clues to answering your assignment (but not everything). ;^)

• You have correctly identified the problem with signal strength. You're going to have to figure out a way to detect a signal and extract the pulses and make them the same amplitude.
• Detecting pulse width with a micro would be straightforward but that's not on your list of components so you'll have to go analog. If you low-pass filter the pulses you'll get a DC signal that varies with pulse width and now you just have to ...