36 KHz modulated infrared light detector
2008-03-08 15:59

I have started working on a new robot that is mainly based on LEGO MINDSTORMS NXT. This robot is aimed at participating in DTU robocup 2008 but time will tell if it will be finished in time. Anyway in robocup the robot must at least be good at following a black line and preferably it should be able to accomplish other of the tasks at hand as well, and this is just not feasible using the standard LEGO sensors and the very limited number of these it can use at one time. So I thought I'd take advantage of the fact that LEGO sensor ports can access I2C hardware (up to 127 devices on each port!) and make my own I2C slave line follower.
First off I had read somewhere that the picaxe can only do I2C master, so I figured I'd go for using the PCF8574 I/O expander from NXP since I had five of these lying around. After designing a circuit on paper I realised that the picaxe 40x1 which is the only picaxe chip I have can in fact be set to act as an I2C slave (though I have not tested this yet - just read it in the manual), so I dropped the PCF8574 since it would now be possible to do the whole processing of the line detection in the picaxe and just returning the result of the processing to the NXT when it asked for it.
The line sensor will contain 8 SFH5110-36 infrared detectors that can detect an infrared signal modulated at around 36 KHz - when a signal is detected it draws its DETECT-pin low. Also it will contain 7 infrared LEDs that will be modulated at 36 KHz by the picaxe via PWM. The light from the LEDs are supposed to be bounced back from the floor only where there is no black line.
Yesterday I made a test setup for the detector circuit on my breadboard and it seems to work kind of like I want it to. First I thought that the SFHs could only be used for ON/OFF detection but after testing it, I think maybe I can put in a capacitor on the DETECT-pin and maybe a resistor somewhere to make a potential divider and measure the voltage somewhere. I got the idea since the detection LED I put in did not just switch on and off - rather it seemed to go from off to on smoothly which I guess happened because the infrared light just barely reached the SFH so the DETECT-pin was modulated like PWM or something.
You can see a short movie showing detection of my hand here:
http://defiant.dk/movies/infrared_detector.mov
As you can see this setup can easily be used for obstacle detection as well (maybe my robot will use that as well).
Picture of the test setup:

- Jimmy
- jip's blog
- Login or register to post comments
So many questions :)
You do not have to answer the below, but your post leaves me with so many questions, so here is my comment, answer if you like, it is only chit-chat, of course you can do what ever robots you want etc :)
/ Frits
Early morning answers...
I still have my Picaxe Pete under development (he is just missing some picaxe basic in his brain) and I also have my R/C car which will most likely be controlled by my LPC2106 development board using I2C devices like line sensor, motor controller etc.
- Jimmy
D/A?
"it might be possible to do something similar to analogue with the modulated signal using capacitor and resistor (working on that design)"
Huh?? Modulated = 1/0 = Digital, no?
Are you thinking of multiple modulated signals and over time getting average of 1/0's? That will be a bad idea, your robot will be extremely slow, and the resoult poor compared to just getting an analouge signal, I should think!
Sorry for being such a killer to your projects this wonderfull sunday morning, and sorry for allways coming after you for using that LEGO-brick ;D but you are telling me that you are inserting a whole LEGO-brick on your project to get "motor controller and wheel encoder"?
/Frits
Regarding the detector I'm
Regarding the detector I'm thinking that there is no hard cutoff where there is stable detection on one side and stable non-detection on the other side. There is an interval where the detector switches on and off rapidly (like PWM) because some blinks get detected and others don't. If you feed this pulsing into a capacitor or maybe an inductor (I haven't tried those yet - not counting motors) then maybe you can get a voltage (through a potential divider) that will be the mean of the pulses. That's at least how motors work with PWM so I thought it might be possible. You know that PWM is digital too, right? Still you get more than just ON and OFF with your motors since the motor can't react as fast as the PWM signal. It integrates the voltages seen over a period of time and acts as if it had seen a voltage with the same value as that integral. Anyway read more about motors and PWM if you want to learn more about it.
Regarding the lego brick I'm saying that by using the lego brick I won't have to do the electronics for anything other than the line sensor, and this makes it easier and faster to build the robot.
Please stop bugging me and take care of your baby... or it will just start playing with LEGO ;-)
- Jimmy
Hello fritsl, now I know
Hello fritsl, now I know what I meant by converting the digital signal to analog... I was thinking about putting in a low pass filter that would be set to some usable frequency so when detection switches on and off rapidly the signal will be smoothed out to an average voltage or something like that. That filter can be made by just one capacitor and one resistor (known as an RC-circuit). When the detection switches on and off rapidly I would think that it is because it is not being reflected quite so well so only some of the rays make it back to the detector and that could be because an object is far away (or because the detector is on the edge of a black line when doing line following).
Tomorrow is my weekly day off from work so I will try to get the damn thing to work properly. Right now it bothers me that I can get the circuit to light up an LED but the microcontroller seems to have problems with it since the output voltage doesn't go quite as low as expected (I think that maybe has something to do with the output being connected to the base of a PNP-transistor that lights up the LED.
Hopefully more info tomorrow sometime...
- Jimmy
:)/ Frits
:)
/ Frits
LOL, sorry, I _will_ try to
LOL, sorry, I _will_ try to stop bugging you. At least here on your own blog!
I just so much want to see a robot of yours if not finished, then at least just driving around or something. It is for your own sake, you know and you know it!
/ Frits