Lolra
Transmit LoRa Frames Without a Radio
Install / Use
/learn @cnlohr/LolraREADME
LoLRa
Transmit 900MHz LoRa frames surprisingly far without a radio (And other radio shenanigans using ADCs, PWMs and I2S/SPI busses) including sending other RF data, as well as receiving RF signals (Though admittedly not a LoRa receiver).
If you are looking for the Hackaday 2024 microcontroller radio talk, you can <a href=https://cnlohr.github.io/lolra_talk>click here</a>.
If you are looking for LoLRa Merch (Like t-shirts, etc.), <a href="https://cnlohr-shop.fourthwall.com/">click here</a>.
[!NOTE]
- Portions of code in this repo are under various licenses and cannot be trivially incorporated into other libraries, including some files containing a no-ai-training license for any of the RF-specific portions of the project. Be cautious when using code from this repo. See
for more information.
- The LoRa® and LoRaWAN® Mark and LoRa Logo are trademarks of Semtech Corporation.
- LoLRa is not associated with Semtech in any way whatsoever.
- This repo is designed for use with ITU Region 2 (The Americas) targeting 902-928MHz. Code changes are needed for use in Region 1 (EU, Russia, Africa) to target 863-870MHz or Region 3 (Australia, China, India) to target 920-923MHz.
[!CAUTION] Because we rely on harmonics and aliasing, the primary frequency components emitted by your microcontroller are going to be in portions of the RF spectrum where RF transmissions are banned. Please filter your output or perform your tests in an area where you are unlikely to leak significant RF. The overall EIRP output is genreally ≪300uW across the whole spectrum spread out over hundreds of emission frequencies, but there is virtually no way a device deliberately transmitting on these frequencies could ever pass FCC part 15 compliance, even with filtering.
Introduction and Repo Overview
I have always been fascinated with sending and receiving radio signals from microcontrollers that don't have dedicated radio hardware. This repo serves as a overview of many of the projects I've done to do this decoding, along with example code (Though some of it is restrictively licensed)
In general the repo is split up in to many projects, but categoriezed by device type.
- ch32v (Note, all examples require 8MHz (v203) or 24Mhz (v003) crystal oscillator)
- General Note: All OLED displays used here are 128x128 SPI-mode OLED displays.
- ch32v003-adcrx - prints quadrature values for receiving at 1/4 sample rate signals, or harmonics thereof. Specifically this is tuned to receiv CW on citizen band frequencies, specifically 27.000050 MHz
- ch32v003-lora - Successful (but very poor) transmission of LoRa messages with a ch32v003.
- ch32v003-timer - An attempt to use non-tabled dithering of PWM signals to send FM radio and/or 315MHz signals. This does not work well but it is included as a reference for dtrying to dither RF on the 003.
- ch32v003-txrx - Trying to send from one 003 to another 003 receiving. This does not work well - only about 1'.
- ch32v203-adcrx - Very basic quadrature decoding on a ch32v203.
- ch32v203-fft - Perform an FFT on a small window of samples on a ch32v203. This outputs to an OLED display. It doesn't keep up in realtime though. It also relies on <a href=https://gist.github.com/cnlohr/c4f9647a220781c005ff1a733dc9ed7f>fix_fft.h</a> (which cannot be distirbuted with this project because of a lack of license.
- ch32v203-goertzel - Perform a full goertzel's tuning on an incoming ADC signal so that it can listen to multiple AM and NBFM radio stations from an ADC pin.
- lib/calculator.html - webpage that can use webhid with ch32v203-goertzel.
- ch32v203-lora - Proper transmission of LoRaWAN packets (from the tests outlined below).
- ch32v203-tx - Very basic test, setup to just turn on a PWM on the ch32v203.
- esp32-s2
- loratest - Full stack protocol for sending LoRa messages from an esp32-s2. (From range test)
- narrow_fsk_test - Very basic test using dithering and the PLL in the esp32-s2 to see how tight/narrow control is possible with the esp32-s2. This does not do a dithered closed loop, but would not be terribly hard to add.
- videoending - Mechanism for allowing an ESP32-S2 to FSK, hopping around to draw a picture in a spectrogram. This was used for the video ending.
- esp8266
- example_125k_raw - Sending a raw 125kHz wide LoRa message.
- example_500k_raw - Sending a raw 500kHz wide LoRa message.
- lorawan_example - Using the I2S bus on the ESP8266 to send a full-stack LoRaWAN message to the things network.
- non_lora_310_transmit - Exmaple of how to transmit 310MHz OOK with an ESP8266.
- lib
- aes-cbc-cmac.h - Public Domain RFC4493 AES-CMAC header only library.
- LoRa-SDR-Code.h - MIT (unrestrictive) Licensed code to construct LoRa packets
- lorawan_simple.h - MIT (unrestrictive) Licensed code to construct LoRaWAN packets.
- rf_data_gen.h - Helper function for helping generate bit tables for I2S/SPI outpiut of carefully crafted signals.
- tiny-AES-c.h - Public Domain AES encryption/decryption library.
- tools
- 60-rtlsdr.rules - Make it so you can use your airspy from Linux as a user.
- complex_magsink_to_image.c - Generate ultra high resolution (in time domain) waterfall views.
- testloradec.grc - Using gr_lora exmaple to decode LoRa in GNURadio
Introduction (LoRa)
Firmware-only LoRa transmission, for a variety of processors. Send LoRa packets, without any radio, chips, external hardware or built-in radios at all on a variety of common, inexpensive processors. While not truly bit banging, this repository shows how using either a shift register (i.e. I2S or SPI port) or an APLL, you can send LoRa packets that can be decoded by commercial off the shelf LoRa gateways and other chips.
There are two major modes that this repository works with.
- Transmission using a tunable PLL, creating a square wave, then using a harmonic (the 13th harmonic in the case of the ESP32-S2) and then transmitting the signal out a clock out pin.
- Direct synthesis on a bitstream, a much more versatile method able to work on a myriad of microcontrollers. This creates an image of the intended bitstream up at 900 MHz, even in situations where the bitstream itself can be as low as 7.2 MSPS. But for most platforms, I've targeted between 24 and 173 MSPS.
Click Below for the Youtube Video version of this page:
Background
Square waves, and images
Any time a signal changes state from low to high or high to low, a disturbance is created in the electromagnetic fields surrounding that wire. Any time. The difference is, are you, as an engineer, going to fear it, squelching it waddling, being afraid of whatever EMI it might cause, or are you going to grab the bull by its horns and emit some artisanally crafted signals? The major principles you will need to understand are:
- The actual emission of a wave is made from several frequency components at different frequencies and phases. You can read more about it in this wolfram article or This 3Brown1Blue Video

- A pure sinewave has only its principle output wave in frequency space.

- You can create a high frequency tone by generating a low frequency tone (Pictured is a 13th harmonic of at 69.420MHz signal)

- You can spread a signal over an area of spectrum by scanning it between frequencies. (There are other ways, but that isn't LoRa)

- Square waves are actually several "odd harmonic" frequencies all added together.

- It is important to note that many more cheap micros frequencies cut off rather quickly at high frequencies.

The second principle is signal mixing. If you create a signal, then "mix" it with a high frequency, you get an "image" wrapped around that high frequency. Mixing can be done with diodes, special RF equipment, or even just sampling, like that done by using a shift register, outputting bits at a steady rate.

Now the real magic happens, when you realize these two principles actually work together. You get an image at the base band
Related Skills
node-connect
338.7kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
83.6kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
338.7kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
commit-push-pr
83.6kCommit, push, and open a PR

