SparkFun Forums 

Where electronics enthusiasts find answers.

General project discussion / help
Did you make a robotic coffee pot which implements HTCPCP and decafs unauthorized users? Show it off here!
By BlueSails
#201107
Hey guys.
I've been searching for a while now for a beam-break sensor utilising a reflector panel instead of a sender/receiver-setup. My goal is to detect presence in the vicinity of the sensor and up to about 15m from it.
So far I've been using a sender/receiver setup with batteries and solar panels on one side. However even after upgrading the battery capacity and putting in another solar panel, there is not enough light during the daytime this time of year.

Do you know of a sensor I can buy that will utilise a retroreflector over that distance?

Can I build one myself with an Arduino (or the like) without burning my retinas on an IR laser?
I'd rather not begin to construct advanced enclosures with lenses and such. The perfect setup could be a red(?) laser modulated to a frequency, installed right next to - but not interferring with - a sensor able to detect the reflected light.
Do you know if this could be possible and which components to use for this?

Cheers
By lyndon
#201112
Search Amazon and you should find quite a few. I repackaged and resold one, but I don't have my records on exactly which one I used right now.
15 m is a pretty long distance though.
By BlueSails
#201137
The reason I'm asking the question here is that I haven't been able to find ANY online with a rated range around the 15m. If you can link me to any I'd be grateful.
By lyndon
#201143
I see. The lowest cost retroreflective sensor I could find with that range is an Omron unit for $300. The price drops an order of magnitude if you use a through-beam sensor, although then you need an emitter and a detector separately.

If you drop your distance requirement, there are a lot more options.

If you're willing to tinker with it, you may be able to build your own with a detector and a laser pointer.
By n1ist
#201146
It will be a challenge over that distance in daylight. Here are a few ideas; I know you don't want to do some but they may be needed...
- Optics - You need to shield the sensor from extraneous light, and try to increase the amount of light you are collecting. Try a paper towel tube with the inside painted flat black. Add a lens and focus it on the detector on the other end. Even without the lens, it will help. If nothing else, put the detector on the rear of the enclosure with the light shining in thru a small hole on the front.
- Modulate the light source and look for that modulation in the detector; that will help decide whether the signal received is from the light source or just sunlight swamping the detector. I'd look into 38kHz stuff used for IR remotes. Keep in mind that this may be temperature sensitive (both oscillator and discriminator) which could be an issue if used outside. If you can, use the same oscillator for the modulator and demodulator so they will track regardless of the actual frequency
- Positioning: Try to position both the detector and retroreflector so they don't get swamped by sunlight; there's not much you can do to overpower the sun...
- Try a laser; you don't need an "eye burning" one; a nice collimated beam from a 1mW laser will probably work much better than a single LED. IR may be better but I would start with red since it will be easier to aim,
/mike
By BlueSails
#201158
Thanks Mike.

I think I will try modulating one or several IR LEDs. I found these LEDs with a half-angle of 3 degrees: https://docs-emea.rs-online.com/webdocs ... 545a27.pdf
You say a red laser would be useful but I can't figure out which receiver to use then. All of the photoresistors I've found utilizing 38 kHz are not even looking in the visible, red spectrum. Only IR. Any ideas?

Also. Can you point me in a direction of how I would go about modulating the light source and how to decode it on the receiver side?
By BlueSails
#201160
Alright, update time...

I just uploaded the sketch IRrelay on an Arduino pro Mini 3.3V and hooked it up with a VS1838B IR receiver. I won't paste the code right here but essentially it decodes incoming IR signals and outputs it in some format to the Serial Monitor. When pointing a random IR remote to it it reads:
Could not decode message
Raw (70): -15298 150 -50 8550 -4400 550 -600 550 -500 600 -500 550 -600 500 -550 550 -550 550 -550 550 -550 550 -1650 550 -1650 550 -1650 550 -1650 550 -1650 550 -1650 550 -1650 550 -1650 500 -1650 600 -550 500 -1650 600 -1650 500 -550 550 -550 550 -550 550 -550 550 -550 550 -1650 550 -550 550 -550 550 -1600 600 -1650 550 -1650 550 -1650 500

So far so good.

I then uploaded the following code to an Arduino Uno 5v with an IR led hooked up through pin D11 along with a 150ohm resistor.
According to another post i found this should modulate the output to 38 khz although I don't understand much of it:

const byte LED = 11; // Timer 2 "A" output: OC2A

void setup() {
pinMode (LED, OUTPUT);

// set up Timer 2
TCCR2A = _BV (COM2A0) | _BV(WGM21); // CTC, toggle OC2A on Compare Match
TCCR2B = _BV (CS20); // No prescaler
OCR2A = 209; // compare A register value (210 * clock speed)
// = 13.125 nS , so frequency is 1 / (2 * 13.125) = 38095

} // end of setup

void loop() { }


Now when pointing the IR led to the IR receiver it reads:

Could not decode message
Raw (10): -15530 50 -300 100 -250 350 -150 100 -100 50864
Could not decode message
Raw (44): -3052 100 -400 100 -1050 350 -1800 100 -950 100 -200 600 -300 100 -250 100 -150 100 -200 100 -200 100 -200 100 -150 100 -300 100 -100 24406 -50 250 -200 100 -500 100 -1600 100 -250 100 -1550 50 -1400 100
FFFFFFFF (0 bits)
Raw (28): -6800 100 -1700 100 -150 100 -4350 100 -1000 100 -750 100 -1550 100 -2150 100 -1700 400 -2550 100 -2050 100 -150 100 -800 100 -3450 100


So something IS getting through.
Now I just need to figure out how to make the receiver act as a "beam-break" and do something when there's no input.
Next step is upscaling the IR LEDs for more power and testing with reflector over different distances.

Any inputs as to how I should code the receiver?