basic stamp code ir beacon
patrick van der Tol
Posts: 9
hello,
i have my boe-bot remote controlled by infrared with a sony remote.
here is my problem: my boe bot is turning around to look for a beacon. if i touch a button on the remote it stops turning and then it drives a straight way.
i want that the boe bot comes to my ir remote as long as i touch the button (like it comes to a beacon).
can anybody help with this code please?
thanks for the help!!
kind regards,
Patrick
i have my boe-bot remote controlled by infrared with a sony remote.
here is my problem: my boe bot is turning around to look for a beacon. if i touch a button on the remote it stops turning and then it drives a straight way.
i want that the boe bot comes to my ir remote as long as i touch the button (like it comes to a beacon).
can anybody help with this code please?
thanks for the help!!
kind regards,
Patrick
Comments
Do you have working beacons already that you are tracking to? Are they sending Sony TV codes, or just constant pulses of modulated IR?
Hi have not yet any beacons. i have a sony remote and i got it now working with my boe-bot.
how can i create an constant pulse out of my remote? the idea is if i press for example the enter button and i hold it ( it think this is a constant pulse), the boe-bot search for this signal and then drive to it.
please help with the code, i dint know how/where to start.
thanks again for the help!!
patrick
Hi
yes ive read the article. the part i dont understand is where in the code the boe bot searchs for the ir remote signal and then drive through it.
if i program it looks like this:
if remote code is 101 (my enter button on the remote for example).THEN GOSUB ...
how does my boe bot sees where it have to go?
thanks for the help
patrick
That's the code. I used mute (code 20) for tracking. The bot goes straight forward when it detects the mute code, and spins left when it doesn't detect it. Your IR detector needs to have IR-proof light shields (blinders) around it so it only sees forward. A typical IR remote blasts a ridiculously strong signal. You can aim the remote at the wall and the bot will go straight where the remote is aimed. If you want it to drive directly towards the remote, you'll have to reduce the signal. You can either mod the remote by adding an internal resistor on the IR LED, or cover the LED with 2 layers of black electrical tape and poke a tiny hole in the tape.
Hi this is my code: ive copy pasted it and tweaked it a bit.:
' Scribbler Robot PHASE 1
' Eric Ostendorff 3/10/2008
' modified Parallax readir routine
' drive robot with IR remote/Sony TV codes
' ENTER button starts track mode, STOP ends track mode
' {$STAMP BS2}
' {$PBASIC 2.5}
' define variables
irPulse VAR Word ' Stores pulse widths
remoteCode VAR Byte ' Stores remote code
trackflag VAR Bit ' 1 for track mode
main: ' start main program
trackflag=0 ' 0 = driving mode
LOW 8:LOW 9:LOW 10 ' LEDs off = driving mode
GOSUB readir ' read IR remote code
IF remoteCode=56 THEN GOSUB stopp 'center button=stop
IF remoteCode=121 THEN GOSUB fwd 'up arrow=forward
IF remoteCode=122 THEN GOSUB bwd 'down arrow=backward
IF remoteCode=123 THEN GOSUB left 'left arrow=left
IF remoteCode=124 THEN GOSUB right 'right arrow=right
IF remoteCode=11 THEN GOSUB track 'enter = track routine
GOTO main 'loop back, ignore other keys
fwd:PULSOUT 12,850 'right motor forward calibration 850=max fwd
PULSOUT 13,650 'left motor forward calibration
RETURN
bwd:PULSOUT 12,650 'right motor backward calibration 650=max reverse
PULSOUT 13, 850 'left motor backward calibration
RETURN
stopp:PULSOUT 12,650 '650 = stop right motor
PULSOUT 13,850 '850 = stop left motor
RETURN
left:PULSOUT 12,850 'left motor full forward
PULSOUT 13,850' 'stop left motor
RETURN
right:PULSOUT 12,650 'stop right motor
PULSOUT 13,650 'right motor full forward
RETURN
leftslow:PULSOUT 12,750 'left motor slow
PULSOUT 13,850' 'stop left motor
RETURN
track:
trackflag=1 ' set track mode
HIGH 8:HIGH 9:HIGH 10 ' turn on 3 LEDs for track mode
GOSUB readir ' read ir remote
IF remoteCode=11 THEN GOSUB fwd ' forward if enter received
IF remotecode=0 THEN GOSUB leftslow ' circle left if enter not received
IF remotecode=56 THEN GOTO main ' exit on STOP command
GOTO track
readir: 'Parallax read ir remote subroutine
remoteCode = 0
RCTIME 6, 1, irPulse
IF IN7=1 THEN GOSUB stopp:GOTO main ' if stalled, stop!
IF irPulse < 1000 THEN endir 'no start signal, skip ahead
getdata:PULSIN 6, 0, irPulse ' Get data pulses.
IF irPulse > 500 THEN remoteCode.BIT0 = 1
RCTIME 6, 0, irPulse
IF irPulse > 300 THEN remoteCode.BIT1 = 1
RCTIME 6, 0, irPulse
IF irPulse > 300 THEN remoteCode.BIT2 = 1
RCTIME 6, 0, irPulse
IF irPulse > 300 THEN remoteCode.BIT3 = 1
RCTIME 6, 0, irPulse
IF irPulse > 300 THEN remoteCode.BIT4 = 1
RCTIME 6, 0, irPulse
IF irPulse > 300 THEN remoteCode.BIT5 = 1
RCTIME 6, 0, irPulse
IF irPulse > 300 THEN remoteCode.BIT6 = 1
IF (remoteCode < 10) THEN remoteCode = remoteCode + 1
IF (remoteCode = 10) THEN remoteCode = 0
endir:IF trackflag=1 THEN endread 'tracking, skip ahead
IF remotecode=0 THEN endread 'zero or no signal, skip ahead
DEBUG ? remoteCode
FREQOUT 11,60,730 'beep speaker
endread:
RETURN
ive got some problems:
my servo's are stuttering how come?
how can i see if my boe-bot receives track code? if i put my remote to the boe-bot debug sees remote code 11 (enter key on my remote).but the boe bot wont drive through it.
if i pressed stop my servo's are still turning as long as i push the button.
thanks for the help!!
patrick
As I said, that's Scribbler code, not BoeBot code. You need to send a stream of pulses to your servos, but your IR read routine will interfere with that.
i dont have a servo pal installed. wil order it here in the netherlands.
is it possible to change code just for boe-bot or do i still need a servo pal?
Are you up to the challenge? I want to see your results!
Next, I got my BoeBot tracking to my IR remote today, just as quick & dirty as described previously. It took 4 layers of black construction paper to make an IR-proof baffle! The code is short & simple:
Pic & video attached below. You could integrate this into a bigger program that uses the full Sony remote IR routine to select other functions. Cheers!
Only using a ServoPal. Without one, it will seek any 38khz signal, can't tell 'em apart.
patrick, you still got yer ears on?
Hello,
my boe bot is working now too!!!
i have to understand how ir signal works (im new with electronics this is a starting hobby).
but with all the codes and studing boe bots manouvers. i wil getting it.
thanks for the help!!!
And have a look at this for more great IR info: http://www.imagineeringezine.com/files/air-bk2.html