HackerBox 0077: Veritas

Introduction: HackerBox 0077: Veritas

Welcome to HackerBox 0077. Let's learn about polygraph technology. Configure the Seeeduino XIAO microcontroller module. Modify an OLED module to enable dual display operation on a single microcontroller. Assemble a galvanic skin response (GSR) sensor using operational amplifiers. Integrate a heart rate sensor. Practice both surface mount and through hole soldering techniques to assemble and test a complete miniature lie detector project.

HackerBoxes is the monthly subscription box of electronics, computer technology, and hacker culture. Each HackerBox is a discovery box, which means all members await and enjoy a new surprise each month. Tech, toys, knowledge, and fun... It's like having a hacker convention, your birthday, and the first day of school - every month - right in your mailbox.

There is a wealth of information for current and prospective members in the HackerBoxes FAQ. Almost all of the non-technical support emails that we receive are already answered there, so we'd really appreciate it if you can take a few minutes to read the FAQ.

Supplies

This Instructable contains information for getting started with HackerBox 0077. The full box contents are listed on the product page for HackerBox 0077 where the box is also available for purchase while supplies last. If you would like to automatically receive a HackerBox like this right in your mailbox each month with a $15 discount, you can subscribe at HackerBoxes.com and join the party!

A soldering iron, solder, and basic soldering tools are generally needed to work on the monthly HackerBox. A computer for running software tools is also required. Have a look at the HackerBox Workshops for basic tools and a wide array of introductory activities and experiments.

The most import thing you will need is a sense of adventure, hacker spirit, patience, and curiosity. Building and experimenting with electronics, while very rewarding, can be tricky, challenging, and even frustrating at times. The goal is progress, not perfection. When you persist and enjoy the adventure, a great deal of satisfaction can be derived from this hobby. Take each step slowly, mind the details, and don't be afraid to ask for help.

Step 1: Veritas Vos Liberabit

Carved in stone at the Original Headquarters Building of the Central Intelligence Agency...

Ye Shall Know the Truth and the Truth Shall Make You Free

A polygraph, or lie detector test, measures and records several physiological indicators such as blood pressure, pulse, respiration, and skin conductivity while a person is asked and answers a series of questions. It is believed that deceptive answers will produce physiological responses that can be differentiated from those associated with truthful answers. There are, however, no specific physiological reactions associated with lying, making it difficult to identify factors that separate those who are lying from those who are telling the truth. (Wikipedia)

The Veritas kit was inspired by the most excellent DEF CON 29 Tor Badge - a mini lie detector. The DEF CON 29 Tor Badge features a Galvanic Skin Response (GSR) sensor and a heart rate sensor, which are two of the primary sensors used in a polygraph machine. The Tor Badge also featured two OLED screens, four buttons, and some nice Arduino-friendly firmware. Watch this video overview of the DEF CON 29 Tor Badge.

The Veritas kit achieves similar functionality as the DEF CON 29 Tor Badge, but modified for DIY assembly. A schematic diagram of the PCB is shown above.

Just like the DEF CON 29 Tor Badge, the Veritas kit includes a Seeeduino XIAO microcontroller module, two 1.3 inch OLED display modules, and four buttons. The sensor circuits are similar apart from the required DIY modifications:

GSR Sensor: A similar skin resistance circuit based on LM324 operational amplifiers is used for the Veritas kit. Documentation is available for this example module. To make the GSR circuit friendly for hand soldering, the Veritas kit uses a socked DIP version of the LM324 op-amp chip and larger (1206 sized) discrete components. To simplify the GSR finger cuffs, the Veritas kit incorporates two large PCB finger pads. There is also a header (J1) for optionally connecting finger cuffs or other wired GSR sensors.

Heart Rate Sensor: The APDS-9008 light sensor is a nightmare to hand solder, so the Veritas kit incorporates a pre-assembled pulse sensor module with practically the same circuit and components. 

Firmware: The Arduino sketch for the DEF CON 29 Tor Badge was released under the permissive free software "Do What The F*ck You Want To Public License" abbreviated as the WTFPL license. The Tor Badge sketch code runs on the Veritas kit project.

