Introduction: HackerBox 0109: Bluetooth

Welcome to HackerBox 0109. Explore features of the various revisions of Bluetooth personal area network (PAN) technology. Stream audio to headphones and speakers using a Bluetooth Audio Receiver module. Configure the SuperMini NRF52840 to operate as an nRF Sniffer device for communication capture and analysis using Wireshark. Assemble the exclusive Burning Chrome ESP32 Kit to experiment with the wireless features of the ESP32 microcontroller, particularly Bluetooth functionality. Demonstrate RGB LEDs, capacitive touch pads, I2S audio streaming, and MicroSD storage. Experiment with sinking and sourcing Bluetooth Audio streams into and out from the ESP32 Burning Chrome platform. Leverage USB Bluetooth adapters to explore additional modes of short range wireless traffic.

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 0109. The full box contents are listed on the product page for HackerBox 0109 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, you can subscribe at HackerBoxes.com and join the party. Subscription members save at least $15 every month and automatically receive each new HackerBox shipped immediately off the production line.

A soldering iron, solder, and basic assembly 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 tools and supplies along with 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.

WEAR SAFETY GLASSES WHEN SOLDERING, WHEN TRIMMING WIRE LEADS, OR WHEN CUTTING, DRILLING, ETC.

Step 1: Introducing Bluetooth

Bluetooth is a short-range wireless technology standard that is used for exchanging data over short distances within a personal area network (PAN). In the most widely used mode, transmission power is limited to 2.5 milliwatts, giving it a very short range of up to 10 meters (33 ft). It employs UHF radio waves in the ISM bands, from 2.402 GHz to 2.48 GHz. It is mainly used as an alternative to wired connections between nearby portable devices. For example, connecting cell phones and music players with wireless headphones.

Bluetooth specifications have been formalized by the Bluetooth Special Interest Group (SIG) since its formation in May 1998. The SIG was established by Ericsson, IBM, Intel, Nokia and Toshiba, and was later joined by many other companies.

Additional details and technical specifications for the various Bluetooth versions are presented on the Wikipedia Bluetooth Page.

Step 2: Bluetooth 5.1 Audio Receiver

This is a nice little module to begin our Bluetooth experimentation. It can be used to turn any device with a 3.5mm audio input into a bluetooth audio device.

  1. Connect headphones, earbuds, or powered speakers to the 3.5mm audio jack.
  2. Supply to the module using any USB-C cabled to provide 5VDC.
  3. A blue LED will be blinking.
  4. A female voice will announce, "Bluetooth device is ready to pair."
  5. Device name "HW-BT" will show as available for pairing.
  6. Upon pairing, the blue led will stops blinking and glow solid.
  7. Also, the voice will announce, "Bluetooth device is connected successfully."

The module can stream bluetooth audio from tablets, mobile phones, and ESP32 microcontrollers.

Step 3: SuperMini NRF52840

The SuperMini NRF52840 development board is based on the Arduino Pro Micro layout.

The nRF52840 MCU (Specs and Documentation from Nordic Semiconductor) features an ARM Cortex-M4F CPU clocked at 64MHz and offers 1MB of flash memory and 256KB of RAM. It supports multiple wireless protocols, including Bluetooth 5, Thread, Zigbee, ANT, and 2.4GHz. The MCU peripherals include ADC, PWM, SPI, I2C, UART, USB, GPIO, etc. The nRF52840 also supports a variety of security functions, such as AES encryption, SHA-256 hashing and True Random Number Generator (TRNG).

The SuperMini NRF52840 supports charging and discharging of a 3.7V lithium battery connected at the B+ and B- terminals. The charging rate is 100mA.

Initial Power Up

When first plugging in the SuperMini nRF52840, the red LED will glow solid and the blue LED will blink. A USB storage device named NICENANO will appear on the attached computer.

Firmware Update

At this point you probably want to jump to the next Step and set up the SuperMini NRF52840 as a nRF bluetooth sniffer.

However, you can drop any NRF52840 compatible UF2 file onto the NICENANO volume to update the firmware. For example, you can install CircuitPython.

