HackerBox 0057: Safe Mode

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.

Supplies

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:

  1. 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.
  2. 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.
  3. 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
  • Form Tools > Library Manager, search for TFT_eSPI
  • Install the TFT_eSPI Library from Bodmer
  • Find the folder where Arduino Libraries are installed and the folder for TFT_eSPI
  • Locate and open the file User_Setup_Select.h in a text editor
  • Comment out the line with #include User_Setup.h (default)
  • Uncomment the line with #include User_Setups/Setup25_TTGO_T_Display.h
  • Load File > Examples > TFT_eSPI > Test and Diagnostics > Colour_Test
  • Compile and Upload Colour_Test onto the ESP32 T-Display Module

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.

References:

TTGO-T-Display GitHub Repository

Jeroen Maathuis' T-Display ESP32 Code Snippets

LCD wiki for module with 1.14 inch IPS Display

Step 4: HackerBox 0057 Safe Mode Indie Badge PCB

From the schematic, we can see which devices are connected to which IO pins of the ESP32. This information will become useful while programming code for the badge.
  • 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.

Buzzer Output

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

Additional Projects

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.

ESPFLIX streaming NETFLIX to ESP32

ESP32 Mini Console (Composite AV)

ESP32 Handheld Game Console (LCD)

Marauder Bluetooth and Wi-Fi Pen-Testing

ArduinoMenu demo on ESP32 T-Display

MicroPython on the T-Display

ESP32 Bluetooth Low Energy (BLE) on Arduino IDE

TV-B-Gone for ESP32

ESP32 Wi-Fi IR Remote

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.

References:

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 support@hackerboxes.com 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.

10 People Made This Project!

Recommendations

  • Water Speed Challenge

    Water Speed Challenge
  • Summer Fun: Student Design Challenge

    Summer Fun: Student Design Challenge
  • Fandom Contest

    Fandom Contest

30 Comments

0
seaprimate
seaprimate

Question 10 months ago

Has anyone gotten the ESP32 Marauder to compile? I used the exact same components they used in the github instructions and it still won't work

0
sporksan
sporksan

Answer 12 days ago

I've been having issues with that project for months. I write it off to oddities in the ESP32 Dev boards i've been using.

2
herr_friday
herr_friday

11 months ago

I've been playing around with the ESP32 Game Emulator (2nd link just
above the Marauder) and have gotten it to compile and upload but
unfortunately it seems like I have something in the config wrong because
my LCD is constantly black. Any help would be appreciated! Maybe
someone from @hackerboxes could shed some light...

0
Squeakasaur
Squeakasaur

Reply 9 months ago

Not sure if you figured it out but according to the readme it looks like the screen is supposed to be black and you have to plug it into a TV. " Build and run the sketch and connect to an old-timey composite input. The first time the sketch runs in will auto-populate the file system with a selection of fine old and new homebrew games and demos. This process only happens once and takes about ~20 seconds so don't be frightened by the black screen."

0
jer502
jer502

Reply 11 months ago

I had that problem when I tested ESP32 with the colortest program. I reinstalled the TFT_eSPI library, Went to an older version than back. Reedited the User_Setup_Select.h file and it worked.

0
nlundt
nlundt

Question 9 months ago on Step 6

I am struggling with the buzzer. I downloaded the buzzer.ino file and loaded it onto the badge. No issues. It outputs exactly as the demo for badge assembly from youtube. It worked, but sounded weird. After experimenting with the code, I found that the smaller the frequency, the higher the note, and the larger the frequency, the lower the note. This is counter-intuitive to what I understand about the relationship between frequency and how notes sound. I have made progress by listing the known note frequencies of a piano and then re-centering and inverting the octaves. e.g. c7 is now c1. This solution feels very kluge, but I haven't figured out anything better. Does anyone have a suggestion as to why this frequency inversion is happening?

0
wolvzor
wolvzor

10 months ago

I wasn't sure if this was mentioned elsewhere, but after I've assembled the badge and load the joystick demo, everything works fine except for Joystick Left repeatedly gets displayed. This even happens when the joystick is in another position; for example, when in the Right position, it will simultaneously display "Joystick Left" and "Joystick Right" below it.

0
wolvzor
wolvzor

Reply 10 months ago

Fixed my own problem; found out that I had two solder joints that were accidentally touching. After fixing the two solder joints, things work normally now. :thumbsup:

0
d4e5
d4e5

11 months ago

The usual Arduino frustration: does not compile....
Anyone can help?
Thanks!

Arduino: 1.8.13 (Mac OS X), Board: "ESP32 Dev Module, QIO, 80MHz, 4MB (32Mb), 921600, None"
In file included from /Users/dimi/Documents/Arduino/libraries/TFT_eSPI/TFT_eSPI.h:48:0,
from /Users/dimi/Documents/Arduino/libraries/TFT_eSPI/examples/Test and diagnostics/Colour_Test/Colour_Test.ino:53:
/Users/dimi/Documents/Arduino/libraries/TFT_eSPI/Processors/TFT_eSPI_ESP32.h:68:36: fatal error: SPIFFS.h: No such file or directory
compilation terminated.
exit status 1
Error compiling for board ESP32 Dev Module.
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

1
d4e5
d4e5

Reply 11 months ago

It appears my Arduino install was messed up on Mac OS X.
To clean up and do a fresh install:
- Remove Arduino App (usually in Applications folder)
- Open Terminal
# cd ~/Library
# rm -r Arduino15

If you want to also eliminate current libraries, go to local user directory...
# cd
# cd Documents
# rm - r Arduino

Do a fresh install!
Note that App uninstaller like CleanMyPC will NOT clean up properly the files in ~/Library
0
kavior
kavior

Reply 11 months ago

Well, you're missing the SPIFFS.h file. I guess I would go back through the early instructions to ensure that the TFT_eSPI library gets installed correctly.

0
d4e5
d4e5

Reply 11 months ago

I have the TFT_eSPI library by Bodmer version 2.2.14 (yes, I read the instruction).
Now, the library manager has like a dozen of versions available... which one did you use?

1
sporksan
sporksan

11 months ago

Anyone start fooling around with Marauder Yet? A neophite woudl love some guidance in reconfiguring the video output to show up correctly on the built-in video screen!

0
kavior
kavior

Reply 11 months ago

Right there with you. I'm going to try in the next week or so, but I have zero idea what I'm doing.

0
lmperkins
lmperkins

Reply 11 months ago

I couldn’t get it to compile at all.

0
kavior
kavior

11 months ago

Can't seem to get DawnofAV to run, even though it compiles and uploads with no errors. What am I doing wrong?

0
lmperkins
lmperkins

Reply 11 months ago

What are you looking for it to do? Once you connect it to the TV you basically only get the video clip and sound. Mostly a demo.

1
lmperkins
lmperkins

Question 11 months ago on Step 6

I've got the joystick and buttons working as well as the video and audio out. I'm trying to run the Atari emulator. It loads fine and I get the splash screen on the monitor but can't get it to do anything other than the default robot walking animation. Is this all there is? Are there games to be played, and if so how? Thanks.

0
Greyhawk009
Greyhawk009

Question 11 months ago

For the buzzer & joystick tests, I get a compile error, can't find esptool.py. So, I'm thinking that several other things need to be installed on my system (win10). Python? Which ver? Esptool? Maybe these were added to most peoples setup in previous hackerboxes? This is my first one.

0
Kimbruce70
Kimbruce70

Question 11 months ago

My joystick did not work in the demo. I made sure there wasn't any soldering bridges and the orientation is correct. Did anyone else have this issue? Is there a solution?