Tutorial 5: Setting Up and Configuring LilyGO T-Beam Supreme ESP32-S3 and T-Deck ESP32-S3 Keyboard


Welcome to this comprehensive guide on setting up and configuring the LilyGO T-Beam Supreme ESP32-S3 and the T-Deck ESP32-S3 Keyboard with LoRa capabilities. Whether you’re a seasoned developer or a curious enthusiast stepping into the world of IoT and long-range communication, this tutorial aims to provide you with detailed, step-by-step instructions to get these devices up and running.

By the end of this guide, you will:

– Understand the hardware components of both devices.
– Configure them for basic LoRa communication.
– Establish a connection between the two devices.
– Test the communication link.
– Explore practical applications such as off-grid communication and point-to-point messaging.

Let’s embark on this exciting journey into the world of LoRa and ESP32-S3 micro-controllers!

 

Table of Contents

1. Unboxing and Hardware Overview
– 1.1 T-Beam Supreme ESP32-S3
– 1.2 T-Deck ESP32-S3 Keyboard
2. Setting Up the Development Environment
– 2.1 Installing Arduino IDE
– 2.2 Configuring ESP32-S3 Board Support
– 2.3 Installing Required Libraries
3. Step-by-Step Configuration
– 3.1 Connecting the Devices
– 3.2 Programming the T-Beam
– 3.3 Programming the T-Deck
4. Connecting to a LoRa Network
– 4.1 Understanding LoRa Parameters
– 4.2 Configuring LoRa Settings
5. Testing Basic Communication Between Two Nodes
– 5.1 Sending Data from T-Beam to T-Deck
– 5.2 Receiving Data on T-Deck
6. Practical Applications
– 6.1 Off-Grid Communication
– 6.2 Point-to-Point Messaging
7. Troubleshooting Tips
8. Conclusion
9. Additional Resources

 

1. Unboxing and Hardware Overview

Before diving into the setup, let’s familiarize ourselves with the hardware components of both devices.

1.1 T-Beam Supreme ESP32-S3

T-Beam Supreme ESP32-S3

Key Features:

ESP32-S3 Microcontroller: Dual-core processor with Wi-Fi and Bluetooth 5 (LE) capabilities.
LoRa Module: Supports long-range communication.
GPS Module: Integrated for positioning applications.
Battery Support: Slot for 18650 Li-Ion battery.
USB-C Port: For programming and power.
Antenna Connectors: SMA connectors for LoRa and GPS antennas.
Expansion Ports: GPIO pins for sensors and peripherals.

In the Box:

– T-Beam Supreme ESP32-S3 board
– LoRa antenna
– GPS antenna
– USB-C cable
– Quick Start Guide

Hardware Components Overview:

Microcontroller: ESP32-S3 with 8MB PSRAM and 16MB Flash.
LoRa Module: Semtech SX1262.
GPS Module: Quectel L76K or equivalent.
Buttons: Power button and reset button.
LED Indicators: Power and status LEDs.

1.2 T-Deck ESP32-S3 Keyboard

T-Deck ESP32-S3 Keyboard

Key Features:

ESP32-S3 Microcontroller: Dual-core processor with Wi-Fi and Bluetooth 5 (LE).
Built-in Keyboard: Mini QWERTY keyboard for input.
LCD Screen: Optional display for output.
Trackball: For navigation.
LoRa Module: Enables long-range communication.
Battery Support: Internal rechargeable battery.
USB-C Port: For charging and programming.

In the Box:

– T-Deck ESP32-S3 Keyboard device
– LoRa antenna
– USB-C cable
– Quick Start Guide

Hardware Components Overview:

Microcontroller: ESP32-S3 with integrated Wi-Fi and Bluetooth.
Display: Optional LCD screen for displaying messages and status.
Input Devices: Keyboard and trackball for user interaction.
Expansion Ports: GPIO pins for additional peripherals.
Buttons: Power button and function keys.

2. Setting Up the Development Environment

To program and configure these devices, we’ll use the Arduino IDE along with the necessary board support and libraries.

