Overview

BotSpine provides most of the functionality required for this project:

For phase 1, all the smarts will be in BotSpine itself. For phase 2, the smartphone will directly control NukeBot by sending commands to BotSpine via BLE. One of the advantages of using a BASIC interpreter, rather than a compiled programming environment, is that you can run a program or send one command at a time. So, switching between stand-alone mode and tethered is seamless. You can even send a direct command, while a program is running.

Hardware

The picture shows the BotSpine board connected to a DIN connector, which plugs into Roomba's serial port. Underneath BotSpine (can't see it in the picture) is a board of the same size as BotSpine, which provides the High Voltage (500V) to the Geiger tubes. Roomba provides the power. Roomba's voltage is too high (up to 19V) for BotSpine and our High Voltage board. That's why there is an extra regulator/capacitor sticking out the bottom.

This picture shows the bottom of NukeBot. There is room for 6 Geiger tubes. But, for testing, I'm only using 1.

Here is NukeBot on the floor. BotSpine and the HV board are inside the plastic case, velcroed to the top of Roomba.

Software

Phase 1 took about 50 lines of BASIC code:

// "run" will start data collection. "goto 3000" will dump data. 
12 N = 50 // Number of spots where a measuremen is to be taken
13 V = 100 //delay between sending serial commands
14 X = 10000 // driving time in ms
15 Y = 10000  //short count in ms (reduced for demo video)
17 Z = 10000  //additional count time in ms (reduced for demo video)
110 T = 50   //short count threshold
111 U = 150  //long count threshold
112  L = 0   // measurement counter
113 pinmode P1(7) output
114 P1(7) = 1  //turn on HV 
115 pinmode P0(7) output
117 P0(7) = 0  //wake up roomba strobe low 
119 Delay 250  
121 P0(7) = 1 //roomba should now be awake 
122 Delay 500 // just wait a bit to make sure roomba is ready
124 SERIAL 115200,N,8,1,H // initialize serial
127 WRITE # SERIAL,128  // tell roomba to expect data
130 OPEN 0, APPEND "A" // open a file to be written to. 
160 delay V
170 WRITE # SERIAL,135        // Start Stop = Start
180 delay X		// drive around for X ms
1100 WRITE # SERIAL,135          // Start Stop = Stop 
1110 L = L + 1 // Increment measurement counter
1120 M = 0   // initialize pulse counter
1130 interrupt attach P0(6) rising gosub 1500  // start pulse counting
1150 delay Y   // count for Y ms
1160 IF M > T  // check if short count threshold exceeded
1170 DELAY Z    // count for another Z ms if first count was kinda high
1180 END   // END IF
1190 interrupt detach P0(6)  // done counting 

1195 IF M > 65535
1196 M = 65535
1197 END
1198 K=M/256
1199 B=M-K*256
1200 WRITE #0, L , B , K  // write the measurement number and the contamination reading (in 2 bytes) to file 0 

1210 OLED clear 
1220 OLED M   // Might as well display every measurement result. At least for initial testing.
1250 IF M > U 
1252 GOTO 4000 //contamination was found. Stop here.
1254 end
1260 IF L > N 
1262 GOTO 4000 // took all the measurements we wanted to take. Stop here
1264 END
1270 GOTO 170   //Start diriving to a new location and take another count
1500 M = M + 1   //increment pulse counter
1510 RETURN

3000 CLOSE 0 // close flie 0 just in case the data collection got interrupted without closing the  program 
3010 OPEN 0, READ "A" // open the file to read from. 
3012 PRINT "Here is the contamination data"

3015 IF EOF(0)  //check for End of Data
3017 GOTO 3900
3018 END
3020 READ #0, L , B , K
3023 M = K*256 + B   //reconstruct the reading from 2 bytes
3030 PRINT M, " ", L
3035 DELAY 3
3040 GOTO 3015

3900 PRINT "No more data"
4000 CLOSE 0 // close flie 0  
4013 pinmode P1(7) output
4014 P1(7) = 0  //turn off HV