Skip to main content

Reply to "IR or Optical Sensors"

ken's trains posted:

.. So I would like to put an adjustable delay in "beam detection". So when beam is broken, output's at approx. 5V, and then is detected, it slowly falls to it's lowest value. 

HI%2520when%2520beam%2520broken

Add a capacitor across the 10K resistor at the output.  When the beam is broken the output quickly rises to approx. 5V.  When beam is detected the output will slowly fall to its lowest value.  The voltage decay will be exponential rather than straight-linear.  But in round-numbers, it will take about 3 x R x C.  For example, if R=10K and C=100uF, it will drop to near 0 in about 3 x 10K x 100uF = 3 seconds.  If you only have, say, 10uF then use R=100K and you'll get about the same decay (3 x 100K x 10uF = 3 seconds).

The output quickly rises because the NPN transistor turns ON when the beam is broken.  The transistor rapidly charges up the new capacitor.  When the beam is detected, the IR sensor turns ON which turns OFF the transistor.  With the transistor turned OFF, the capacitor discharges thru the resistor in parallel with it.  You might get slightly different timing on a voltmeter bench test vs. with the Arduino actually connected because the Arduino pin itself is a load that discharges the capacitor.  OTOH you may not see any practical difference for the matter at hand.

 

Attachments

Images (1)
  • HI%2520when%2520beam%2520broken
Last edited by stan2004

OGR Publishing, Inc., 1310 Eastside Centre Ct, Suite 6, Mountain Home, AR 72653
800-980-OGRR (6477)
www.ogaugerr.com

×
×
×
×
×