Project in progress
Arduino Star Trek Tricorder (BETA)

Arduino Star Trek Tricorder (BETA) © GPL3+

Working Star Trek tricorder, including a temperature sensor, and multiple other show-like scanning features.

  • 1,619 views
  • 2 comments
  • 5 respects

Components and supplies

Necessary tools and machines

09507 01
Soldering iron (generic)

About this project

I was looking at my Star Trek tricorder one day, and I thought "I wonder if I could build this using an Arduino". I searched the internet for weeks trying to find someone else who had built one, but I couldn't even find ONE Arduino tricorder!

So, I decided to venture out, and try and build one of my own.

I began by soldering the LEDs.

Once I did that, I soldered the buzzer.

Then, I built a temporary case for everything out of cardboard.

A few days later, I decided to also add in a thermister, so that I could "scan" for the temperature. Rather than soldering the thermistor, I just used a rail from a breadboard. And, I also added a "pocket" for the 9V battery.

And then, I added a front panel to make it look more user-friendly.

Code

Star Trek TricorderArduino
Code to upload to your Arduino Mega.
#include <LiquidCrystal.h>
#include <math.h> 
 
// Initialize the library with the numbers of the interface pins
LiquidCrystal lcd(8, 9, 4, 5, 6, 7);
 
//States for the menu.
int currentMenuItem = 0;
int lastState = 0;


 
void setup() {
   //Set the characters and column numbers.
   lcd.begin(16, 2);
   //Print default title.
   clearPrintTitle();
}
 
double Thermister(int RawADC) {  //Function to perform the fancy math of the Steinhart-Hart equation
 double Temp;
 Temp = log(((10240000/RawADC) - 10000));
 Temp = 1 / (0.001129148 + (0.000234125 + (0.0000000876741 * Temp * Temp ))* Temp );
 Temp = Temp + 273.15;              // Convert Kelvin to Celsius
 Temp = (Temp * 9.0)/ 5.0 + 32.0; // Celsius to Fahrenheit - comment out this line if you need Celsius
 return Temp;
}
 
void loop() {
  //Call the main menu.
  mainMenu();
}
 
void mainMenu() {
  //State = 0 every loop cycle.
  int state = 0;
  //Refresh the button pressed.
  int x = analogRead (0);
  //Set the Row 0, Col 0 position.
  lcd.setCursor(0,0);
 
  //Check analog values from LCD Keypad Shield
  if (x < 100) {
    //Right
  } else if (x < 200) {
   //Up
    state = 1;
  } else if (x < 400){
   //Down
    state = 2;
  } else if (x < 600){
    //Left
  } else if (x < 800){
    //Select
    state = 3;
  }
 
  //If we are out of bounds on th menu then reset it.
  if (currentMenuItem < 0 || currentMenuItem > 4) {
   currentMenuItem = 0; 
  }
 
   //If we have changed Index, saves re-draws.
   if (state != lastState) {
      if (state == 1) {
         //If Up
          currentMenuItem = currentMenuItem - 1; 
          displayMenu(currentMenuItem);
      } else if (state == 2) {
         //If Down
          currentMenuItem = currentMenuItem + 1;  
          displayMenu(currentMenuItem);
      } else if (state == 3) {
         //If Selected
         selectMenu(currentMenuItem); 
      }
      //Save the last State to compare.
      lastState = state;
   } 
   //Small delay
  delay(5);
}
 
//Display Menu Option based on Index.
void displayMenu(int x) {
     switch (x) {
      case 1:
        clearPrintTitle();
        lcd.print ("Bio Scan");
        break;
      case 2:
        clearPrintTitle();
        lcd.print ("Firmware Scan");
        break;
       case 3:
        clearPrintTitle();
        lcd.print ("Temperature Scan");
        break;
      case 4:
        clearPrintTitle();
        lcd.print ("Geo Scan");
        break;
      case 5:
        clearPrintTitle();
        lcd.print ("General Scan");
        break;  
    }
}
 
//Print a basic header on Row 1.
void clearPrintTitle() {
  lcd.clear();
  lcd.setCursor(0,0);
  lcd.print("Starfleet");
  lcd.setCursor(0,1); 
}

void scanMode() {
  lcd.clear();
  lcd.setCursor(0,0); 
}

void ledDelay(){
        const int buzzerPin1 = 26;
        //led pins (in order): 22 23 24 25
        digitalWrite(22, HIGH);
        delay(100);
        digitalWrite(22, LOW);
        digitalWrite(23, HIGH);
        delay(100);
        digitalWrite(23, LOW);
        digitalWrite(24, HIGH);
        delay(100);
        digitalWrite(24, LOW);
        digitalWrite(25, HIGH);
        delay(100);
        digitalWrite(25, LOW);
        digitalWrite(22, HIGH);
        delay(100);
        digitalWrite(22, LOW);
        digitalWrite(23, HIGH);
        delay(100);
        digitalWrite(23, LOW);
        digitalWrite(24, HIGH);
        delay(100);
        digitalWrite(24, LOW);
        digitalWrite(25, HIGH);
        delay(100);
        digitalWrite(25, LOW);
        tone(buzzerPin1, 700);
        delay(70);
        noTone(buzzerPin1);
        delay(70);
        tone(buzzerPin1, 700);
        delay(70);
        noTone(buzzerPin1);
}

