Introduction: HackerBox 0111: Relay

Welcome to HackerBox 0111. Experiment with LoRa long range wireless communications. Configure both ESP32 and RISC-V ESP32-C3 development boards for use with the Arduino IDE. Assemble the exclusive LoRa I/O and LoRa C3 OLED kits. Implement an embedded web server for controlling RGB LEDs over Wi-Fi. Relay information and control signals between USB Serial, Wi-Fi, and LoRa. Explore the utility, esthetics, and mathematics of knots.

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 0111. The full box contents are listed on the product page for HackerBox 0111 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: Lora

LoRa (Long Range) is a physical proprietary radio communication technique based on spread spectrum modulation derived from chirp spread spectrum (CSS) technology. LoRa enables long-range transmissions with low power consumption. It is one of the most popular low-power wireless sensor network technologies for the implementation of the Internet of Things, offering longer range compared to technologies such as Zigbee or Bluetooth, but with lower data rates. (Wikipedia)

LoRa uses license-free sub-gigahertz radio frequency bands EU868 (863–870/873 MHz) in Europe; AU915/AS923-1 (915–928 MHz) in South America; US915 (902–928 MHz) in North America; IN865 (865–867 MHz) in India; and AS923 (915–928 MHz) in Asia.

Ra-01SH LoRa Module

We'll be using the Ra-01SH LoRa module (datasheet) designed and developed by Anxinke Technology. The module is designed for ultra-long-distance spread-spectrum communication. Its radio chip, the SX1262, features SEMTECH's patented LoRa modulation technology for high sensitivity, power output of +22dBm, long transmission distances, and high reliability.

Ra-01SH Features:

  1. LoRa modem
  2. FSK, GFSK, MSK, GMSK, LoRa and OOK modulation methods
  3. Frequency band: 803MHz~930MHz
  4. Working voltage: 3.3V
  5. Maximum power output: +22dBm
  6. Maximum working current: 140mA
  7. Minimum (receive mode) current: 4.2 mA
  8. Standby current: 1.6mA
  9. High sensitivity: down to -148dBm
  10. Package: small volume castellated module
  11. SPI interface with CRC and 256-byte packet engine

There is an online tutorial covering theory of operation for these SX1278 LoRa Modules along with some details about interfacing them to ESP32 controllers in the Arduino development environment.

Step 2: ESP32-C3 Dev Board - Integrated OLED Display

The HackerBox LoRa C3 OLED Kit is based on the ESP32-C3 Development Board with an integrated 0.42 inch OLED Display.

Let's test out the Development Board on its own before we begin to assemble the HackerBox LoRa C3 OLED Kit.

  1. Attach the ESP32-C3 Dev Board to a computer using a USB-C cable
  2. The red and blue LEDs will illuminate and the Display will show "HW-675"
  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 > ESP32C3 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 8 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 8 to blink.

Demonstrate the Integrated 0.42 inch OLED Display

  1. Install the U8g2 Library from olikraus (available in the Arduino IDE Library Manager)
  2. Grab the Simple_OLED_DEMO.ino sketch attached here
  3. Compile the sketch and upload to the ESP32-C3 target
  4. Hack the Planet!

Step 3: Assemble the LoRa C3 OLED Kit

Solder the Ra-01SH Module

If you are new to soldering castellated modules, review this SparkFun tutorial.

Solder the Female SMA Edge Launch Connector

Be sure to position the center pin of the connector in the top side of the PCB. You'll notice that is where the solder pad for the center pin. There is no center pad on the back side of the PCB. The SMA connector has a bit of metal to it, so soldering it will probably take a couple more seconds than usual to build up enough heat to flow solder.

Solder the ESP32-C3 Development Board with 0.42" Display

Use the supplied header pins. Position the Dev Board as shown in the image - with the USB connector to the edge of the PCB and the OLED display on the top side of the PCB.

Verify Operation of the ESP32-C3

Apply power through the USB-C port. The display demo code that was previously loaded should still run.

