I realize this looks really basic but it cant be added to so that your robot does a certain action when a certain button is pushed. For example channel up makes it go forward, channel down makes it go backward, the volume buttons make it go left, or right, and other buttons make your robot do whatever. This is a simple how to set up the IR sensor so all it does is make it blink.
From a 5 volt power source tie a 4k7 ohm resisor to pin 1 and from the resistor to an input pin on your microcontroller.
Take pin 2 and connect it to ground.
Take pin 3 and connect it to a 330ohm resistor and to a 4.7 uF capacitor. Connect the other end of the capacitor to ground.
I used a $5 universal remote, but you could also make your own remote using another IR sensor and some buttons. Notice at the end of the video the button pushes are stored in a variable and sent to the debug window. To determine which button was pushed just have your code look at the variable and do whatever action was pushed. If you want your bot to stop when a button isnt pushed just put the IRIN in a for loop. Have it kick out of the loop after 50 miliseconds if nothing was pushed. Then clear the variable and go back to the irin loop.
The code I used:
SYMBOL IR_PIN = pin0 SYMBOL LED_PIN = 0 symbol infra = b14
HIGH LED_PIN pause 250 LOW LED_PIN
WaitForSignal:
irin 0, infra debug infra HIGH LED_PIN PAUSE 250 LOW LED_PIN
GOTO WaitForSignal
I'll add more to this once I am done with my next bot. I want to eventually make my own remotes as well.
I updated my post to include a link.Eventually I am going to add to this post when I work on it some more. When I start my robot I want an LED by the fron tot blink and the next button push would be assigned to make it go forward. Then the same process for backward, left,right, etc. This way when it starts you program what button does what. All I have to do is throw the decoded IR number into a variable and do a case statement. More on my project later. I hope to finish the build tonight and work on the circuit boards tomorrow. The problem is I have to make two for the purpose I want it to serve. I’m excited
A 4k7 resistor is built in A 4k7 resistor is built in going from voltage to the chip, but not from voltage to the pin you will be using to get voltage to the sensor. You still need one that goes between 5volts and the sensor.
ummm so, lets say that MY FRIEND didn’t read any schematics and just hooked it up to the 5v. Lets pretend he didn’t get any reading from it. Does that mean that MY FRIEND fried it already?
Considering it is usually Considering it is usually within the same amp requirements as a LED, it could be fried. To be sure hook one up properly and ensure it is working. Then swap the sensors and see if the fried one is fried. I burned one before I hooked it up properly. It happens quickly.
Variables So I’ve recreated the circuit as you do it, but my variables aren’t in any way consistent. The same buttons can yield dozens of different variables. Any ideas?
Sounds very odd. My buttons Sounds very odd. My buttons always gave the same results. Maybe the wavelength the remote uses is on the edge of what the sensor can recognize? Just to ensure the easy problems aren’t the issue post a pic of the circuit.
while the picaxe and the circuit get about 4.3 volt (same source)
i tried to read to voltage on the 4.7k resistor:
while no button is pressed it shows 1.59 volt
and when i push a button on the remote it changes to about 1.8-1.7 volt (depends on the button i push)
so something is working here, i just thought if you could tell me what that voltage reading is supposed to be , ill try to change the 4.7k resistor so it will take more or less voltage and change the signal to what it needs to be.
I dont have the circuit I dont have the circuit built anymore so I cant measure voltage. If you are using s different sensor you may need to wire it differently. Please find a part number and see if it has a datasheet. Just because it is an IR sensor and has 3 pins doesnt mean it is wired the same. Wiring it incorrectly can burn the sensor and possibly cause damage to the batteries or a fire. That sounds a bit dramatic but always wire things according to the datasheet. In this case I have no idea what part you are using.
Try removing the 4k7 Try removing the 4k7 resistor. It may be that the IR sensosr you have does not need a pull-up, and can operate directly to make a digital voltage signal.
technically every chip can technically every chip can receive it, if you’re using the SERIN method. If you are using the infrain method then only some chips can receive it. You should check the pinouts of the picaxe chips on your manuals to see whether they have a pin labelled “infrain”.
Not sure I havent done much Not sure I havent done much with the 8m. I would assume b14 memory address doesnt exist on th e8m since it has less memory. Check the debug window to see if it is there. It likely also doesnt support pin0 as a command. Check the manual to see if it lists 8m as being able to use it. It may not be supported.