I’m still a rookie when it comes to electronics, so bear with me. I’ve been reading this book: 30 Arduino Projects for the Evil Genius and it shows the schematic to a lie detector built with an arduino. I read up on it. It turns out that some lie detectors (such as this one) use galvanic skin response. I looked it up on wikipedia. Ahh, makes total sense. In a nutshell, human beings tend to be a better conductor of electricity when we lie…. Got it. So basically, all it does is gauge the electricity that’s conducted through your fingers. How? By comparing it to the electrical current that passes through a variable resistor. Okay. Sounds simple enough. The schematics that were in this book looked like this:

I’m no electrical engineer, but I was confused by a couple things. What the heck is the 220 ohm resistor that analog pin 1 is supposedly pointing to? I’m assuming that is the variable resistor. Why the heck are digital pins 9,10,11 INPUTS with one common 5V entry? huh?
Okay… so I looked at the specs on my own RGB LED and noticed the specs are very different. The RGB LED that the book is using is a common anode RGB LED…. while mine is a common cathode RGB LED. On top of that, I need 330ohm resistors rather than 100ohm resistors for each of my LED endpoints. So I decided to redraw the schematic.

There you go. That’s much better.

Analog pins 0 and 1 need to be inputs… They’re analog because we need to actually measure the current. Pin 0 would be the incoming current from the potentiometer (variable resistor) and pin 1 would be the current from your fingers. Pins 7 is a digital output… digital because it’s either an on or off. The piezotransducer uses digital because the way you make different tones is to adjust the delay. Pins 9,10,11 are all analog outputs. The RGB is relatively simple. You send a signal to each pin. If you think web, #FFFFFF or 255,255,255…. you get the point. For the finger sensors, I simply used an extra piece of wire…. which I will tape to two metal brackets which came with my \$1800 Franke 16 gauge stainless steel deep dish sink. And here’s the code:

``````
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;

void setup()
{
pinMode(potPin, INPUT);
pinMode(sensorPin, INPUT);
pinMode(redPin, OUTPUT);
pinMode(greenPin, OUTPUT);
pinMode(bluePin, OUTPUT);
pinMode(buzzerPin, OUTPUT);
}
void loop()
{
if (gsr > pot + band)
{
setColor(red);
beep();
}
else if (gsr > 16;
int green = (rgb >> 8) & 0xFF;
int blue = rgb & 0xFF;
analogWrite(redPin, red);
analogWrite(greenPin, green);
analogWrite(bluePin, blue);
}

void beep()
{
for (int i=0; i<1000; i++)
{
digitalWrite(buzzerPin, HIGH);
delayMicroseconds(100);
digitalWrite(buzzerPin, LOW);
delayMicroseconds(100);
}
}
```
```

I had to tamper with the color part of the RGB a bit… but there you go. When unused, the light should remain blue. When you put your fingers on the pad, you need to adjust the potentiometer until it turns green…. That’s when the questioning begins. It gives an annoying/intimidating high-pitched beeeeeeeeeeeeeeep when you lie….and the RGB LED turns red. You can also adjust the sensitivity (which is set to 10) in the code.

Next step: move this design off the breadboard and onto a prototype board and make it into an arduino shield. Enclose it in an arduino case and attach a 9v battery. And voila… a portable, pocket lie detector…. Every man’s nightmare.

Other things to consider: Steve Haldane, one of the founders of Buzz Media suggested I use the predator openTD library for face detection and detect some simple eye patterns as seen here and write a completely visual lie detector. Very cool idea… and it wouldn’t even require embedded programming, but a piece of software that runs on your laptop that utilizes your webcam!

Forgive my sloppy fritzing sketch. This is my first time using it.

From → Hacks

Hey… Do you have/make an Fritzing pics? I can’t understand your drawings 😦 Would love to build it…

• I’m so sorry. I do not. I will make some fritzing pics and upload them. That is some cool software and I should definitely take advantage of it.

Wow, thanks for help! That would be nice!

• Okay! I uploaded a .fzz file. Forgive the sloppiness. First time using the software. It’s a really cool piece of software.

Thanks! When I open up your file, I get some errors that the Arduino/Poti/RGB Pics cant be loaded. Its located in /home/cranky/xxxxxxx. Is it possible to fix that? I think I am not the only one without access to your \$HOME 😉

• awww. My apologies. I’m not sure why the .fzz would do that unless our core libraries are different. Would the exported .png help? if you right-click the image that I posted and save it, it’s a full-sized .png exported from the software.

Ya, allready fixed that with your .png. With my Mega, but I think it will work.

Nevertheless I have another silly problem. Maybe I’m blocked but the Arduino compiler says

liedetector.cpp: In function ‘void loop()’:
liedetector:31: error: ‘setColor’ was not declared in this scope
liedetector:34: error: expected `)’ before ‘;’ token
liedetector:35: error: ‘rgb’ was not declared in this scope

It’ v1.0. Do you use 1.0 too or an earlier version?

• At the time of this post, I was using the 0.22 SDK…. but we can make this work. Your compiler is asking for a declaration. Instead of doing that, you can just copy and paste the entire “setColor” function definition and move it between the “setup” and “loop” sections. That should cover the first and last errors. For the second error, I realized that wordpress stripped a small chunk of my code. 😦 I added an additional link to download the arduino source code so you don’t need to copy and paste the ruined code. 🙂

Oh, the whoe setColor() function was missing in the copy&paste’ed code.

With the downloaded file, it compiles without any error… Tomorrow I will get the missing parts and hope it works 😉

If so, I plan to attach a LCD… Maybe with some infos on it or the current skin resistance or something… 🙂 I’m on the beginning with that arduino stuff 😉

• That sounds awesome. I would love to see pictures when you’re done. Keep me posted on it!

6. Could you possibly help me? I am building a lie detector wit hmy daughter for a science project and have NO idea how to input the codes onto cygwin. I can send a pic and the codes to you if necessary, but I do not have a clue as to what to do with the codes or how to get any of this to work. I would be so grateful.

• Hi Mayra, I would love to help. First, do you have an arduino and all the parts necessary?

great post. daughter and i built it for the science fair and it was a big hit! easy and fun for my 9 year old. however it was very sensitive to movement, we tried a variety of finger sensors and tweeking the sensitivity in code. any suggestions?

• That’s awesome! Did you try adjusting the threshold value (band) to a higher value? Also, some variable resistors are more sensitive than others.

Our lie detector is fine for the “blue”, but it says “red/liar” for everything: dry hands, sweaty hands…
We do not have the metal piece though, is that necessary?
How can we fix this?
Thanks

• The metal piece isn’t necessary. It sounds like your lie detector is functioning properly. What you may want to do is raise the threshold in code (to make it less sensitive) and calibrate it with the variable resistor.

I’ve been messing around with that but haven’t got it quite right. Should I raise the lying, truth or “please put fingers on”?

• Try raising the “band” value. Also, if you have a better finger piece that can strap onto your finger, it will work better. I noticed that unknowingly, people press down harder or softer which affects the output.

gooooooooooooooooooooooodddddddddddddddddddddddddddddd

Hi there! Nice instructions!
Question: Would it be possible to let my computer plot a graph based on the galvanic skin response?

hey crankin can u list the equipments which is used in this detector