void ledDelay2(){
  const int buzzerPin1 = 26;
        //led pins (in order): 22 23 24 25
        digitalWrite(23, HIGH);
        digitalWrite(24, HIGH);
        delay(200);
        digitalWrite(23, LOW);
        digitalWrite(24, LOW);
        delay(150);
        digitalWrite(22, HIGH);
        digitalWrite(25, HIGH);
        delay(200);
        digitalWrite(22, LOW);
        digitalWrite(25, LOW);
        delay(150);
        digitalWrite(23, HIGH);
        digitalWrite(24, HIGH);
        delay(200);
        digitalWrite(23, LOW);
        digitalWrite(24, LOW);
        delay(150);
        digitalWrite(22, HIGH);
        digitalWrite(25, HIGH);
        delay(200);
        digitalWrite(22, LOW);
        digitalWrite(25, LOW);
        tone(buzzerPin1, 700);
        delay(70);
        noTone(buzzerPin1);
        delay(70);
        tone(buzzerPin1, 700);
        delay(70);
        noTone(buzzerPin1);
}
 
//Show the selection on Screen.
void selectMenu(int x) {

  

randomSeed(analogRead(14));
int scanResults = random(6, 1000);
int a = 0;
int scanResults2 = random(0, 3);
 
   switch (x) {
      case 1:
        scanMode();
        lcd.print ("Bio scan ");
        lcd.setCursor(0,1);
        lcd.print("initiated");
        ledDelay();
        lcd.print(".");
        ledDelay();
        lcd.print(".");
        ledDelay();
        lcd.print(".");
        ledDelay();
        scanMode();
        lcd.print ("Bio scan ");
        lcd.setCursor(0,1);
        lcd.print("completed");
        ledDelay();
        scanMode();
        lcd.print ("Life signs: ");
        lcd.setCursor(0,1);
        lcd.print(scanResults);
        lcd.setCursor(1,1);
        lcd.print(".");
        lcd.setCursor(2,1);
        lcd.print(scanResults);
        //Call the function that belongs to Option 1
        break;
      case 2:
        while (a == 0){
        /*scanMode();
        lcd.print ("Firmware scan ");
        lcd.setCursor(0,1);
        lcd.print("initiated");
        ledDelay2();
        lcd.print(".");
        ledDelay2();
        lcd.print(".");
        ledDelay2();
        lcd.print(".");
        ledDelay2();
        scanMode();
        lcd.print ("Firmware scan ");
        lcd.setCursor(0,1);
        lcd.print("completed");
        ledDelay2();*/
        ledDelay2();
        scanMode();
        lcd.print ("Teraquads: ");
        lcd.setCursor(0,1);
        lcd.print(scanResults);
        lcd.setCursor(1,1);
        lcd.print(".");
        lcd.setCursor(2,1);
        lcd.print(scanResults);

        }
        //Call the function that belongs to Option 2
        break;
       case 3:
        while (a == 0) {
          digitalWrite(22, HIGH);
        delay(100);
        digitalWrite(22, LOW);
        digitalWrite(23, HIGH);
        delay(100);
        digitalWrite(23, LOW);
        digitalWrite(24, HIGH);
        delay(100);
        digitalWrite(24, LOW);
        digitalWrite(25, HIGH);
        delay(100);
        digitalWrite(25, LOW);
        digitalWrite(22, HIGH);
        delay(100);
        digitalWrite(22, LOW);
        digitalWrite(23, HIGH);
        delay(100);
        digitalWrite(23, LOW);
        digitalWrite(24, HIGH);
        delay(100);
        digitalWrite(24, LOW);
        digitalWrite(25, HIGH);
        delay(100);
        digitalWrite(25, LOW);
        scanMode();
        int val;                //Create an integer variable
        double temp;            //Variable to hold a temperature value
        val=analogRead(15);      //Read the analog port 0 and store the value in val
        temp=Thermister(val);   //Runs the fancy math on the raw analog value 
        lcd.setCursor(0,0);
        lcd.print("Temperature:");
        lcd.setCursor(0,1);
        lcd.print(temp - 900);   //Print the value to the serial port
        lcd.setCursor(6,1);
        lcd.print("(F)");
        delay(100);
        }
        break;
      case 4:
        scanMode();
        lcd.print ("Geological scan ");
        lcd.setCursor(0,1);
        lcd.print("initiated");
        ledDelay();
        lcd.print(".");
        ledDelay();
        lcd.print(".");
        ledDelay();
        lcd.print(".");
        ledDelay();
        scanMode();
        lcd.print ("Geological scan ");
        lcd.setCursor(0,1);
        lcd.print("completed");
        ledDelay();
        scanMode();
        lcd.print ("Dilithium: ");
        lcd.setCursor(0,1);
        lcd.print(scanResults);
        lcd.setCursor(1,1);
        lcd.print(".");
        lcd.setCursor(2,1);
        lcd.print(scanResults);
        
        //Call the function that belongs to Option 4
        break;
      case 5:
        scanMode();
        lcd.print("Location");
        
        //Call the function that belongs to Option 4
        break;
    }
}

Comments

Similar projects you might like

Laser, Robe, Star Wars?! - Versalume + Adafruit Gemma

Project tutorial by Kitty Yeung

  • 1,968 views
  • 2 comments
  • 6 respects

Android App-Based Home Automation System Using IOT

Project tutorial by Team Autoshack

  • 24,854 views
  • 17 comments
  • 75 respects

Marduino Party 1

Project tutorial by Arduino “having11” Guy

  • 1,358 views
  • 0 comments
  • 1 respect

'Roger Bot' the Pet Rover

Project showcase by hannu_hell

  • 1,697 views
  • 0 comments
  • 12 respects

Doggo Water Bowl Refill Monitor/Indicator - Part 1

Project tutorial by Heathen_Hacks-v2

  • 681 views
  • 2 comments
  • 3 respects

Simple Arduino Digital Clock Without RTC

Project in progress by Annlee Fores

  • 96,190 views
  • 23 comments
  • 80 respects
Add projectSign up / Login