IR beam break sensor

Breakout boards, sensors, other Adafruit kits, etc.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
User avatar
isuga
 
Posts: 51
Joined: Thu Dec 11, 2014 8:09 pm

IR beam break sensor

Post by isuga »

I was hoping you could help me with connecting multiple IR sensors to a Raspberry Pi (B+). I'm doing a science project for my kid and would like to hookup as many IR sensors as possible to measure acceleration. I plan on using a separate power source for the emitters so that should not be a problem for the Pi. However, the datasheet provided does not say how much current the receiver draws so I don't know what I need to do to keep the setup safe for the Pi. I plan on using the 5V provided by the Pi to power the receivers and hook up the yellow (digital) wire to the GPIO pins and connect the black to ground. I got one IR sensor to work easily but am unsure how many more I can add. Can you please help?

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: IR beam break sensor

Post by adafruit_support_rick »

You can safely hook up as many as you like.

User avatar
isuga
 
Posts: 51
Joined: Thu Dec 11, 2014 8:09 pm

Re: IR beam break sensor

Post by isuga »

Really? No resistors or anything? Thanks for your help!

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: IR beam break sensor

Post by adafruit_support_rick »

What are the output levels of the sensors? That's the one concern. If they signal at 5V, you don't want to hook them directly to the Pi's GPIO pins. You want to use a level-shifter in between:
https://www.adafruit.com/products/395

User avatar
isuga
 
Posts: 51
Joined: Thu Dec 11, 2014 8:09 pm

Re: IR beam break sensor

Post by isuga »

Sorry, I'm a total newbie. On the receiver, I've connected the red to the 5V and black to ground and the white/yellow to a GPIO pin. Set the GPIO pin as pull-up input so I can read it. The transmitter, I've put on a separate breadboard with an independent 5V power supply. This setup works perfectly well and I haven't fried anything yet if I've done something wrong. For some reason, I couldn't get it to work with 3V. But now I'm concerned that I WILL fry something if I hook up more this way....

I tried the 3V again when I got home last night and it works fine. I still have the transmitter on a separate breadboard with an independent 5V power supply since that's the only one I have. But I changed the receiver to 3V. And it seems to work fine with one receiver. So I will use that setup for the rest of my receivers and it should work. I was just worried that hooking up too many receivers to the Pi will draw more current than the Pi can handle since I can't seem to find anywhere how much current each receiver needs.

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: IR beam break sensor

Post by adafruit_support_rick »

The max you can draw from the 3.3V GPIO pins is 50mA
http://elinux.org/RPi_Low-level_peripherals#Power_pins
So you probably don't want to power your sensors from the 3.3V pins on the GPIO. You would use a separate power supply, or you would power them from 5V. on the GPIO. If you power them form 5V, then I would use the level shifter I linked earlier on the white/yellow data lines.

User avatar
isuga
 
Posts: 51
Joined: Thu Dec 11, 2014 8:09 pm

Re: IR beam break sensor

Post by isuga »

Thanks for your help. I really appreciate it. When you say "sensor" do you mean the receiver, emitters, or both? I understand the max draw from the 3.3 V is 50 mA. But I thought it was for all the pins combined and not just 3V. That's why I have the emitters on a separate power source since they each draw 10-20 mA depending on voltage. But there's no info on what the receiver draws. I also couldn't find that info when I googled, either.

So if I want to put the receivers on a separate power supply, how would I do that? Since the output goes to the GPIO pin, doesn't it have to share power and ground with the Pi? I tried putting the red and black wires of the receiver onto an independent power source and have only the yellow/white wire attached to a GPIO pin and that didn't work. I didn't think it would but I tried it anyway. I would have to use an NPN transistor or something to switch the GPIO on/off if I use a separate power supply for the receivers, right? Can I use a level shifter if I use a separate power source for the receiver to accomplish the same thing? I haven't played with them yet so I don't have experience.

I've gone through a lot of your tutorials and they are absolutely excellent. Even many of things that are specific for the Arduino, I've been able to adapt for the Pi. I haven't had any problems figuring new things out until now.

Thanks for your help.

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: IR beam break sensor

Post by adafruit_support_rick »

The sensor wires that attach to your GPIO pins don't take any current from the GPIO pins, so you don't need to worry about that

