Basic Lie Detector

With this machine, the truth will never escape you! As long as you can make your subject hold a moisture sensor for a while.

This tutorial was contributed by Samuel Ong from Raffles Institution.

Step 0 – Pre Build Overview

In this project, we will create a simple lie detector machine, which works by measuring the electrical conductivity of our skin. Upon feeling nervous, our skin’s electrical conductivity will increase, and the moisture sensor can pick up on that. This allows us to determine if a person is telling the truth or not.

MATERIALS: 1 x BBC micro:bit, 1 x Micro USB cable, 1 x Breakout board, 1 x Octopus LED, 1 x Moisture Sensor

Goals

  • Get to know the Octopus LED and Soil Moisture Sensor
  • Learn basic statistics
  • Make something using the moisture sensor

Step 1 – Components

First of all, plug in the soil moisture sensor. Ensure the colours match and take note of what pin you plug them into as it will be relevant later.

Next, plug in the Octopus LED. Any of the three slots should do.

Step 2 - Pre-coding

We'll need to add a package of code to be able to use our kit components. Click on Advanced in the Code drawer to see more code sections and look at the bottom of the Code Drawer for Add Package.

This will open up a dialog box. Do a search for tinkercademy or just tinker. Click on the search icon  or press enter, then click on tinkercademy-tinker-kit.

Note: If you get a warning telling you some packages will be removed because of incompatibility issues, either follow the prompts or create a new project in the Projects file menu.

Click on Tinkercademy or OLED inside the Code Drawer to find our custom blocks for the various components in your kit

Step 3 – Coding

First of all, initialise the OLED using blocks in the OLED section as shown in the picture

This part of the code allows the soil moisture sensor to measure and record down the electrical conductivity between the two fingers every few seconds for about a minute. Then, it calculates the average. This is the “calm” value, when the user has not told any lies.

This part of the code calculates the standard deviation of the readings obtained in that first minute. The standard deviation indicates how varied the readings were. A larger standard deviation means more variance in the readings. The “Math.sqrt” block square roots the given value and was added in Javascript.

After the initial readings have been made and recorded, the moisture sensor now measures the average electrical conductivity over five seconds. If it is higher than the average added to the standard deviation, we can conclude that the user has an abnormally high electrical conductivity and is thus lying. Then, the LED screen would show an “X”shape.

 

Step 4: Using It

First of all, you will have to attach your each prong of the soil moisture sensor to one of your fingers. Personally, I found that using rubber bands was a simple and effective way to do so. You can experiment with different methods, such as using crocodile clips or tape.

Now, turn on the device. The device will record the electrical conductivity of your skin under calm circumstances. Then, it will give the average value and its standard deviation.

After the initial readings have been made, ask away! Should the person lie, he will become nervous and the device can pick up on that, resulting in a cross being displayed.

Step 5 – Success!

Voila! Now you can tell truth from lies with ease using this machine.