Download as pdf or txt
Download as pdf or txt
You are on page 1of 11

labs project

with the
Raspberry Pi Pico
Fun with MicroPython

By Mathias Claußen (Elektor)

Using a Raspberry Pi Pico with MicroPython The Raspberry Pi Pico (Figure 1) is a new microcontroller board, featur-
is a beginner-friendly way to program. ing the RP2040. This chip is designed and developed in-house by the
Raspberry Pi Foundation and therefore it is their first silicon. After seeing
Adding a SeeedStudio RFM95 LoRa all the news around it — and after hearing about some of the doubts and
module and a DS18B20 temperature sensor fascination with it — I figured it was time to get some projects started.
can create a quick LoRaWAN node with The board offers no Wi-Fi but can be run on a set of batteries for porta-
ble applications, so why not combine the Raspberry Pi Pico with a LoRa
MicroPython. And as putting components modem? The HOPERF RFM95 (Figure 2) is a well-priced and widely
only on breadboards may be a bit instable, a supported module that has been used in former Elektor projects, like
suggestion for a PCB is included. My First LoRaWAN [1]. While in this article an STM32 BluePill module
was used, this time we will go with the Raspberry Pi Pico.
 
What we will build is a simple temperature measurement device using
a DS18B20 sensor that will transmit data to a LoRaWAN gateway which
will forward the data to The Things Network Cloud. From there we
will grab the data with a (classical) Raspberry Pi running the (home)
automation platform Node-RED.
 
We will build the temperature sensing LoRa node on a breadboard, but if you
prefer a PCB instead, this article will provide a draft one, done with KiCad.
 
Figure 3 gives you the dataflow from the Raspberry Pi Pico over the
LoRaWAN to The Things Network server. As you can see, a gateway is
in the middle, translating the RF data into something that can be trans-
ported over the Internet to The Things Network. The data delivered to
Figure 1: The Raspberry Pi Pico.
the The Things Network shall be processed as we are interested in the
temperature transmitted. To do so, we need to grab this data and are
going to present it on a small web page. Figure 4 shows the dataflow
from The Things Network to a Raspberry Pi that will generate a web
page with the actual transmitted temperatur and also a chart indicating
the last transmitted values.
 
The software used to grab the data form The Things Network and gener-
ate a web page is Node-RED. Node-RED is a tool that allows to build
graphically data flows and process various data. This can be done just

Figure 2: RFM95 module.

6 July & August 2021 www.elektormagazine.com


by using a browser of choice — you only need to install the Node-RED the Raspberry Pi Pico offers and connect it to the RFM95 LoRa modem.
server and just open a browser to get started. Node-RED has been Also, we just need to connect RESET and DIO0 from the module to any
used in Elektor projects in the past and allows a quick entry into data of the GPIOs of the Pico. To get a fully operational LoRa modem, also
processing and handling. A Node-RED beginner book can be found at an antenna needs to be attached.
the Elektor Store. (See Related Products for more information.)  
  For the antenna, we are going to use simple wire. A piece of copper wire
The ingredients for this project are simple and can be seen in the textbox with a diameter of 1 mm is perfectly sufficient. The required length is
Required Material. Also make sure you are in a range of a LoRaWAN calculated as λ/4 antenna for the 868 MHz, the range in which the LoRa
gateway that will route your data to The Things Network. If you do not module operates, as follows λ/4 = (c0/868 MHz)/4 = (299792458 m/s)/
have one in range but want to start with your own gateway, providing (868000000 1/s*4) = 0,08635 m = 8,635 cm. This length applies if wave
better LoRaWAN coverage, have a look at [3]. This is an all-in-one would propagate in vacuum, but in copper the speed of the wave is lower
solution you can buy off the shelf. As an alternative, you can build your and a shortening factor must be considered. With the value 0.95, you get
own Raspberry Pi based gateway with [4]. an approximation with a length of 8.2 cm at the end for the copper wire.
 
