KA BoeBot Project
Moutasem
Posts: 11
This thread is for my teacher, my classmates and I to communicate with each other.
04/12/2012
04/12/2012
Comments
L. Mark Kibler, M.Ed.
Project mentor
(formerly with project ARLISS)
- hamza
One of my project ideas is to build a Boe-Bot with multiple IR transmitters, and I might not have as many as I need. Would removing IR transmitters from a TV remote control work with the Parallax circuit-board and if so does it work on the same frequency?
Thank you.
Moutasem.
Thanks for your reply. I'm waiting for and encouraging my guys to post to the forum so they can network with other programmers and electrical engineers. Two are high school seniors, headed off to university in September to study engineering and they need to know how to do this.
One of them built a BOE-bot that has a camera integrated into it. Its purpose is to navigate a square (30 x 30 x 30 x 30 meter) obstacle course, record imagery and return to the lab unassisted. The other is building a simple SHT chip circuit board that measures and records temperature, humidity, and time. Any suggestions you can offer us are very much appreciated.
On another note to those of you who follow our progress and know about project ARLISS, one of the student project members was just accepted at WPI with a scholarship and he has applied to NASA for a summer (high school internship.
Thank you, Parallax Inc., for all of your encouragement and support. Because of your support a number of my former students are attending top universities, some with scholarships, and studying fields like aerospace science and engineering,
Best regards,
Mark Kibler
Erco, thank you for your post and warm welcome. Moreover, I would keep you guys updated with my project here from now. The IR transmitters on my boe-bot seem to be working fine, but my problem is that its not navigating through the halls like it is suppose to. It now is simple avoiding crashing into objects, and depending on the objects in the hallway it either follows the correct path or not. Do you think if I was to program it to move a certain distance (the distance of the hallway) and avoid hitting objects would be a good idea? Do you have any other ideas?
KAT
MEASURES AND RECORDS TEMPERATURE, HUMIDITY, AND TIME
' {$STAMP BS2e}
' {$PBASIC 2.5}
'
Program Description
'
' This program measures and records temperature, humidity and time using
' a data logger. The data collected will be saved as a txt file in a USB.
' I give credit to the ARLISS team and Tracey Allen for writing the origonal program,
' I only modified it.
'
'
I/O Definitions
ShtDta PIN 1 ' Data pin (HS)
ShtClk PIN 0 ' Clock Pin (HS)
DSclk PIN 3 ' Sclk (HS)
DSdta PIN 5 ' I/O (HS)
DSce PIN 7 ' request to send (HS)
TD PIN 8 ' TD (HS)
RTS PIN 9 ' RTS (HS)
RD PIN 10 ' RD (HS)
CTS PIN 11 ' CTS (HS)
'
Constants
SBR CON 84 ' SBR (Serial baud rate) for datalogger (HS)
ShtTemp CON %00011 ' temp command (HS)
ShtHumid CON %00101 ' humid command (HS)
Ack CON 0
NoAck CON 1
logInterval CON 5
DegSymbol CON 186 ' degree symbol (HS)
'
Variables
first VAR Word
iobyte VAR first.BYTE0
loopcounter VAR first.NIB2
notused VAR first.NIB3
tani VAR Word
flags VAR tani.BYTE0
ackbit VAR flags.BIT0
SHTERROR VAR flags.BIT1
DISKERROR VAR flags.BIT2
LND VAR flags.BIT3
tani0 VAR tani.BYTE1
shoman VAR Word ' extra VAR (HS)
soSHT VAR shoman
soSHT0 VAR soSHT.BYTE0
soSHT1 VAR soSHT.BYTE1
Tout VAR shoman ' Sensirion timeout (HS)
degreeC VAR Word ' temp Cx10 (HS)
rh VAR Word ' humid %x10 (HS)
time0 VAR Word
sec VAR time0.BYTE0
minute VAR time0.BYTE1
time1 VAR Word
hour VAR time1.BYTE0
loopcounterx2 VAR time1.BYTE1
buffer VAR Word
buf0 VAR buffer.BYTE0
buf1 VAR buffer.BYTE1
'
Initialization
OUTS = %0001001000000000
DIRS = %1111001111111101
GOSUB init_Message
PAUSE 10
GOSUB RTC_init ' reset clock (HS)
PAUSE 1000
GOSUB RTC_init
PAUSE 512
HIGH TD ' initialize TD (HS)
LOW RTS
PAUSE 512 ' 0.5 second pause
GOSUB V_synchronize ' ready to send (HS)
DEBUG CR,"synchronizing: ",DEC shoman
GOSUB V_short_commands ' short command mode (HS)
GOSUB V_Check_Drive
DEBUG CR,"disk tries: ",DEC shoman, CR
IF DISKERROR=1 THEN
DEBUG " device not found" ' If the USB is not plugged into the Data Logger,
ELSE ' the screen will say "devise not found" (HS)
GOSUB V_open_datafile
SEROUT TD\CTS, SBR, [ $8,$20,0,0,0,10,CR,"KAT data",CR, LF]
GOSUB V_purge
GOSUB V_close_datafile
ENDIF
DEBUG CR," Run Time Sample# Humidity(%) Temp(C)",CR
GOSUB SHT_Connection_Reset
PAUSE 256
'
Program Code
Main:
DO
GOSUB RTC_sync
loopcounterx2 = loopcounterx2 + 1
DEBUG CR,HEX2 hour,":",HEX2 minute,":",HEX2 sec, TAB, DEC loopcounterx2
GOSUB SHT_Measure_Temp
GOSUB SHT_Measure_Humidity
DEBUG TAB,REP "-"\degreeC.BIT15,DEC ABS degreeC/10,".",DEC1 ABS degreeC,DegSymbol
DEBUG TAB, DEC rH/10, ".", DEC1 rH, "%"
GOSUB V_open_datafile
GOSUB V_write_record
GOSUB V_close_datafile
LOOP
END
'
RTC
RTC_init:
HIGH DSce
SHIFTOUT DSdta,DSclk,LSBFIRST,[$8E,$00]
LOW DSce
HIGH DSce
SHIFTOUT DSdta,DSclk,LSBFIRST,[$BE,$00,$00,$00,$04,$07,$09,$09,$80]
LOW DSce
RETURN
rtc_Sync:
buffer=loginterval*200
DO:DO
GOSUB RTC_read
buffer=buffer-1
LOOP UNTIL sec<>tani0 OR buffer=0 '
tani0=sec
LOOP UNTIL sec.NIB1*10+sec.NIB0//logInterval=0 OR buffer=0
RETURN
RTC_read:
HIGH DSce
SHIFTOUT DSdta,DSclk,LSBFIRST,[$BF]
SHIFTIN DSdta,DSclk,LSBPRE,[sec,minute,hour]
LOW DSce
RETURN
'
Vinculum/Thumb Drive
V_purge:
V_Get_Data:
SERIN RD\RTS, SBR, 128, V_Timeout, [STR buf0\12]
V_Timeout:
RETURN
V_synchronize:
shoman=0
DO
GOSUB V_purge
PAUSE 256 ' 0.25 seconds wait
SEROUT TD\CTS, SBR, ["E", CR]
GOSUB V_get_Data
shoman=shoman+1
LOOP UNTIL (buf0="E" AND buf1=CR) OR shoman=8
GOSUB V_purge
SEROUT TD\CTS, SBR, ["e", CR]
GOSUB V_get_Data
IF (buf0<>"e" OR buf1<>CR) THEN shoman=shoman + 1
IF shoman>7 THEN DISKERROR=1
RETURN
V_Check_Drive:
shoman=0
DO
GOSUB V_purge
SEROUT TD\CTS, SBR, [CR]
GOSUB V_get_Data
IF buf0="N" AND buf1="D" THEN
shoman=9 ' if disk = 9 then disk not found (HS)
EXIT
ENDIF
shoman=shoman+1
PAUSE 100
LOOP UNTIL buf0=">" OR shoman=8
IF shoman>7 THEN DISKERROR=1
RETURN
V_short_commands:
SEROUT TD\CTS, SBR, ["SCS", CR]
GOSUB v_get_Data
RETURN
V_Open_DataFile:
GOSUB V_purge
SEROUT TD\CTS, SBR, [$09, $20, "datafile.txt", CR]
GOSUB V_purge
RETURN
v_Close_DataFile:
GOSUB V_purge
SEROUT TD\CTS, SBR, [$0A, $20, "datafile.txt", CR]
GOSUB V_purge
RETURN
V_write_record: ' write data int USB as a txt file (HS)
SEROUT TD\CTS, SBR, [ $8,$20,0,0,0,23,CR, HEX2 hour, ":" , HEX2 minute, ":", HEX2 sec, "," ,
degreeC.BIT15*13+32,DEC3 ABS (degreeC/10),".", DEC1 ABS degreeC,",",DEC3 (RH/10),".",DEC1 RH, CR, LF]
GOSUB V_purge ' 23 was 29 but subtracted 6 to delete the altitude
RETURN ' from the USB flash drive (HS)
'
Sensirion
SHT_Connection_Reset:
SHIFTOUT ShtDta, ShtClk, LSBFIRST, [$FFF\9]
RETURN
SHT_Start:
INPUT ShtDta
LOW ShtClk
HIGH ShtClk
LOW ShtDta
LOW ShtClk
HIGH ShtClk
INPUT ShtDta
LOW ShtClk
RETURN
SHT_measure:
GOSUB SHT_Start
GOSUB SHT_Write_Byte
GOSUB SHT_Wait
ackBit = Ack
GOSUB SHT_Read_Byte
soSHT1 = ioByte
ackBit = NoAck
GOSUB SHT_Read_Byte
soSHT0 = ioByte
RETURN
SHT_Measure_Temp: ' temp program for measuring data (HS)
ioByte = ShtTemp
GOSUB SHT_measure
degreeC = soSHT / 10 - 400 ' covert celsius to 10ths (HS)
RETURN
SHT_Measure_Humidity: ' humidity program for measuring data (HS)
ioByte = ShtHumid
GOSUB SHT_measure
rh = (soSHT ** 26542)
rh = rh - ((soSHT ** 3468) * (soSHT ** 3468) + 50 / 100)
rh = rh - 40
rh = ((degreeC + 250 / 10 - 50) * (soSHT ** 524 + 1) + (rh * 10)) + 5 / 10
RETURN
SHT_Write_Byte:
SHIFTOUT ShtDta, ShtClk, MSBFIRST, [ioByte]
SHIFTIN ShtDta, ShtClk, LSBPRE, [ackBit\1]
RETURN
SHT_Read_Byte:
SHIFTIN ShtDta, ShtClk, MSBPRE, [ioByte]
SHIFTOUT ShtDta, ShtClk, LSBFIRST, [ackBit\1]
INPUT ShtDta
RETURN
SHT_Wait:
INPUT ShtDta
Tout = 255
DO
Tout=Tout-1
PAUSE 1
LOOP UNTIL ShtDta=0 OR Tout=0
IF Tout=0 THEN
GOSUB SHT_Connection_Reset
SHTERROR=1
ENDIF
RETURN
init_message:
DEBUG CR,"Hamza Shouman - King's Academey - APR 17 13", CR, CR
DEBUG "Temperature, humidity, and data logging program",CR, CR
DEBUG "KAT", CR, CR
RETURN