Step 4: Sixteen Element RGB LED Ring

The LED ring module is an annular PCB populated with sixteen WS2812B addressable RGB LEDS. The module is wired with two three-pin JST-SM pigtails (one male and one female), which have become something of a standard for connecting chains of addressable LEDs.

The back side of the LoRa C3 OLED board features three pads (5V, IO21, and GND) for connecting the LED module. There are a variety of different ways to make that connection. These two options are probably the two most interesting. Pick the one you like, or make your own plan...

Wiring option (a) - Pluggable

This pluggable option may be more versatile.

  1. Locate the data output (DO) pad on the back of the ring module
  2. Snip off all three wires associated with the output side (DO)
  3. Snip them very closely (against the ring)
  4. Leave the three wires for the input (DI) side connected
  5. Strip the ends of the three snipped wires
  6. Solder the stripped ends onto the back of the LoRa C3 OLED board
  7. Be sure to match the wire labels (DI connects to IO21)
  8. Plug the DI wires of the ring into the plug on the LoRa C3 OLED board

Wiring option (b) - Direct Connect

This option results in a tight, compact solution that may be better suited to mounting for display (as discussed later).

  1. Locate the data input (DI) pad on the back of the ring module
  2. Snip the connector off the wires associated with the input side (DI)
  3. Cut the (DI side) wires shorter if you want the ring tighter to the board
  4. Strip the ends of the three snipped (DI) wires
  5. Solder the stripped ends onto the back of the LoRa C3 OLED board
  6. Be sure to match the wire labels (DI connects to IO21)
  7. Optional: snip off all three wires associated with the output side (DO)

Time for Code!

Watch this very cool video from Tech Talkies. Their project creates a tiny webserver within the ESP32 presenting a GUI webpage for controlling the NeoPixel RGB LED ring from any browser over WiFi. We've modified their code a bit to specifically work with the HackerBox LoRa C3 OLED Kit.

  1. Grab the Web_Neopixel_C3.ino sketch attached here
  2. Get the header file webpage.h created by Tech Talkies
  3. Put the header file in the same folder at the sketch file
  4. Make sure you have three libraries:
  5. U8g2 Graphics (should have from earlier step)
  6. Adafruit NeoPixel (can be installed from Library Manager)
  7. ESPAsyncWebSrv (can be installed from Library Manager)
  8. Open the sketch in the Arduino IDE
  9. Edit the WiFi credentials
  10. Again, select Tools > Board > esp32 > ESP32C3 Dev Module
  11. Also, set Tools > USB CDC On Boot > "Enabled"
  12. Compile the sketch and upload to the ESP32-C3 target
  13. The assigned IP address will display on the OLED
  14. Connect your phone/tablet to the same 2.4GHz WLAN
  15. Open a browser and enter the provided IP address

This project would be fun to mount on a wall in your workplace or hackerspace inviting others to control with the LEDs using only the browser on their own phone.

Step 5: ESP-WROOM-32 Development Board

The HackerBox LoRa I/O Kit is based on the ESP-WROOM-32 Development Board. Note that this development board features a "traditional" ESP32 and not the ESP32-C3 used above. Among a handful of other difference, the ESP32 features dual-core Xtensa LX6 processing while the ESP32-C3 is a single-core RISC-V processor.

Let's test out the ESP-WROOM-32 Development Board on its own before we begin to assemble the HackerBox LoRa I/O 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

The sketch will cause the blue LED (connected at I/O pin 2) to blink.

Step 6: Assemble the LoRa I/O Kit

Solder the Ra-01SH Module

If you are new to soldering castellated modules, review this SparkFun tutorial.

Solder the Female SMA Edge Launch Connector

Be sure to position the center pin of the connector in the top side of the PCB. You'll notice that is where the solder pad for the center pin. There is no center pad on the back side of the PCB. The SMA connector has a bit of metal to it, so soldering it will probably take a couple more seconds than usual to build up enough heat to flow solder.

Solder the ESP-WROOM-32 Development Board