Bread Board First While not recommended, the pull-up on the reset-line has shown in the
To demonstrate the basic schematic that we are going to build, it will past to be required. It is added for a more stable operation, as RESET may
be set up first on a bread board. This allows for fast testing, and as you pick up noise from the flying wires and reset the module unexpected.
can see, can be done with some simple wiring (Figure 5). To connect If you are working on your own LoRa board, it might be safe to place a
the LoRa modem to the Raspberry Pi Pico, we need four connections pull-up, not populate it, and then later patch it to your board by hand.
for the basic SPI interface: MOSI, MISO, SCK and CS (data in, data  
out, clock and chip select). This will allow for data exchange with the For the temperature sensor, a One-Wire connection will be used. As
LoRa modem. In addition, RESET and DIO0 are requiered to control the name One-Wire indicates, we will need only one GPIO pin for the
the modem. DIO1 to DIO3 are connected and required by some other data exchange. The protocol can be implimented as a pure software
LoRa libraries, like the LMIC library (if we are going to program the solution so any GPIO pin is suitable to be used. One-Wire requires
Raspberry Pi Pico in C/C++). We can choose from one of the SPI ports a pull-up resistor to be present. Depending on the MCU used, this

Figure 3: Dataflow to The Things Network. Figure 4: Dataflow from The Things Network to User web page.

+3V3 +3V3

Required Material J1 J3
C1 C2 R5 20 1 40 1
> Raspberry Pi Pico *
USB
GP0 VBUS V_BUS
19 2 39 2
4k7

V_SYS
> RFM95 *
GP2 VSYS
4µ7 100n 18 3 38 3
10V GND LED GND
> Bread board set * 17 4
GP2 3V3_EN
37 4
BOOTSEL

> 9 jumper wires male-male


16 5 36 5
13 GP3 3V3_OUT +3V3
15 6 35 6
> Breakout Board for RFM95
GP4 ADC_VREF
3.3V

2 14 7 34 7
MISO GP5 GP28
> 2x20 pin header + 2x8 pin header NSS
5 13 8
GND MOD1 GND
33 8

> DS18B20 temperature sensor 6


RESET SCK
4
3
12
11
9
10
GP6 GP27
32
31
9
10
> 10 cm copper wire (1 mm diameter) ANT1
U1
RFM95W
MOSI
DIO0
14 10 11
GP7
GP8
GP26
RUN
30 11

  868S2 DIO1
15 9 12
GP9 GP22
29 12
16 8 13 28 13
Parts marked with * can be ordered
Raspberry Pi PICO

DIO2 GND GND


9 11 7 14 27 14
ANT DIO3 GP10 GP21 +3V3
at the Elektor store, pls see Related DIO4
12 6 15
GP11 GP20
26 15

Products. DIO5
7 5 16
GP12 GP19
25 16
4 17 24 17 R11
GND
GND
GND

  3 18
GP13 GP18
23 18 U2
4k7

1 8 10 GND GND
For the breakout board Gerberfiles 2 19 22 19 3
GP14 GP17
are provided [15] at your preferred
SWCLK

1 20 21 20 2
SWDIO

GP15 GP16
GND

1
PCB service.
Figure 5: Schematic how to attach 210047-003 DS18B20
components.

lektor July & August 2021 7


Figure 7: MicroPython download for the Raspberry Pi Pico.
Figure 6: Setup on a breadboard.

Figure 9: Thonny
installed in version
3.3.4.

Figure 8: Raspberry Pi Pico in bootloader mode.

can be either an internal one, provided by the GPIO block inside your of the TinyLoRa library for CircuitPython by Adafruit. The limitations
MCU, or an external one. To have a reliable data transfer an external mentioned are that we can only transmit data, but will be unable to
pull-up resistor is prefered. receive anything back from the LoRaWAN. With this limitation, we also
  needed to use APB (activation by personalization) for authentication,
If all the hardware is set up, it will look like what you see in Figure 6, meaning that the network session key and application session key
so we can start coding. are stored inside our code.
 
