From 1133b4f9d9bd26d341a118b092b4782cdc32aa94 Mon Sep 17 00:00:00 2001 From: BlueFox Date: Sun, 17 Mar 2024 15:25:50 +0000 Subject: [PATCH] Did the ToDo in README.md, added instructions and pinout, etc. , added License notice to README.md --- README.md | 77 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 76 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 29ccf76..86e1f31 100644 --- a/README.md +++ b/README.md @@ -3,4 +3,79 @@ An repository containing some example code written for the Raspberry Pi Pico; also contains ping pong -TODO: Add useful instructions on how to use this, what things need to be connected and where, and how to run things. \ No newline at end of file +## 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](https://micropython.org/download/?vendor=Raspberry%20Pi)** installed on. To do this, use e.g. **[Thonny](https://thonny.org/)**. + +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](https://git.privacynerd.de/BlueFox/ProgramChooser)**). + + +## Credits and useful links + +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: + +- [The driver library used in this tests](https://github.com/lemariva/uPyLoRaWAN/) +- [Tutorial introducing main steps to get the SX127x board to run](https://www.electroniclinic.com/raspberry-pi-pico-w-with-lora-sx1278-for-sensor-monitoring/) +- [Website providing some pinout and info](https://wei1234c.blogspot.com/2017/08/sx127x-lora-transceiver-driver-for.html) +- [More pinout and stuff :)](https://www.electroschematics.com/rf-radio-frequency/) +- [Interesting article for building general LoRa knowledge](https://circuitdigest.com/microcontroller-projects/arduino-lora-sx1278-interfacing-tutorial) + + +## License + +The scripts contained here are licensed under the GNU GPLv3-or-later. A copy of this license can be found in the [LICENSE](LICENSE) file \ No newline at end of file