Saturday, June 6, 2015

Arduino Polygraph(Basic Lie Detector)

Hi.In my first tutorial I would like to show you "How to make a simple polygraph machine with arduino?".It's a really simple project and I will explain the operating logic.But you can't use this project to detect lies about important situations.This project is not equal to professional machines.So please use it just for fun.


Before we start.Lets talk about our circuit.The circuit's operation logic is simple. When the person said a lie he/she starts sweating a little then the aluminum foil gets wet and conducts more electricity(don't worry it won't hurt you) after that we will observe the current graphic in our pc.


So the parts you need.



-Arduino Uno
-Breadboard
-1x10k Resistor
-Jumper Wires
-Aluminum Foil
-Electric Band

and also we need arduino ide and processing.


First lets do our probes.























                                                                 
                                                                 Yes it's that easy :)


Then we can build our circuit.





Now the circuit is ready. We can upload the code.

Arduino Code
void setup() {
  // initialize the serial communication:
  Serial.begin(9600);
}

void loop() {
  // send the value of analog input 0:
  Serial.println(analogRead(A0));
  // wait a bit for the analog-to-digital converter
  // to stabilize after the last reading:
  delay(2);
}


and Processing Code


import processing.serial.*;
    Serial myPort;
    int xPos = 1;
    float oldHeartrateHeight = 0;

    void setup () {
    // set the window size:
    size(1000, 400);
    frameRate(30);

    // List available serial ports.
    println(Serial.list());

    // Setup which serial port to use.
    // This line might change for different computers.
    myPort = new Serial(this, Serial.list()[0], 9600);

    // set inital background:
    background(0);
    }

    void draw () {
    }

    void serialEvent (Serial myPort) {
    // read the string from the serial port.
    String inString = myPort.readStringUntil('\n');

    if (inString != null) {
    // trim off any whitespace:
    inString = trim(inString);
    // convert to an int
    println(inString);
    int currentHeartrate = int(inString);

    // draw the Heartrate BPM Graph.
    float heartrateHeight = map(currentHeartrate, 0, 1023, 0, height);
    stroke(0,255,0);
    line(xPos - 1, height - oldHeartrateHeight, xPos, height - heartrateHeight);
    oldHeartrateHeight = heartrateHeight;
    // at the edge of the screen, go back to the beginning:
    if (xPos >= width) {
    xPos = 0;
    background(0);
    } else {
    // increment the horizontal position:
    xPos++;
    }
    }
    }








So we are ready. Put the probes on your finger.






Run the processing code after uploading arduino code. The graph should be seen like this.






Yes, its finished. Now you can have fun with your project. By the way I tested on two of my friend. I caught %80-%90 of lies in the first time then I tried on other friend the results were not that good :( It was about %30-%40 lies I caugh.

Ask anything you want in the comment section.I will be glad to answer it :)





No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...