Paja

Icon

Rapid prototyping for music, art and design work

UCIT: The Heatseeker

The heatseeker was a quickly build robot to demonstrate the Parallax Boe-Bot robot system. The robot uses two servo motors to move around and a remote sensing infra red thermometer for measuring temperatures in front of the robot.

The robot seeks heat sources by turning around until the thermometer measures a warmer spot, which makes the robot to move straight towards the spot. If the warmer spot is lost, seeking with turning around starts over.

Heat seeker from Harri Rantala for the UCIT Interaction Design with Electronics Workshop 2009 on Vimeo.

Here is the BS2 BASIC code the robot:

‘ {$STAMP BS2}
‘ {$PBASIC 2.5}

‘ =========================================================================

‘ —–[ Program Description ]———————————————

‘ Controls Parallax Boe-Bot robot to seek heat sources with
‘ the help of MLX90614 Infra Red Thermometer.
‘ Temperature reading part from Parallax demo code for MLX90614 Infra Red
‘ Thermometer Module

‘ —–[ I/O Definitions ]————————————————-

Reset CON 1
Alarm CON 2
Sensor CON 3
lmotor PIN 13
rmotor PIN 12

‘ —–[ Constants ]——————————————————-

baud CON 84
xslave CON $35 ‘slave address

‘ —–[ Variables ]——————————————————-

pretemp VAR Word
temperature VAR Word
tempL VAR temperature.LOWBYTE
tempH VAR temperature.HIGHBYTE
pec VAR Byte
Kelvin VAR Word
KelvinDec VAR Word
Celsius VAR Word
CelsiusDec VAR Word
w VAR Byte
x VAR Byte
y VAR Byte
z VAR Byte
counter VAR Word
onTrack VAR Bit

‘ —–[ EEPROM Data ]—————————————————–

PEC0 DATA $00,$07,$0E,$09,$1C,$1B,$12,$15,$38,$3F,$36,$31,$24,$23,$2A,$2D
PEC1 DATA $70,$77,$7E,$79,$6C,$6B,$62,$65,$48,$4F,$46,$41,$54,$53,$5A,$5D
PEC2 DATA $E0,$E7,$EE,$E9,$FC,$FB,$F2,$F5,$D8,$DF,$D6,$D1,$C4,$C3,$CA,$CD
PEC3 DATA $90,$97,$9E,$99,$8C,$8B,$82,$85,$A8,$AF,$A6,$A1,$B4,$B3,$BA,$BD
PEC4 DATA $C7,$C0,$C9,$CE,$DB,$DC,$D5,$D2,$FF,$F8,$F1,$F6,$E3,$E4,$ED,$EA
PEC5 DATA $B7,$B0,$B9,$BE,$AB,$AC,$A5,$A2,$8F,$88,$81,$86,$93,$94,$9D,$9A
PEC6 DATA $27,$20,$29,$2E,$3B,$3C,$35,$32,$1F,$18,$11,$16,$03,$04,$0D,$0A
PEC7 DATA $57,$50,$59,$5E,$4B,$4C,$45,$42,$6F,$68,$61,$66,$73,$74,$7D,$7A
PEC8 DATA $89,$8E,$87,$80,$95,$92,$9B,$9C,$B1,$B6,$BF,$B8,$AD,$AA,$A3,$A4
PEC9 DATA $F9,$FE,$F7,$F0,$E5,$E2,$EB,$EC,$C1,$C6,$CF,$C8,$DD,$DA,$D3,$D4
PEC10 DATA $69,$6E,$67,$60,$75,$72,$7B,$7C,$51,$56,$5F,$58,$4D,$4A,$43,$44
PEC11 DATA $19,$1E,$17,$10,$05,$02,$0B,$0C,$21,$26,$2F,$28,$3D,$3A,$33,$34
PEC12 DATA $4E,$49,$40,$47,$52,$55,$5C,$5B,$76,$71,$78,$7F,$6A,$6D,$64,$63
PEC13 DATA $3E,$39,$30,$37,$22,$25,$2C,$2B,$06,$01,$08,$0F,$1A,$1D,$14,$13
PEC14 DATA $AE,$A9,$A0,$A7,$B2,$B5,$BC,$BB,$96,$91,$98,$9F,$8A,$8D,$84,$83
PEC15 DATA $DE,$D9,$D0,$D7,$C2,$C5,$CC,$CB,$E6,$E1,$E8,$EF,$FA,$FD,$F4,$F3

‘ —–[ Initialization ]————————————————–

Init:
LOW Reset
INPUT Reset
pretemp = 0

‘ —–[ Program Code ]—————————————————-

Main:

DO

GOTO getTemperature

move:

IF Celsius > pretemp+1 THEN

onTrack = 1

GOSUB moveF

ELSEIF Celsius+1 < pretemp THEN

GOSUB turnR
onTrack = 0

ELSE

IF onTrack = 1 THEN

GOSUB moveF
ELSE
GOSUB turnR
ENDIF
ENDIF

pretemp = Celsius

LOOP

END

turnR:

FOR counter = 1 TO 22
PULSOUT rmotor, 850
PAUSE 20
NEXT

PAUSE 500

RETURN

turnL:

FOR counter = 1 TO 22
PULSOUT lmotor, 650
PAUSE 20
NEXT

PAUSE 500

RETURN

moveF:

FOR counter = 1 TO 22
PULSOUT lmotor, 850
PULSOUT rmotor, 650
PAUSE 20
NEXT

PAUSE 500
RETURN

getTemperature:
SEROUT Sensor,baud,[0,”!TEMR”,xslave,$07]
SERIN Sensor,baud,1000,PECfail,[tempL,tempH,pec]

checkPEC:
z=0
y = xslave<<1+0
GOSUB calculateCRC
y = $07
GOSUB calculateCRC
y = xslave<<1+1
GOSUB calculateCRC
y = tempL
GOSUB calculateCRC
y = tempH
GOSUB calculateCRC
IF z<>pec THEN PECfail
GOTO convertTemperatures

calculateCRC:
w=z^y
READ w,z
RETURN

convertTemperatures:
Kelvin = (temperature/100)*2
KelvinDec = temperature*2
IF (temperature*2) < 27315 THEN overWordsize
Celsius = (temperature/100*2)-273
CelsiusDec = (temperature*2)-27315
GOTO displayTemperatures

overWordsize:
Celsius = ((27315-(temperature*2))/100)
CelsiusDec = (27315-(temperature*2))
‘ DEBUG CRSRXY, 23, 4,”-“,DEC Celsius,”.”,DEC2 CelsiusDec, CLREOL

displayTemperatures:
‘ DEBUG CRSRXY, 23, 3,DEC Kelvin,”.”,DEC1 KelvinDec,CLREOL
‘ DEBUG CRSRXY, 23, 4,DEC Celsius,”.”,DEC2 CelsiusDec, CLREOL
‘ DEBUG CRSRXY, 23, 5,”Pass”,CLREOL
PAUSE 1000
‘ GOTO getTemperature
GOTO move

PECfail:
‘ DEBUG CRSRXY, 23, 3,CLREOL,CR
‘ DEBUG CRSRXY, 23, 4,CLREOL,CR
‘ DEBUG CRSRXY, 23, 5,”Fail”,CLREOL,CR
PAUSE 500
GOTO getTemperature

Facebook Twitter Email

Category: Graduate School in User-Centered Information Technology, Student Projects

Tagged:

One Response

  1. MPreston says:

    Can you send me a picture of how you wired the MLX90614 into the breadboard? I am doing a simular project for my class and could use the help.
    Thank You,
    M.Preston

Social links powered by Ecreative Internet Marketing