# Prototype the Circuit

395

4

Published

## Introduction: Prototype the Circuit

The following information is a single lesson in a larger project. Find more great projects here.

Project Overview:

This project simulates the Galvanic Skin Response to determine whether an individual is being truthful, using an Arduino to detect the change in skin resistance.
In the first lesson, you will create a prototype circuit for the Lie Detector Project. In the second lesson, you will use common TinkerCAD tools and actions to create a 3D printed finger bed. The final lesson shows you how to create a real-life version of the Lie Detector circuit prototyped in 123D Circuits.

## Step 1: Add an LED

Begin by adding an LED that will illuminate if it detects a change in resistance, indicating your subject may not be telling the truth!

A Light Emitting Diode (commonly called an LED) uses semiconductor technology to generate light. When electric current passes through an LED, electrons fill electron holes within a pn-junction, which releases photons and causes the LED to illuminate.

1. Click on “Components”.
2. Select a LED (Light Emitting Diode) and drag it to the breadboard.
3. Move the LED so that the cathode (negative lead) aligns with breadboard position E30.

## Step 2: Add a Pushbutton

You will use the pushbutton to calibrate the lie detector to each individual.

A pushbutton is a switch that allows electricity to flow only when pressed. Pushbuttons spring back to the off position when not pressed (as opposed to toggle switches, which remain in their current state unless pressed again).

1. Click on “Components”.
2. Select a Pushbutton and drag it to the breadboard.
3. Move the Pushbutton so that terminal 12 (in the upper left lead) aligns with breadboard position E24. The pushbutton should connect the upper and lower sections of the breadboard.

Add resistors to limit current to the LED and Arduino.

A resistor reduces the current within a circuit, and lowers the voltage. Resistors do not have polarity, therefore, they do not have a positive and negative side. This resistor will protect your LED from receiving too much current.

1. Click on “Components”.
2. Select a resistor (R1) and drag it to the breadboard.
3. Rotate the resistor 90 degrees by clicking the rotate icon in the upper left corner on the dashboard.
4. Move the resistor so that the leads align with positions B26 and B30. This resistor will limit current to the LED.
5. Using the drop down menu in the blue label box, change the resistance to 130 Ω.
6. Click on “Components”.
7. Select another resistor (R2) and drag it to the breadboard.
8. Move the resistor so that the leads align with positions E23 and G23. This resistor will limit current from the Arduino.

## Step 4: Simulate Variable Resistance

Add a potentiometer to simulate the probes that you will ultimately create for your subject’s fingers.

A potentiometer is a variable resistor. Turning the knob of a potentiometer causes the resistance to change. You will use a potentiometer to simulate the change in resistance that would occur if your subjects’ skin resistance were to decrease due to sweating, a common physical reaction that occurs when someone is lying.

1. Click on “Components”.
2. Select a potentiometer (rPot) and drag it to the breadboard.
3. Rotate the potentiometer 180 degrees by clicking the rotate icon in the upper left corner on the dashboard. The terminals of the potentiometer should be facing up.
4. Move the potentiometer so that the left-most terminal (terminal 2) aligns with breadboard position E15.

## Step 5: Add a Battery

Add a battery to power the Arduino and circuit

A battery contains chemicals which react and release electrons, creating a voltage potential (a difference between two voltages). While in 123D Circuits, the Arduino Uno has a built in battery, you will need a 9V battery to power your real-life circuit, so it is good to practice where it connects within the circuit.

1. Click on “Components”.
2. Select the 9V battery and drag it to the breadboard.
3. Move the battery so that it hovers above the breadboard and off to the bottom right of the Arduino.

## Step 6: Power Up the Arduino

Provide power to the Arduino by connecting the terminals of the battery to the Arduino.

1. Click on the red terminal (end) of the battery and drag the resulting red line to the Vin (stands for Voltage In) pin on the center bottom area of the Arduino.
2. Click on the black terminal of the battery and drag the resulting red line to the GND (stands for Ground) pin, which is located just to the left of the Vin Pin.
3. Click on the red line you just created, it will turn slightly lighter.
4. Using the drop down menu in the blue label box, change the color to black. The colors will not change the function of the circuit, but help tell different parts of your circuit apart.

## Step 7: Power Up the Breadboard

Connect the Arduino to the breadboard and provide the breadboard with power.

1. Click on the 5V Pin on the bottom of the Arduino.
2. Drag the resulting red line to the top positive (+) power rail of the breadboard. This will provide a positive connection from the Arduino to the breadboard.
3. Click on the GND (ground) Pin on the bottom of the Arduino.
4. Drag the resulting red line to the top negative (-) power rail of the breadboard. This will provide a negative (ground) connection from the Arduino to the breadboard.
5. Click on the red line you just created, it will turn slightly lighter.
6. Using the drop down menu in the blue label box, change the color to black.
7. The breadboard conveniently places power and ground rails at both the bottom and top of the breadboard. This allows for simpler layout and flexibility. Since you will use the top and bottom positive (+) power rail, click on a hole at the bottom left positive power rail and drag it to meet the top positive power rail.
8. Since you will use the top and bottom negative (-) rail, click on a hole at the bottom left negative rail and drag it to meet the top negative rail.
9. Click on the red line you just created, and using the drop down menu at the bottom of the window, change the color to black.