2.1 Installing Arduino IDE

1. Download Arduino IDE:

– Visit the Arduino Software – https://www.arduino.cc
– Download the latest version suitable for your operating system (Windows, macOS, or Linux)

2. Install the Arduino IDE:

– Run the installer and follow the on-screen instructions.
– Agree to the license agreement and install the required drivers if prompted.

2.2 Configuring ESP32-S3 Board Support

1. Add the ESP32 Boards URL:

– Open the Arduino IDE.
– Go to `File` > `Preferences
– In the “Additional Boards Manager URLs” field, add the following URL:

“`
https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
“`

– Click “OK”

2. Install the ESP32 Boards Package:

– Go to `Tools` > `Board` > `Boards Manager`.
– In the search bar, type “esp32”.
– Install the “esp32” package by Espressif Systems.

2.3 Installing Required Libraries

We’ll need specific libraries to work with LoRa and the hardware components.

1. Install the LoRa Library:

– Go to `Sketch` > `Include Library` > `Manage Libraries`.
– Search for “LoRa”.
– Install the “LoRa” library by Sandeep Mistry.

2. Install Additional Libraries:

– For the Display (if applicable):

– Install “TFT_eSPI” library by Bodmer.

– For GPS (T-Beam only):

– Install “TinyGPS++” library by Mikal Hart.

3. Install any other required libraries:

– Depending on your specific needs, you may need other libraries for sensors or peripherals.

3. Step-by-Step Configuration

Now, let’s proceed to configure each device for basic communication.

3.1 Connecting the Devices

T-Beam Supreme ESP32-S3:

1. Insert the Battery (Optional):

– If using a battery, insert a charged 18650 Li-Ion battery into the battery holder.

2. Attach the Antennas:

– Screw the LoRa antenna onto the LoRa SMA connector.
– Screw the GPS antenna onto the GPS SMA connector.

3. Connect to the Computer:

– Use the USB-C cable to connect the T-Beam to your computer.
– The device should power on; if not, press the power button.

 

T-Deck ESP32-S3 Keyboard:

1. Charge the Device:

– Connect the T-Deck to your computer using the USB-C cable to ensure it has sufficient power.

2. Attach the LoRa Antenna:

– Screw the LoRa antenna onto the antenna connector.

3. Power On the Device:

– Press and hold the power button until the device turns on.

3.2 Programming the T-Beam

We’ll program the T-Beam to send data over LoRa.

1. Open Arduino IDE and Configure Board Settings:

– Go to `Tools` > `Board` > `ESP32 Arduino` > `ESP32S3 Dev Module`.
– Configure the following settings under `Tools`:

– USB CDC On Boot: Enabled
– USB Mode (USB-OTG): Hardware CDC and JTAG
– Flash Mode: QIO
– Flash Frequency: 80MHz
– Flash Size: 16MB (or as per your device)
– Partition Scheme: Default 4MB with spiffs (or appropriate for your application)
– Core Debug Level: None

2. Select the Correct Port:

– Under `Tools` > `Port`, select the COM port associated with the T-Beam.

3. Write the Code:

“`cpp
#include <LoRa.h>

// Define LoRa parameters
#define BAND 915E6 // Adjust according to your region (e.g., 868E6 for Europe)

// Pin definitions (may vary based on the board)
#define SCK 18
#define MISO 19
#define MOSI 23
#define SS 5
#define RST 14
#define DI0 2

void setup() {
Serial.begin(115200);
while (!Serial);

Serial.println(“T-Beam LoRa Sender”);

// Initialize LoRa module
LoRa.setPins(SS, RST, DI0);

if (!LoRa.begin(BAND)) {
Serial.println(“Starting LoRa failed!”);
while (1);
}
Serial.println(“LoRa Initialized”);
}

