IR on Stingray
I am attempting to add IR detection for my Stingray but the IR never detects anything. I'm not sure if my mistake is in the code or the circuit. I'm using the IR Detector object. Any assistance or guidance is appreciated.
dira[noparse][[/noparse]IR_R_LED..IR_L_LED]~~ 'output dira[noparse][[/noparse]IR_Motion_LED]~~ dira[noparse][[/noparse]IR_L_Rec]~ dira[noparse][[/noparse]IR_R_Rec]~ outa[noparse][[/noparse]IR_R_LED..IR_L_LED]~~ outa[noparse][[/noparse]IR_Motion_LED]~ IR_L.init(23,22) IR_R.init(20,21) repeat if IR_L.object 'if IR_L.distance < 10 Counter := cnt !outa[noparse][[/noparse]IR_Motion_LED] waitcnt(Counter += 10_000_000) !outa[noparse][[/noparse]IR_Motion_LED] if IR_R.object 'if IR_R.distance < 10 Counter := cnt !outa[noparse][[/noparse]IR_Motion_LED] waitcnt(Counter += 10_000_000) !outa[noparse][[/noparse]IR_Motion_LED]
Comments
You may be experiencing a similar problem. To see if you are, you'll want to get a multimeter out and see if the signals are present or not on the receiver. If they are, then try writing a small program that simply continuously pulses out on the IR LED, and displays (via terminal or visible light LED or something) what the input is seeing (0 or 1). If the results are different than the multimeter says, you're in the same trap. From there I'd experiment with different sized resistors (probably a higher value).
There is some discussion in the Propeller Education book (pdf on Parallax site) about the IR detectors that might help. I believe that it has some simple code that you can hack if needed.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Powered by enthusiasm
2) You didn't say what IR Detector object you're using. There are several in the Object Exchange. Please identify it more clearly.
SRLM, I'll check the thread you suggested to determine if that is my problem.
Mike Green, I drew the connections as I have them so I think I am good there. I got the files from my Propeller folder on my computer and I am unsure where I got them from, or when I downloaded them for that matter, so I am attaching the 2 object files used.
You can often use a VCR to check if an IR LED is working ok. The IR will show up on the screen if it's pointed at a working IR LED.
CON
_CLKMODE = XTAL1 + PLL16X
_XINFREQ = 5_000_000
Page 38 of Prop Manuas v1.1 says that _clkfreq is read only
John Abshier
You have to adjust the circuit for the difference on voltage, which I believe means using larger resisters to the LEDs and smaller resisters to the recievers. One of you electronics experts correct me if I am wrong...
I think you might try using a 1.8k resistance (maybe 2.2k resister is the closest?) to the LED (this is based on the spec sheet on the parallax store for the IR LED that says it has a max 1.5 forward voltage which is lower than a typical color LED), and no resister on the reciever since it outputs between 0 and 5 volts (according to the data sheet linked to on the parallax store).
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Check out the Propeller Wiki·and contribute if you can.
Post Edited (Roy Eltham) : 1/5/2010 10:02:20 AM GMT
I'll let you know how it goes.
Jim-
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Signature space for rent!
Send $1 to CannibalRobotics.com.
so I got it up on the scope. The little silver, metal case IR receivers seem to have a couple of issues.
The signal is inverted and it can not seem to overcome the 3.3-5v converter. If I power it up and run the output directly into the scope, I get clean 5->0v square pulses. If I hook it up to the converter through 100 up to 10K resistor, it goes flat or way too low.
The only way I have been able to get them to work is by placing a 1K pull UP resistor on the output of the sensor and connecting the output directly to the prop converter pin.
It seems to work with Bob Belleville's IR code.
J-
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Signature space for rent!
Send $1 to CannibalRobotics.com.
Thanks to everyone for the troubleshooting assistance.
I don't think the problem was the inverted signal. Rather, the level changing chip that was used has some requirements that the 5v side has to accommodate, and the circuit wasn't doing it.
As a side note, I think Parallax should come out with a number of reference circuits for the Stingray. There needn't be many, but things like buttons, IR detectors, LEDs, QTIs, etc. would be a good start.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Powered by enthusiasm
So a quick example: Std. red LED Vf 1.7v If 30mA max (so I'll run it at 20 mA to avoid absolute max rating).
·Take your supply voltage ie 5.0V and subtract the forward voltage across the diode junction ie 1.7Vf.
This leaves 3.3V that will be across your series current limiting resistor. Use Ohms Law 3.3V/20mA = 165 ohms. Resistors of the carbon film type come in standard "series of values" ie 1.0, 1.2, 1.5, 1.9, 2.0, 2.2 etc. +/- 5%. Select something close for example a 150 ohm resistor should work fine (3.3V / 150ohms = 22mA)
If you use a 1k ohm you will get 3.3v / 1000 ohms = 3.3mA hardly enough to light the LED!
Infrared LEDs (940nm wave length) that are used for transmit recieve pairs are·sometime rated at up to 50·mA so you might need something closer to 100ohms or less, and·because you are pulsing the LED ie 50% duty cycle means you could run Iforward at 100 mA and be safe. Keep in mind to check·if this runs close to the max rating of the MRS1 translator chip output rated current.
If you have a scope take a look at the output of the reciever. That output probably "floats" when the reciever is off. You have to determine if it floats high or low to see if it gets to the translator chips rated "Voltage input high/low levels" to see if you need either a pull up or pull down resistor.
You can also some times use a cellPhone camera·to see if you have IR from your emitter.
·
Polbit
Polbit
So I ended up building a simple circuit using the 74HC595 serial to parallel shift register and wrote an object to control the lights without disabling the level shifters.
A good side effect is the I have 8 outputs (and can cascade several more in groups of 8) at a cost of only 3 I/O pins.
Attached is my object which includes the schematic, there is at least one other object in the obex to control these shift registers but I don't remember its name at the moment.
I also built a similar circuit for the input side using the 74HC165 parallel to serial shift register but have not as yet written the object to control it, but I will, and I'll post the combined object to the exchange when I do.
OK I just checked the obex and found two objects here are the links
http://obex.parallax.com/objects/437/
http://obex.parallax.com/objects/523/
Btw, my Stingray board works fine, I have 3 pings and roaming works fine.
Any help would be greatly appreciated!
Polbit
Have you talked to tech support or Chris Savage about this? I'll bet they can help clear this up.
I agree that the notes on the Robot Control Board data sheet and the Stingray documentation should be co-ordinated.
The translators need to see +/- 2 m.a. to trigger them (see pages 10/11 of attached data sheet). The Parallax irdetector which is equivalent to a Panasonic PNA4601 only has a built in pull up resistor of 20K ohms that's why I choose a 4.7k, although that is right on the edge of the requirements for the translators.
The program irtest.spin only decodes compatible Sony T.V. remotes.
I didn't come by this setup from Parallax, so if you can't get yours to work you might give tech support a call and see what they recommend.
If it seems like we're slow to respond to the issues related to this part it is only because we're currently working on possible solutions and want to update documentation once the issues are solved rather than making several updates with test information (things we're looking into). Please bear with us and we should have something early in January or know our timeline at that point.
Edit: modemman just posted he was able to get it working by using a 3.3k without bypassing the translators.
ratronic, I've decided to do exactly that for now, since I'll need it for more sensors. But will definitely try 3.3k resistor for the IR...
Polbit
Polbit
other thread: http://forums.parallax.com/showthread.php?t=123850