An repository containing some example code written for the Raspberry Pi Pico; also contains ping pong
Go to file
2024-03-30 17:31:28 +00:00
lib Added needed libraries 2024-03-16 14:20:42 +01:00
led_test.py Added led_test.py and copyright notices 2024-03-16 14:47:33 +01:00
LICENSE Initial commit 2024-03-12 06:16:28 +00:00
lora_pingpong.py Fixed blinking too early in lora_pingpong.py 2024-03-30 17:31:28 +00:00
lora_receiver.py Added led_test.py and copyright notices 2024-03-16 14:47:33 +01:00
lora_sender.py Added led_test.py and copyright notices 2024-03-16 14:47:33 +01:00
main_-lcd.py Included the led_test into the two main.py 2024-03-16 14:50:31 +01:00
main_+lcd.py Included the led_test into the two main.py 2024-03-16 14:50:31 +01:00
README.md Added more links to README.md 2024-03-17 15:31:40 +00:00

LoRa-Training

An repository containing some example code written for the Raspberry Pi Pico; also contains ping pong

Requirements

To re-run this tests, you need at least two LoRa transceivers with the chip SX127x (e.g. SX1278) connected to two different Raspberry Pi Picos. Also - for improved "usability", attach two buttons, two leds (red for send and green for receive) and an LCD to the microcontrollers. The matching pins are for ...

... the LoRa transceiver:

Device Pin on device Pin on Pico
LoRa VCC 36 (V3V)
LoRa GND 3 (GND)
LoRa MISO 6 (GPIO 4)
LoRa MOSI 5 (GPIO 3)
LoRa SCLK 4 (GPIO 2)
LoRa NSS 7 (GPIO 5)
LoRa DIO0 9 (GPIO 6)

... further components (optional):

Device Pin on device Pin on Pico
LCD1 SDA 1 (GPIO 0)
LCD1 SCL 2 (GPIO 1)
LCD1 VCC 40 (VBUS2)
LCD1 GND 3 (GND)
BTN1 Pin 1 36 (V3V)
BTN1 Pin 2 10 (GPIO 7)
BTN2 Pin 2 11 (GPIO 8)
BTN2 Pin 1 36 (V3V)
LED green + 31 (GPIO 26)
LED green - 33 (GND)
LED red + 32 (GPIO 27)
LED red - 33 (GND)

1 with PCM5102 I2C port multiplexer

2 works only if the pico's connected over USB

Installation

To get the tests to run, start by uploading all the content of this repo on the two (ideally empty) Pi Picos with MicroPython installed on. To do this, use e.g. Thonny.

Also make sure you have at least added the LoRa transceiver module, otherwise nothing will work.

Now, depending on whether the lcd and buttons are installed or not (always buttons AND lcd, only one of these won't work), open the main_+lcd.py for running with lcd screen and main_-lcd.py else. Save the opened one as main.py, so that this script (the main.py) is run at startup (when you connect power). Don't worry - you will still be able to access the data on the pico just by interrupting the execution using e.g. Thonny. The LEDs will always turn on and off - if there are none connected, there's just no light. No way to disable that easily (you'd have to refactor all the files as LED pins are hardcoded sometimes :).

By default, the main_-lcd.py file will execute an ping-pong program as the responder. As a responder, it waits for the first message and short after receiving it, sends the response including info e.g. about the signal quality. To change this behaviour, change the variable to_run right in this file.

When running the main_+lcd.py file, you are able to choose whether to run as a ping-pong responder, initializer, just simple sender, etc. from the list by navigating with the two buttons (this is done with the ProgramChooser library).

Lastly, thanks to all the people sharing their code, e.g. the driver for the SX127x chip series ported for MicroPython on the Pico. Here are some links:


License

The scripts contained here are licensed under the GNU GPLv3-or-later. A copy of this license can be found in the LICENSE file