Glad you could get it to work.
Now get yourself a 47K trim-pot so you can adjust the sensitivity according to your requirements.
Yep! gotta put that on the to-do list…
To make the sensor more directional, try placing a black tube over the receiver. This will block a little of the stray IR beam and will pickup the beam directly in front of it.
quick question, would I put the pot in the same place I put the resistor (in between the cap leads) or somewhere else?
The pot has three leads. You connect the outer leads across the capacitor (like you did with the resistor) and the middle lead to you atom input pin
Ok thanks. your help is much appreciated!
Good job! 8)
so now i made this fantastic sensor…
What code to use??
I have been looking here:
lynxmotion.net/viewtopic.php?p=46797#46797
But there are so many…
Help please…
Hi mano,
Basically, you just need to do an Analog to Digital conversion of the signal. I have not programmed in BASIC for a few months now so i’ll try my best to help.
ir var word
main
adin ax0, 1, AD_RON, ir
debug[ir, 13]
goto main
Just make sure you plug the sensor in to the first A/D pin on the BotBoard (I assume you are using a Basic Atom?).
Brandon C.
Edit: if you are using the Atom Pro, I don’t really know where the A/D pins are. Also, you might be able to the the code from the GP2D12 IR sensor because they both output an analog signal.
The code is similiar on the Atom Pro:
You can use P16-P19 (which are shown as AX0-3) on the BB2 and P0-P3.
So the code would look like:
ir var word
main
adin P0, ir
debug[ir, 13]
goto main
I tried your code, but nothing…
I doesn’t give me any output what so ever.
I also tried the sharp code multiple times. I gives me an output as shown in one of my former posts, but still no info from the sensor.
Might there be any code i have to adjust? or add?
Do you have a picture of the sensor? maybe you didn’t add the pullup resistor. if you look back a few pages you will see I had trouble getting the sensor to work but I added a 10k pullup resistor.
Please note no code, that it is setup to use debug mode, which may be what you want. But to use you have to compile it with debug and then go to the debug terminal…
Personally I usually don’t run it this way. so I would normally change the debug command into something like:
serout s_out, i9600, [ir, 13]
This is like the other serouts you have used to the terminal…
As for your sensor, who can tell? It is very possible that you have problems with your sensor. If you followed this thread, it took Wowy7 several attempts to make this work properly, so without additional information, like a diagram and pictures of your sensor, there is little that I can suggest.
Kurt
I made it exactly the same like in this topic. I used the same components and the light is working. Every now and then i get a hickup in the output but nothing more.
EDIT*
I tried gain in debug mode. It does compile and when i run the program the cursor goes up and down but thats about it…
still no output.
Did you use Kurt’s code he posted above?
ir var word
main
adin P0, ir
debug[ir, 13]
goto main
is the IDE outputting any numbers at all? I think that would be a code problem and not the sensor.
Also, it was kind of silly not to ask this in the first place, which pin do you have the sensor connected to?
Oh, I completely forgot! after you click “debug”, you have to click “run” to actually run the program.
If the debug output is working properly, you should at least see a number “0” If you don’t see any numbers at all you are not doing something right.
I admit the debug feature is not very user friendly when compared to the basic stamp IDE. I wish Nathan would make the IDE display a seperate debug window when running any program that uses the debug command, and eliminate all the hoops and hurdles one has to go through in order to see any ouput.
I got the debug to work with no problem. I know i have to klick “run”.
It looks like it is outputting something because the cursor is moving around in the output field.
But no numbers at al. I allready ordered a gp2d12 sensor and that should be here in a few days. but i would still love to get my own made sensor working.
Any other suggestions?
By the way is the capacity of the capacitor very important? or can it be different values?
Sorry, I did not catch it earlier, I simply cut and pasted Wowy7s responce and change the adin command. It might help if you did something like:
ir var word
main
adin ax0, 1, AD_RON, ir
debug[dec ir, 13]
goto main
Or likewise with the serout:
ir var word
main
adin ax0, 1, AD_RON, ir
serout s_out, i9600, [dec ir, 13]
goto main
Right now it is simply dumping the binary value which may not be printable.
Kurt
I never use debug. It’s too affected by timing sensitive commands. Just use the terminal. It works so much better. 8)