Step 2: Seeeduino XIAO

The Seeeduino XIAO is the smallest member of the Seeeduino family. It is designed around a powerful SAMD21G18 microcontroller with an ARM Cortex M0 processing core. The 32bit microcontroller operates at 48MHz and leverages 256KB of flash storage and 32KB of SRAM memory. The microcontroller also features 14 GPIO PINs, 1 DAC output, 1 I2C interface, 1 SPI interface, and 1 serial UART.

Perform the configuration and initial test procedures for the XIAO before soldering anything to the module. Simply connect the module to your PC using a USB-C cable. Be sure that the cable is a data cable and not simply a charge-only cable. Follow the instructions here to install the Arduino IDE, configure the necessary seeeduino board manager, and run the blink.ino test sketch.

Full documentation: Seeeduino XIAO Wiki

Step 3: Surface Mounting Size 1206 Components

Surface Mount Devices (SMDs) are soldered onto the flat surface of a printed circuit board. In contrast, through-hole devices have leads that are inserted through plated holes in the PCB and soldered therein.

SMDs are often quite small and can be challenging to hand-solder. This challenge can be mitigated by using slightly larger landing pads on the PCB along with larger components such as 1206 components. A 1206 component is .12 x .06 inches in size, which is 8-10 times larger than the tiny 01005 packages likely found in your smartphone or other mobile devices. With just a little practice, 1206 components become quite reasonable to hand solder.

Take a look at the HackerBox Soldering Workshop for additional practice and some free soldering videos including pointers on soldering SMD components.

Take plenty of time to mount the twelve small SMD1206 components. Open only one value at a time peeling the packaging strips very carefully to avoid launching the components across the room. The twelve components are not polarized meaning that they can be attached in either direction. Simple match each one up to the correct R and C numbered positions on the PCB as listed here:

THREE 100nF Ceramic Capacitors (brown/beige - no number marking): C2, C5, C8

TWO 4.7K Resistors (marked "472"): R2 R3

TWO 100K Resistors (marked "104"): R7, R8

FOUR 200K Resistors (marked "204"): R4, R5, R12, R13

ONE 1M Resistor (marked "105"): R14


Step 4: More Surface Mount Components

There are two remaining types of surface mount devices to mount on the Veritas PCB.

Four Momentary Buttons 

For each button, start by only affixing one lead while adjusting the button until the button is correctly positioned - centered over its landing pads. Then solder the other three leads of the button.

Seeeduino XIAO Module

Orient the module such that the USB connector extends to the edge of PCB. Start by affixing only one corner pad while adjusting the module until the XIAO is correctly positioned - centered over the landing pads on the PCB. Then solder the remaining pads by touching the iron and some solder into each semicircular void where a castellated hole meets the landing pad on the PCB. The solder should wick into, and slightly under, the castellated hole.

XIAO Test Code

After soldering the XIAO into place, power it up to be sure the blink sketch still runs properly.

Next, grab the ButtonTest.ino sketch attached here. Compile and run the sketch, open the Arduino Serial Monitor set to 9600 baud, and test the four momentary buttons by pressing each one while checking the serial monitor output.

Step 5: Heartrate Sensor Module

The heartrate sensor module can detect pulses and real-time heart rate. The module includes a reverse-mounted green LED, a light sensor adjacent to the green LED, an integrated optical amplifier circuit, and a noise filtering circuit. The coarse sensitivity of the sensor is automatically adjusted by the hardware. Before your finger is placed on the sensor, the motion of your hand can be detected moving up and down a few inches above the board.

Assembly:

First review the information below under "Challenges with The Heartrate Sensor"

  1. Remove the three wire leads or header pins from the pulse sensor.
  2. Solder a thin solid wire, such as a component lead trimming, into the top hole of the module as shown. The wire should extend from the back of the sensor.
  3. Closely trim the solid wire at the front of the sensor to make it smooth to the touch.
  4. Position the sensor module flush with the Veritas PCB.
  5. Solder the solid wire onto the anchor pad
  6. Bridge the three signal pads with cut header pins. Solder the bridges into place.
  7. Cover the front of the sensor (and surrounding Veritas PCB) with the clear sealing wafer.

