View this project on GitHub
A kill switch is arguably one of the most important components in any robotic system. This master enable is what will give humans the upper-hand in the event of an apocalyptic robot uprising.
This kill switch was designed for an autonomous underwater vehicle, serving as a thruster enable to initiate navigation or to “kill” the AUV when its thrusters go awry. Being interfaced to an underwater vehicle, the switch must be waterproof, easily accessible, and intuitive to use.
In my time with the USC AUV team, I built two versions of the kill switch. The first of which, was my first ever PCB design. The second revision was an effort to miniaturize the board and simplify the software interface.
Both kill switch boards were housed in a custom-built waterproof aluminium enclosure. Machined in our lab, the enclosure featured a transparent acrylic “window” to view sensor state, double o-ring seals for waterproofing, and a rotating shell with embedded neodymium magnet to trigger the hall sensor.
This is the first PCB I ever designed. It was a 2-layer board designed with the free version of Eagle.
This revision was an attempt to miniaturize the design and simplify the software interface with an Arduino. It was a 2-layer board designed with Altium Designer.
The kill switch code monitors the on-board sensors, and outputs a corresponding digital signal to the host processor, which feeds the enable signal of the motor control driver with direct access to the robot’s thrusters.
The Parallax Propeller microcontroller uses a programming language called Spin. The core input/output code is shown below. I also implemented a few LED patterns for special events including a color circulation, color flickering, and random.
MAG = 1
TOUCH = 2
...
'Display status on LCD
if ina[MAG] == 1
lcd.str(string("off"))
else
lcd.str(string("on "))
if ina[TOUCH] == 1
lcd.str(string("off"))
else
lcd.str(string("on "))
...
'Display status on LEDs
outa[16]:=ina[MAG]&ina[TOUCH] 'green: good (even)
outa[17]:=!ina[MAG]|!ina[TOUCH] 'red: kill (odd)
outa[18]:=ina[MAG]&ina[TOUCH]
outa[19]:=!ina[MAG]|!ina[TOUCH]
outa[20]:=ina[MAG]&ina[TOUCH]
outa[21]:=!ina[MAG]|!ina[TOUCH]
outa[22]:=ina[MAG]&ina[TOUCH]
outa[23]:=!ina[MAG]|!ina[TOUCH]
The Arduino Nano uses a simple sketch developed with the Arduino IDE.
const int REED_SW = A0;
const int RED_LED1 = 3;
const int RED_LED2 = A4;
const int RED_LED3 = A2;
const int WHT_LED1 = A5;
const int WHT_LED2 = A3;
const int WHT_LED3 = A1;
void setup() {
pinMode(REED_SW, INPUT);
pinMode(RED_LED1, OUTPUT);
pinMode(RED_LED2, OUTPUT);
pinMode(RED_LED3, OUTPUT);
pinMode(WHT_LED1, OUTPUT);
pinMode(WHT_LED2, OUTPUT);
pinMode(WHT_LED3, OUTPUT);
}
void loop() {
int state = digitalRead(REED_SW); //magnet in range, state=LOW
digitalWrite(RED_LED1, state); //glow RED when no magnet
digitalWrite(RED_LED2, state);
digitalWrite(RED_LED3, state);
digitalWrite(WHT_LED1, !state); //glow WHITE when magnet
digitalWrite(WHT_LED2, !state);
digitalWrite(WHT_LED3, !state);
}
Killswitch Rev2 by hieu on Sketchfab