Skip to main content

Reply to "IR or Optical Sensors"

 

If driving an Arduino digital input pin, you need a resistor to define or pull up (to 5V or hi level) the "floating" node when the beam is broken.  The eBay relay modules effectively have such a resistor on its input trigger pins.

LO%20trigger%20when%20beam%20detected

Presumably somewhere in your Arduino sketch you define the digital pin connected to the IR sensor to be an input.  If using pin number X, look for something like:

pinMode (x, INPUT)

Instead, try:

pinMode (x, INPUT_PULLUP)

and, lo and behold, you get: 

pullup

Since your transistor-based circuit is already hooked up, just change the pinMode instruction and you should be off to the races. 

Attachments

Images (2)
  • LO%20trigger%20when%20beam%20detected
  • pullup
Last edited by stan2004

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

×
×
×
×
×