To return the SuperMini NRF52840 to bootloder mode, simply short the RST and GND pins together twice within half a second, connect to a computer via USB, and once again use the storage device named NICENANO to drop in a UF2 file of your choice.

Step 4: NRF Sniffer

To install the nRF Sniffer firmware onto the SuperMini nRF52840:

  1. Download this UF2 file
  2. Drop the file onto the "NICENANO" storage volume

After re-flashing itself, the SuperMini nRF52840 will have its red LED off and again the blue LED blinking.

To setup the software on the PC side, Adafruit has a tutorial covering all of the necessary elements...

Begin HERE and follow the instructions to install python3, pyserial, Wireshark, and the nRF Sniffer plugin.

Step 5: Burning Chrome ESP32 Kit

The HackerBox Burning Chrome ESP32 Kit is an embedded platform for experimenting with the wireless features of the ESP32 microcontroller ~ particularly, in this case, the Bluetooth functionality. The kit includes:

  1. Exclusive Burning Chrome PCB
  2. ESP-WROOM-32 Development Board
  3. PCM5102A I2S Digital Audio Module
  4. MicroSD Card Module
  5. Eight Pixel RGB LED Module
  6. 22 Gauge Copper Wire

The PCB features four capacitive touch pad inputs.

Step 6: ESP-WROOM-32 Development Board

The HackerBox Burning Chrome ESP32 Kit uses the ESP-WROOM-32 Development Board.