MicroPython and LoRa As this is an example to show that you can do LoRa with MicroPython
As using C/C++ for LoRa has been shown in other projects, this time on the Raspberry Pi Pico, it is not perfect, but it can be done quickly
we are going to choose MicroPython. As the Raspberry Pi Pico is a to get started. The modified files needed can be downloaded from the
well-suited board for education, using MicroPython will make things Elektor GitHub page [12]. Also note that even if seems to be working
even a bit easier. If you are new to MicroPython on the Raspberry software, stability might be an issue that needs to be addressed at
Pi Pico, take a look at Gareth Halfacree and Ben Everard’s book, some point.
Get Started with MicroPython on Raspberry Pi Pico (Raspberry Pi
Foundation, 2021). If you would like to get a paper copy, head over Getting MicroPython on the Raspberry Pi Pico
to the Elektor store [5]. If you would prefer an E-Book, grab a free The Raspberry Pi Pico comes with an included bootloader that makes
English copy at [6]. it easy to swap the running firmware on it. As we are going to use
  MicroPython, we will install the latest version available from [8] as you
Using LoRa and MicroPython has been done on other platforms but can see in Figure 7. Download the UF2 file form the webpage and
introduces some addtional challanges. MicroPython is an interpreted prepare your Raspberry Pi Pico to enter bootloader mode.
language like BASIC was on the C64 or other home computers. While  
this allows easy access, it leads to some CPU overhead during execu- To enter bootloader mode, disconnect the Raspberry Pi Pico, press
tion and thus some limitations. the BOOTSEL button and reconnect it to your computer. It shall now
  a new mass storage device show up, like you see in Figure 8. Drag
The library we are going to use is a slightly modified version of uLora the downloaded UF2 file into this drive, so MicroPython in its current
by fantasticdonkey found on GitHub at [7]. This library itself is a fork version will be installed.

8 July & August 2021 www.elektormagazine.com


 
After a reboot you will be read to go, or at least your Raspberry Pi Pico 915 MHz range. For Europe, it is mainly 868 MHz. It is 915 MHz if you
will be. For development, having an editor or IDE would be beneficial. are in the US. As this project will be developed within the European
The next step is the setup of Thonny as Python IDE. region, it will use the 868 MHz band plan, so if you rebuild it, be sure
to change it to your region. As the uLoRa is patched to be used on
Get Thonny in Place the Raspberry Pi Pico, you need to open and save ulora.py, ttn_eu.py,
Installing the Thonny IDE on a recent Ubuntu 20.04 or even Windows ulora_encryption.py and lora.py to your Raspberry Pi Pico through
takes just a few clicks. For Windows, you can grab an installer at [9]. the Thonny IDE. For the ttn_eu.py, if this one is not applicable to your
For Ubuntu, you can use wget -q -O - https://github.com/thonny/ region, you need to save the corresponding ttn_xx.py to your board.
thonny/releases/download/v3.3.4/thonny-3.3.4.bash to get the installer This will provide the board with the required libraries, and a basic
for version 3.3.4 with support for the Raspberry Pi Pico. After the file example we are going to explain now.
has been downloaded, you can run it with bash thonny-3.3.4.bash. If  
the installation succeeds, you will have the Thonny IDE in version 3.3.4 Inside the lora.py resides the main logic for this project. The program
installed, as you can see in Figure 9. flow is shown in Figure 11. After the initialization, a temperature sensor
  attached to our One-Wire bus is searched for. If none is present, after
After its first start, we need to configure the Raspberry Pi Pico. This is 120 seconds of sleep, a new attempt will be done to find one. If a sensor
done from the menu with Tools  Options and will open the configura- is present, its temperature will be read and afterwards transmitted.
tion dialog like you can see in Figure 10. When the tools and hardware The way the value is encoded is not very efficient in terms of payload
are in place, it’s time for some code. but will be later good for demonstration. Figure 12 shows the trans-
mitted data inside The Things Network console. After a transmission,
Get the Code in Place we need to wait for 900 seconds to comply with the fair use policy of
For LoRa, it is important to know in which region of the world you The Things Network. If you like to start your code automatically on
are. As an ISM Band is used, it may be in the 433 MHz, 868 MHz or your Raspberry Pi Pico, save the lora.py as main.py.
 

Figure 11:
Flowchart
for data
transmission.

Figure 10: Connection setting for the Raspberry Pi Pico.

Figure 12: Received data inside the TTN console.

lektor July & August 2021 9


Figure 13: Create a new application.

Figure 14: Wizard to add a new application.

Figure 15: Add new device.

Figure 16: Wizard to create a new node.

Figure 17: Settings for ABP mode.

10 July & August 2021 www.elektormagazine.com


Figure 18: Settings for name and EUI.

