Author Topic: MAKING 2 IR SENSORS USE 1 PORT??  (Read 2042 times)

0 Members and 1 Guest are viewing this topic.

Offline BANETopic starter

  • Supreme Robot
  • *****
  • Posts: 639
  • Helpful? 4
  • E=roboticsC^2
MAKING 2 IR SENSORS USE 1 PORT??
« on: January 21, 2008, 06:21:14 PM »
What I'm trying to make is a conveyor belt that can detect an object ether at the front or back.  However, I'm trying conserve on the ports used on the microcontroller, so if i can figure out how to make a sensor that sends four signals (nothing detected, front detected, back detected, and both detected).  I know this is probably really simple, but if someone could link me to some schematics or some helpful advise that would be most appreciated  :).

see the conveyor pic!

bane

Offline airman00

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 3,653
  • Helpful? 21
  • narobo.com
Re: MAKING 2 IR SENSORS USE 1 PORT??
« Reply #1 on: January 21, 2008, 06:40:18 PM »
just dedicate another microcontroller just for deteting the things and have the microcontroller output serial data on one of the pins on the master microcontroller and thats it ,
Check out the Roboduino, Arduino-compatible board!


Link: http://curiousinventor.com/kits/roboduino

www.Narobo.com

Offline BANETopic starter

  • Supreme Robot
  • *****
  • Posts: 639
  • Helpful? 4
  • E=roboticsC^2
Re: MAKING 2 IR SENSORS USE 1 PORT??
« Reply #2 on: January 21, 2008, 07:38:41 PM »
Yes thats what kind of what i had in mind, but what i really need is the schematics for the IR sensor :P

I quickly drew this up, do you think i will work if i have to different resistors for the IR's outputs.  I think i can get the microcontroller to distinguish between the voltage difference (2.5 v = no detection, 1 v = front detection, 1.5 v = back detection, and 0 v = both detection) 
Sorry if this is terribly incorrect, I'm still pretty new at all of this ;)

bane

Offline BANETopic starter

  • Supreme Robot
  • *****
  • Posts: 639
  • Helpful? 4
  • E=roboticsC^2
Re: MAKING 2 IR SENSORS USE 1 PORT??
« Reply #3 on: January 21, 2008, 07:40:10 PM »
whooooops!!! forgot to attach the picture!!

bane

Offline airman00

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 3,653
  • Helpful? 21
  • narobo.com
Re: MAKING 2 IR SENSORS USE 1 PORT??
« Reply #4 on: January 21, 2008, 08:37:49 PM »
this is a clearer schematic of what you want
http://www.superdroidrobots.com/product_info/qrb1134.htm

I think i can get the microcontroller to distinguish between the voltage difference (2.5 v = no detection, 1 v = front detection, 1.5 v = back detection, and 0 v = both detection) 


You want an analog output from your microcontroller  , I believe you can use PWM to do analog output , just like speed control.


I personally always did serial data, thats extremely easy to do . Ill take a look into analog outputs . You are using C on an AVR , right


EDIT: found the link on doing analog outputs ,and it does use PWM like I thought . http://www.tigoe.net/pcomp/analogout.shtml
« Last Edit: January 21, 2008, 08:38:59 PM by airman00 »
Check out the Roboduino, Arduino-compatible board!


Link: http://curiousinventor.com/kits/roboduino

www.Narobo.com

Offline BANETopic starter

  • Supreme Robot
  • *****
  • Posts: 639
  • Helpful? 4
  • E=roboticsC^2
Re: MAKING 2 IR SENSORS USE 1 PORT??
« Reply #5 on: January 21, 2008, 08:56:21 PM »
Sorry, im not sure what you mean by this
you are using C on an AVR , right

But i assume that "C" is the programming languge and AVR is the microcontroller?

I will be using LynxTerm as the programming program (in the mailing process) so what every that uses (assuming C) and i will be using Lynxmotions mini ABB BS2.

Just a question, is there anything wrong will the schamatics that I drew up??

bane

Offline airman00

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 3,653
  • Helpful? 21
  • narobo.com
Re: MAKING 2 IR SENSORS USE 1 PORT??
« Reply #6 on: January 21, 2008, 09:21:48 PM »
you assumed correctly  and your schematic was correct , just you layed it out in an unorganized fashion 
you should spread out your components and also  have the power wire be a horizontal wire , makes it easier for the eyes

also you only needed schematic for one sensor , since the other 4 were copies


mailing process, what do you mean?
Check out the Roboduino, Arduino-compatible board!


Link: http://curiousinventor.com/kits/roboduino

www.Narobo.com

Offline BANETopic starter

  • Supreme Robot
  • *****
  • Posts: 639
  • Helpful? 4
  • E=roboticsC^2
Re: MAKING 2 IR SENSORS USE 1 PORT??
« Reply #7 on: January 22, 2008, 10:29:43 AM »
There are 2 IR emitters and 2 IR receivers and I only drew them that way because thats the way it will look on the conveyor system (sorry, helps me see what I'm doing  :D)    I don't have the microcontroller right now, but ordered it two days ago, so i assumed its in the mailing process :D.

I haven't considered this but what type of resistors (amount of resistance) should I use so that the signal is strong yet a major difference in the microcontrollers readings is still shown?

bane

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,653
  • Helpful? 169
    • Society of Robots
Re: MAKING 2 IR SENSORS USE 1 PORT??
« Reply #8 on: January 22, 2008, 10:39:59 AM »
Easy . . . wire both IR receivers in series . . .

5V --- IR1 --- IR2 --- Vout --- resistor --- ground

Now, use two different types of IR - not the same model or sensitivity!

So IR1 might cause a 2V shift, while IR2 might only cause a 1V shift. You'd have to check datasheets to do this . . .

0V shift - nothing happened
2V shift - IR1 was blocked
3V shift - both IR's were blocked
1V shift - IR2 was blocked

Offline BANETopic starter

  • Supreme Robot
  • *****
  • Posts: 639
  • Helpful? 4
  • E=roboticsC^2
Re: MAKING 2 IR SENSORS USE 1 PORT??
« Reply #9 on: January 22, 2008, 07:46:32 PM »
couldn't you just use two diff. resistors for a diverse signal?   I'm not quite sure about how to make the IR sensors in series (maybe some schematics ;) please if your time premites)  And why did you call it a "shift" in voltage and what would be your nominal voltage?  Couldn't you program the controller to look for a series of voltage ranges?   Another thing, when you see a signal and its just a big number, i know that the frequencies are but if its just voltage?  (I only have used the Parralax Sumo Bot board and thats what it does, not sure about others)

bane

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,653
  • Helpful? 169
    • Society of Robots
Re: MAKING 2 IR SENSORS USE 1 PORT??
« Reply #10 on: January 22, 2008, 09:31:15 PM »
its really not as hard as it sounds . . . replicate my above circuit using two different types of IR sensors, attach Vout to an ADC pin on your microcontroller, program and IF->Then loop, and you are done.

Quote
I only have used the Parralax Sumo Bot board and thats what it does, not sure about others
hmmmm problem . . . the parallax sumo board does not have an analog to digital converter, meaning each of your pins are only capable of two digital states - not four like you want. You will have to use two pins (for four states) if you want to use that board.

 


Get Your Ad Here