Let's test out he Development Board on its own before we begin to assemble the Burning Chrome Kit.

  1. Attach the ESP32 Dev Board to a computer using a USB-C cable
  2. A solid red light will illuminate - nothing else
  3. Install the Arduino IDE (if you don't already have it)
  4. In the IDE, use the Boards Manager to search for ESP32 (by Espressif Systems)
  5. Select that board package and hit install
  6. From the top menu, select Tools > Board > esp32 > ESP32 Dev Module
  7. Select Tools > Port (COM port that appears when the ESP32 is connected and turned on)
  8. Open the sketch File > Examples > Basics > Blink
  9. Add the line #define LED_BUILTIN 2 at the top of the sketch
  10. Compile an upload the sketch to the Dev Board

If everything is in order, the sketch will cause the blue LED that is connected to I/O pin 2 to begin blinking.

Step 7: Burning Chrome Assembly: LEDs

  1. Identify the 22 gauge insulated copper wire
  2. Four inches of wire is more than enough to form eight 1 cm leads
  3. Strip 1cm of insulation from one end of the wire
  4. Fig. A: Solder the stripped wire onto one pad of the LED module
  5. Snip the wire off at 1 cm
  6. Fig. B: Repeat the strip-solder-snip process for all eight pads
  7. Fig. C: Bend the wires at right angles away from the LEDs
  8. Fig. D: Push the wires through openings in the PCB
  9. Popping the LED module into place against the PCB
  10. Double check that the two IN pads and the two OUT pads are aligned
  11. Fig. E: Bend the wire leads against the PCB and solder each into place

Step 8: Burning Chrome Assembly: Audio Module

The PCM5102A (specifications and datasheet from Texas Instruments) Digital Audio Module is configured to receive Inter-Integrated Circuit Sound (I2S) data streams from the ESP32.

Prior to Connection to the Burning Chrome PCB

The four jumpers on the back side of the PCM5102A module must be set using four blobs of solder as shown here. Jumper #3 is set HIGH (solder blob between 3 and H). Jumpers 1, 2, and 4 are set LOW (solder blob between the respective number and L).

Step 9: Burning Chrome Assembly: Modules

Start with the Burning Chrome PCB having only the LED module attached...

Attach the other three modules:

  1. MicroSD Card Module
  2. PCM5102A I2S Digital Audio Module
  3. ESP-WROOM-32 Development Board

Notes on Preparing the headers:

  1. Removing the black plastic insulators from the header between the MicroSD Card Module and the PCB allows the module to lie flat against the PCB and generally looks nicer
  2. We suggest leaving the header insulators in place between the PCM5102A I2S Digital Audio Module and the PCB
  3. We also suggest leaving the header insulators in place between the ESP32 Board and the PCB

Notes on Orientation:

  1. Be sure to orient the USB connector of the ESP32 Board along the PCB edge as shown
  2. Orientation of the other two module should be obvious as shown

Test LEDs and Touch Pad Inputs:

  1. In the Arduino IDE, navigate to Tools > Manage Libraries
  2. Search for and Install: FastLED by Daniel Garcia
  3. Grab the HB0109_TouchTest.ino sketch attached here
  4. Compile the sketch and upload to the ESP32 target
  5. Test each of the touch pads

PCM5102A I2S Digital Audio (from Internet):

  1. Install Arduino Library ESP32-audioI2S
  2. Grab the TestESP32i2s.ino sketch attached here
  3. Set the SSID and Password Strings in the sketch to your network
  4. Set Tools > Partition Scheme > Huge APP
  5. Compile the sketch and upload to the ESP32 target
  6. Plug headphones or amplified speakers into the PCM5102A

PCM5102A I2S Digital Audio (from MicroSD Card):

  1. Place an MP3 file on a Micro SD card (card must be formatted as FAT32)
  2. Use the same TestESP32i2s.ino sketch as above
  3. Comment out the line starting: audio.connecttohost
  4. Uncomment the line: audio.connecttoFS(SD, "song.mp3");
  5. Change song.mp3 to the name of your mp3 file
  6. Compile the sketch and upload to the ESP32 target

Step 10: Burning Chrome Via Bluetooth

Stream Bluetooth Audio from ESP32 to Red Audio Receiver Module

(ESP32 Acting as Audio Source)

  1. Install Arduino Library ESP32-A2DP
  2. Open File > Examples > ESP32-A2DP > bt_music_sender_write.ino
  3. Set Tools > Partition Scheme > Huge APP
  4. Change a2dp_source.start("LEXON MINO L"); from "LEXON MINO L" to "HW-BT"
  5. Change a2dp_source.set_volume(20); from 20 to 100
  6. Compile the sketch and upload to the ESP32 target

This demonstrates using sound samples from the associated header file.

In contrast, this project uses samples sourced from an SD Card.

Stream Bluetooth Audio to the ESP32

(ESP32 Acting as Audio Sink)

  1. Open File > Examples > ESP32-A2DP > bt_music_receiver_arduino_i2s_3.ino
  2. Change three pin numbers like so:
  3. const uint8_t I2S_SCK = 26;
  4. const uint8_t I2S_WS = 25;
  5. const uint8_t I2S_SDOUT = 22;
  6. Connect audio source (e.g. mobile device) to "speaker" named MyMusic

Step 11: USB Bluetooth 5.3 Adapter

Use a USB Bluetooth Adapter to add Bluetooth support to a computer.

Step 12: USB Keyboard and Mouse to BLE Adapter

This adapter can be paired to eight systems supporting BLE.

The adapter name will appear as M1Pro.

The adapter may be used to connect a USB keyboard and/or mouse to a tablet or other mobile device supporting BLE.

The nRF Sniffer can capture and analyze BLE traffic from the M1Pro adapter.

Explore this demo using the ESP32 as a BLE HID Client to receive keystroke data from a BLE keyboard.

Step 13: Hack All the Things

"It was hot, the night we burned chrome." [w] [yt]

We hope you are enjoying this month's HackerBox adventures into electronics, computer technology, and hacker culture. We aim to curate a challenging and rewarding experience of learning through experimentation and exploration. Thank you for joining us on this journey.

Reach out and share your success in the comments below. Email support@hackerboxes.com anytime with questions or whenever you need some help.

Hungry for more? Surf over to HackerBoxes.com and join us as a monthly HackerBox subscription member. You'll get a cool box of hackable gear delivered right to your mailbox every month and you'll enjoy a generous member discount.

Please consider sharing this free Instructable with others who may be interested in learning about these subjects. Word of mouth advertising is the greatest compliment that we can receive. We sincerely appreciate your support.