## Step 8: Connect the Arduino

In this step, you will connect the Arduino to one pin of the potentiometer. When you create the real-life version of this circuit, you will replace the potentiometer with probes to measure varying resistance.

The Arduino has several different types of pins, that provide different functions for a project. Input pins measure incoming voltages. Digital input pins measure either on or off, while analog input pins measure a range of voltages. Output pins are usually digital, so they output full voltage or no voltage.

1. Click on the A0 Pin at the bottom of the Arduino.
2. Drag the resulting red line to breadboard position A23.
3. Click on the red line you just created, and using the drop down menu in the blue label box, change the color to green.
4. Click on breadboard position D23.
5. Drag the resulting red line to breadboard position D16.
6. Click on the red line you just created, and using the drop down menu in the blue label box, change the color to green. This trace and the trace you created in step 2 connect to one pin of the potentiometer.
7. Finally, connect the resistor in breadboard column 23 to ground by clicking on breadboard position J23.
8. Drag the resulting red line to the bottom negative (-) rail.
9. Click on the red line you just created, and using the drop down menu in the blue label box, change the color to black.

## Step 9: Continue Connecting the Arduino

Continue to connect the Arduino to the circuit. In this step, you will set up the reset function to calibrate the Lie Detector for each new user.

1. Click on the A1 Pin at the bottom of the Arduino.
2. Drag the resulting red line to breadboard position A24. This will connect the Arduino to the pushbutton.
3. Click on the red line you just created, and using the drop down menu in the blue label box, change the color to blue.
4. Next connect the other side of the pushbutton to ground. To do this, begin by clicking on breadboard position A26.
5. Drag the resulting red line to the top ground (-) rail.
6. Click on the red line you just created, and using the drop down menu in the blue label box, change the color to black.

## Step 10: Finish Connecting the Arduino

In this step, you will connect the LED to the circuit so that you will know whether your user is telling the truth!

1. Click on the A1 Pin at the bottom of the Arduino.
2. Drag the resulting red line to breadboard position A31. This will connect the Arduino to the positive lead (anode) of the LED.
3. Click on the red line you just created, and using the drop down menu in the blue label box, change the color to orange.
4. Thanks to the resistor stretching between breadboard positions B26 and B30, the negative lead (cathode) of the LED is already connected to ground.

## Step 11: Simulate the Finger Pads

This project uses an potentiometer to simulate the finger pads you will create in the photo-based lesson. In this step, you will continue to hook up the potentiometer to rest of the circuit.

1. Click on breadboard position A15.
2. Drag the resulting red line to the top power rail. This will connect the potentiometer to power.
3. The other side of your potentiometer is connected through the green trace you laid in Step 7!

## Step 12: Code the Arduino

Add the code that will detect the change in resistance.

1. Click on the Code Editor icon on the top right of the dashboard.
2. Load the code below into the editor: /* Galvanic skin response detector using a voltage divider */ #define ELECTRODE_PIN A0 #define BUTTON_PIN A1 #define LED_PIN A2 //There will be some amount of noise from reading to reading, so we will average a set of values float threshold = 0.08; //ratio of allowable fluctuation before detector is triggered int numSamples = 10; int avgReading; int baseline; //the resting state value, if the read value differs by more than the threshold allows, we will light up the LED void setup(){ Serial.begin(9600); pinMode(ELECTRODE_PIN, INPUT); //electrode input pinMode(BUTTON_PIN, INPUT_PULLUP); //calibration button input pinMode(LED_PIN, OUTPUT); //status LED } void loop(){ //first we'll sample our pin and collect/average a set of samples int runningTotal = 0; //we will add all of our sample readings to this to compute the average for(int i=0; i baseline * threshold){//returns true if your current value is different enough from the "normal" state analogWrite(LED_PIN, 200); //turn LED on } else analogWrite(LED_PIN, 0); //otherwise turn LED off }

## Step 13: Simulate the Circuit

Test everything out!

1. Click “Upload & Run” to enter your code into the Arduino.
2. Click the pushbutton to initiate the reset. A small green light will illuminate in the bottom left corner of the pushbutton.
3. Click the pushbutton again to complete the reset. The green light should go out.
4. Click on the potentiometer. The knob will turn one place to the right.
5. To simulate the change in resistance that might occur when your subject sweats and might be lying, continue to click on the potentiometer, when the threshold change over 8% is reached, the LED will illuminate.
6. To reset the detector, repeat steps 2 and 3.

In the next lesson you will learn to make a finger hold for the detector!

Next Lesson:Create a Finger Bed for Your Lie Detector

## Recommendations

• ### Large Motors Class

9,113 Enrolled