Notinaut an Arduino driven notifier

I bought this cheap keychain couple of months ago and thought it would be a nice weekend Arduino project. My idea is to modify this novelty device as a notifier to notify me when my Jenkins or software build is successful. It has a web interface and REST API.

An astronaut keychain from a novelty shop

This keychain comes with a pre-recorded voice message

Disassembly

After removing four screws, I was able get inside the keychain and inspected its circuitry. This is powered by 3 small cell batteries though for this project I will be powering this device directly from Arduino’s 5 volt power supply.

Power supply bypass

I used jumper wires to test if I can power this device from the Arduino.

Of course testing every step is a good approach. I am testing here if the power supply works.

Switch bypass

Without damaging the existing electronic circuit, the best way to trigger this using an Arduino is to bypass the physical button and use an external transistor. I used a number of jumpers and temporarily connect them to the circuit to finalize the solder points

Soldering

I first planned to use paperclip as connector by I had difficulty soldering them, instead I used a solid core wire as alternative.

Testing my soldered wires

Putting it back together

Putting back together is straigh forward. I drilled holes to route the wires and used hot glue to hold the wires in place. By the way, while routing the wires the copper pad broke off from the circuit and I have to solder the wire to the LED.

Arduino Code

boolean isActive = false;
String x;

void setup() {
  pinMode(13, OUTPUT);

  digitalWrite(13, LOW);  
  Serial.begin(19200);
}

void toggleControl() {
  digitalWrite(13, HIGH);
  delay(700);
  digitalWrite(13, LOW);
}

void loop() {
  while(Serial.available() > 0) {
    char c = Serial.read(); 
    if(c != '\n') {
      x += c;      
    }
    else {
      if(x.length() > 0) {
        if(x == "run") {          
          toggleControl(); 
          x = "";          
        }
        else {
          x = "";
        }
      }
      Serial.flush();
      Serial.println(x);
    }   
  }
}

Web Interface