Wireless Group Critical Design Review
Movement BS command -> PULSOUT pin, period –BS2P units for period = 1.18 s 1.0ms pulse = CW, 2.0ms pulse = CCW –CW: period = 1ms/1.18 s = 1695 –CCW: period = 2ms/1. 18 s = 847
IR Navigation IR led must 38.5kHz BS command -> FREQOUT pin, period, freq BS2P units for freq = 3.77Hz freq = 38.5kHz/3.77Hz = Can increment to decrease distance of sensitivity > inches Nominal: > 2-6 inches
Light Searching Light location can be found with photoresistors included with kit Photoresistors have high resistances with little light, and low resistances with more light We can find relative values of the resistance using RC circuits and use these to navigate
Searching Algorithm To introduce some randomness, have all Bots go in random directions from a base point as soon as they are released. Afterwards, use IR navigation to a void collisions with other robots Use photoresistors to find sources of light and move towards them
Program flow (FSM) Prog_0: initProg_1: get ID Prog_2: Search for light Prog_3: Listen Prog_4: Search for bot If Rx If timeout If Rx If light is found If end of exe If timeout
Prog_0: “Initialization” PROG_0 pollin 5,1 'poll for Rx pollmode 3 'polled-run only pollrun 1 'run slot 1 token var bit token = 1 time var word time = 0 ID var byte TIMeOUT con 'may need something better ' main start: if time > TIMEOUT then start_token 'listen, if nothing, start new token time = time + 1 goto start start_token: token = 1 'give node right to Tx ID = 1 'give node ID = 1 put token, 0 'save token and ID in RAM put ID, 0 'before calling new program run 2 Listen for Rx in background If Rx, run prog_1 Set token = 0 While !Timeout, loop Else Start_Token Start_Token: Token = 1 ID = 0 Save token, ID in RAM Run prog_2
Prog_1: “Listen and Learn” node VAR byte node_next VAR byte node_list VAR bit(254) x VAR byte ID VAR byte SYNCH CON "A" 'Establish synch byte BAUD CON 16780'N2400 baud (MAX) trash VAR word SERIN 5,BAUD,[WAIT(SYNCH),node] SERIN 5,BAUD,[WAIT(SYNCH),trash] node_list(node) = 1 START: SERIN 5,BAUD,[WAIT(SYNCH),node_next] 'get node SERIN 5,BAUD,[WAIT(SYNCH),trash] 'trash node_list(node_next) = 1 if node = node_next then GET_ID GOTO START GET_ID: for x = 0 to 254 if node_list(x) <> 1 then SET_ID next SET_ID: ID = x ' wait for Invitation to join ring Set token = 0 Listen for ID’s in use Choose unique ID Wait for invitation to join Ring Run prog_2
Prog_2: “To boldly go…” Listen for Rx in background If Rx, run prog_3 Get token, next_ID from RAM If token = 1, then Talk Continually Search if timeout, then run prog_0 if light is found, found =1 Talk: tell if light is found Send token Continue search
Prog_3: “Listen” If found = 1, run prog_4 Listen for token Save token on RAM Run prog_2
Prog_4: “Find node” Search for node by beacon If timeout, goto prog_2
Communication Program Testing Begin with wired network Avoids RF latency and reception due to distance All Tx run to OR gate. This simulates the possiblility of collisions. Allows all nodes to “promiscuously” listen to all Tx’s