Final Project

EXTERMINATE

For my final project i built a Dalek from the Doctor Who franchise. I started designing the Dalek with Autodesk Fusion 360 (see Exercise 02). But instead of designing it all by myself I decided to take the design files from snifikino with some changes and additional parts. Then I designed a board (Dalek.brd Dalek.sch) for connecting the electronics inside the Dalek following the same process as in Exercise 04. The board is designed to include
  • a MSP430G2452
  • 2 white LEDs
  • 2 dc motors
  • a speaker
  • a button a
  • a bluetooth module
The motors are mounted on a suspension which is attached to the ground plate of the Dalek. I used a laser cutter to make the parts for the suspension and the wheels. To provide more grip to the wheels rubber was glued to it. The battery pack is attached to the back part of the skirt via Velcro fastening. Then the board is taped onto the suspension to make it still removable for maintanance. The motors, LEDs, and speaker can be controlled via bluetooth with a desktop app further described in

Code: Board(Energia IDE)

//String mode = "drivebeepdrive";
String mode = "remote";
boolean blink = false;

void setup()
{
  Serial.begin(9600);

  pinMode(12, OUTPUT); //motor1
  pinMode(13, OUTPUT); //motor2
  pinMode( 9, OUTPUT); //speaker
  pinMode( 8, OUTPUT); //LEDs
  pinMode( 2, OUTPUT); //test
}

void loop()
{
  if(mode == "drivebeepdrive"){
    digitalWrite(12, HIGH);
    digitalWrite(13, HIGH);
    delay(3000);
    for(int i = 0; i <=3; i++){
      digitalWrite(8, HIGH);
     // digitalWrite(9, HIGH);
      delay(300);
      digitalWrite(8, LOW);
      digitalWrite(9, LOW);
      Serial.println("test");
      delay(300);
    }
    delay(3000);
    digitalWrite(12, LOW);
    digitalWrite(13, LOW);
    delay(5000);
  }
  
  
  if(mode == "driveledblink"){
    digitalWrite(9, LOW);
    digitalWrite(12, HIGH);
    digitalWrite(13, HIGH);
    digitalWrite(8, HIGH);
    delay(500);
    digitalWrite(8, LOW);
    delay(300);
  }
  
  if(mode == "remote"){
    if (Serial.available()){
      switch(Serial.read()){
        case 'w':     digitalWrite(12, HIGH);
                      digitalWrite(13, HIGH); break;
        case 'a':     digitalWrite(12,  LOW);
                      digitalWrite(13, HIGH); break;
        case 'd':     digitalWrite(12, HIGH);
                      digitalWrite(13,  LOW); break;
        case 'b':     blink = !blink;
        default:      digitalWrite(12, LOW);
                      digitalWrite(13, LOW);        
      }
      if(blink){
        digitalWrite(8, HIGH);
        delay(500);
        digitalWrite(8, LOW);
        delay(500);
      }
    }
  }
}

Code: Inteface(Processing)

import processing.serial.*;

Serial myPort;

void setup(){
  size(640, 360);
  background(0);
  printArray(Serial.list());
  myPort = new Serial(this, Serial.list()[0], 9600);
}

void draw(){
  //forward
  rect(100, 50, 100, 100);
  //left
  rect(0, 150, 100, 100);
  //right
  rect(200, 150, 100,100);
  //blink
  rect(400, 150, 100, 100);
  fill(0, 0, 100);  
  textAlign(CENTER, CENTER);
  text("Forward", 150, 100);
  text("Left", 50, 200);
  text("Right", 250, 200);
  text("Blink", 450, 200);
  fill(255);
  
  //forward
  if(mouseX >= 100 && mouseX <= 200 && mouseY >= 50 && mouseY <= 150 && mousePressed){
    myPort.write('w');
  }
  //left
  if(mouseX >= 0 && mouseX <= 100 && mouseY >= 150 && mouseY <= 250 && mousePressed){
    myPort.write('a');
  }
  //right
  if(mouseX >= 200 && mouseX <= 300 && mouseY >= 150 && mouseY <= 250 && mousePressed){
    myPort.write('d');
  }
  //blink
  if(mouseX >= 400 && mouseX <= 500 && mouseY >= 150 && mouseY <= 250 && mousePressed){
    myPort.write('a');
  }
}