eGuidezhan
Published

7 Steps to Build a Simple Arduino Lie Detector

Are you worried that your friend is lying to you? Take out this lie detector at the party to test his sincerity to you!

BeginnerProtip350
7 Steps to Build a Simple Arduino Lie Detector

Things used in this project

Hardware components

Arduino Nano R3
Arduino Nano R3
×1
Geen LED
×1
5 mm LED: Red
5 mm LED: Red
×1
LED, Orange
LED, Orange
×1
Resistor 10k ohm
Resistor 10k ohm
×1
USB-A to Mini-USB Cable
USB-A to Mini-USB Cable
×1
Cardboard
×1
Tinker Board
Tinker Board
×1
Velcro
×1
Hot Glue
×1

Hand tools and fabrication machines

Hot glue gun (generic)
Hot glue gun (generic)
Soldering iron (generic)
Soldering iron (generic)
Craft Knife

Story

Read more

Schematics

f05w608irsuey26_6x1kB5EWXn.jpg

Code

Code

C/C++
// 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);
}

Credits

eGuidezhan
2 projects • 0 followers
TechSparks is a tech blogger who makes a living with professional articles!

Comments