Electronics Microcontrollers RF "/> DHT11 and DHT22 testing Electronics Sensors "/> IoT hardware control Electronics Projects "/> BioLite SolarPanel 5+ review Electronics "/> Review of HiGrow ESP32 moisture and temperature sensor Electronics Microcontrollers RF "/> Time for a refresh! Programming Web "/> How to Display live data from an Arduino on a webpage GameDev Web "/> Working with Pneumatics Electronics Pneumatics "/> Velleman KA05 / VMA05 pinout Electronics "/> Assembling the Prusa MK3 3D Printing "/> Requiem for a Reprap - packing down the BAM printer 3D Printing BAM printer "/> General PCB design tips Electronics PCB "/> Persistence of Vision with APA102 Electronics Blinky! "/> Getting started with STM32F0 Electronics Microcontrollers "/> Xmas cleaning and new workspace Electronics 3D Printing BAM printer Misc "/> MegaMatrix 1.0 Electronics Blinky! "/> Particle memory limitations and workarounds Electronics Microcontrollers "/> Level shifting NeoPixels for Particle Photon Electronics Microcontrollers Blinky! "/> Odd Particle Photon error messages and what they can mean Electronics Microcontrollers "/> Easter funtime with KiCad Electronics PCB "/> Embedding myself in devices Electronics Microcontrollers Projects "/> Basic Blink example for dsPIC30F4013 Electronics Microcontrollers Blinky! "/> Makeblock mBot review Electronics Robots "/> Playing with LoRa radio Electronics RF "/> Milling 2-sided PCB’s Electronics PCB "/> Buying a laser cutter for your Hackerspace Hacking/Making "/> React with Javascript package managers Programming Web "/> Call me! (with Adafruit FONA) Projects Microcontrollers "/> Fixing avr-eclipse paths Programming "/> Testing with Testflight Programming Mobile "/> Popcorn Time! Misc "/> Including Native extensions on OSX Programming Mobile "/> Filament review: Printing with potatoes? 3D Printing Materials "/> Beta testing for Makeblock Electronics Robots "/> ESP8266 and stability Electronics Microcontrollers "/> Spark Core shows solid magenta LED Electronics Microcontrollers "/> Unpacking the Titan 1 3D Printing SLA "/> Filament review: PlastInk Rubber 3D Printing Materials "/> Filament review: ColorFabb PLA-PHA variables 3D Printing BAM printer Materials Ultimaker "/> Teaching with robots Electronics Robots Projects "/> Filament review: NinjaFlex rocks! 3D Printing BAM printer Materials "/> Filament Review: PET+ from MadeSolid 3D Printing BAM printer Materials "/> Making a custom 3D printer controller Electronics 3D Printing "/> Why I’ll never use Windows Phone again Mobile "/> Project: Makeblock 3D printer Electronics Robots 3D Printing Projects "/> Project: wifi-enabled RGB LED displays Electronics Microcontrollers Projects "/> Summertime Projects "/> Ultimaker - preventing the extruder from plugging 3D Printing Ultimaker "/> Filament review: Colorfabb XT 3D Printing Materials Ultimaker "/> What platform next? Programming "/> X/Y robot with MakeBlock (Part 4) Microcontrollers Robots "/> X/Y robot with MakeBlock (Part 3) Robots "/> X/Y robot with MakeBlock (Part 2) Microcontrollers Robots "/> Apple is not currently accepting applications built with AIR 3.9 Programming Mobile "/> X/Y robot with MakeBlock (Part 1) Electronics Robots "/> Time for Maker Faire again! Electronics Robots Hacking/Making "/> Error occurred while installing the application: Invalid specified Programming Flash "/> Raspberry Pi or Arduino? Electronics Microcontrollers "/> Heated Build Platform update 3D Printing Ultimaker "/> Heated Build Chamber for Ultimaker 3D Printing Ultimaker "/> Promoting 3DP 3D Printing Ultimaker Hacking/Making "/> 3D printing trick: ABS sludge 3D Printing Heated bed Materials "/> Making a scale for Arduino with INA125 Electronics Microcontrollers "/> Project: pressure sensitive floor Electronics Microcontrollers Projects "/> Custom PCB’s with Fritzing Electronics PCB "/> VerifyError: Error #1102: Illegal default value for type int Programming Flash "/> Maker Faire Oslo Hacking/Making "/> Filament review: Conductive ABS from Repraper 3D Printing Materials "/> My first PCB - a DS1307 based realtime clock Electronics PCB "/> Printrbot Jr Heated bed upgrade 3D Printing Printrbot Jr "/> 3D Printer meetup #3 3D Printing Makerbot Printrbot Jr Ultimaker Hacking/Making "/> Meetup Pocket Sign Electronics Microcontrollers 3D Printing Hacking/Making "/> Unexplainable errors in Flash Builder 4.7 Programming Flash "/> A two dollar programmable FM radio Electronics Microcontrollers "/> 2012 - what a difference a year makes Misc Projects "/> Tutorial: making Gravitech’s MP3 Player add-on work Electronics Microcontrollers "/> Using Printrbot Jr with Kisslicer 3D Printing Printrbot Jr "/> Printrbot Jr - built by Jr! 3D Printing Printrbot Jr Hacking/Making "/> 3D Printer weekend 3D Printing Printrbot Jr Hacking/Making "/> Installation Error: ApplicationVerificationFailed Programming Mobile "/> The slow climb of HTML5 Programming GameDev "/> Dead HDD = a 3DP moment 3D Printing "/> How to update the official Arduino Wifi Shield Electronics Microcontrollers "/> SafeFrames for mobile apps Programming Mobile "/> Flash Builder fails to start Programming Flash "/> AIR package has no certificates at entry in AIR Programming Flash "/> JY-MCU Pro Mini (made in china) Electronics Microcontrollers "/> Heated Build Platform (Take 3) 3D Printing Heated bed Ultimaker "/> Warming up to browser apps Programming GameDev Projects "/> Rock in the road Misc "/> 3D printing with Color! 3D Printing Materials "/> MK1 heated bed and different power supplies 3D Printing Heated bed "/> Heated Build Platform for Ultimaker Electronics 3D Printing Heated bed Ultimaker "/> About Archive Arduino Companion 1.1 Programming Mobile "/> ExpressionEngine: redirecting based on group_id Programming Web "/> SAEF’s annoying default Programming Web "/> My new Ultimaker 3D printer 3D Printing Ultimaker "/> Arduino Serial - a real retro-arduino Microcontrollers "/>

ESP32-based LoRa

10 August 2019 at 4:29 pm

Article image for ESP32-based LoRa

For several years I’ve been using LoRa radios from Adafruit for my students. This year, Adafruit are sold out so I’m need for an alternative. The first one I’m looking at is the TTGO LoRa 1.0 and it looks quite promising in terms of both performance and price.

The LoRa radios I’ve used from Adafruit are based on the Atmel SAMD M0 processor. They use the Feather form factor, they are well documented and very suited for teaching (as with everything shipped by Adafruit). The M0 versions did have it’s hiccups though, so the teaching experience was far from smooth as the M0 have a few conflicts and the software examples confuse many of the students. They also come without an antenna, so the students had to solder this. Not too big of a problem, but the price of $35 a piece is a “tad” expensive.

The TTGO on the other hand is $24 for two complete boards, meaning that the students no longer need to work in pairs to solve LoRa related tasks. This makes it much easier for students that for some reason miss that lecture. The boards also include a tiny Oled that can be useful when testing, so this is a really good deal. They’re based on the ESP32 from Espressif and I’ve been wanting to get one of these boards into the hardware kits for a while and now is a good time as the software SDK is reasonably mature.

Easy to use

Getting these up and going is as easy as installing ESP32 support in your Arduino tool and selecting the TTGO LoRa board and its port. You can of course go the “traditional route” by using CMake/Ninja and ESP-IDF, but the official Arduino package covers what we need. Most of the standard Arduino examples will work, but it also comes with lots of good examples for spinning up small servers & clients using HTTP/UDP, OTA updates, BLE and even Azure IoT.

When you find code examples online, be sure to use code for the 1.0 boards and not examples for the 2.0 or 2.1 boards. If a sketch says it’s for the latter, the pinout is different, so check the table below for what pins to use. The ESP32 module still has quite a few pins available when subtracting the ones used by the LoRa radio (SX127x / RFM9x using SPI) and the Oled (using I2C). There’s also a user-controllable blue LED and the pin connected to the battery is connected via a voltage divider, so you can monitor the remaining charge.

The builtin Oled is really nice and something you don’t get with the boards from Adafruit. It’s a 128x64 pixel screen, so it can fit quite a bit of information. Note that you have to set pin 16 HIGH to use the Oled screen.

These are the pins used on the TTGO LoRa32 1.0:























Power usage isn’t too bad on these modules either. I’ve tested briefly using some typical sketches:

Power use

Wh @ 5.1V

Deep Sleep






LoRa & Oled



Wifi (standby)



Wifi (working)



Overall I’m pretty sure that these will work just as well for teaching, so I’m placing an order for these.

The antenna is the worst part

As can be seen in Andreas Spiess excellent review of the TTGO LoRa 1.0 & Heltek LoRa board, the antenna is the largest disappointment with these boards. The 915Mhz version only shows an RSSI of 65 when two boards are next to each other. The antennas that come with the board will easily work from inside my house and about 50m around it with acceptable performance, so you may not need to upgrade them. I’m upgrading my boards to a proper antenna from Digikey, but the cheapest proper antenna is more than $8 so it kind of ruins the budget, but I need to have a couple of these anyway.

Multiple boards and not all from TTGO

The TTGO LoRa design is Open Source and several vendors produce these boards. Be aware of this and also note that there are several versions of the board. You can identify the lateer 2.0 and 2.1 versions easily since they have the USB connector to the long side, rather than in the middle of the short end as the 1.0 version I’m using. Also note that none of the sellers of the 1.0 module lists the correct pinout, but this article has a correct version.

Useful software for these boards

Given that you use the proper resources (listed below), you should get these boards up and running really easy. I don’t understand why Banggood, Aliexpress, ebay and other vendors provide code at all. It’s much better to link to a proper source. Here’s some of the sketches and resources I’ve found when testing:

Working library for the LoRa part of the 1.0 modules: https://github.com/YogoGit/TTGO-LORA32-V1.0

Working sketch to test battery: https://gist.github.com/jenschr/dfc765cb9404beb6333a8ea30d2e78a1

I2C detect sketch: https://gist.github.com/jenschr/5fed7920d861cc3e0b753dd64ed3cc68

Getting it onto the ThingsNetwork: https://www.thethingsnetwork.org/forum/t/big-esp32-sx127x-topic-part-3/18436

Two part 3D printable enclosure: https://www.thingiverse.com/thing:3443245

Neat online font converter for 1306 Oled’s http://oleddisplay.squix.ch