DIY LoRa-based Anemometer Network Using ESP32 – Need Guidance on: solar, Heltec WiFi LoRa 32, RS485 & LoRa Setup

Hi all,

I’m working on a small DIY project to create a network of ultrasonic anemometers in a localised area where I need real time data of wind behaviours (a 1km square). The goal is to measure wind speed and direction at multiple (10+) points and send the data wirelessly back to a base station in real time (or as close to that as possible).

For now - I think I need a firm steer on what kit to buy before I worry too much about the coding.

Current situation - I have bought an Arduino beginner’s kit (to get a grasp of the basics) and I am awaiting arrival of 2 ultrasonic anemometers from China.

The plan - to build a prototype of 2 nodes and a base station in the next 3-4 weeks.

Longer-term - thereafter, expand to 10 nodes. I plan for the solar powered nodes to also facilitate extra sensors including humidity, light, air pressure and temperature. The nodes having bluetooth/wifi also seems like a good feature, to enable me to debug/maintain from a distance (research has led me to believe a T-Beam is a sensible choice with this in mind - but maybe a cheaper option in future?)

Hardware I plan to use:

  • ESP32 boards (likely T-Beam for LoRa + GPS)
  • LoRa modules (868 MHz – UK legal band)
  • Ultrasonic anemometers – RS485 output, 10-30V power, 0.12W consumption
  • Power via small Li-ion and solar to maintain it for daily 0800-1700hrs use
  • Solar panel - some initial calculations on chat-gpt thinks 5W is enough and a 3000mA battery in the T-Beam to be adequate…

What I’m trying to figure out:

  1. What exact items do I need to buy? When I search aliexpress etc, I’m overwhelmed by choice.
  2. is the t-beam the best board for my prototype node? What could/should I use instead?
  3. RS485 boards (eg MAX485) look super cheap online, should I choose one in particular for this use? Again, I am overwhelmed by choice.
  4. What LoRa board to get? How to send those readings via LoRa to a base unit and display them (even just serial output for now). I realise this is a big question.
  5. What equipment should the base station/gateway consist of? A friend recommends a raspberry pi - but which? It would need to be good enough to receive up to 10 nodes’ packet transmissions, be solar powered, SIM card to upload the wind data to the internet so I can see the feed on my phone. What LoRA board? What battery? What solar?
  6. Any general design advice for linking multiple nodes (~10 units) without interference or packet loss. I realise this is also a big question, and I anticipate getting rapidly out of my depth - im really grateful for the help here.

I’m not from an electronics background, and with a really young family I don’t have loads of time to learn everything from scratch — so I’m trying to keep things as simple as possible while still making it reliable and expandable. I’m such a rookie I’m not sure I’m even asking the right questions.

If I can at least get the right components as a first step towards making my 2 node prototype, that’ll be progress!

Thanks in advance,
Nick (in the UK)

There are no short cuts. Use the beginners kit and work through the examples. Coding knowledge is not possible to escape from. There are no projects matching Your goal to copy.

Posting links to datasheets for the components You’ve ordered would spread light over the project.

1 Like

This is quite an advanced project. You may want to spendthe next few months working through the Arduino Cookbook.
Power will be a major stumbling block.
Good luck.

There is nothing small about this project, especially if you are a beginner. A 10 node network itself is a very challenging task.

Any general design advice for linking multiple nodes (~10 units) without interference or packet loss.

That is an extremely difficult task, a separate project far more challenging than setting up the network in the first place. It is completely out of the question for a beginner, and hardly necessary for collecting useful data.

Start by learning how to collect data from one wind sensor. Any Arduino will work for that.

Then learn how to send and receive messages to the base station by radio.

No.

"Real time" and "LoRaWAN" are excluding each other.

LoRa / LoRaWAN is meant to send small packets of sensor data at maybe one packet per hour.

