Introduction: HackerBox 0057: Safe Mode
Greetings to HackerBox Hackers around the world! HackerBox 0057 brings a village of IoT, Wireless, Lockpicking, and of course Hardware Hacking right into your home lab. We will explore microcontroller programming, IoT Wi-Fi exploits, Bluetooth interfacing, IR hacks, Locksports, Audio/Video signal generation, and more.
HackerBoxes is the monthly subscription box service for enthusiasts of electronics and computer technology - Hardware Hackers - The Dreamers of Dreams.
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 really appreciate your taking a few minutes to read the FAQ.
This Instructable contains information for getting started with HackerBox 0057. The full box contents are listed on the product page for HackerBox 0057 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 revolution!
A soldering iron, solder, and basic soldering tools are generally needed to work on the monthly HackerBox. A computer for running software tools is usually also required.
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.
Step 1: Starting in Safe Mode With Networking
Most HackerBox Members attend various hacker conventions. Even those who do not are likely quite familiar with these conferences and the incredible sense of community they evoke through networking, villages, contests, speakers, activities, traditions, and so on. For some context, you might enjoy this hackumentary all about DEF CON, which is the largest hacker convention in the world.
One fun aspect of hacker conventions, particularly DEF CON, are the badges which historically served as the access pass to enter and participate in the con. These evolved into electronic badges. Eventually attendees began making their own indie badges, which are not formally part of the conference but are built, collected, and worn for the love of #badgelife. Yes, there's also a hackumentary about living the badgelife. HackerBox 0057 includes an indie badge kit that you can assemble and program on your own. Trust your technolust.
Due to the COVID-19 pandemic, from August 6th to 9th of 2020, DEF CON 28 will be booting into Safe Mode with Networking. All activities will be virtual, online, and free. We hope to see you there! The theme of HackerBox 0057 is clearly inspired by DEF CON 28 Safe Mode.
One of the DEF CON villages is the Hardware Hacking Village (HHV) and the associated Soldering Skills Village (SSV). For obvious reasons, HackerBoxers are huge fans and supporters of HHV/SSV. During DEF CON 28, HHV hosted live video builds with Q&A sessions for the HackerBox 0057 Indie Badge Kit. The video stream has been published on YouTube in case you missed it live, or just want to watch again.
Step 2: Locksport
Locksport is the sport or recreation of defeating locks. Enthusiasts learn a variety of skills including lock picking, lock bumping, and other techniques traditionally used by locksmiths and other security professionals. Locksport enthusiasts enjoy the challenge and excitement of learning to defeat all forms of locks, and often gather together in sport groups to share knowledge, exchange ideas, and participate in a variety of recreational activities and contests.
For a nice introduction, check out the MIT Guide to Lock Picking.
Also, watch this video and be sure to check the excellent links in the description of the video.
TOOOL (The Open Organisation Of Lockpickers) is an organization of individuals who engage in the hobby of Locksport, as well as educate its members and the public about the security (or lack thereof) provided by common locks. "The mission of TOOOL is to advance the general public knowledge about locks and lockpicking. By examining locks, safes, and other such hardware and by publicly discussing our findings we hope to strip away the mystery with which so many of these products are imbued."
DEF CON 28 SAFE MODE Lockpick Village (LPV) has been working hard to get some great speakers and talks for us to enjoy from the safety of home. The LPV calendar available here.
ETHICAL CONSIDERATIONS: Carefully review, and take serious inspiration from, TOOOL's strict code of ethics which is summarized in the following three rules:
- Never pick or manipulate with the aim of opening any lock that does not belong to you, unless you have been granted explicit permission by the lock's rightful owner.
- Never disseminate knowledge or tools of lockpicking to individuals whom you know or whom have reason to suspect would seek to employ such skills or equipment in a criminal manner.
- Be mindful of the relevant laws concerning lockpicks and related equipment in any country, state, or municipality where you seek to engage in hobbyist lockpicking or recreational locksporting.
Step 3: ESP32 T-Display Module
NOTE: To build confidence, configure our tools, and reduce troubleshooting variables, we will initially be working with the T-Display WITHOUT SOLDERING the pins (or anything else) to the module.
The LilyGO TTGO T-display ESP32 is a very compact ESP32 development board with an 1.14 inch IPS 240x135 Full-Color Display, Wi-Fi, Bluetooth, battery charging interface, two onboard GPIO buttons, and a USB-C connector.
The IPS Color Display is controlled by an ST7789V Driver Chip that is prewired to the ESP32 pins shown in the diagram above.
- Power up the T-Display using a USB-C cable
- Pre-programmed firmware will display a graphics demo
- Install the Arduino IDE
- Use the Arduino IDE Boards Manager to add ESP32 Support
- Within Tools menu, select:
- Board: ESP32 Dev Module
- Upload Speed: 921600
- CPU Frequency: 240Mhz (WiFi/BT)
- Flash Frequency: 80Mhz
- Flash Mode: QIO
- Flash Size: 4MB (32Mb)
- Partition Scheme: Default 4MB with spiffs (1.2MB APP/1.5 SPIFFS)
- Core Debug Level: None
- PSRAM: Disabled
- Port: COM port that appears and disappears when T-Display is connected/disconnected
A new program is now loaded onto the ESP32, which will generate an example of colorful text display. This confirms that our ESP32 T-Display Module is fully functional and also that our tools and libraries are properly configured.
Step 4: HackerBox 0057 Safe Mode Indie Badge PCB
- IO21 - Tactile Button A
- IO22 - Tactile Button B
- IO15 - Joystick Up
- IO27 - Joystick Down
- IO17 - Joystick Right
- IO12 - Joystick Left
- IO13 - Joystick Center (Press)
- IO32 - Buzzer
- IO33 - Infrared Receiver TSOP4838
- IO02 - Infrared LED Transmit
- IO25 - Composite Video Output (RCA)
- IO26 - Audio Signal Output (RCA)
Step 5: Assemble the Badge
The components can be soldered onto the Badge PCB according to the image showing placement for the components. All components go on the top (blacker side) of the PCB with the exception of the four battery wires as discussed later.
The three resistors looks very similar, but they are not interchangeable. You can identify them using an ohmmeter or by reading the colored bands with a magnifier:
- 220 Ohm Resistor (red, red, black, black, brown)
- 330 Ohm Resistor (orange, orange, black, black, brown)
- 1K Ohm Resistor (brown, black, black, brown, brown)
The resistors and the ceramic capacitor are not polarized and can be inserted in either direction. However, several of the other components have a specific required orientations:
- The long pin of the IR LED should be closest to the neighboring RCA plug.
- The Joystick has two tiny positioning pegs that fit into the PCB. If reversed, the solder pads will not line up.
- The 2N2222 Transistor should be oriented with the flat side facing the Joystick.
- The Buzzer should be oriented with dot closest to the ESP32 T-Display.
- The TSOP4838 IR Receiver's rounded surface should face away from the ESP32 T-Display
Set aside the power switch and the battery connector for now. We will address these in a later step.
Step 6: Load Some Code
We've already experimented with programming the ESP32 MCU. Now that it's soldering into the badge, we can use the ESP32 to exercise the various aspects of the badge hardware.
For our first trick, let's buzz the buzzer. This only requires one pin (IO32) and it should still operate even if the display library is not properly configured. Simply grab the file HB0057_Buzzer.ino and upload it to the ESP32.
Joystick and Button Inputs
Next, we can test out the user inputs. The sketch HB0057_Joystick.ino will show the status of the joystick and tactile buttons on the IPS Display.
Composite Video and Audio Output
The DawnOfAV Project from the ever-brilliant bitluni works out of the box if we simply change the ESP32 Partition Scheme to "Huge APP" under Tools in the IDE. This video explains how he generates color PAL/NTSC signals.
Emulation Gone Wild
The ESP_8_BIT Project from rossumur goes old school to emulate Atari 8 bit computers, NES, and SMS game consoles on the ESP32 MCU leveraging Composite A/V output. Check out this Hackaday report on the project.
We do need to update the three IO pins used by this project so they match the wiring of the badge. These are found in the file video_out.h :
- #define VIDEO_PIN 25
- #define AUDIO_PIN 26
- #define IR_PIN 33
There are a lot of great ESP32 projects out there that can be targeted for this badge board by changing the IO pin assignments and reconsidering video generation to use the RCA AV outputs or the onboard IPS Display. We will get a couple of these up and documented, so keep an eye out.
Step 7: Battery Power for the HackerBox 0057 Indie Badge
The T-Display ESP32 can be powered by a 3.7V lithium polymer (LiPo) battery and can also charge the battery while the module is powered by the USB port. As shown here, the badge PCB provides a simple mechanism for switching the battery out of the circuit without having to unplug it from the T-Display module to turn it off. Note that when the switch is powered off (battery lead open), the battery cannot be charged by the badge.
Step 8: Infrared Communications
According to the Sparkfun IR Communications Tutorial: IR, or infrared, communication is a common, inexpensive, and easy to use wireless communication technology. IR light is very similar to visible light, except that it has a slightly longer wavelength. This means IR is undetectable to the human eye - perfect for wireless communication. For example, when you hit a button on your TV remote, an IR LED repeatedly turns on and off, 38,000 time a second, to transmit information (like volume or channel control) to an IR photo sensor on your TV.
Infrared PC Remote with USB IR Receiver
The PC Remote is an infrared remote control that works with the included USB receiver to operate as a remote mouse and controller for any personal computer. Such a controller is useful for making presentation and also for controlling audio or video playback from a distance For example, in HTPC applications.
Note that you cannot see the IR LED light up inside the PC Remote. IR light is outside the range of human light perception. If you want to see the LED illuminate, take a look through your smartphone's camera and press a button on the remote. IR light is not outside the detection range of your phone's camera sensor.
Infrared Badge Hacking
The HackerBox Safe Mode Indie Badge incorporates a TSOP4838 (datasheet) infrared receiver. The badge also incorporates a 940nm infrared LED transmitter that is driven by a transistor circuit for extra power.
An IR library is needed to use these IR receiver and transmitter devices.
In the Arduino IDE, use Tools > Manage Libraries to install the library IRremoteESP8266.
The library also works with ESP32s
Demonstrating the TSOP4838 IR Receiver
Open File > Examples > IRremoteESP8266 > IRrecvDemo
Edit the code to set kRecvPin = 33;
Compile and Upload the sketch.
Open the Serial Monitor and set it to 115,200 baud.
Aim the PC Remote (or other IR remote) at the badge and fire away.
Demonstrating the 940nm IR LED Transmitter
Open File > Examples > DumbIRRepeater
Edit the code to set kRecvPin = 33; and kIrLedPin = 2;
Compile and Upload the sketch.
Open the Serial Monitor and set it to 115,200 baud.
Use the badge as an IR Repeater to receive an IR signal from the PC Remote and then "blast" it into the USB receiver.
For an interesting effect, insert a new line of "delay(5000);" just before the first line that starts with "irsend". This will place a five second delay between the receive and transmit of the repeater. The USB receiver will see a button press from the remote at the time it is pressed and then again five seconds later when it is replayed by the DumbIRRepeater.
Video guide to IR Communications for ESP32 and ESP8266.
Adafruit's guide to Using an Infrared Library on Arduino
Step 9: Hack Life
We hope you are enjoying this month's HackerBox adventure into electronics and computer technology. Reach out and share your success in the comments below or other social media. Also, remember that you can email firstname.lastname@example.org anytime if you have a question or need some help.
What's Next? Join the revolution. Live the HackLife. Get a cool box of hackable gear delivered right to your mailbox each month. Surf over to HackerBoxes.com and sign up for your monthly HackerBox subscription.