Skip to main content

USB Polygraph


This is a USB Polygraph, which I designed and built as a classroom project on June 2018. The hardware side is pretty simple, an Arduino UNO collects data from some sensors and sends it via serial. On the computer, a Python program takes that data and not only graphs it, but it also allows the user to save it, manages questions and adds question and answer markers to the graphs so results can later be inspected. All results are saved in .txt files.

First, some legal stuff:

DISCLAIMER: I make no claim whatsoever on the validity of poligraphy for lie detection. Call this a signal acquisition device if you must. While it makes for an interesting and enjoyable build, it is intended just as an experiment and cannot distinguish between truth or else. Anyway, it is up to the user to decide. Always make use of common sense.
WARNING: Using this device involves attaching metal objects to someone's hand. To avoid any possibility of shock hazard, please make sure all "probes" are attached to the same hand and that the polygraph is connected to an isolated computer (i.e. a laptop running on batteries). The device as is does not provide galvanic isolation, so powering it from a supply derived from mains is out of the question. If you build and use this, you are doing so at your own risk. I am not to be held responsible for any damage that may occur.

Now, we can get on with further describing the project:

Electronics, sensors and project enclosure:

Here you can see the simple schematics for this project:

Three different sensors are used: 
-A "galvanic skin response" (GSR) sensor, which is just a voltage divider in which your hand is one of the resistors. When you get nervous, your skin resistance changes and that can be measured as proposed. Photos below show the simple probes, just two pieces of aluminum and some "hook and loop tape".




 -A pulse sensor, which is just a piezo element that generates a voltage proportional to changes of pressure resulting from blood flowing in your finger. I am relying on the ESD diodes on the Arduino inputs to handle overvoltage, although a series resistor would not be a bad idea. One side of the piezo is biased with a potentiometer, so the trace can be moved up and down for best results. It can be seen on the leftmost picture above.
-A breath sensor, based around the same principle of the pulse sensor. This time, the piezo element is mounted inside a 3d printed box. A strap goes around the "suspect" and a rubber strip presses the element in time while breathing. See photos below:

 The enclosure was designed in Fusion 360 and 3d printed. Front panel overlay was made on Inkscape. Connections are made using 4 mm banana plugs:

Software side: 
The Arduino reads data from its analog inputs and sends a formatted string at periodic intervals to the computer, where a python program interprets it. Below, a screenshot of said program can be seen.

This is my first "major" python program, and I must admit it is a bit messy. If I started again, I would do things differently. The program is made out of two files, one contains all the GUI related code, while the other has all the underlying methods. I am using PyQt for the GUI and PyQtGraph for the graphs. Other libraries needed include PySerial.

"Installation" instructions:
Install python on your computer if you have not already done so. Don't forget to check the "Add Python to Path" box. 
There is a file named "Modules install.bat" that will install all required libraries on your computer. Or you can do it manually of you wish. 
Then, the program can be run by clicking on:  "USBPolygraphLogic113.py".

Quick start guide, as it appears after pressing the "Help" button:

1) Connect with polygraph:
 -Enter port name.
 -Press Connect.
 -Use Start and Stop to start and stop the transmission.
2) Record an exam:
 -Create a .txt question file: 2 lines for notes and each question in a new line. 
 -Press the New exam button and chose a file name, press Save.
 -Click Load question set and choose the question file.
 -Connect and press Start.
 -Press Q key, read question and press again. Press Y and N for answer markers.
 -Questions will automatically update.
 -Press E key or click Close/Save to end the exam.
3) Open exam:
 -Click Open exam and choose file.
 -Use arrow keys or < > buttons to move through the file.
 -Press Close exam to exit.
4) Miscellaneous:
  -To zoom in the graph, use ctrl and mouse.
  -To return to auto-scaling, click the A button on the bottom left of each graph.
  -For fixed scale, click Reset scale.
  -To enable or disable the pulse Beep, click Beep ON or Beep OFF.

Documentation and project files:

All project files, including STLS and code, can be found in this GitHub repository.

This work is licensed under GNU General Public License v3.0


P.D. This project has been featured in Hackaday and in the Arduino website. Only noticed a couple months later looking at blogger stats... :)

Comments

Popular posts from this blog

Split-ring compound epicyclic/planetary gearboxes

A while ago, I came across this strange thing called ‘split-ring compound epicyclic/planetary gearboxes’. They seemed really nice, extremely high gear ratios in compact, stackable modules. But the already existing models were not enough. I wanted to be able to design my own, and due to the lack of information on the subject, I had to do a little research and some math. Here is most of what I would have liked to find on the first place: 1. What is a planetary gearbox? Planetary gearboxes, as their name says, resemble planets orbiting around a “sun”. They are composed of a sun gear, in the center, two or more planet gears around it -and often fitted to a carrier- and a ring/annulus gear on the outside. As an image is worth a thousand words: Source Their main feature is a high reduction ratio in a small, flat space, and also, it is easy to couple the output of one gearbox to the input of another one, getting a two or more stage gearbox with such a high reduction ratio. But where is the i

Arduino Based Electronic Load

I have had some problems with my "lab power supply" and I wanted to build another one, so I thought a DC load may be handy to have around. The design is based around Dave Jone's design shown in this video , but with a couple more features, including:     -Arduino controlled.     -Voltage, current, power and temperature monitoring.     -CC and external in hardware modes and CP, Cr software modes.     -Over temperature, over power and over current protection (software) It can handle around 4 amps and 24 volts, limited by the mosfet. It's divided in two main boards. * UI Board: houses the 7 segment displays (I know one is bigger that the others, just what I had aroud...) and the keyboard. The display is multiplexed using a shift register. In addition, the four buttons are read taking advantage of the transistors switching the comon anodes, requiring only one additional pin. Only the first digit had decimal point, so one led was added for the second dig

Linear lab power supply

This is a dual channel linear lab power supply I have spent recent months building, much thanks to the help received in  this EEVBlog thread . All design files are available in this  GitHub repository . I will attempt to go over the general progress of the project, but please refer to the said thread for more information. Design requirements: Dual isolated channels. Adjustable voltage and current  30 V , 500 mA per channel. Digital voltage and current displays. Build stages: First, the case was made out of a wooden board and 3d printed front and back panels. Heatsinks were taken from old computers. One side of a 2x 10Vac and a 15 Vac transformer power each channel, plus a 12 Vac smaller transformer for the displays, fan and microcontroller. Ac voltages are rectified and filtered on a separate board. Here are some photos of the early development, initial circuit was based on the one found  here . Then came perfboard prototypes, testing and throubleshooting: