Software apps and online services
Hi, I am sidik from sidik.my - an accountant with interest in programming and robotics.
Recently I purchased a pair of Grove LoRa-E5 STM32WL module. Current documentation for Grove LoRa-E5 at Seeedstudio wiki have example of Arduino application.
This project by Sufian Kaki Aslam on LORA-E5 communication without LoRaWAN is also based on Arduino code provided by Seeedstudio above.
Currently i am exploring CircuitPython for microcontroller programming. However I could't find CircuitPython library for this sensor, so I created simple CircuitPython script to demonstrate how it can be done.
As the communication with this sensor is thru UART, sending and receiving information is done thru AT command.Hardware
- Microcontroller :Cytron Maker Nano RP2040
- Grove Shield for Arduino Nano
- Grove LoRa-E5- connected to UART port on Grove Shield
- Grove I2C hub 6 port- connected to I2C port on Grove Shield
- Grove OLED SSD1306- connected to Grove I2C hub 6 port
- Grove CO2, Humidity & Temperature Sensor (SD30) - connected to Grove I2C hub 6 port
- Microcontroller : Seeeduino Xiao RP2040
- Seeeduino Xiao Expansion board with Built-in OLED
- Grove LoRa-E5 - connected to RX-7 & TX-6 grove port
First, let's try the "Hello World" for this sensor and Circuitpython. We connected 2 x Grove LoRa-E5 to Seeeduino Xiao RP2040 and Maker Nano RP2040 respectively and put this same code in a file named code.py in both microcontrollers using Mu Editor. Please change the pin respectively.
(Note: hackster code block do not correctly color code python script)
# Set UART Pin to the pin where Grove Lora E5 is connected
uart = busio.UART(board.TX, board.RX, baudrate=9600)
get_input = True
message_started = False
message_print = 
allstring = ""
printshow = False
# wait for user input
userinput = input().strip() #input command
# convert to byte
b = bytes(userinput, 'utf-8')
# write out the byte
byte_read = uart.readline()# read one line
if byte_read != None:
allstring += byte_read.decode()
printshow = True
if printshow == True:
if allstring != "":
Then, we open two Mu Editor windows side by side for each microcontroller and open the serial, and save, the code will immediately run. at this stage no external library required.
We send this command (typing keyboard) on the serial console (control+D if it enter REPL mode).
this is the output:
+INFO: Input timeout
+INFO: Input timeout
+ID: DevAddr, AB:CD:EF:12
+ID: DevEui, 01:23:45:67:89:AB:CD:EF
+ID: AppEui, 80:00:00:00:00:00:00:06
Which means the connection to Grove LORA-E5 is successful, now we test sending message to other microcontroller.Transmitting Message between Two Microcontrollers via Grove LoRa-E5
on the receiver node (In our case Seeeduino Xiao RP2040) we send following AT commands. this will prepare the node as RX receiver.
On the TX Transmitter node (Cytron Nano RP2040) we send following AT Command
The output on both console should show this.
We can see that the message (Hex String) is sent from Transmitter on the right (Maker Nano RP2040) to Receiver (Seeeduino Xiao RP2040). This shows that the radio transmission is successful.Send P2P Sensor Data between two Grove LoRa-E5 using CircuitPython
Now, we move forward to common use case for LoRa, which is sending sensor data. In this example, I use following code:
- Copy following code to transmitter (Maker Nano RP2040) and rename to code.py : github transmitter code
- Copy following code to receiver (Seeeduino Xiao RP2040) and rename it to code.py : github circuitpython receiver code
Dont forget to copy all the required library from Adafruit Circuitpython Library Bundle to folder named lib
Open serial console for both microcontrollers:
we can see that data is transmitted between transmitter and receiver. The OLED on both microcontroller also shows the sensor value which is CO2, Humidity and Temperature. Now, we already have our LoRa P2P environment monitor working!.
This end our project. In summary we covered the followings:-
- Test AT command to check the connection
- Send Hex string between two P2P Grove LoRa-E5 using AT command
- Send and Receive sensor Data using Grove LoRa-E5 and display it on OLED
In the next project, I share how to use Grove LoRa-E5 with CircuitPython to upload sensor data to full stack LoRaWAN network Environment Dashboard
Side Note : For those who interested in PCB design I discovered this campaign online, which is relevant to LoRa-E5:
To accelerate the development of IoT, Seeed is sponsoring Lora-E5 projects with the Seeed Fusion PCB Assembly Service for all hardware enthusiasts, designers, makers, and engineers around the world! Each person is limited to two PCBA boards 100% completely FREE for one design, including PCB fabrication, the cost of parts, assembly and shipping. The design must include LoRa-E5. Find out more: https://www.seeedstudio.com/blog/2021/10/21/invigorate-your-inspiration-for-iot-with-lora-e5-and-free-seeed-fusion-pcba-prototypes/