Figure 19: Bandplan settings.

You may notice in the code that a value is written to a file called current. over to the version 3 stack using [10]. After the login to our account,
txt. This one will store the current frame counter we are using for trans- we need to create a new node. To create a new node, we first need to
mission to The Things Network.If we would not save the value, the value setup an application. As Figure 13 shows, you need to click on Create
would be zero again at every restart of the node, e.g. after a battery an application and follow the user dialog shown in Figure 14. Select
change. If the counter would be reset every time the device is rebooted, the owner of this application, in this case your account, and fill in the
the transmitted data would be rejected by The Things Network for Application-ID. A click on Create application will complete the process.
security reasons. After every transmission, the file is updated with the  
current value used and loaded on next restart. This is not ideal and As we have set up a new application, we can add a new node to it.
will shorten the flash lifetime. If we are writing every 15 minutes a new This new node will provide the credentials we need to enter to the
value, this means 96 writes a day, or 35040 writes every year, so this MicroPython script. In your newly created application, select Add end
is far from perfect and needs improvement. device, to start a wizard to create a new node, as seen in Figure 15.
   
The wizard, shown in Figure 16, will ask to select a device. As our
To The Things Network and Back device will not be in the list, you need to choose Manually. As seen in
How to setup a LoRa Node has been discussed in previous articles, but Figure 17, you need to choose Activation by personalization (ABP) and
I still want to share a few words about it. The former article showed The select the LoRaWAN version for our MAC. Here you can choose MAC
Things Network stack in version 2. Recently, version 3 was announced, V1.0.2. Select Start to get to the basic settings like shown in Figure 18.
and in some places, you can already transfer your applications and  
gateways into the new version 3 stack and therefore console. Enter the End device ID, a unique ID for your node. The field End device
  name and End device description are used for your convenience to
To get data transmitted, you need to add a few important parame- later distinguish what nodes you have created. The next page, as seen
ters to the provided MicroPython files. We need to have an account in Figure 19, will require you to select the frequency plan. Set this
at The Things Network to use the communities infrastructure. When according to your region. As the node we are doing just does enough
an account has been created, or you like to create one, you can head LoRaWAN to transmit data, we have no support for Class B or Class C.

lektor July & August 2021 11


Figure 20: Application Key generation.

Figure 21: Device information for the new node.

Figure 22: Basic Node-Red flow for LoRaWAN data.

Figure 23: Server setting for the MQTT node.

Figure 25: User name and password settings.

Figure 24: Server and SSL settings.

12 July & August 2021 www.elektormagazine.com


Select Application layer settings to continue. Generate an Application
session key as shown in Figure 20 and finish with Add end device.
 
A new generated device will show up, like in Figure 21. We need for
our MicroPython script the Device address, NwkSKey and AppSKey.
Those will be placed in the lora.py, where DEVADDR will hold the Device
address, NWKEY will hold NwkSKey and APP the AppSKey. If all data is
entered correctly, transmission will show up in The Things Network.

Grabbing Data with Node-RED


Installing Node-RED on a Raspberry Pi can be done by opening a
terminal or log in via SSH and executing the following command:
 
