<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta />
    <article-meta>
      <title-group>
        <article-title>Designing and evaluating an afordable Arduino-based lie detector prototype</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Stanislav V. Pravytskyi</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Pavlo V. Merzlykin</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Alexander N. Stepanyuk</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Kryvyi Rih State Pedagogical University</institution>
          ,
          <addr-line>54 Universytetskyi Ave., Kryvyi Rih, 50086</addr-line>
          ,
          <country country="UA">Ukraine</country>
        </aff>
      </contrib-group>
      <fpage>80</fpage>
      <lpage>88</lpage>
      <abstract>
        <p>Lie detection is an important issue in various contexts ranging from criminal investigations to hiring processes. The paper covers the prototyping and evaluation of an afordable Arduino-based lie detector that integrates physiological sensors and machine learning to detect deception. Testing on 20 questions showed the detector achieved 55% accuracy in identifying truth and 45% accuracy in identifying lies, with an overall accuracy of 50%. While further refinements are needed, this prototype demonstrates the challenges of developing an accessible lie-detection system.</p>
      </abstract>
      <kwd-group>
        <kwd>eol&gt;lie detection</kwd>
        <kwd>Arduino</kwd>
        <kwd>physiological sensors</kwd>
        <kwd>machine learning</kwd>
        <kwd>LSTM</kwd>
        <kwd>neural networks</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>1. Introduction</title>
    </sec>
    <sec id="sec-2">
      <title>2. Literature review</title>
      <p>
        Polygraph tests, which measure multiple physiological indicators, became the dominant lie detection
tool in the 20th century [
        <xref ref-type="bibr" rid="ref1 ref5">1, 5</xref>
        ]. However, these tests have been criticized for their lack of scientific
validity, vulnerability to countermeasures, and inadmissibility as legal evidence [
        <xref ref-type="bibr" rid="ref6 ref7 ref8">6, 7, 8</xref>
        ].
      </p>
      <p>
        In recent years, researchers have turned to neuroscience tools like fMRI [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ]. These studies suggest
that certain brain regions, such as the prefrontal cortex, are more active during lying than truth-telling.
      </p>
      <p>
        Another emerging trend is the use of machine learning. Recent work [
        <xref ref-type="bibr" rid="ref9">9</xref>
        ] has applied deep learning
algorithms and reported 57–63% accuracy, which leaves a gap for further research.
      </p>
      <p>
        Alongside scientific developments, ethical and legal debates surround lie detectors. Critics argue
that polygraphs and other lie detection technologies are unreliable, violate privacy rights, and may
be misused or overinterpreted in high-stakes contexts like criminal investigations and employment
decisions [
        <xref ref-type="bibr" rid="ref10">10</xref>
        ]. In the US, the Employee Polygraph Protection Act of 1988 prohibited most private
employers from using lie detectors. However, the technology is still widely used in government and
law enforcement settings [
        <xref ref-type="bibr" rid="ref11">11</xref>
        ].
      </p>
      <p>While researchers continue to develop and test new methods, fundamental questions persist about
the accuracy, validity, and ethics of lie detectors. The current study aims to advance this field by
designing an Arduino-based lie detector that integrates physiological measurements with machine
learning analysis. By examining the potential and limitations of afordable lie detectors, we hope to
contribute to the ongoing dialogue.</p>
    </sec>
    <sec id="sec-3">
      <title>3. Methods</title>
      <sec id="sec-3-1">
        <title>3.1. Hardware</title>
        <p>The lie detector prototype was built using an Arduino UNO development board, chosen for its
afordability and extensive community support. The following peripherals were connected to the board:
• SHT20 temperature and humidity sensor
• Pulse sensor to measure heart rate
• ADS1115 16-bit ADC to increase measurement precision</p>
        <sec id="sec-3-1-1">
          <title>The schematics is shown in figure 1.</title>
        </sec>
      </sec>
      <sec id="sec-3-2">
        <title>3.2. Software</title>
        <sec id="sec-3-2-1">
          <title>Three main software components were developed:</title>
          <p>1. Arduino sketch to read sensor data and print it to the serial port
2. Data collection program to save sensor readings along with truth/lie labels
3. Machine learning model to classify data sequences as indicating truth or lies</p>
          <p>The Arduino code initializes the sensors and reads temperature, humidity and pulse values at regular
intervals. The data is printed to the serial port to be processed on the computer. Key sections of the
code are shown below.</p>
          <p>In setup() function, which is executed on startup, we initialize all the interfaces. We use dedicated
