Human skin contains a wealth of valuable information. Aside from its role in sensing the external environment and protecting against pollutants, it also exhibits a natural response known as Electrodermal Activity (EDA). Taking advantage of this property, we can detect human emotions. In this project, we will construct a simple lie detector using Arduino.
Prior to the actual testing, the examiner will ask the subject a series of questions, such as their identity and profession. The purpose is to establish a baseline for determining the subject's non-deceptive state. Subsequently, the subject will be tested while deliberately providing false answers, allowing us to observe the changes from the established baseline :D.
Step 2: Prepare Required ComponentsTo build our lie detector, we require a microcontroller that can control three LEDs and transmit data to a computer. For seamless communication between the microcontroller and the computer, it is crucial to select a microcontroller with a built-in serial communication chip, specifically a USB communication chip. This means we cannot utilize an Arduino Pro Mini or an Adafruit ornament. So, when deciding on a microcontroller, it is important to ensure it includes the necessary serial communication capabilities. By choosing the appropriate microcontroller, we can seamlessly control the LEDs and transmit data to the computer, enabling the lie detector to function effectively.
Step 3: WiringLet's proceed with the wiring process, which is straightforward and consists of the following steps:
Connect a long cable to the analog pin 0 of the microcontroller (e.g., Arduino).
Connect the 2k resistor to the ground and extend the analog 0 pin to ground as well.
Attach a long cable to the 5V pin of the microcontroller.
Connect the anode (long leg) of the green LED to pin 2, and the cathode (short leg) to ground.
Connect the anode of the orange LED to pin 3, and the cathode to ground.
Connect the anode of the red LED to pin 4, and the cathode to ground.
With the above wiring steps completed, we have successfully set up the connections for the microcontroller. Next, we will explore how to properly attach the sensor wires to our finger, but that will be covered in the subsequent section.
Step 4: Software and CodeFor the software aspect, we will utilize the latest version of the Arduino IDE. The updated version introduces an enhanced feature for visualizing the data received from the Arduino. Instead of relying on text output from the serial monitor, we can now display the data in a live graph. This graphical representation will be instrumental in identifying any changes in the data patterns, particularly when someone is lying.
To access the plotter function, launch the Arduino IDE and navigate to the tools menu. You should find the plotter option listed below the serial monitor.
Once you have downloaded the code for the microcontroller, open it and proceed to upload it onto your board.
// Define the pins for the LEDs
const int greenLED = 2;
const int orangeLED = 3;
const int redLED = 4;
void setup() {
// Set the LED pins as output
pinMode(greenLED, OUTPUT);
pinMode(orangeLED, OUTPUT);
pinMode(redLED, OUTPUT);
// Initialize the serial communication at a baud rate of 9600
Serial.begin(9600);
}
void loop() {
// Read the analog value from pin 0
int sensorValue = analogRead(A0);
// Check if the sensor value exceeds a threshold
if (sensorValue > 500) {
// Turn on the red LED
digitalWrite(redLED, HIGH);
// Send a message indicating possible deception
Serial.println("Possible deception detected!");
} else {
// Turn off the red LED
digitalWrite(redLED, LOW);
}
// Delay for a short period
delay(100);
}
Explanation:
- The code begins by defining the pins for the three LEDs: greenLED, orangeLED, and redLED.
- In the
setup()
function, the LED pins are set as output usingpinMode()
, and the serial communication is initialized withSerial.begin()
. - The
loop()
function is where the main functionality of the lie detector occurs. It reads the analog value from pin A0 usinganalogRead()
. - If the sensor value exceeds a threshold of 500 (adjust as needed), it turns on the red LED using
digitalWrite()
and sends a message via serial communication indicating possible deception. - If the sensor value is below the threshold, the red LED is turned off.
- The
delay()
function adds a short delay of 100 milliseconds between each iteration of the loop.
Remember to upload this code to your Arduino board to run the lie detector.
Step 5: Making the Finger ClipsTo enhance the user experience and improve the project's usability, we will now incorporate additional features. Our first step is to integrate finger clips that will ensure a stable connection between the fingers and the cables. Begin by attaching a strip of tinfoil to the underside of both the hook and loop sections of the Velcro strip. Next, carefully wrap the Velcro strip around your finger until it fits securely and snugly (refer to the accompanying photo). Then, use tape to securely fasten the exposed wire from the analog pin 0 to the tinfoil. Repeat this process for the 5-volt pin, ensuring a strong and reliable connection.
Step 6: ArgumentTo create a functional and compact design, we will construct a small compartment using cardboard. Follow the instructions below to cut out the required shapes:
- Cut two rectangles measuring 15x3 cm.
- Cut one rectangle measuring 15x5 cm.
- Cut three rectangles measuring 5x3 cm (one of these should have a square cutout in the middle for the Nano's USB).
- Cut a rectangle measuring 9x5 cm.
- Cut a rectangle measuring 6x5 cm.
Start by using the 15x5 cm rectangle as the base. Attach the two 15x3 cm rectangles to the sides of the base, and affix the two 5x3 cm rectangles to the bottom, with one placed approximately 6 cm from the sides (towards the middle). This will divide the rectangle into two sides, one measuring 6 cm and the other measuring 9 cm.
Next, cut three holes in the 6x5 cm rectangle (sized to accommodate the LEDs) and glue it to one side of the 6 cm section (to serve as the cover). Finally, attach the short side of the 9x5 cm rectangle to the opposite side of the 9 cm section. This will act as a cover that can be flipped upside down to reveal the finger pads.
By following these steps, you will have a well-structured and functional compartment made from cardboard, perfectly suited for your project.
Step 7: Putting It All TogetherFinally, it's time to assemble the electronics inside the case. Begin by securely gluing the Arduino and all the wires to the 6 cm side of the compartment. Make sure they are properly connected and positioned. Next, connect the extension wires (analog pin 0 and 5 volts) to the opposite side of the rectangle (9 cm side). This will ensure a neat arrangement of the components within the case.
Once the electronics are in place, carefully glue the three LEDs into the designated holes on the 6x5 cm rectangle. Take a moment to test the lie detector. If everything is functioning correctly, you should now have a compact and portable Arduino lie detector. However, please be aware that this system is not highly accurate. Real lie detectors employ a variety of additional sensors such as heart rate monitors to determine if someone is lying. Therefore, it's advisable not to rely on the results of this DIY project for serious matters. Keep it light-hearted!
If you have any inquiries or require further assistance, feel free to reach out to me via personal message or leave a comment. Alternatively, you can visit the TechSparks blog site for more exciting projects.
Comments