Introduction: HackerBox 0038: TeknoDactyl
HackerBox Hackers are exploring electronic fingerprint recognition and mechanical spinner toys with surface-mount microcontroller and LED circuits. This Instructable contains information for getting started with HackerBox #0038, which can be purchased here while supplies last. Also, if you would like to receive a HackerBox like this right in your mailbox each month, please subscribe at HackerBoxes.com and join the revolution!
Topics and Learning Objectives for HackerBox 0038:
- Explore electronic fingerprint recognition
- Configure and program the Arduino Nano microcontroller
- Interface fingerprint sensor modules to microcontrollers
- Integrate fingerprint sensors into embedded systems
- Practice surface-mount soldering techniques
- Assemble an acrylic LED fidget spinner project
- Configure and program the Digispark microcontroller
- Experiment with USB keystroke injection payloads
HackerBoxes is the monthly subscription box service for DIY electronics and computer technology. We are hobbyists, makers, and experimenters. We are the dreamers of dreams.
HACK THE PLANET!
Step 1: HackerBox 0038: Box Contents
- Fingerprint Sensor Module
- Arduino Nano 5V 16MHz microUSB
- LED Fidget Spinner Solder Kit
- CR1220 Coin Cells for Spinner Kit
- USB Digispark Microcontroller Module
- ESD Tweezers
- Desoldering Braid
- Two Four-Way Voltage Level Shifters
- USB Extension Cable
- Exclusive HackerBox Forging Decal
- Exclusive "Quad Cut Up" Hacker Decal
- Exclusive Chairborne Iron-On Patch
Some other things that will be helpful:
- Soldering iron, solder, and basic soldering tools
- Soldering Flux (example)
- Lighted Magnifier (example)
- Computer for running software tools
- Fingers for fidget spinning
- Fingers for fingerprint experiments
Most importantly, you will need 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.
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 really appreciate your taking a few minutes to read the FAQ.
Step 2: Electronic Fingerprint Recognition
Fingerprint scanners are biometric security systems for analyzing friction ridges from a human fingertip, also known as a fingerprint (dactylograph). These scanners are used in law enforcement, identity security, access control, computers, and mobile phones.
Everyone has marks on their fingers. They can not be removed or changed. These marks have a pattern called the fingerprint. Every fingerprint is special, and different from any other in the world. Because there are countless combinations, fingerprints have become an ideal means of identification.
A fingerprint scanner system has two basic jobs. First, it captures an image of the finger. Next, it determines whether the pattern of ridges and valleys in this image matches the pattern of ridges and valleys in pre-scanned images. Only specific characteristics, which are unique to every fingerprint, are filtered and saved as an encrypted biometric key or mathematical representation. No image of a fingerprint is ever saved, only a series of numbers (a binary code), which is used for verification. The algorithm cannot be reversed to convert the coded information back into a fingerprint image. This makes it extremely unlikely to extract or duplicate usable fingerprints from the encoded image information.
Step 3: Arduino Nano Microcontroller Platform
An Arduino Nano, or similar microcontroller board, is a great choice for interfacing with fingerprint scanner modules. The included Arduino Nano board comes with header pins, but they are not soldered to the module. Leave the pins off for now. Perform these initial tests of the Arduino Nano module PRIOR to soldering the header pins the Arduino Nano. All that is needed for the next couple of steps is a microUSB cable and the Arduino Nano just as it comes out of the bag.
The Arduino Nano is a surface-mount, breadboard-friendly, miniaturized Arduino board with integrated USB. It is amazingly full-featured and easy to hack.
- Microcontroller: Atmel ATmega328P
- Voltage: 5V
- Digital I/O Pins: 14 (6 PWM)
- Analog Input Pins: 8
- DC Current per I/O Pin: 40 mA
- Flash Memory: 32 KB (2KB for bootloader)
- SRAM: 2 KB
- EEPROM: 1 KB
- Clock Speed: 16 MHz
- Dimensions: 17mm x 43mm
This particular variant of the Arduino Nano is the black Robotdyn design. The interface is by an on-board MicroUSB port that is compatible with the same MicroUSB cables used with many mobile phones and tablets.
Arduino Nanos feature a built-in USB/Serial bridge chip. On this particular variant, the bridge chip is the CH340G. Note that there are various other types of USB/Serial bridge chips used on the various types of Arduino boards. These chips allow you computer's USB port to communicate with the serial interface on the Arduino's processor chip.
A computer's operating system requires a Device Driver to communicate with the USB/Serial chip. The driver allows the IDE to communicate with the Arduino board. The specific device driver that is needed depends upon both the OS version and also the type of USB/Serial chip. For the CH340 USB/Serial chips, there are drivers available for many operating systems (UNIX, Mac OS X, or Windows). The maker of the CH340 supplies those drivers here.
When you first plug the Arduino Nano into a USB port of your computer, the green power light should come on and shortly after the blue LED should start to blink slowly. This happens because the Nano is pre-loaded with the BLINK program, which is running on the brand new Arduino Nano.
Step 4: Arduino Integrated Development Environment (IDE)
If you do not yet have the Arduino IDE installed, you can download it from Arduino.cc
If you would like additional introductory information for working in the Arduino ecosystem, we suggest checking out the guide for the HackerBoxes Starter Workshop.
Plug the Nano into the MicroUSB cable and the other end of the cable into a USB port on the computer, launch the Arduino IDE software, select the appropriate USB port in the IDE under tools>port (likely a name with "wchusb" in it). Also select "Arduino Nano" in the IDE under tools>board.
Finally, load up a piece of example code:
This is actually the code that was preloaded onto the Nano and should be running right now to slowly blink the blue LED. Accordingly, if we load this example code, nothing will change. Instead, let's modify the code a little bit.
Looking closely, you can see that the program turns the LED on, waits 1000 milliseconds (one second), turns the LED off, waits another second, and then does it all again - forever.
Modify the code by changing both of the "delay(1000)" statements to "delay(100)". This modification will cause the LED to blink ten times faster, right?
Let's load the modified code into the Nano by clicking the UPLOAD button (the arrow icon) just above your modified code. Watch below the code for the status info: "compiling" and then "uploading". Eventually, the IDE should indicate "Uploading Complete" and your LED should be blinking faster.
If so, congratulations! You have just hacked your first piece of embedded code.
Once your fast-blink version is loaded and running, why not see if you can you change the code again to cause the LED to blink fast twice and then wait a couple of seconds before repeating? Give it a try! How about some other patterns? Once you succeed at visualizing a desired outcome, coding it, and observing it to work as planned, you have taken an enormous step toward becoming a competent hardware hacker.
Step 5: Soldering the Arduino Nano Header Pins
Now that your development computer has been configured to load code to the Arduino Nano and the Nano has been tested, disconnect the USB cable from the Nano and get ready to solder the header pins. If it's your first time at fight club, you have to solder.
There are a lot of great guides and videos online about soldering (for example). If you feel that you need additional assistance, try to find a local makers group or hacker space in your area. Also, amateur radio clubs are always excellent sources of electronics experience.
Solder the two single row headers (fifteen pins each) to the Arduino Nano module. The six pin ICSP (in-circuit serial programming) connector will not be used in this project, so just leave those pins off. Once the soldering is complete, check carefully for solder bridges and/or cold solder joints. Finally, hook the Arduino Nano back up to the USB cable and verify that everything still works properly.
Step 6: Fingerprint Sensor Module
The fingerprint sensor module has a serial interface making it super easy to add to your projects. The module has integrated FLASH memory to store any fingerprints that it is trained to recognize, a process known as enrollment. Simply connect four wires to your microcontroller as shown here. Note that VCC is 3.3V (not 5V).
Adafruit published a very nice Arduino Library for fingerprint sensors. The library includes some useful sketches. For example, "enroll.ino" demonstrates how to enroll (train) fingerprints into the module. After training, "fingerprint.ino" demonstrates how to scan a fingerprint and search it against the trained data. Adafruit's documentation for the library can be found here. You can get additional fingerprint readers there or check out some feather modules.
Fingerprint sensors can be added to various projects including security systems, door locks, time attendance systems, and so on. For example, it makes an awesome upgrade to projects from the Locksport HackerBox.
This video shows a example system working with a fingerprint sensor.
Step 7: Fidget Spinner LED Kit
The spinning LED kit uses two Microchip PIC controllers and 24 LEDs to display various colorful patterns. The patterns are visible using a Persistence of Vision (POV) technique. The patterns can be changed by pressing the button.
Before we start, check through all of the pieces listed above. There are probably some extra resistors, capacitors, LEDs, screws, and acrylic pieces in the kit, so don't let that confuse you. Even if your kit included an instruction sheet, the instructions here should prove a lot easier to follow.
Step 8: Fidget Spinner LED Kit - Schematic and PCB
Our first question while looking at this schematic should be: How exactly do you drive 24 LEDs with only ten I/O lines? Magic? Yes, the magic of Charlieplexing.
COMPONENT ORIENTATION NOTE. Closely review the diagram of the PCB polarity markings. The two microcontrollers must be rotated into the correct orientation. Also, the LEDs are polarized and need to be correctly oriented. In contract, the resistors and capacitors can be soldered in any direction. The button only fits on one way.
Step 9: Fidget Spinner - Starting With SMT Soldering
The fidget spinner kit PCB is surface-mount technology (SMT), which is typically quite challenging to solder. However, the layout of the PCB and component selection make this SMT kit relatively easy to solder. If you have never worked with SMT soldering, there are some really nice demo video online (for example).
START SOLDERING: The button and its 10K ("103") resistor are probably the easiest place to start since there is a lot of space around them. Take your time and get both of these components soldered in place.
Remember that even if your soldering is not entirely successful, the journey outside your present comfort zone is the best practice. Also, the assembled kit will still operate as a cool-looking electronics-inspired spinner even if the LEDs are not perfectly functional.
Step 10: Fidget Spinner - Microcontroller Soldering
Solder the two microcontrollers (note the orientation marking). Follow with the two 0.1uF Capacitors that are just next to the microcontrollers. The capacitors are not polarized and can be oriented either way.
Step 11: Fidget Spinner - LED Soldering
There are two rows of LEDs on the PCB and two strips of LED components. Each strip is a different color (red and green), so keep the LEDs from each strip together in the same row on the PCB. It doesn't matter which row is green and which is red, but the same colored LEDs do need to be all together in the same row.
There is a "-" marking on each PCB pad for the LEDs. These markings alternate sides as you go along the row of pads, which means the orientation of the LEDs in the row will switch back and forth. The green markings on one side of each LED should be oriented towards the "-" making for that LED pad.
Step 12: Fidget Spinner - Finish Soldering
Solder the six 200 Ohm ("201") Resistors. These are not polarized and may be positioned in either direction.
Solder the three coin cell battery clips by inserting them into the bottom of the PCB and then soldering into the two holes from the top of the board.
Insert three coin cells and press the button to test the LEDs. You will not be able to see the POV patterns while the PCB is stationary but you will notice different brightnesses between the two banks of LEDs as you cycle through the display modes. Note that short presses and long presses have different effects.
Step 13: Fidget Spinner - Prepare Acrylic Housing
Remove the protective paper from the acrylic pieces.
Lay out the five pieces of acrylic and the PCB as numbered in the image. This represents the ordering of the final stack.
Notice the three small circles in each piece. Flip any pieces over until the small circles are all oriented the same direction.
Start with layer 2, which is the one with coin-cell-sized circles in each of the three arms.
Place the bearing in the center of layer 2 and force it into the large hole. This will take a lot of force. Try not to crack the acrylic while doing this. That said, a single small crack around the bearing mounting-hole may form. This is perfectly acceptable.
Step 14: Fidget Spinner - Mechanical Assembly
Stack up the layers - 1 through 5.
Notice that pieces 4 and 5 are actually on the same layer.
Insert three of the threaded brass couplers.
Place layer 6 onto the stack.
Notice that layers 1 and 6 have smaller holes to retain the brass couplers in place.
Use the six short screws to affix layers 1 and 6 to the brass couplers.
Step 15: Fidget Spinner - Center Hub
Remove the protective paper from three of the acrylic cycles - two large ones and one small one.
Put a long screw through one of the large acrylic circles; stack the small acrylic circle onto the screw; and twist a threaded brass coupler onto the screw to make a stack as shown in the image.
Insert the stack through the center hub.
Capture the stack into the hub by affixing the remaining large acrylic circle onto the open side using a long screw.
C'est fin! Laissez les bon fidget rouler.
Step 16: Digispark and USB Rubber Ducky
Digispark is an open source project originally funded through Kickstarter. It’s a super-miniature ATtiny-based Arduino compatible board using the Atmel ATtiny85. The ATtiny85 is an 8 pin microcontroller that is a close cousin of typical Arduino chip, the ATMega328P. The ATtiny85 has about a quarter of the memory and only six I/O pins. However, it can be programed from the Arduino IDE and it can still run Arduino code without a hitch.
The USB Rubber Ducky is a favorite hacker tool. It is a keystroke injection device disguised as a generic flash drive. Computers recognize it as a regular keyboard and automatically accept its pre-programmed keystroke payloads at over 1000 words per minute. Follow the link to learn all about Rubber Duckies from Hak5 where you can also buy the real deal. In the meantime, this video tutorial shows how to use a Digispark like a Rubber Ducky. Another video tutorial shows how to convert Rubber Ducky Scripts to run on the Digispark.
Step 17: HackLife
We hope you have enjoyed this month's voyage into DIY electronics. Reach out and share your success in the comments below or on the HackerBoxes Facebook Group. Certainly let us know if you have any questions or need some help with anything.
Join the party. Live the HackLife. You can get a cool box of hackable electronics and computer tech projects delivered right to your mailbox each month. Just surf over to HackerBoxes.com and subscribe to the monthly HackerBox service.