Hackster is hosting Hackster Holidays, Ep. 6: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Monday!Stream Hackster Holidays, Ep. 6 on Monday!
Sam Horne
Published © GPL3+

Scavenger Hunt CluePhone

Type the correct code on the phone's keypad to hear the clue through the handset, then decode the message to finish before the other team.

BeginnerFull instructions provided5 hours7,425
Scavenger Hunt CluePhone

Things used in this project

Hardware components

Arduino Pro Mini 328 - 5V/16MHz
SparkFun Arduino Pro Mini 328 - 5V/16MHz
×1
MP3 / WAV trigger
×1
Old telephone
×1
Breadboard (generic)
Breadboard (generic)
×1
Jumper wires (generic)
Jumper wires (generic)
×1
SparkFun Hook up wire
×1
microSD card
×1

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)
SparkFun Heat gun

Story

Read more

Schematics

bftp_BQPMfDpl5t.png

Code

Phone Keypad Sketch

Arduino
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

Sam Horne

Sam Horne

0 projects • 6 followers
Former Electrical Engineering Intern at Walt Disney World Resort. Student at University of Memphis.

Comments