User avatar
isuga
 
Posts: 51
Joined: Thu Dec 11, 2014 8:09 pm

Re: IR beam break sensor

Post by isuga »

I kinda figured that it might since the receiver is more than just a simple "switch". Thanks for your help. I will give it a try.

User avatar
isuga
 
Posts: 51
Joined: Thu Dec 11, 2014 8:09 pm

Re: IR beam break sensor

Post by isuga »

Well, it looks like I fried my Pi. We were getting 6 sets of data and half way through the last set, all the sensors went dark and it it looks like none of the GPIO pins work. Here's my set up: I connected 6 receivers for the 3mm IR break beam sensor onto a breadboard with the Pi Cobbler. I attached all the red wires to the 3V rail and the black to the ground rail. I attached all the white wires to the GPIO pins and set them all for pull-up input. I used a separate breadboard and attached an independent 5V power supply to the positive and negative rails and used that for the emitters. I attached all red wires to the 5V rail and the black wires to ground. That way the emitters are totally electrically isolated from the Pi and receivers. I have 30 positions I want to sense so I would take a bunch of data readings with one set of positions then move the sensors to a new position. Things were going great until half way through the last set when all the sensors stopped reading. I checked my wiring and everything still seemed to be ok. I have other breadboards with other projects and they didn't work either when I hooked them up to the Pi. So I'm not sure what happened but it looks like I fried my GPIO pins with this setup. I have a backup Pi so I tried my other projects with that one and everything still worked with that Pi. I would like to continue playing with these. It's for my kid's science project so getting more data would be nice. Also, she has to write it up so I need a setup that works and can be duplicated by someone else. Any thoughts?

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: IR beam break sensor

Post by adafruit_support_rick »

It makes no sense that the receivers would burn out your Pi. Do you have a link to the datasheet for these things?

User avatar
isuga
 
Posts: 51
Joined: Thu Dec 11, 2014 8:09 pm

Re: IR beam break sensor

Post by isuga »

The datasheet that is provided on the Adafruit website for the product (https://www.adafruit.com/products/2167) is in Chinese and what I assume is the translation is in the technical details of the product description. It has useful info about the emitter but doesn't say much about the receiver. I tried to google to see if there was more info from other sources but came up empty.

Here's what the Adafruit product description says:

Sensing Distance: Approx 25cm / 10"
Power Voltage: 3.3 - 5.5VDC
Emitter Current Draw: 10mA @ 3.3V, 20mA @ 5V
Output Current Capability of receiver: 100mA sink
Transmitter/Receiver LED Angle: 10°
Response Time: <2 ms
Dimensions: 20mm x 10mm x 8mm / 0.8" x 0.4" x 0.3"
Cable Length: 234mm / 9.2"
Weight (of each half): ~3g


I don't know exaclty what "Output Current Capability of receiver: 100mA sink" means but when I researched it I got the impression that it meant that's the amount of current the receiver is capable of handling "passively" and is not the amount of current it puts out.

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: IR beam break sensor

Post by adafruit_support_rick »

Those receivers should not burn out your Pi's GPIO. There must be something else going on. Are you sure you're powering the receivers from 3.3V?

User avatar
isuga
 
Posts: 51
Joined: Thu Dec 11, 2014 8:09 pm

Re: IR beam break sensor

Post by isuga »

Hmmm..... Yes, I'm powering the positive rail on the receiver breadboard with the 3.3V pin on the Pi. I used two separate breadboards to prevent me from mixing up the two voltages. I must have had a short somewhere when I moved the sensors around then. I have a lot of wires and even though I soldered and taped everything down pretty good, I suppose something could have come loose.

Can you tell me what "Output Current Capability of receiver: 100mA sink" means?

User avatar
adafruit_support_bill
 
Posts: 88140
Joined: Sat Feb 07, 2009 10:11 am

Re: IR beam break sensor

Post by adafruit_support_bill »

Can you post a diagram of how you have everything connected?
Can you tell me what "Output Current Capability of receiver: 100mA sink" means?
That means the receiver can handle as much as 100mA. But the current draw from a GPIO pin should be much much less than that.

Locked
Please be positive and constructive with your questions and comments.

Return to “Other Products from Adafruit”