Raspberry Pi Pico

Raspberry Pi Pico W with LoRa SX1278 for Sensor Monitoring

Raspberry Pi Pico W with LoRa:

Raspberry Pi Pico W with LoRa SX1278 for Sensor Monitoring– In this tutorial, you will learn how to use Long Range LoRa SX1278 Transceiver modules with Raspberry Pi Pico and Raspberry Pi Pico W. If you want you can also use the same Raspberry Pi Pico boards since they have got the same pins layout. But, the reason I am using these two different versions of the Raspberry Pi Pico boards is; because in my next tutorial I will make an IoT gateway using LoRa and Raspberry Pi Pico W.

You know just like the Arduino, ESP8266, STM32, ESP32, etc you can also program the Raspberry Pi Pico and Raspberry Pi Pico W using Arduino IDE. So, if you want to learn how to get started with Raspberry Pi Pico and Arduino IDE then you should read my getting started article on the Raspberry Pi Pico W and Adafruit IO.




Anyway, for now, as a beginner, you should only focus on how to wirelessly send sensor data from a transmitter Raspberry Pi Pico to a receiver Raspberry Pi Pico W using LoRa Transceiver modules. Because once you learn how to wirelessly send data from Raspberry Pi Pico to Raspberry Pi Pico W; then building an IoT Gateway is a piece of cake as Raspberry Pi Pico W can be connected with different IoT platforms, and by the way I have already demonstrated this in my getting started tutorial on the Raspberry Pi Pico W and Adafruit Io.

Raspberry Pi Pico W with LoRa

Anyway, here is a prototype model of my Raspberry Pi Pico and LoRa based Long Range sensor monitoring system. I have connected everything as per the circuit diagrams which I will explain in a minute.

On the right side, is the transmitter based on the Raspberry Pi Pico, along which a Potentiometer and SX1278 LoRa transceiver moduleare connected. The Raspberry Pi Pico reads the Potentiometer which I am using as a sensor and sends the Potentiometer readings to the remote side receiver using the LoRa.

And on the left side, is the receiver based on the Raspberry Pi Pico W. It has been connected with ani2c-supported 16×2 LCD and an SX1278 LoRa transceiver module. If you want you can also use an i2c-supported SSD1306 Oled display module, I have already used it in so many videos.The Raspberry Pi Pico W takes the data from the LoRa and prints it on the 16×2 LCD. Now, let’s go ahead and start our practical demonstration.



Altium Designer + Altium 365 + Octopart:

Arduino LoRa Free SMS

Altium 365 lets you hold the fastest design reviews ever. Share your designs from anywhere and with anyone with a single click. it’s easy, leave a comment tagging your teammate and they’ll instantly receive an email with a link to the design. Anyone you invite can open the design using a web browser. Using the browser interface, you’re able to comment, markup, cross probe, inspect, and more. Comments are attached directly to the project, making them viewable within Altium designer as well as through the browser interface. Design, share, and manufacture, all in the same space with nothing extra to install or configure. Connect to the platform directly from Altium Designer without changing how you already design electronics. Altium 365 requires no additional licenses and comes included with your subscription plan.

Get real-time component insights as you design with Octopart built into Altium 365. Octopart is the fastest search engine for electronic parts and gives you the most up-to-date part data like specs, datasheets, cad models, and how much the part costs at different amounts etc. Right in the design environment so you can focus on your designs. Start with Altium Designer and Activate Altium 365. Search for electronic parts on Octopart.



Using 5V adaptors, I powered up the Transmitter and Receiver. You can see the Potentiometer value on the 16×2 LCD. Now, I am going to rotate the knob of the potentiometer on the receiver side.

Raspberry Pi Pico W with LoRa

After rotating the knob of the potentiometer, the value changed from 529 to 943. For the practical demonstration, you can watch the video tutorial available on my YouTube channel Electronic Clinic or you can click on the link given at the end of this article.

Raspberry Pi Pico W with LoRa

I am sure by now, you might have got an idea of how does this system work. So, without any further delay let’s get started!!!



Amazon Links:

Raspberry Pi Pico

Raspberry Pi Pico W

Raspberry Pi Pico W Kit

I2C supported 16×2 LCD

Sx1278 LoRa Transceiver modules

Other Tools and Components:

Top Arduino Sensors:

Super Starter kit for Beginners

Digital Oscilloscopes

Variable Supply

Digital Multimeter

Soldering iron kits

PCB small portable drill machines

*Please Note: These are affiliate links. I may make a commission if you buy the components through these links. I would appreciate your support in this way!




Lora SX1278 Module:

The SX1276/77/78/79 transceivers feature the LoRa TM long range modem that provides ultra-long range spread spectrum communication and high interference immunity whilst minimizing current consumption.

Using Semtech’s patented LoRa modulation technique SX1276/77/78/79 can achieve a sensitivity of over -148dBm using a low cost crystal and bill of materials. The high sensitivity combined with the integrated +20 dBm power amplifier yields industry leading link budget making it optimal for any application requiring range or robustness.

LoRa also provides significant advantages in both blocking and selectivity over conventional modulation techniques, solving the traditional design compromise between range, interference immunity and energy consumption.

These devices also support high performance (G)FSK modes for systems including WMBus, IEEE802.15.4g. The SX1276/77/78/79 deliver exceptional phase noise, selectivity, receiver linearity and IIP3 for significantly lower current consumption than competing devices.

Raspberry Pi Pico W with LoRa

I have got these three LoRa SX1278 Modules, LoRa (Long-Range) is digital wireless data communication IoT technology. LoRa transmits over license-free megahertz radio frequency bands: 169 MHz, 433 MHz (Asia), 868 MHz (Europe) and 915 MHz (North America). LoRa enables very-long-range wireless data transmission. The type of the LoRa modules I am using supports 433MHz. Each LoRa module is also provided with an Antenna which we will need to solder to the boards to increase the wireless communication range.

The supply voltage is 1.8 to 3.7 volts, so it can be used with 3.3 Volts and 5 volts compatible controller boards without any problem. 3.3V compatible boards e.g. ESP8266, ESP32, Raspberry Pi Pico, etc. The operational temperature range is -40 Celsius to +85 Celsius.

It has a total of 12 via’s or holes which are clearly labeled and out of which we will be using only VCC, MISO, MOSI, SLCK, NSS, and GND.



As a beginner you may get scared when you first look at these LoRa modules which has holes as they are very close to each other because you cannot solder regular male or female headers. But no worries at all, you can simply start by soldering jumper wires, which of course will need some soldering practice.

Raspberry Pi Pico W with LoRa

As you can see I soldered the jumpers wires and the antennas. Next, I checked the short circuits using a digital Multimeter, and then to secure the wires I applied the silicon, this will help to keep the wires in place and will also protect the wires from getting disconnected.

LoRa Applications:

When it comes to the applications, you have almost infinite ways of controlling and monitoring things including,

Automated Meter Reading.

Home and Building Automation

Wireless Alarm and Security System

Industrial Monitoring and Control

Long range Irrigation Systems and so on…



Raspberry Pi Pico Tx Circuit:

Raspberry Pi Pico W with LoRa

3.3V and GND pins of the LoRa SX1278 are connected with the Raspberry Pi Pico 3.3V and GND pins. While the NSS, MISO, SCK, and MOSI pins of the LoRa SX1278 Transceiver module are connected with the Raspberry Pi Pico GPIO pins 8, 16, 18, and 19.

The potentiometer is connected with the GP26_A0 which is an analog pin.



Raspberry Pi Pico W Rx Circuit:

Raspberry Pi Pico W with LoRa

This is the receiver side circuit diagram. You can see the LoRa SX1278 connection with the Raspberry Pi Pico W remains exactly the same. The VCC pin of the I2C supported 16×2 LCD is connected with the VBUS which is the 5V pin. And obviously the grounds are connected together. The SDA and SCL pins of the I2C supported 16×2 LCD are connected with the GP0 and GP1. As per the Pins layout diagram GP0 is the SDA and GP1 is the SCL.

Raspberry Pi Pico W with LoRa

So, that’s all about the receiver side circuit diagram. Now, let’s go ahead and take a look at the Transmitter and receiver side programming.




Required Libraries:

LoRa.h

LiquidCrystal_I2C

Download the liquidCrystal_I2C and unzip the folder. Open the folder and copy the .h and .cpp files and paste them in the receiver side programming folder. The receiver side main code and these .h and .cpp files are need to inside the same folder. If you find it hard to understand then I highly recommend you should watch my video tutorial. Link is given at the end of this article.

Raspberry Pi Pico LoRa Tx Code:

 

If you have read my previous articles on the Arduino and Lora then I am sure you should have noticed that I am using the same libraries and the same program. Only the pin numbers are different. So, it means you can convert all my Arduino and LoRa based projects into Raspberry Pi Pico and Lora based projects. Now, let’s take a look at the receiver side programming.



Raspberry Pi Pico W LoRa Rx Code:

 

Even on the receiver side, I am using the same exact program which I have been using with the Arduino. The only modification is the addition of the i2c supported 16×2 LCD library. The i2c supported 16×2 library I have been using with the Arduino doesn’t work with the Raspberry Pi Pico, so, after searching for hours, finally, I found this library that works with the Raspberry Pi Pico. Make sure you save these .h and .cpp files in the same folder with this main programming file. So, that’s all for now.



Watch Video Tutorial:

 

Engr Fahad

My name is Shahzada Fahad and I am an Electrical Engineer. I have been doing Job in UAE as a site engineer in an Electrical Construction Company. Currently, I am running my own YouTube channel "Electronic Clinic", and managing this Website. My Hobbies are * Watching Movies * Music * Martial Arts * Photography * Travelling * Make Sketches and so on...

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button