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%

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%?


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

enter image description here

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.

  • \$\begingroup\$ 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. \$\endgroup\$
    – Transistor
    Commented Dec 20, 2015 at 0:46
  • \$\begingroup\$ So far it's just a random circuit to me - where does the photodetector go or am I being blind? \$\endgroup\$
    – Andy aka
    Commented Dec 20, 2015 at 0:47
  • \$\begingroup\$ Sorry I forgot to add it, but the circuit is actually the circuit that generates a square wave with a duty cycle of 20% \$\endgroup\$
    – neko
    Commented Dec 20, 2015 at 0:48
  • \$\begingroup\$ What kind of accuracy are you looking for? \$\endgroup\$
    – EM Fields
    Commented Dec 20, 2015 at 1:43
  • \$\begingroup\$ @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. \$\endgroup\$
    – Transistor
    Commented Dec 23, 2015 at 20:48

2 Answers 2


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.

  • \$\begingroup\$ 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) \$\endgroup\$
    – neko
    Commented Dec 20, 2015 at 1:35
  • \$\begingroup\$ 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. \$\endgroup\$ Commented Dec 20, 2015 at 1:39
  • \$\begingroup\$ 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. \$\endgroup\$
    – Transistor
    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 ...

Do your research and update your question (rather than add comments) with one clear question when you get stuck. Show your research. Show schematics.

  • \$\begingroup\$ Thanks a lot for the answer, but can you explain what you meant with "low-pass filter the pulses" a bit more? \$\endgroup\$
    – neko
    Commented Dec 20, 2015 at 0:50
  • \$\begingroup\$ @NesliKöse You can convert a PWM signal to an analogue voltage using a basic RC low pass filter. If you google PWM to analogue you'll get a lot of results. This video on the eevBlog also does a fairly good explanation of the technique. From that analogue voltage you can just use a simple opamp as a comparator! youtube.com/watch?v=YaRDbw38x7Q \$\endgroup\$
    – Rohan
    Commented Dec 20, 2015 at 5:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.