How To Build a Homemade Lie Detector

September 22, 2011

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:

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!

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

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. 🙂

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.

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?

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.

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.