Even at the most optimal SF7 (https://avbentem.github.io/airtime-calculator/ttn/eu868), assuming a payload of just 12 byte would mean about 61.7 milliseconds of airtime per packet, so that directly limits it at 16 data points per second, and that's not calculating in the RX1 and RX2 receive window, which are 1 second and 2 seconds after the end of transmission respectively. So with LoRaWAN that's well below once per second.

We can tell you are a rookie! The fundamental feature of your project is communications between one or more Arduino units and a base unit. Without that working, all the rest you are describing is going to be wasted time and effort if the communications does not perform.

Please begin with the communications part of the project so you will not be wasting all the effort in vain.

you need to define 'real time', e.g. samples every 10mSec, every minute, every 10 minutes?
LoRa is intended for low power low data rate communications therefore if a few bytes every 10 minutes is the aim LoRa is probably suitable

I would certainly recommend using a module with a microcontroller and LoRa on the same PCB, e.g. T-beam or Heltec wifi-lora-32-v3 or V4
if connecting a RS-485 module make sure it works at 3.3V

you need to experiment!

also maybe worth looking at is the HC-12

1 Like

Thanks for the responses! I can tell there are areas I should have made more clear so am happy to clarify.

Clarification 1 - I am only asking for advice on what components to buy to make the prototype. I will learn lots once I get to the stage of experimentation for sure, and then I can return here with more intelligent questions.

Clarification 2 - by real-time I mean ideally each node transmits every 5-10 seconds, alternatively every 30 seconds could be tolerable for this specific purpose of my project.

Clarification 3 - my research recommends I use raw LoRa point-to-point rather than LoRaWAN, which should mean that I only need to adhere to duty cycle rates, not fair access policies (which seem very restrictive!). Being in the UK, I intend to utilise the 869.4-869.65 MHz (a sub-band of 868Mhz) which permits 10% duty cycle i.e. 6 mins every hour can be used to transmit (rather than 1% duty cycle, which is only 36 seconds every hour).

Horace - thank you for the specific recommendations of components! It has reassured me that my research has been along the right lines as I also considered the Heltec, and am aware the RS-485 should work at 3.3V. Very much looking forward to experimenting!

I would forget about Lora for now, and try to set up an ESPNOW network with small ESP32 boards with external aerials, like the XIAO ESP32C3. Those boards have a LiPo battery connection and a built-in charging chip. ESPNOW should do several hundred metres, depending on the environment. You can always add a Lora module to them if the ESPNOW range is a not enough.
Leo..

Another vote for the Heltec here. I have a small LORA network on water meters on my property and setting up the point-to-point LORA was a piece of cake. The Heltec V3 version with onboard wifi, Lora and OLED display are only about a UK tenner each on AliExpress and they do all the hard work of mounting and powering and interfacing separate modules for you. Be sure to get the right frequency version.

868MHz/915MHz LoRa ESP32 OLED Wifi SX1276 Module IOT Development Board with Antenna For Arduino Electronic Diy Kit PCB - AliExpress 502

The LORA library works just fine and you can use the Arduino IDE with the appropriate board manager installed. There is a Modbus library, working examples to copy and Youtube tutorials.

I used one for my base station (connected to wifi) as well as the nodes and I have it on the Arduino Cloud, but you could send the data anywhere. I don’t see the need for a RPi unless you want to do a lot of number-crunching with your data.

I just set the different nodes to transmit infrequently at different intervals and include an identifying byte. If two transmissions happen to coincide and interfere, too bad - the next transmissions won’t. You could easily make this more sophisticated but I had no need.

1 Like

The fair access polices for TTN are for free access, so the restrictions seem very reasonable.

If you want to use more frequent transmissions, then you can of course pay for the access.

So I’ve been shopping, following further research. My 2 node prototype will comprise of the folllowing. I know I can source cheaper on AliExpress, I’ll go there when I expand this out.

For the sake of other beginners who stumble across this post, I’ve included more detail than most need to know.

eSP32: I’ve gone with heltec lora ESP32 boards (with 3000mAh batteries) for each of the 2 nodes and just the board for the base station. ESP32 LoRa V3 SX1262 Development Board with 0.96 inch OLED Display 240MHz CP2102 863-928 MHz Antenna for Ar duino Meshtastic LoRawan IOT (Upgraded Antenna): Amazon.co.uk: Computers & Accessories

Sensors: 2 ultrasonic anemometers from Renke: Ultrasonic Anemometers | Wind Anemometer - Renke

RS485 modules so the anemometer can talk to the Heltec. DollaTek 5PCS 5V MAX485 / RS485 Module TTL to RS-485 MCU Development Board: Amazon.co.uk: Business, Industry & Science

Power: for now will be battery in the nodes and usb laptop power for the base station. The anemometer requires 10-30v so I got DC-DC step up boards which will convert the 3.7v battery power up to 12V. I plan to enable solar panels to power these but that’s a future problem. zalati Mini Boost Module 10pcs DC-DC 3.7V to 5-12V Step Up Board Power Converter with LED Indicator : Amazon.co.uk: Electronics & Photo

I also got a 200mA slow burn fuse and an inline fuse holder, to protect the anemometer from the battery. 5 x Inline 5x20mm Glass AGC Fuse Holder Splash Proof Screw Type: Amazon.co.uk: DIY & Tools And 200mA 0.2A 20mm Glass Slow Time Delay Blow Fuse (Pack of 10) : Amazon.co.uk: DIY & Tools

And cos I know the small amount of soldering I need to do is gonna be fiddly, I got a helping hand! BEEYUIHF Helping Hands Soldering Station, Soldering Station Tool 4 Flexible Helping Arms Solder PCB Holder for Electronic Repair Soldering Jewellery Craft Model : Amazon.co.uk: DIY & Tools

Thanks for the advice so far. ESPNOW was an interesting one but I’ve ruled it out as I need to cover a 1km length of land eventually.

Be sure to test communications from each of the final locations you will be using.

For sure. Once I’ve tested the prototype in my garden, next step is to spread it out across the land!

the RS485-TTL module you referenced uses 5V logic

the ESP32 uses 3.3V logic so have a look for a RS485-TTL module which uses 3.3V logic, e.g. XY-017 3.3v 5v 12v RS485 TO TTL RS485 SP3485 RS-485 Breakout For Arduino RPi

photo showing Heltec LoRa V3 connected to a RS485 network

ESP32 code

// ESP32 Serial1 to RS485 bus
//
// see https://microcontrollerslab.com/rs485-serial-communication-arduino-tutorial/

#define RS485Serial Serial1  // hardware serial port on ESP32

// RS485 VCC ESP32 to to 3.3V
#define RXD2 39  //  ESP32 Serial1 Receive  pin 16 to RS485 RO  (Receiver Output) /RXD
#define TXD2 40  //  ESP32 Serial1 Transmit pin 17 to RS485 DI  (Driver Input) /TXD

// some RS485 modules automatically switch between transmit and receive DE/RE not defined
// RS485 DE (Driver Enable set HIGH to enable)  and RE (Receiver Enable set LOW to enable) to ESP32 pins 18 and 19
//#define DE   //RS485 Direction control pin
//#define RE   //RS485 Direction control pin

#define RS485Transmit HIGH
#define RS485Receive LOW

void setup() {
  Serial.begin(115200);
  delay(1000);
  Serial.println("\n\nESP32 connect to RS485 bus - enter/receive text");
#ifdef DE  // if DE and RE are defined
  pinMode(DE, OUTPUT);
  pinMode(RE, OUTPUT);
  digitalWrite(DE, RS485Receive);  // Disable RS485 Transmit
  digitalWrite(RE, RS485Receive);  // Disable RS485 Transmit
#endif
  RS485Serial.begin(9600, SERIAL_8N1, RXD2, TXD2);  // set the RS485 data rate
}

// loop sending data to RS485 and receiving data
void loop() {
  if (Serial.available()) {           // Arduino Serial data avaliable?
#ifdef DE                             // if DE and RE are defined
    digitalWrite(DE, RS485Transmit);  // Enable RS485 Transmit
    digitalWrite(RE, RS485Transmit);  // Enable RS485 Transmit
#endif
    RS485Serial.write(Serial.read());  // Send byte to Remote RS485
    RS485Serial.flush();               // wait for byte to be transmitted
#ifdef DE                              // if DE and RE are defined
    digitalWrite(DE, RS485Receive);    // Disable RS485 Transmit
    digitalWrite(RE, RS485Receive);    // Disable RS485 Transmit
#endif
  }

  if (RS485Serial.available())         // RS485 serial data available?
    Serial.write(RS485Serial.read());  // read character and display it
}

serial monitor outputs

Heltec serial monitor

ESP32 connect to RS485 bus - enter/receive text
hello from nano1
hello from nano 2
test2 from nano1 abcdefgh
test2 from nano 2 0987654321

-------------------------------------------------

Nano 1
Nano to RS485 - Use Serial Monitor, type in upper window, ENTER
Use Serial Monitor, type in upper window, ENTER
hello from Heltec LoRa V3
hello from nano 2
test2 from heltec 01234567890
test2 from nano 2 0987654321

---------------------------------------------------------

nano 2
Nano to RS485 - Use Serial Monitor, type in upper window, ENTER
Use Serial Monitor, type in upper window, ENTER
hello from Heltec LoRa V3
hello from nano1
test2 from heltec 01234567890
test2 from nano1 abcdefgh
1 Like

Horace ya ledge. Stupid oversight on my part, a mistaken purchase despite following your earlier guidance to get a 3.3V rs485 module.

Thanks for spotting that!

Very kind to share all that code. I shall consume with a brew.

Thanks
Nick

I’d highly recommend having a watch of this Youtube tutorial video. It might not be the case any longer, but the standard Arduino IDE build did not use to include the Heltec V3 board manager, which has to be added manually. But it did include the version 2, which is not compatible with V3, and it’s all a bit confusing. The video shows how to install the V3 and how to find the example sketch to get two of the Heltecs talking to each other using Lora. The code is easy to then adapt for other uses.

I mounted my base station on a USB phone charger plugged into a GPO in my kitchen so it is effectively wall mounted. This is simultaneously doing Lora to the nodes, wifi (to the Arduino Cloud) and running the display. It really was not all that difficult to set up. I’m sure you’ll crack it.

1 Like

using File>Preferences Additional Board ManagerURLs

https://espressif.github.io/arduino-esp32/package_esp32_index.json)

Tools>Board select Heltec WiFi LoRa 32(V3)

the Heltec WiFi LoRa 32(V4) does not appear to be available though

EDIT: a useful tool when working with RS485 is a USB-RS485 module which plugs into a PC and can be used to monitor and display RS485 traffic (cost about £10 on Ebay in UK)

1 Like

@horace It’s good to see that Espressive now support the Heltec LoraWifi V3 in their boards manager.

@n1ckh I’m not sure what the best board manager will be for your project. The Espressive board manager is not specific to the Heltec products so may be missing some features. The board manager under the Github name Aaron Lee seems to have some tie-in with Heltec and is referenced in their documentation. I don’t know if it offers anything that the Espressive board manager doesn’t, but it seems to me more like an “official” release.

1 Like

Thank you. I’m receiving my boards this week so will tinker with a basic arduino sensor. I’m sure it’ll be straight forward enough (at the prototype stage).

Anemometers due to arrive in a fortnight!