bash <(curl -sL https://raw.githubusercon-
tent.com/node-red/linux-installers/master/deb/
update-nodejs-and-nodered
 
To let Node-RED run as a service, you also need to enter and execute
the following command after the node-red installation:
 
sudo systemctl enable nodered.service
 
The full installation guide can be found here [11]. To start the service,
run the following command in a terminal: sudo systemctl start Figure 26: Wizard for a new API key.
nodered.service.
 
After Node-RED is set up and running, to get our transmitted data
we need to build a flow like seen in Figure 22. Even if nodes for The
Things Network exist, on a Raspberry Pi you need to use the generic
MQTT connectivity. Using the nodes for The Things Network on an
Raspberry Pi can result in errors and crashes of your dataflow. This
may be due to some compatibility issues with the provided nodes, as
they are running fine on X86-based hardware. Figure 27: BASE64 decoder settings in Node-RED.
 
For the MQTT connector, we are interested in the data that our node
will transmit, called payload. Figure 22 shows the complete Node-RED
flow to grab the data we transmit. The required configuration will start
with the MQTT node. Here we need to supply the server, that will
provide our data, and credentials. Getting the password involves a bit more work. Head over to The
  Things Network console and enter your application. Click the API
Figure 23 shows the Server and Topic that needs to be entered. A keys menu entry on the left and start adding an API key with Add API
topic can be considered as a conversation space on a defined subject. key. A new wizard like in Figure 26 will appear. Choose the required
In this way, only messages in which there is an interest are provided. access rights and finish the dialog with Create API Key. The next step
We use +/devices/+/ up as the topic. This indicates that we are will present a new API key you can use. Be sure to store it somewhere
interested in all messages sent to us by the nodes registered with our safely as you cannot later access it again. This key is the password we
application. As output, we expect a parsed JSON object for further need to use for Node-RED.
processing. In the next step it is necessary to set the preferences for  
the servers of The Things Network. To edit a server setting, click on If all settings are in place, the changes will be applied with Done. If
the pencil button to the right of the server. A new dialog, as shown now you deploy the settings, the MQTT node will establish a connec-
in Figure 24, will show up. As we are running on the new V3 stack, tion and new data will be presented at the node. There is only one
use eu1.cloud.thethings.network and port 8883. Make sure Enable catch to the data we receive. The payload, the data our node sends,
secure (SSL/TLS) connection is checked. Under the security tab, as are encoded with BASE64. To retrieve the raw bytes transmitted, we
shown in Figure 25, you need to enter username and a password. As need to insert a BASE64 decoder that will do the conversation. If
username use the name of the application we created before in The configured like in Figure 27, you can access the data as array of bytes
Things Network console. from following nodes.
 

lektor July & August 2021 13


Figure 29: Data presented as webpage.

Figure 28: Example dataflow in Node-RED.

 
For more convenience, a demo flow like shown in Figure 28 has been DIO0 for minimal operation. Figure 3 shows the schematic to attach
set up and will display new arriving data accessible through a web the RFM95 to the Raspberry Pi Pico. Also note that we have added
browser. Figure 29 shows how the webpage looks at the end. Here two capacitors, 100 nF (C2) and 10µF (C1), next to the RFM95. The
you just need to enter your credentials. capacitors shall supply peak currents if the RFM95 is in transmit or
receive mode, as recommended by the datasheet.
Simple and Beginner Friendly  
While this is not the most complex project you can do, it will allow you Also, you can see R5, a 4.7 kΩ resistor on the reset line. This one is
to start tinkering around the Raspberry Pi Pico and LoRaWAN. Using normally not required, as the RFM95 offers an internal pull-up resis-
MicroPython can be, especially for beginner, a smooth transition into tor. As the module has been used in a few projects, it showed that
the world of embedded systems. The time required to build and run an external pull-up avoids undesired resets that otherwise happen
this project makes it suitable for (virtual) classrooms and teaching. from time to time without it. Something not used by the MicroPython
But there was a PCB promised at the beginning. If you are just into software but may be later by C/C++ libraries are DIO0, DIO1, DIO2
software, you can stop reading. If you like not only using electronics and DIO3. While DIO0 is required for general operation on most LoRa
but also building them, the next part is for you. libraries, the other DIO ones provide optional features. These features
can be used with other librarys.
A Word of Warning  
Usually, if we present schematics and PCBs in Elektor, they have been For the DS18B20, shown in Figure 3, we actively power the VCC pin.
built and tested (at least to the extent that they will not catch fire or kill One-Wire allows for passive powering by just using the data pin and
cute kittens). With this PCB and schematics things are different. The ground (parasitic power). These non-genuine ones behave strangely
PCB and therefore the schematic is a work in progress. While it should when not actively powered via VCC. Therefore, all three pins, including
work, it is not tested, so be aware that there may be some bugs left. VCC, are connected in case one of these fake sensors is accidentally
Also, with this schematic, you can download all KiCad files from the installed. So be careful: if you accidently buy nongenuine DS18B20
Elektor page or the Elektor GitHub repository [12] to modify or change sensors, the performance might suffer, or powering it with just the
it to your own needs. If you seen some design faults or stupid design data pin is not working at all. For One-Wire we need a 4.7 kΩ pull-up
choices (and we do not mean something like using a Raspberry Pi resistor on the data line.
Pico), please feel free to give us your suggestions. This is not limited  
to faults. If you missed something that you would like to have included, The Raspberry Pi Pico is a module, so you do not have to connect
feel free to suggest your changes. As I already mentioned, this is a many components. Something that is different are the V_BUS and
work in progress. Your feedback is welcome. V_SYS labels attached to pin 40 and 39. These will be used to attach
a rechargeable battery to the build and will bring us to part two of
Schematic: Part 1 the schematic.
The schematics are divided into two parts, even if all components are
on one KiCad sheet. The first part is just connectivity for the RFM95, our Schematic: Part 2
LoRa transceiver, and a DS18B20 temperature sensor to the Raspberry The second part of the schematic, shown in Figure 30, contains the
Pi Pico. For the RFM95, we need an SPI connection, consisting of section for a rechargeable battery. This consists of an MCP73871-
MISO, MOSI, SCK and nCS. In addition, we need to add RESET and 1CC lithium charger with power path. Thus, if we supply power to its

14 July & August 2021 www.elektormagazine.com


V_BUS_Int
V_SYS_Int
V_BUS V_SYS

GND
R18 R21
J4


1 2 3

R20
0Ω
R9 R13
5 4 3 2 1 10 9 8 7

120k

470k
PROG2

OUT

OUT
OUT
SEL

IN
IN
THERM

VPCC
6 20 11 6
/PG OUT IN OUT
R4 R3 7 19 12 IC2 5
STAST2 IC1 IN IN OUT
8 18 13 4
100k

10k

STAT1_/LBO IN R10 IN TPS25940 OUT


9 17 14 3
/TE MCP73871 CE R15 EN PGTH

27k2
10 16 15 2
VSS
PROG3
VBAT_SENSE 1k OVP PGOOD TP3
PROG1
D3 D1 D2 16 1
GND DEVSLP

VBAT
VBAT
C4
VSS

IMON
dVdT

/FLT
ILIM
11 12 13 14 15 1 8 100n
VM GND
2 7 17 18 19 20
VM IC3 GND
3 6
R8 R6 R7 R19 R2 R1 VM VDD R16 R17 R12 R14
4
VM
XB8089D GND
5 C3
100k

33k2

220k
47k

10k
470Ω

470Ω

470Ω

1k

EP_(GND)
1n5

J2
2 1
Figure 30: Battery charger and protection. TP1 TP2 210047-029

Figure 31: First rendering


of the routed PCB. Figure 32: Preview on the layout done.

input, it will pass this to its output, and not use the battery at all. If the for the DC/DC converter, on the Raspberry Pi Pico. We use R17 with
external power is disconnected or insufficient, an automatic switch 47 kΩ to limit the current at 1.89 A, as this is the maximum the lithium
to the battery will happen. The charger is currently set up to charge charger will be able to supply. Why it is a bad idea to use a polyfuse?
batteries with 1000 mA. Read the Elektor article [13]. Using a diode would introduce at least
  0.3 V drop across it, meaning we are converting energy into heat.
To protect the attached battery an XB8089D, already used in the  
GreatScott! DIY LiPo Supercharger Kit [14], is included. This will prevent Something not often seen in PCBs are R20, R21 and R18. Those are
over-charge, over-discharge, over-current and reverse polarity. The 0 Ω resistors that will allow you to disconnect parts of the battery
last element is a Texas Instruments TPS25940 eFuse. This one acts charger. If some parts need closer investigation or don’t work at all,
as ideal diode, preventing a current flow back to the lithium battery they can be separated and bypassed without breaking traces on the
charger. It will serve as an over-current and over-discharge protection PCB. Just the removal of some SMD components would be sufficient.
element. Overvoltage und undervoltage are determined by R9, R10
and R16. The datasheet provides the required formulas to calculate A Quick Placement on a PCB
the desired values. We use 120 kΩ for R9, 27.2 kΩ for R10 and 33.2 kΩ As the schematic is done, all parts have been placed on a PCB and
for R16 to get 5.37 V for over voltage lockout and 2.957 V for under- are routed. It is not looking nice for now, but for a first try, it will server
voltage lockout. This should be in the safe range, for the battery and the purpose. Figure 31 shows the first rendering. Figure 32 gives an

lektor July & August 2021 15


related products

> Raspberry Pi Pico Microcontroller-Board


www.elektor.com/raspberry-pi-pico-microcontroller-board  
> Breadboard (830 Tie Points)
www.elektor.com/breadboard-830-tie-points  
impression how the routing looks. You can also see that the PCB is
designed in a way that the charging part can be completely removed > Mini Breadboards & Jumper Wires
and used for other purposes as well. If it does not work, you can also www.elektor.com/mini-breadboards-jumper-wires  
remove it from the PCB. It is like two for one. > SeeedStudio RFM95 Ultra-long LoRa Transceiver
Module (868 MHz)
What Is Next? www.elektor.com/rfm95-lora  
The next steps that will follow depend on feedback from our readers, > KiCad Like a Pro (2nd Edition)
meaning you. If you like this project and want us to continue, add www.elektor.com/kicad-like-a-pro  
components or have suggestions on how to improve it, feel free to > Dragino LPS8 Indoor LoRaWAN Gateway
leave a comment or send us a message. Also, if you have suggestions www.elektor.com/dragino-lps8-indoor-lorawan-gateway  
for different parts, we are interested. You can also leave use a message > Dragino PG1301 LoRaWAN GPS Concentrator for
about other potentially interesting projects. Raspberry Pi (868 MHz)
www.elektor.com/dragino-pg1301  
Final Thoughts > Programming with Node-RED (E-book)
Using MicroPython on the Raspberry Pi Pico and working on a www.elektor.com/programming-with-node-red-e-book
LoRaWAN project is fairly straightforward and can be fun even for a
beginner. But the software stability can be an issue. For more reliable
setups, going the C/C++ way is preferred. If the MicroPython scripts
work, it is a fast and convenient way to get started. What you measure
and transmit is up to you, and the used code is simple enough to try Contributors
with kids. Why only transmitting temperature information? You may Design and Text: Mathias Claußen
do a LoRaWAN alert system with some PIR detectors. Or you can Editor: Jens Nickel
monitor if your plants need water. Let your creativity be your limit. Layout: Harmen Heida
 
While this is the first project involving the Raspberry Pi Pico, it will not
be the last. We are preparing some more, but note that they might Questions or Comments
not be completely finished. Nevertheless, we hope they will inspire Do you have any technical questions or comments about his article?
you for your own projects or give you some background that may be Email the author at [email protected] or contact Elektor
useful in the future. at [email protected].
210047-01

WEB LINKS
[1] My First LoRaWAN: www.elektormagazine.com/magazine/elektor-141/57159
[2] Project files on GitHub: https://github.com/ElektorLabs/210047-LoRa-with-the-Raspberry-Pi-Pico
[3] Dragino LPS8 Indoor LoRaWAN Gateway: www.elektor.com/dragino-lps8-indoor-lorawan-gateway
Dragino PG1301 LoRaWAN GPS Concentrator for Raspberry Pi: www.elektor.com/dragino-pg1301
[4] 
Get Started with MicroPython on Raspberry Pi Pico:
[5] 
www.elektor.com/get-started-with-micropython-on-raspberry-pi-pico
Free Get Started with MicroPython on Raspberry Pi Pico PDF (EN):
[6] 
https://hackspace.raspberrypi.org/books/micropython-pico/pdf/download
[7] GitHub repository of uLoRa: https://github.com/fantasticdonkey/uLoRa
[8] Raspberry Pi Pico MicroPython: www.raspberrypi.org/documentation/pico/getting-started/
[9] Thonny IDE download: https://thonny.org/
[10] The Things Network v3 Stack: https://eu1.cloud.thethings.network/console/
[11] Node-RED installation instructions: https://nodered.org/docs/getting-started/raspberrypi
[12] Elektor GitHub: https://github.com/ElektorLabs
[13] DIY LiPo Supercharger Bundle: www.elektormagazine.de/articles/diy-lipo-supercharger-bundle
[14] GreatScott! DIY LiPo Supercharger Kit: www.elektormagazine.com/191188-B-01
[15] RFM95 BOB Gerberfiles: https://github.com/ElektorLabs/191069-RFM95-BOB/

16 July & August 2021 www.elektormagazine.com

You might also like