Position the Dev Board as shown in the image - on the top side of the PCB with the USB connector aligned to the edge of the PCB.

Solder the Terminal Blocks

Position the four terminal blocks on the PCB as shown - one 4-pin block and one 8-pin block on each side. Orient the blocks with the open ports facing the PCB edge. Align neighboring blocks neatly into place prior to soldering.

Verify Operation of the ESP32

Apply power to the USB-C port. The blink.ino code that was previously loaded should still run.

Step 7: LoRa Communications Test

Let's test a LoRa communication link between the two different ESP32 boards.

  1. Get the LoRa-Ra01S Library from nopnop2002
  2. In the folder for library, open the file Ra01S.cpp
  3. Comment out line 23 like so: //SPI.begin();
  4. Save the file Ra01S.cpp

Program the LoRa C3 OLED Board

  1. Grab the LoRa_Link_C3_OLED.ino sketch attached here
  2. Select Tools > Board > esp32 > ESP32C3 Dev Module
  3. Select Tools > Port > [USB Port for the LoRa C3 OLED Board]
  4. Set Tools > USB CDC On Boot > "Enabled"
  5. Compile the sketch and upload to the LoRa C3 OLED Board

Program the LoRa I/O Board

  1. Grab the LoRa_Link_IO.ino sketch attached here
  2. Select Tools > Board > esp32 > ESP32 Dev Module
  3. Select Tools > Port > [USB Port for the LoRa I/O Board]
  4. Compile the sketch and upload to the LoRa I/O Board

Note About Modification of the Ra01S Library

The reason for commenting out the SPI.begin() call on line 23 in the Ra01S.cpp file is so the setup routine for each board variant can perform the call differently. Specifically for the ESP32-C3 board, the LoRa SPI bus must be initialized with particular pin numbers and not simply left to the default pins.

Further LoRa Explorations

With the basics in hand, you're ready to explore additional applications of LoRa technology...

  1. Place the LoRa I/O board in a "remote" location and use the terminal blocks to connect sensors, actuators, etc.
  2. Use the LoRa C3 OLED board "locally" to control outputs of the "remote" LoRa I/O
  3. Use the LoRa C3 OLED board "locally" to query inputs of the "remote" LoRa I/O
  4. Interface to the local device using USB, WiFi, or Bluetooth and relay to/from LoRa

Meshtastic is an open source, off-grid, decentralized, mesh network built to run on affordable, low-power devices. It should operate on the ESP32 + SX1262 platforms created here.

Step 8: Knots, Knots, and More Knots

The included paracord keychain can be used to connect keys, tools, etc. However, the pedagogical intent behind its inclusion is simply a convenient provisioning of two different colors of paracord for practicing knot tying. Yes, that means we intend for you to take the keychain apart. Obviously, if you'd rather keep it as a keychain, just grab some other cord (preferably paracord) to work with. A competent person should be able to tie and use a variety of basic knots.

According to Wikipedia, a knot is an intentional complication in cordage which may be practical, decorative, or both. Practical knots are classified by function, including hitches, bends, loop knots, and splices: a hitch fastens a rope to another object; a bend fastens two ends of a rope to each another; a loop knot is any knot creating a loop; and splice denotes any multi-strand knot, including bends and loops.

Cobra Knot and Snake Knot (weaves)

List of Knots

Mathematical Knot Theory

Wearable Knots

Mathematics of Wearable Knots

Paracord, short for parachute cord, is a lightweight nylon kernmantle rope originally used in the suspension lines of parachutes. This cord is now used as a general purpose utility cord. This versatile cord was used by astronauts during the 82nd Space Shuttle mission to repair the Hubble Space Telescope. (Wikipedia)

Step 9: Hack the Planet

Enjoy this video about one of our favorite movies. JoBlo Originals takes us back to the year 1995 when a new-ish thing called the Internet was becoming more mainstream. Offering up a deep dive into one of the most quintessentially 90’s movies ever made, we can explore just what happened to the movie Hackers.

Step 10: Trust Your Technolust

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.