void loop() {
Serial.println(“Sending packet…”);

LoRa.beginPacket();
LoRa.print(“Hello from T-Beam!”);
LoRa.endPacket();

delay(5000); // Send a packet every 5 seconds
}
“`

4. Upload the Code:

– Click the upload button (right arrow icon).
– If you encounter upload issues, press and hold the “BOOT” button on the T-Beam while uploading.

5. Monitor Serial Output:

– Open the Serial Monitor (`Tools` > `Serial Monitor`).
– Set the baud rate to `115200`.
– You should see “Sending packet…” messages.

3.3 Programming the T-Deck

We’ll program the T-Deck to receive data over LoRa and display it.

1. Open Arduino IDE and Configure Board Settings:

– Use the same board settings as for the T-Beam.

2. Select the Correct Port:

– Under `Tools` > `Port`, select the COM port associated with the T-Deck.

3. Write the Code:

“`cpp
#include <LoRa.h>
// Include display library if using LCD
#include <TFT_eSPI.h>

// Define LoRa parameters
#define BAND 915E6 // Adjust according to your region

// Pin definitions
#define SCK 18
#define MISO 19
#define MOSI 23
#define SS 5
#define RST 14
#define DI0 2

// Initialize display
TFT_eSPI tft = TFT_eSPI();

void setup() {
Serial.begin(115200);
while (!Serial);

// Initialize display
tft.init();
tft.setRotation(1);
tft.fillScreen(TFT_BLACK);
tft.setTextColor(TFT_WHITE, TFT_BLACK);
tft.setTextSize(2);

Serial.println(“T-Deck LoRa Receiver”);

// Initialize LoRa module
LoRa.setPins(SS, RST, DI0);

if (!LoRa.begin(BAND)) {
Serial.println(“Starting LoRa failed!”);
while (1);
}
Serial.println(“LoRa Initialized”);
}

