An ESP32 and LoRa radio can send short text messages directly between nearby devices, without cell service or internet. This guide covers a basic two-node setup; you will need matching radio hardware, suitable antennas, and a small amount of firmware configuration before you can exchange messages.
What You’ll Need
- Two ESP32 development boards and two LoRa transceiver modules, or two integrated ESP32-and-LoRa boards. Each endpoint needs its own complete device.
- Antennas made for the radio frequency your modules use. Connect the antenna before transmitting; transmitting without one can damage the radio.
- USB cables and a computer for installing firmware or uploading a sketch.
- A supported LoRa library and a text-messaging example or your own simple firmware. The library must match the radio chip and board wiring.
- A power source for each device, such as USB power or a correctly wired battery pack. Check the board’s voltage and current requirements.
- A way to identify the correct legal radio band and transmission rules for your location. LoRa frequencies and permitted transmission settings vary by country.
Step-by-Step
- Choose compatible hardware. Confirm that both radios use the same LoRa chip family and can operate on a frequency permitted where you will use them. Two boards that look alike may have different radio chips, antenna connectors, or pin assignments. Read the board documentation before wiring or selecting firmware.
- Check local radio requirements. Look up the permitted frequency band and applicable limits on transmit power, airtime, and duty cycle for your location. Do not assume a frequency listed in an online example is legal or appropriate everywhere. Use the lowest practical transmit power and avoid continuous test transmissions.
- Assemble each node with power disconnected. For separate modules, connect the radio to the ESP32 using the interface specified by the board or library, commonly SPI. Match the documented pins for clock, data in/out, chip select, reset, and any interrupt line. Connect ground to ground and use the specified logic voltage; many ESP32 boards use 3.3 V logic, and a module may be damaged by an incorrect supply. Attach the correct antenna to each radio.
- Install the development tools and library. Set up an ESP32-compatible development environment, install the board support package, and add a LoRa library that explicitly supports your radio. Select the exact ESP32 board in the tool’s board menu. Use the library’s example for your chip rather than assuming all LoRa modules share one software interface.
- Configure a minimal sender and receiver. Start with a documented point-to-point example, not a mesh or internet-connected project. Set both devices to the same permitted frequency and matching radio parameters: spreading factor, bandwidth, coding rate, sync word, and any other settings required by the example. Set the correct pin definitions for each board. Configure one device to send a short text string and the other to receive and print the decoded message over USB serial.
- Upload and check startup messages. Connect the first board to your computer, select its port, upload the receiver firmware, and open the serial monitor at the baud rate specified in the sketch. Confirm that the radio initializes successfully and reports its listening state. Repeat for the sender. If initialization fails, stop and check wiring, board selection, and radio-chip support before trying to transmit.
- Test at short range in an open area. Keep the antennas attached and place the two devices a few metres apart, with antennas upright and a clear path between them. Power the receiver first, then send a brief message from the sender. Check that the receiver displays the text and, if the example provides it, a packet count or signal reading. Swap roles to confirm that both devices can send and receive.
- Add a usable text interface. Once the radio link works, connect a small keyboard, buttons, or a display, or use the serial monitor as the first interface. Have the firmware package each message with a sender ID and sequence number, keep messages within the radio library’s supported packet size, and show an acknowledgment or delivery status. LoRa packets are not automatically private or guaranteed to arrive.
- Try your intended range gradually. Increase the distance a little at a time and retest with the devices in their real positions. Buildings, hills, foliage, antenna orientation, interference, and legal transmission limits all affect range. A successful short-range test does not establish a reliable long-distance link.
Common Mistakes
- Mixing incompatible components: Different radio chips need different libraries and pin settings. Verify the exact module model and board wiring.
- Using mismatched radio settings: Both ends must agree on frequency and modulation settings. One differing parameter can make packets appear to vanish.
- Transmitting without an antenna: Attach the correctly tuned antenna before powering or transmitting with the radio.
- Expecting phone-style texting: A basic LoRa link does not connect to ordinary SMS, phone numbers, or the internet. Both endpoints need compatible hardware and software.
- Assuming delivery or privacy: A sent packet may be lost, and plain-text radio traffic can be received by others with compatible equipment. Add acknowledgments and suitable encryption if the application requires them.
Tips
- Keep a written record of frequency, radio settings, pin assignments, and firmware version for both nodes.
- Use short messages and include a sequence number so repeated or missing packets are easier to spot.
- For a field device, test battery life and restart behavior separately from radio range. Add a clear low-battery indication if needed.
- Use an enclosure that does not block the antenna, and secure the antenna connector against movement.
- Keep the first version simple: point-to-point text is easier to diagnose than routing, mesh networking, or a phone app.
Troubleshooting
- Radio initialization fails: Recheck the selected board, library support, power, ground, and every documented radio pin. Confirm the module’s voltage requirements and that the antenna is connected.
- Neither device receives messages: Confirm both are set to the same permitted frequency and radio parameters. Check that the receiver reports it is listening and that the sender reports a successful packet transmission.
- Serial output is unreadable or absent: Match the serial monitor baud rate to the firmware, select the correct USB port, and check that the board is running the newly uploaded sketch.
- Messages work nearby but fail farther away: Test outdoors with a clear line of sight, upright antennas, and fresh power. Reduce obstacles and interference; do not exceed local transmit limits to force more range.
- Only one direction works: Test each board separately as sender and receiver. Look for a wiring or antenna fault on the failing node, then confirm both firmware builds use identical settings.
- Text is cut off or corrupted: Shorten the message to fit the example’s packet limit and check how it handles line endings, character encoding, and packet buffers.
Frequently Asked Questions
Can I text someone who has no LoRa device?
No. The other person needs a compatible LoRa receiver and software, or a gateway that bridges the radio network to another service. A direct two-node setup does not reach ordinary phones.
Does this work without cell service or internet?
Yes. A direct radio link can work without either, as long as both devices are powered, configured alike, and within usable radio range.
How far can ESP32 LoRa messages travel?
There is no single reliable distance. Terrain, buildings, antennas, frequency, radio settings, interference, and legal limits all matter. Measure performance where you plan to use it.
Can I use any LoRa frequency?
No. Permitted bands and operating restrictions depend on your location. Check current local radio regulations and configure both devices accordingly.
Are LoRa messages private?
Not by default. Anyone with suitable equipment and compatible settings may be able to receive unencrypted packets. Do not send sensitive information unless your design adds appropriate encryption.
Can I use a phone as the keyboard?
Possibly, but it requires a separate interface such as Bluetooth or a local Wi-Fi connection between the phone and ESP32. The LoRa link itself does not provide a phone keyboard or internet access.
Related
Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.
More cards in this drawer
- Valheim Server Not Showing in Community List Fixes
- DisplayPort vs HDMI: Which Cable Should You Use?
- Soundbar vs 2.1 Speaker System: Which Is Better?
- MySQL Dump Import: Fix Common Errors
- Mouse Moving on Its Own? Causes & Fixes
- Slack Channels for Construction Projects: Setup Guide