Introduction: Lie Detector
With this machine you will know if somebody is being sincere or not with you.
Step 1: Electronic Components
Arduino Genuino UNO x2
Protoboard
Cables
DC Motor
Transistor
Servo motor
Red LED
Green LED
Arduino pulsometer
Resistor x3
Potentiometer
Step 2: Connection
Here you can see the scheme of the connections.
Step 3: Code 1
// This code below serves to simulate a lie detector.
//It has been created by Nicolas Baqués and Carolina Romanos.
//First of all all the variables have to be declared.
//DC MOTOR int motorPin = 9; // the PWM pin the LED is attached to int power = 100;
//SENSOR int pulse=0; //Variable that will convert
//SERVO #include Servo servoMotor; //Declare the servo
//LEDs
int ledPin1 = 6; // Green LED is connected to pin 6 int ledPin2 = 5; // Red LED is connected to pin 5
void setup() { // put your setup code here, to run once: Serial.begin(9600); //Sets the data rate in bits per second or serial data transmission //DC MOTOR pinMode(motorPin, OUTPUT);
//SENSOR pinMode(A5,INPUT);//Saying that we are collecting information from A0
//SERVO servoMotor.attach(13);// Servo connected to pin 13
//LEDs pinMode(ledPin1,OUTPUT); //Saying that the LED receives information pinMode(ledPin2,OUTPUT); //Saying that the LED receives information
}
void loop() { // put your main code here, to run repeatedly:
//DC MOTOR analogWrite(motorPin, power); //Telling the DC motor in Pin 9 the speed we want 64 (slow) delay (30); //SENSOR pulse= (analogRead(A0)); //Pulse will be what Arduino reads in A5 Serial.println(pulse); //Print the reading in the monitor serie delay(1);
//SERVO servoMotor.write(0); // Inicial position of the Servo is 0 degrees
if (((600<(analogRead(A0))))){ //Condition for the servo //if the reading in A5 is more than 600 for (int i=0; i<=30; i++){ //The servo will move continously 90 degrees in both directions servoMotor.write(i); delay(25); } for (int i=29; i>0; i--){ servoMotor.write(i); delay(25); } }
if (((600>(analogRead(A0))))){ //Condition for the servo if the reading in A5 is less than 600 for ( int i = 0; i <= 15; i++){ //The servo will move continously 45 degrees in both directions servoMotor.write(i); delay(25); } for ( int i = 14; i>0; i--){ servoMotor.write(i); delay(25); } }
//LEDs
if (((600<(analogRead(A0))))){ digitalWrite(ledPin2 , HIGH); // Switch on the LED 2 when analog read is more than 600 digitalWrite(ledPin1 , LOW); // LED 1 stays off when analog read is more than 600 delay (100); } if (((600>(analogRead(A0))))){ digitalWrite(ledPin1, HIGH); //Switch on the LED 1 when analog read is less than 600 digitalWrite(ledPin2 , LOW); // LED 2 stays off when analog read is less than 600 delay (100);
} } //IMPORTANT: to simulate a person is lying change the analog read of port A5 to A0! //This would make possible to control the data the servo is reading with a potentiometer
Step 4: Code 2
int motorPin = 9; // the PWM pin the DC Motor is attached to
int power = 100; // how fast the DC Motor is
// the setup routine runs once when you press reset: void setup() { // declare pin 9 to be an output: pinMode(motorPin, OUTPUT); }
// the loop routine runs over and over again forever: void loop() { // set the power of pin 9: analogWrite(motorPin, power); }
Step 5: Structure
In this step I show the plan of the box. Using Autocad is the simplest way to draw it.
Step 6: Production
After making plans of the box, you must buy a 4mm wood and cut the different parts using a laser cut.
Step 7: Building
Join the different pieces of the box using glue. And for organizing the inside box part, you must buy polyurethane foam and used the best way you think is.
Step 8: Display
How the lie detector looks like.
Step 9: Problems & Improvements
The only problem that our lie detector has given us is transform the pulsations into BPM. Also say that the Arduino pulsometers aren't very professionals and does not always work perfectly.
We found that our lie detector could be improved by introducing another DC motor, making it pick up all the remaining paper, re-rolling it.