HackerBox 0077: Veritas
by HackerBoxes in Circuits > Electronics
3823 Views, 8 Favorites, 0 Comments
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.
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.
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
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
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.
Downloads
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"
- Remove the three wire leads or header pins from the pulse sensor.
- 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.
- Closely trim the solid wire at the front of the sensor to make it smooth to the touch.
- Position the sensor module flush with the Veritas PCB.
- Solder the solid wire onto the anchor pad
- Bridge the three signal pads with cut header pins. Solder the bridges into place.
- 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.
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.
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.
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.
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.