As this is a popular subject among those following my posts, I decided to talk about LoRa today. However, I’m going to discuss the subject with some new elements: this time without using the ESP32, but the STM32 instead. I always wanted to post about the STM32, as it composes a whole family of 32-bit microcontrollers produced by STMicroelectronics. I have several friends who are using this chip outside of Brazil. They can attest to the successes of this European manufacturing device. First, I’m going to introduce the STM32, and also discuss the LoRa Ra-01 Module. In addition, I’ll discuss programming the STM32 in the Arduino IDE.
This video will show you an STM32 development kit not meant for programming in Arduino, but instead with C language or those that are native to STMicroelectronics. If I'm not mistaken, there are eight companies that produce compilers for STM32, which shows us that there is a sizable global culture concerning this chip.
I want to explain to you here that STMicroelectronics is at least four times larger than Microchip, and it produces the STM32 family. It consists of architectures ranging from very small chips to STM32 F7, which I consider to be "super powerful".
In our assembly, we use an STM32 Maple Mini, which looks like an Arduino Nano. However, it is much more powerful. We’ll also use the Ai-Thinker Ra-01. It is separate from the LoRa radio, which will communicate with the STM32 via SPI (the communication of the Semtech LoRa chip).
In our video, you can see in the assembly that we have the STM32 Maple Mini connected via SPI to the Ra-01 module. This assembly transmits the data to our "beloved" ESP32, which has an embedded i2c display that displays the packages. You can see that it only takes 81 milliseconds for preparation, sending, and receiving of the package by the ESP32, as well as for the on-screen display. If the distance is increased, and there is a change in the software, this time tends to increase.
Our aim with this assembly is to show the STM32, which is a different chip, sending data in the standard Lora radio. It is important to remember that there are two different hardware pieces that are talking via LoRa radio protocol.
Basically, we have here the Semtech LoRa chip, with some discrete components on the board, including an antenna output. The interface is SPI. At this moment, we must bring up the question of chip speed, which is at above 300Kbps. We know that LoRa doesn’t function at this speed, as it rotates only at 37K or less. Why? To go far, you must lower the bit rate. It is important to remember that speed is not a concern of LoRa, but rather its scope. The frequency of this device is 433MHz, and the transmission power is at about 18 dBm, with 3v3 power.
I consider this special concerning the STM32. What's the difference between this and the STMicroelectronics development kit (the STM32 L4 Series ultra low power)? The kit is more powerful, but the Maple Mini works in the Arduino IDE, which makes it a lot easier for those who are not as knowledgeable with regards to the programming. We can say that Maple Mini functions like a kind of Arduino, with a Flash of 128 KB. The Maple Mini also has 20 KB of RAM, USB input, LEDs, buttons, a highlight for its 34 IOs, plus 12 16-bit PWMs and 9 12-bit analog inputs.
Download the zip at https://github.com/rogerclarkmelbourne/Arduino_STM32
Unzip and copy the folder to Documents / Arduino / hardware
The source code we use in this project is the same that we have already used in an assembly with an ESP32, in the video: ESP32 LoRa with Arduino IDE: Send and Receive TX RX, with one exception: it does not have the display. This part of i2C has already been removed from the code that I downloaded below. To find out how this code works, simply watch the video.