Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
211 views

Lie Detector Arduino

This code defines pin connections for an Arduino circuit with red, green, and blue LEDs, a buzzer, and sensors to read potentiometer and galvanic skin response values. It sets the LED colors based on comparing the sensor readings to thresholds, triggering an alarm if the GSR reading exceeds the potentiometer reading by more than a set band.

Uploaded by

Willy
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
211 views

Lie Detector Arduino

This code defines pin connections for an Arduino circuit with red, green, and blue LEDs, a buzzer, and sensors to read potentiometer and galvanic skin response values. It sets the LED colors based on comparing the sensor readings to thresholds, triggering an alarm if the GSR reading exceeds the potentiometer reading by more than a set band.

Uploaded by

Willy
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

int redPin = 9;

int greenPin = 10;


int bluePin = 11;
int buzzerPin = 7;
int potPin = 1;
int sensorPin = 0;
long red = 0xFF0000;
long green = 0x00FF00;
long blue = 0x000080;
int band = 10;
// adjust for sensitivity
void setup()
{
pinMode(potPin, INPUT);
pinMode(sensorPin, INPUT);
pinMode(redPin, OUTPUT);
pinMode(greenPin, OUTPUT);
pinMode(bluePin, OUTPUT);
pinMode(buzzerPin, OUTPUT);
}

void loop()
{
int gsr = analogRead(sensorPin);
int pot = analogRead(potPin);
if (gsr > pot + band)
{
setColor(red);
beep();
}
else if (gsr < pot band)
{
setColor(blue);
}
else
{
setColor(green);
}
}
void setColor(long rgb)
{
int red = rgb >> 16;
int green = (rgb >> 8) & 0xFF;
int blue = rgb & 0xFF;
analogWrite(redPin, 255 red);
analogWrite(greenPin, 255 green);
analogWrite(bluePin, 255 blue);
}
void beep()
{
// 5 Khz for 1/5th second
for (int i = 0; i < 1000; i++)
{
digitalWrite(buzzerPin, HIGH);
delayMicroseconds(100);
digitalWrite(buzzerPin, LOW);
delayMicroseconds(100);
}
}
PARTS LIST
R1 R3 = 100

R4 = 470 K

VR1 = 100 K

Arduino duemilanove or uno

LED1 LED3 different color LED

PZ1 = piezo buzzer

You might also like