libraries to handle both SHT20 and the pulse sensor. Serial connection is established to transfer the
collected data outside.
//Libraries to handle the interfaces
#include &lt;Wire.h&gt;
#include "DFRobot_SHT20.h"
#include "PulseSensorPlayground.h"
DFRobot_SHT20 sht20; //SHT20 instance
PulseSensorPlayground pulseSensor; //pulse sensor instance
const int PulseWire = A0; // Pin for Pulse Sensor
const int Threshold = 525; // Threshold value for Pulse Sensor
void setup() {</p>
          <p>Serial.begin(9600); //establishing serial connection
// Initialize Pulse Sensor
pulseSensor.analogInput(PulseWire);
pulseSensor.setThreshold(Threshold);
// Initialize SHT20
sht20.initSHT20();
delay(100);
sht20.checkSHT20();</p>
          <p>Unlike setup() function, loop() subroutine is executed repeatedly while the device is powered on.
It collects sensors and sends it via serial interface for further processing.
void loop() {
//read pulse sensor data
int myBPM = pulseSensor.getBeatsPerMinute();
pulseSensor.sawStartOfBeat(); // Update pulse status
int pulseValue = analogRead(PulseWire);
// Read SHT20 data at set interval
if (currentMillis - lastSHT20ReadTime &gt;= SHT20Interval) {
lastSHT20ReadTime = currentMillis;
lastHumd = sht20.readHumidity();
lastTemp = sht20.readTemperature();
//send collected data to serial port
Serial.print(lastTemp, 2);
Serial.print(",");
Serial.print(lastHumd, 1);
Serial.print(",");
Serial.println(myBPM);</p>
          <p>The data collection script is written in Python and consists of two subroutines.
read_serial_data() functions reads messages from serial port and returns them.
The
def read_serial_data():
line = ser.readline().decode('utf-8', errors='ignore').strip()
if line:
try :
temperature, humidity, pulse = map(float, line.split(','))
return temperature, humidity, pulse
except ValueError:</p>
          <p>return None
return None</p>
          <p>The collect_data() function asks the user to label each set of collected data as true (1), false (0),
or test mode (3). In normal mode, 100 lines of labelled sensor data are saved to a CSV file for each
prompt. Test mode collects 2000 lines of unlabeled data for evaluating the model. Key functions are
shown below:
def collect_data(filename):
while True:
data = []
label = None
test_mode = False
print("Start collecting data. Press '1' for truth, '0' for lie, " +
"'3' for test.")
label_input = input("Enter label (1-truth, 0-lie, 3-test): ")
if label_input in ['1', '0']:
label = int(label_input)
flush_serial()
print(f"Start recording data with label {label}.")
elif label_input == '3':
test_mode = True
flush_serial()
print("Test mode active. Collecting 2000 lines of data.")
else:
print("Invalid input. Try again.")
continue
while True:
sensor_data = read_serial_data()
if sensor_data:
temperature, humidity, pulse = sensor_data
data.append([label, temperature, humidity, pulse] if not
test_mode else [temperature, humidity, pulse])
if test_mode and len(data) &gt;= 2000:
print(f"Collected {len(data)} lines in test mode.")
data = []
test_mode = False
print("Test mode complete. To continue, press '1', '0',"+
" or '3'.")
break
elif not test_mode and len(data) &gt;= 100:
df = pd.DataFrame(data, columns=['Label', 'Temperature',</p>
          <p>'Humidity', 'Pulse'])
with open(filename, 'a', newline='') as f:</p>
          <p>df.to_csv(f, header=f.tell()==0, index=False)
print(f"Recorded {len(data)} lines with label {label}.")
data = []
label = None
break</p>
          <p>A long short-term memory (LSTM) neural network was implemented using the Keras library. The
model architecture consists of an LSTM layer with 50 neurons followed by a dense output layer with
sigmoid activation. It was trained on overlapping sequences of 100 sensor readings to predict the
probability that each sequence corresponds to a lie. An 80/20 train/validation split and early stopping
based on validation accuracy were used. The key model setup code is shown below:
def create_sequences(data, seq_length):
sequences = []
labels = []
for i in range(len(data) - seq_length + 1):
seq = data[i:i + seq_length][features].values
label = data.iloc[i + seq_length - 1][label_col]
sequences.append(seq)
labels.append(label)
return np.array(sequences), np.array(labels)
X, y = create_sequences(df, sequence_length)
model = Sequential()
model.add(LSTM(50, input_shape=input_shape))
model.add(Dense(1, activation='sigmoid'))
model.compile(optimizer='adam', loss='binary_crossentropy',</p>
          <p>metrics=['accuracy'])
checkpoint = ModelCheckpoint('best_model.h5',
monitor='val_accuracy',</p>
          <p>Finally, a real-time prediction program was developed to load the trained model, collect live sensor
data from the Arduino, and output truth/lie classifications. Predictions are made on rolling windows of
the last 100 sensor values. Key sections are shown below:
model = load_model('lie_detector_model.h5')
def predict_from_buffer(buffer):
input_data = np.array(buffer).reshape(1, sequence_length, len(features))
prediction = model.predict(input_data)
return 1 if prediction[0][0] &gt; 0.5 else 0
while True:
user_input = input("Enter 'start' to begin data collection: ")
.strip().lower()
if user_input == 'start':
data_buffer = []
# Clear serial buffer
ser.reset_input_buffer()
# Collect data
while len(data_buffer) &lt; sequence_length:
if ser.in_waiting &gt; 0:
data_line = ser.readline().decode('utf-8').strip()
temperature, humidity, pulse = map(float, data_line.split(','))
data_buffer.append([temperature, humidity, pulse])
# When buffer is full, run test
print("Data collected. Running test...")
results = []
for _ in range(100):
result = predict_from_buffer(data_buffer)
results.append(result)
true_count = results.count(1)
false_count = results.count(0)
# Output final result
if true_count &gt; false_count:</p>
          <p>print("Truth")
else:</p>
          <p>print("Lie")</p>
          <p>These software components work together to enable the Arduino lie detector prototype to collect
physiological data, analyze it using a trained machine learning model, and output lie/truth classifications
in real time. The system’s modular design allows for easy modification and extension of its capabilities.</p>
        </sec>
      </sec>
    </sec>
    <sec id="sec-4">
      <title>4. Results</title>
      <p>The lie detector prototype was tested on 20 questions designed to elicit a mix of true and false responses:</p>
      <p>The system accurately classified 55% of true statements and 45% of lies, for an overall accuracy of
50% (table 1).
• Collecting a larger and more varied training dataset
• Tuning the neural network architecture and hyperparameters
• Incorporating additional physiological sensors
• Personalizing models to each individual’s baseline physiology</p>
      <p>
        These results highlight both the promise and challenges of developing an afordable lie detection
system. With an overall accuracy of 50%, the current prototype performs similarly to the average human
lie detector [
        <xref ref-type="bibr" rid="ref12">12</xref>
        ].
      </p>
    </sec>
    <sec id="sec-5">
      <title>5. Discussion</title>
      <p>This work demonstrates that an inexpensive lie detector can be constructed by interfacing physiological
sensors with an Arduino microcontroller and applying machine learning to the collected data. However
the LSTM neural network’s accuracy (50% overall) is not yet suficient for practical application.</p>
      <p>
        It falls short of the claims made by polygraph proponents, who often report accuracy rates of 90%
[
        <xref ref-type="bibr" rid="ref8">8</xref>
        ], although these claims are highly controversial. However another machine learning approach is
reported to have 57% accuracy [
        <xref ref-type="bibr" rid="ref9">9</xref>
        ], which is comparable to our results.
      </p>
      <p>
        The Arduino prototype’s slight bias towards classifying statements as true (55% accuracy on truths
vs. 45% on lies) is consistent with the “truth bias” observed in human lie detection [
        <xref ref-type="bibr" rid="ref13">13</xref>
        ].
      </p>
      <p>Several limitations of the current study should be acknowledged. First, the test questions, while
designed to elicit a range of truthful and deceptive responses, may not fully capture the complexity
and motivation of real-world deception. The stakes in a laboratory setting are inherently lower than in
high-consequence contexts like criminal investigations or national security screenings.</p>
      <p>Second, the physiological measures used by the prototype (skin temperature, humidity, pulse) are a
subset of those typically collected by polygraphs, which also measure respiration and blood pressure.
Incorporating additional sensors could potentially improve the system’s accuracy.</p>
      <p>
        Third, the current prototype uses a single machine-learning model trained on data from multiple
individuals. Developing personalized models tailored to each individual’s baseline physiological
responses could potentially improve accuracy, as prior work has shown that accounting for individual
diferences can enhance deception detection [
        <xref ref-type="bibr" rid="ref9">9</xref>
        ]. However, collecting suficient training data from each
user to develop robust personalized models would be a significant practical challenge.
      </p>
    </sec>
    <sec id="sec-6">
      <title>6. Ethical challenges</title>
      <p>All the mentioned gaps in the results return us to the ethical challenges surrounding lie detection. Since
physiological responses measured by lie detectors can be influenced by various factors unrelated to
deception, such as anxiety, fear, or medical conditions, it is doubtful that these devices should be used
in the cases which can have serious consequences for individuals’ lives and reputations.</p>
      <p>Moreover, persons subjected to polygraph testing may not fully understand how the test works,
which may afect the results. Ensuring that individuals are adequately informed is an important ethical
challenge for lie detectors research and practical usage.</p>
      <p>Privacy and personal data collection is another issue that should be considered in such tests. There is
always a risk that information obtained during testing could be used against individuals in ways they
did not anticipate.</p>
      <p>The potential lasting impact of undergoing a lie detector test on mental health and well-being is
another concern.</p>
      <p>Addressing these challenges requires a careful consideration of the implications for individuals and
society, as well as a commitment to ethical principles such as validity, informed consent, privacy, and
fairness.</p>
    </sec>
    <sec id="sec-7">
      <title>7. Conclusion</title>
      <p>The development of an Arduino-based lie detector prototype demonstrates the challenges for low-cost,
accessible DIY lie detection tools. The prototype’s performance, while not yet suficient for practical
application, highlights the promise of this approach.</p>
      <p>Substantial improvements in accuracy, reliability, and generalizability will be necessary for such a
system to be viable for real-world use. This will likely require more extensive and more diverse training
datasets, more sophisticated machine learning models, and the integration of additional physiological
and behavioural measures. Personalized models that take into account individual diferences may also
be a promising direction.</p>
      <p>At the same time, it is crucial to recognize that the challenges of lie detection are not purely
technological. Even a substantially improved lie detector would still face fundamental questions about the
nature of deception, the ethics of its application, and its appropriate role in legal, commercial, and
personal contexts.</p>
      <p>Lie detector studies should take into account the mentioned ethical considerations and be designed
to minimize harm, provide benefits, and respect the autonomy of participants.</p>
      <p>Declaration on Generative AI: During the preparation of this work, the authors used Claude 3 Opus in order to: Drafting
content, Text translation, Generate literature review, Grammar and spelling check, Content enhancement. After using this
service, the authors reviewed and edited the content as needed and takes full responsibility for the publication’s content.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [1]
          <string-name>
            <given-names>G. C.</given-names>
            <surname>Bunn</surname>
          </string-name>
          , '
          <article-title>Supposing that truth is a woman, what then?': The lie detector, the love machine, and the logic of fantasy</article-title>
          ,
          <source>History of the Human Sciences</source>
          <volume>32</volume>
          (
          <year>2019</year>
          )
          <fpage>135</fpage>
          -
          <lpage>163</lpage>
          . doi:
          <volume>10</volume>
          .1177/ 0952695119867022.
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [2]
          <string-name>
            <given-names>E.</given-names>
            <surname>Rusconi</surname>
          </string-name>
          ,
          <string-name>
            <surname>T.</surname>
          </string-name>
          Mitchener-Nissen,
          <article-title>Prospects of functional magnetic resonance imaging as lie detector, Frontiers in Human Neuroscience (</article-title>
          <year>2013</year>
          ). doi:
          <volume>10</volume>
          .3389/fnhum.
          <year>2013</year>
          .
          <volume>00594</volume>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [3] BuildItDR,
          <string-name>
            <surname>Arduino Lie</surname>
          </string-name>
          Detector - projecthub.arduino.cc, https://projecthub.arduino.cc/BuildItDR/ arduino-lie
          <source>-detector-41f703</source>
          ,
          <year>2022</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          [4]
          <string-name>
            <given-names>S.</given-names>
            <surname>Olfat</surname>
          </string-name>
          ,
          <string-name>
            <surname>Arduino Polygraph Machine (Lie Detector</surname>
          </string-name>
          )
          <article-title>- ElectroPeak - electropeak</article-title>
          .com, https: //electropeak.com/learn/arduino-lie
          <string-name>
            <surname>-</surname>
          </string-name>
          detector
          <string-name>
            <surname>-</surname>
          </string-name>
          polygraph-machine/,
          <year>2016</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          [5]
          <string-name>
            <given-names>C. A.</given-names>
            <surname>Ruckmick</surname>
          </string-name>
          ,
          <article-title>The truth about the lie detector</article-title>
          ,
          <source>Journal of Applied Psychology</source>
          <volume>22</volume>
          (
          <year>1938</year>
          )
          <fpage>50</fpage>
          -
          <lpage>58</lpage>
          . doi:
          <volume>10</volume>
          .1037/h0059742.
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          [6]
          <string-name>
            <given-names>W. G.</given-names>
            <surname>Iacono</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D. T.</given-names>
            <surname>Lykken</surname>
          </string-name>
          ,
          <article-title>The validity of the Lie detector: Two surveys of scientific opinion</article-title>
          ,
          <source>Journal of Applied Psychology</source>
          <volume>82</volume>
          (
          <year>1997</year>
          )
          <fpage>426</fpage>
          -
          <lpage>433</lpage>
          . doi:
          <volume>10</volume>
          .1037/
          <fpage>0021</fpage>
          -
          <lpage>9010</lpage>
          .
          <year>82</year>
          .3.426.
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          [7]
          <string-name>
            <given-names>D. T.</given-names>
            <surname>Lykken</surname>
          </string-name>
          ,
          <article-title>Psychology and the lie detector industry</article-title>
          ,
          <source>The American psychologist 29</source>
          (
          <year>1974</year>
          )
          <fpage>725</fpage>
          -
          <lpage>739</lpage>
          . doi:
          <volume>10</volume>
          .1037/h0037441.
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          [8]
          <string-name>
            <given-names>W. G.</given-names>
            <surname>Iacono</surname>
          </string-name>
          ,
          <article-title>Psychology and the lie detector industry: A fifty-year perspective</article-title>
          ,
          <source>Biological Psychology</source>
          <volume>190</volume>
          (
          <year>2024</year>
          )
          <article-title>108808</article-title>
          . doi:
          <volume>10</volume>
          .1016/j.biopsycho.
          <year>2024</year>
          .
          <volume>108808</volume>
          .
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          [9]
          <string-name>
            <given-names>N.</given-names>
            <surname>Rodriguez-Diaz</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Aspandi</surname>
          </string-name>
          ,
          <string-name>
            <given-names>F. M.</given-names>
            <surname>Sukno</surname>
          </string-name>
          ,
          <string-name>
            <given-names>X.</given-names>
            <surname>Binefa</surname>
          </string-name>
          ,
          <article-title>Machine learning-based lie detector applied to a novel annotated game dataset</article-title>
          ,
          <source>Future Internet</source>
          <volume>14</volume>
          (
          <year>2022</year>
          ). doi:
          <volume>10</volume>
          .3390/fi14010002.
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          [10]
          <string-name>
            <given-names>J. J.</given-names>
            <surname>Furedy</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R. J.</given-names>
            <surname>Heslegrave</surname>
          </string-name>
          ,
          <article-title>Validity of the Lie Detector: A Psychophysiological Perspective</article-title>
          ,
          <source>Criminal Justice and Behavior</source>
          <volume>15</volume>
          (
          <year>1988</year>
          )
          <fpage>219</fpage>
          -
          <lpage>246</lpage>
          . doi:
          <volume>10</volume>
          .1177/0093854888015002008.
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          [11]
          <string-name>
            <given-names>V.</given-names>
            <surname>Mellema</surname>
          </string-name>
          , Lie Detector Tests,
          <source>in: The Encyclopedia of Civil Liberties in America: Volumes One-Three</source>
          , volume
          <volume>2</volume>
          ,
          <year>2015</year>
          , pp.
          <fpage>567</fpage>
          -
          <lpage>568</lpage>
          . doi:
          <volume>10</volume>
          .4324/
          <fpage>9781315699868</fpage>
          -
          <lpage>398</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref12">
        <mixed-citation>
          [12]
          <string-name>
            <given-names>T. H.</given-names>
            <surname>Feeley</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M. J.</given-names>
            <surname>Young</surname>
          </string-name>
          ,
          <article-title>Humans as lie detectors: Some more second thoughts</article-title>
          ,
          <source>Communication Quarterly</source>
          <volume>46</volume>
          (
          <year>1998</year>
          )
          <fpage>109</fpage>
          -
          <lpage>126</lpage>
          . doi:
          <volume>10</volume>
          .1080/01463379809370090.
        </mixed-citation>
      </ref>
      <ref id="ref13">
        <mixed-citation>
          [13]
          <string-name>
            <given-names>T. R.</given-names>
            <surname>Levine</surname>
          </string-name>
          ,
          <string-name>
            <given-names>C. N. H.</given-names>
            <surname>Street</surname>
          </string-name>
          ,
          <article-title>Lie-truth judgments: Adaptive lie detector account and truth-default theory compared and contrasted</article-title>
          ,
          <source>Communication Theory</source>
          <volume>34</volume>
          (
          <year>2024</year>
          )
          <fpage>143</fpage>
          -
          <lpage>153</lpage>
          . doi:
          <volume>10</volume>
          .1093/ct/ qtae008.
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>