Note that the thin solid wire (#2 above) is just a mechanical anchor and doesn't electrically connect to anything. Be sure that it doesn't short any components or traces aside from the hole it is mounted in. The three signal pads do connect to actual signal traces: Heart Rate Output, 3.3V Power, and Ground.

Step 6: Challenges With the Heartrate Sensor

We've had challenges with a lot of these Heartrate Sensor Modules. Very impressive troubleshooting and detective work from HackerBox Members has shed much light on the subject.

The root issue seems to be that many of the heartrate modules have the green LED brightness configured too high. The excess amount of green light seems to overwhelm the light sensor.

Interestingly, the code examples on the Pulse Sensor Github Repo seem to work fine even with the modules where the green light is too bright. However, those modules do not behave with the Tor Badge Code.

HackerBox Members have come up with two awesome hacks to turn down the intensity of the green light...

QUICK AND EASY

The easiest hack is to attenuate the green light using green or blue tape as an optical filter.   

Success had been obtained with electrical tape or by stacking a few layers of painter's tape.  

In either case, place the tape only over the green LED, not over the light sensor.

The provided clear sealing wafer can be placed over the green/blue tape to keep everything in place.

TRICKIER (but perhaps a bit more elegant)

The heartrate modules that emit too much green light all seem to use a 470 ohm resistor to "current limit" the green LED.

Replacing that 470R resistor with a 2.2K seems to do the trick. Some report that a 5.6K resistor works as well.

Step 7: Dual OLED Display Requirements

The two OLED modules each feature 1.3 inch black and white display panels. Each has a resolution of 128x64 pixels. They are variants of the those features on this LCD Wiki page. All of the details generally apply.

I2C Address Modification

The two OLED modules are connected to the same I2C bus of the microcontroller. In order for the OLED modules to act as a dual display, they must display different output information. The microcontroller must be able to differentiate between the two OLED modules. This is done by assigning a different I2C address to each OLED module.

The simplest way to set different I2C addresses is to apply a solder short to one of the OLED modules as shown here. This short changes the I2C address from the factory default 78/3C to the optional 7A/3D (all hex). Note that only one of the modules is modified and one is left set to the factory default address.

You may note that the intended technique for setting the address is to differently populate the 4.7K resistor in either of the two positions. So technically, we should unsolder the resistor and move it to the other position. However, the center of the three pads is barely attached and very easily lifts away from the module's PCB substrate. Applying the solder short, as instructed here, easily overrides the 4.7K ground with a zero ohm (short) pull up to 3.3V without having to unsolder the resistor. This shortcut wastes a tiny bit of extra current, but that is fine for this application.

You may also note that we refer to I2C address options with two different numbers. These are 7 bit and 8 bit representations of the same addresses. You can learn more about that here if you are curious.

Step 8: Final Through Hole Assembly

We're almost done...

Mount the two OLED modules to the Veritas PCB

The OLED module that was modified with the solder short mounts onto header J3 (the right-side display). The OLED still set to the factory default I2C address mounts onto header J2 (the left-side display).

Mount and stuff the IC socket

Populate the DIP14 IC socket into the location labeled U2. Match the notched end of the socket to the notch marking on the PCB silkscreen. Stuff the LM324 op-amp chip into the socket, once again matching up the notched ends.

Mount the potentiometer and attach the silicon rubber bumpers

No mystery here. (Don't take that as a challenge.)

Load the code and seek the truth

Surf over to the github repository for the DEF CON 29 Tor Badge. It has a lot of great information about the sensors, operation of the firmware, and the Arduino code. The Veritas PCB has the same I/O pin connections to the Seeeduino XIAO microcontroller, so that sketch file can be used as is. Be sure to Install the three necessary Arduino libraries as instructed in the repository notes.

Step 9: HACK LIFE

We hope you are enjoying this month's HackerBox adventure into electronics, computer technology, and hacker culture. Reach out and share your success in the comments below or other social media. Also, remember that you can email support@hackerboxes.com anytime if you have a question or need some help.

What's Next? Join the party and live the HackLife! Get a cool box of hackable gear delivered right to your mailbox each month and enjoy a generous member discount. Surf over to HackerBoxes.com right now and sign up for your monthly HackerBox subscription.

7 People Made This Project!

Recommendations

  • Cardboard Speed Challenge

    Cardboard Speed Challenge
  • Science Fair Challenge

    Science Fair Challenge
  • Tinkercad to Fusion 360 Challenge

    Tinkercad to Fusion 360 Challenge

40 Comments

0
dpk136
dpk136

8 hours ago

Can't get the Tor sketch to upload.
Arduino: 1.8.19 (Mac OS X), Board: "Seeeduino XIAO, Arduino, Off"
Sketch uses 79128 bytes (30%) of program storage space. Maximum is 262144 bytes.
Atmel SMART device 0x10010005 found
Device : ATSAMD21G18A
Chip ID : 10010005
Version : v1.1 [Arduino:XYZ] Nov 27 2019 16:35:59
Address : 8192
Pages : 3968
Page Size : 64 bytes
Total Size : 248KB
Planes : 1
Lock Regions : 16
Locked : none
Security : false
Boot Flash : true
BOD : true
BOR : true
Arduino : FAST_CHIP_ERASE
Arduino : FAST_MULTI_PAGE_WRITE
Arduino : CAN_CHECKSUM_MEMORY_BUFFER
Erase flash
done in 0.861 seconds
Write 80844 bytes to flash (1264 pages)
[======= ] 25% (320/1264 pages)
SAM-BA operation failed
An error occurred while uploading the sketch
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

0
lmperkins
lmperkins

26 days ago

I was initially able to get the pulse monitor working with green tape although it was a little finicky. I then swapped out the 470 resistor for a 5.6k and it works much better. Cute little device.

0
random fet
random fet

6 weeks ago

Running into an issue measuring heartrate. If I tap the sensor with my finger I can simulate a heartrate but if I hold my finger against the sensor it just remains a flat line. Any idea what could be causing this?

0
jer502
jer502

Reply 6 weeks ago

Same issue with the heartrate sensor not working right.

Side note - I was playing it with my kids and they loved it. My youngest had to show it to all his friends and when he did, it brought back memories of a toy a friend had back in the 80's. It was a lie detector test (GSR) that would shock and light up when you triggered it. I don't remember quite what it looked like but Amazon has one for sale. We had tons of fun with it when we were kids!

0
MichaelSinclair
MichaelSinclair

Reply 4 weeks ago

Yes, as confirmed by others, the LED is far to bright on the cheap China copy. A 470 ohm resistor is in series on the cheap China board. The Original pulse sensor board uses 2.2k ohm in series. So, changed out one of the cheap China boards to 2.2k and it works. R6 is also a different value on the cheap China board but does not seem to affect the performance. In the picture attached, Original Pulse Sensor on top, Cheap China board below.

Veritas Sensor Compare.jpg
0
MichaelSinclair
MichaelSinclair

Reply 6 weeks ago

Same. Doesn't register a pulse, jumps around by
tapping on it, otherwise flat lined. GSR is calibrated to around
512, no BPM.

0
MichaelSinclair
MichaelSinclair

Reply 4 weeks ago

Ordered the original Sensor from Amazon, ( pulsesensor.com ) not the China copy, Works perfectly! Also have a pair of the China copies, no joy. Both of the China copies fail to function. Now comparing the boards to check for differences.

Veritas Display.jpgVeritas Sensor.jpg
0
eburman
eburman

Reply 5 weeks ago

Try putting some green tape over the LED to dim it a bit. That worked for me. See photos and comment above.

0
norlin
norlin

Reply 5 weeks ago

Thanks to this suggestion, I replaced the 470 ohm resistor with a 5.6k ohm resistor for the LED and get successful results (see other reponses for details, photo in the "I made it" section)

0
jabutleratmacdotcom
jabutleratmacdotcom

Reply 5 weeks ago

Mr. fet, this detector is a dud. Anyone out there get a heartbeat? I had a detector from an old Hackerbox and I bought 3 more from Amazon last week. The results were always as you described. It definitely works, after a fashion, it just doesn't detect a heartbeat. But I'm not surprised, I couldn't get the detector to work on that older Hackerbox, either.

0
ebchopra
ebchopra

Reply 6 weeks ago

same

0
Cgpsa1
Cgpsa1

Reply 6 weeks ago

Same. Doesn't register a pulse, but I can get it to jump around by tapping on it, otherwise it is flatlined. GSR is calibrated to about 512, but nothing seems to cause it to spike, just stays pretty much flatlined too.

0
HackerBoxes
HackerBoxes

Reply 6 weeks ago

The GSR doesn't spike, it drops a tiny bit under stress. For GSR watch the delta value. "The GSR sensor measures resistance of electricity traveling between the two finger cuff contacts. As your body reacts to nervousness or stress it releases more sweat, which changes the resistance of your body between the contacts, and the GSR reading will drop."

0
mrGman123
mrGman123

Reply 6 weeks ago

Same, no heart rate.

0
eburman
eburman

Tip 5 weeks ago

I think that the green LED is just too bright on some of the heart rate sensor modules. It overwhelms the light sensor. I spent an hour trying different fingers, different positions, different pressures but the module wasn't able to pull out a readable signal. So I peeled off the clear plastic sticker that was provided with the kit and I stuck green painters tape over the green LED to attenuate its light. Be careful not to cover the light sensor. Just be sure to cover the LED completely. It required about three layers of tape to dim the LED sufficiently. That has worked well for me. I now get a well defined pulse signal that is easily detected by the monitor. The masking tape lets through just enough light so that the signal isn't overwhelmed but is still sufficient to illuminate my finger and pass through to the light sensor. I used generic green painters masking tape that has no branding inscriptions on it. Everyone has green masking tape on their benchtop don't they? Give it a try. It might work for you too! Maybe there's a way to modify the code to dim the LED instead of using masking tape?

0
norlin
norlin

Reply 5 weeks ago

Since I only have blue painters tape lying around, I decided to maybe try reducing the LED power. The LED's cathode is connected to ground via a 470 ohm resistor. Figured I'll desolder that resistor and put it in series with a potentiometer, measure the resistance value where I get a good result and solder in the equivalent resistor. At about 4-5k ohms I started seeing a bump on the graph that corresponded with my heartbeat, at 5.6k ohms and holding my finger on the pad very still and lightly, I got the heartbeat to register.

Thanks for the tip of attenuating the LED's light output! Works a charm now! (posted photo above of the board during testing in the "I made it" section)

0
jabutleratmacdotcom
jabutleratmacdotcom

Reply 4 weeks ago

Blue tape works, too. Turned my dud into a do-er. Thanks, Mr. eburman!

0
eburman
eburman

Reply 5 weeks ago

That's fantastic! I was thinking about doing the same (but I'm feeling too lazy this morning). Replacing the resistor sure would be a lot less cheesy looking than green tape. I'm glad you got it to work! That's the true hacking spirit! Now you can solder in a 5.6k SMD resister to replace the lower value one. It seems odd that a lot of these modules seem to have this problem. Poor quality control I guess. Or maybe they changed their supplier of green LEDs.

0
DavidS926
DavidS926

Reply 5 weeks ago

Great solution with the tape! I used a tiny square of green electrical tape over the led and it was perfect! Excellent mod to make it work. I put the clear plastic sitker on over the green tape and you'd never know it wasn't suppose to be like that.

0
pbhound
pbhound

5 weeks ago

like others, I can't get the HR monitor to work (I will get some green painters tape to try that trick). mine also seems to restart on its own.

the blink and button uploads worked great. but when I upload the tor the upload button does not seem to work with everything connected.