void loop() {
int packetSize = LoRa.parsePacket();
if (packetSize) {
// Received a packet
String incoming = “”;
while (LoRa.available()) {
incoming += (char)LoRa.read();
}

Serial.print(“Received: “);
Serial.println(incoming);

// Display on LCD
tft.fillScreen(TFT_BLACK);
tft.setCursor(0, 0);
tft.println(“Received:”);
tft.println(incoming);
}
}
“`

4. Upload the Code:

– Click the upload button.
– If you encounter upload issues, press and hold the “BOOT” button on the T-Deck while uploading.

5. Monitor Serial Output:

– Open the Serial Monitor.
– Set the baud rate to `115200`.
– You should see “Received: Hello from T-Beam!” messages.

4. Connecting to a LoRa Network

While we’re establishing a direct communication between two nodes, understanding how to connect to a LoRa network is essential for scaling up your projects.

4.1 Understanding LoRa Parameters

Frequency Band (BAND): Set according to your region (e.g., 915 MHz in North America, 868 MHz in Europe).
Spreading Factor (SF): Controls the trade-off between data rate and range. Higher SF increases range but decreases data rate.
Bandwidth (BW): The width of the frequency band used. Common values are 125 kHz, 250 kHz, and 500 kHz.
Coding Rate (CR): Error correction rate. Values range from 4/5 to 4/8.

4.2 Configuring LoRa Settings

You can adjust these parameters in your code to optimize performance.

Example:

“`cpp
LoRa.setSpreadingFactor(7); // Range from 6 to 12
LoRa.setSignalBandwidth(125E3); // Bandwidth in Hz
LoRa.setCodingRate4(5); // Denominator ranges from 5 to 8
“`

– For Long Range:

– Increase spreading factor.
– Decrease bandwidth.
Note: This will reduce data rate.

For Higher Data Rate:

– Decrease spreading factor.
– Increase bandwidth.

5. Testing Basic Communication Between Two Nodes

Now that both devices are programmed, let’s test the communication.

5.1 Sending Data from T-Beam to T-Deck

– The T-Beam is continuously sending “Hello from T-Beam!” every 5 seconds.
– Ensure the T-Beam is powered on and running the sender code.

5.2 Receiving Data on T-Deck

– The T-Deck should receive the message and display it on the LCD screen and Serial Monitor.
– If the message is not being received:

– Check that both devices are set to the same frequency band.
– Ensure antennas are properly connected.
– Verify that there are no obstacles severely blocking the signal.

6. Practical Applications

Let’s explore how you can apply this basic communication setup in real-world scenarios.

6.1 Off-Grid Communication

Scenario:

You’re in a remote area with no cellular coverage and need to communicate with another person over a long distance.

Implementation:

– Use the T-Deck as a handheld messaging device.
– Enhance the code to allow the user to input messages via the keyboard.
– Send the typed message over LoRa to the T-Beam, which could be connected to another T-Deck or display.

Benefits:

– Reliable communication without reliance on existing infrastructure.
– Useful for hiking, camping, or emergency situations.

6.2 Point-to-Point Messaging

Scenario:

In an industrial setting, you need to send sensor data from a remote location to a central monitoring station.

Implementation:

– Attach sensors to the T-Beam to collect data (e.g., temperature, humidity).
– Send the data over LoRa to the T-Deck, which displays it on the LCD screen.
– Use the trackball and function keys on the T-Deck to acknowledge messages or send commands back.

Benefits:

– Long-range communication without the need for Wi-Fi or cellular networks.
– Low power consumption, allowing for battery-operated devices.

7. Troubleshooting Tips

– No Communication:

– Ensure both devices are on the same frequency and have matching LoRa parameters.
– Verify that the antennas are securely connected.
– Check for physical obstructions or interference sources.

– Upload Issues:

– Press and hold the “BOOT” button during upload.
– Ensure the correct COM port is selected.

– Serial Monitor Not Displaying Output:

– Confirm the baud rate is set to `115200`.
– Check that the correct serial port is selected.

– Device Not Powering On:

– Ensure the battery is charged or the device is connected via USB.
– Check the power button and indicators.

– Unexpected Behaviour:

– Double-check your code for typos or errors.
– Ensure all required libraries are installed and up to date.

8. Conclusion

Congratulations! You’ve successfully set up and configured the LilyGO T-Beam Supreme ESP32-S3 and the T-Deck ESP32-S3 Keyboard for basic LoRa communication. You’ve learned how to:

– Unbox and understand the hardware components.
– Set up the development environment.
– Program both devices for sending and receiving data.
– Test the communication link.
– Explore practical applications.

This foundational knowledge opens up a world of possibilities in IoT and long-range communication projects.

9. Additional Resources

– LilyGO Official GitHub Repositories:

– T-Beam Resources – https://github.com/Xinyuan-LilyGO/LilyGO-T-Beam
– T-Deck Resources – https://github.com/Xinyuan-LilyGO/T-Deck

– Arduino LoRa Library Documentation:

– LoRa Library – https://github.com/sandeepmistry/arduino-LoRa

– ESP32 Resources:

– ESP32 Arduino Core – https://github.com/espressif/arduino-esp32

– Community Forums:

– Arduino Forum – https://forum.arduino.cc/

 

Next Steps:

– Expand Functionality:

– Implement two-way communication.
– Incorporate encryption for secure communication.

– Integrate Sensors and Actuators:

– Connect environmental sensors to the T-Beam.
– Control devices remotely via the T-Deck.

– Explore LoRaWAN Networks:

– Connect your devices to a LoRaWAN gateway for internet connectivity.
– Utilize network servers for large-scale deployments.

Thank you for following this tutorial. We hope you found it informative and engaging. The world of LoRa and IoT is vast and exciting, and we encourage you to continue exploring and experimenting with these powerful devices.

Happy tinkering!

 

 

‘Fix the broken countries of the west through increased transparency, design and professional skills. Support Skills Gap Trainer.’


To see our Donate Page, click https://skillsgaptrainer.com/donate

To see our Twitter / X Channel, click https://x.com/SkillsGapTrain

To see our Instagram Channel, click https://www.instagram.com/skillsgaptrainer/

To see some of our Udemy Courses, click SGT Udemy Page

To see our YouTube Channel, click https://www.youtube.com/@skillsgaptrainer

Scroll to Top