Things used in this project

Hardware components:
11113 01
SparkFun Arduino Pro Mini 328 - 5V/16MHz
×1
MP3 / WAV trigger
×1
Old telephone
×1
12002 04
Breadboard (generic)
×1
11026 02
Jumper wires (generic)
×1
SparkFun Hook up wire
×1
microSD card
×1
Hand tools and fabrication machines:
09507 01
Soldering iron (generic)
SparkFun Heat gun

Schematics

bftp_BQPMfDpl5t.png
Bftp bqpmfdpl5t

Code

Phone Keypad SketchArduino
This example code was modified to work with a telephone keypad and MP3 trigger.
#include <Password.h> //http://www.arduino.cc/playground/uploads/Code/Password.zip
#include <Keypad.h> //http://www.arduino.cc/playground/uploads/Code/Keypad.zip

Password password = Password( "7365" );

const byte ROWS = 4; // Four rows
const byte COLS = 3; //  columns
// Define the Keymap
char keys[ROWS][COLS] = {
  {'4','5','6'},
  {'7','8','A'}, //"A" is a placeholder; no such button exists on my keypad
  {'B','2','3'}, //"B" is a placeholder; no such button exists on my keyopad
  {'*','C','D'} //"C" and "D" are placeholders; no such buttons exist on my keypad
};

byte rowPins[ROWS] = { 7,5,3,8 };//Connect keypad rows to these Arduino pins.
byte colPins[COLS] = { 6,4,2 };// Connect keypad columns to these Arduino pins.

const int dial = 13; //Digital Arduino pin going to MP3 triggerboard.
const int morse = 12; //Digital Arduino pin going to MP3 trigger board.

// Create the Keypad
Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );

void setup(){
  pinMode(dial, OUTPUT);
  pinMode(morse, OUTPUT);
  digitalWrite(dial, HIGH); //MP3 board triggers active low, so begin with HIGH.
  digitalWrite(morse, HIGH); //MP3 board triggers active low, so begin with HIGH.
  Serial.begin(9600);
  keypad.addEventListener(keypadEvent); //add an event listener for this keypad
}

void loop(){
  keypad.getKey();
}

//take care of some special events
void keypadEvent(KeypadEvent eKey){
  switch (keypad.getState()){
    case PRESSED:
	Serial.print("Pressed: "); //For monitoring
	Serial.println(eKey); //For monitoring
  digitalWrite(dial, LOW); //Play the dial beep audio file; this occurs for each key press
  delay(50);
  digitalWrite(dial, HIGH);
	switch (eKey){
	  case '*': checkPassword(); break; // * is the enter key
	  default: password.append(eKey);
     }
  }
}

void checkPassword(){
  if (password.evaluate()){
    Serial.println("Success");  //Monitoring
    password.reset(); //Clear the key entries
    digitalWrite(morse, LOW); //Play the clue audio file
    delay(50);
    digitalWrite(morse, HIGH);
  }else{
    Serial.println("Wrong"); //Monitoring
    password.reset(); //Clear the key entries for the next passcode attempt
  }
}

Credits

B57dc145 205f 4523 9c98 4f052a708665 v9luk4kums
Sam Horne
0 projects • 0 followers
Contact

Replications

Did you replicate this project? Share it!

I made one

Love this project? Think it could be improved? Tell us what you think!

Give feedback

Comments

Sign up / LoginProjectsPlatformsTopicsContestsLiveAppsBetaBlog