This project example describes a basic hardware setup that allows a LoRa based wireless peer-2-peer (device-2-device) communication on a proprietary protocol. It is used to validate the hardware setup, PSoC 6 MCU and external radio module.
Each device consists of a PSoC 6 MCU pioneer kit (CY8CKIT-062-BLE) and an Arduino Shield (Dragino LoRa) with mounted LoRa radio module (RFM95W).
Figure 1 shows both PSoC 6 MCU pioneer kits with mounted Dragino LoRa shield. One kit has running a transmitter software, the other one has been configured as receiver.
Figure 1: PSoC 6 MCU with LoRa Shield - System setup (Transmitter and Receiver)
The radio module is interfaced by SPI. Further one external interrupt is used to indicate radio events. The project has been realized by PSoC Creator, see Figure 2, having the components configured accordingly. Additionally, an UART and LED has been configured for HMI and debug channel.
Figure 2: PSoC Creator project using SPI and ExtInterrupt for interfacing the radio module
After programming the dedicated TX and RX project to the PSoC 6 MCU Pioneer kit the system is ready. The transmitter will send a packet that is been shown and additionally answered by the receiver with a reply packet.
The debug output of the transmitter (here: COM13) and receiver (here: COM24) is shown in Figure 3 and Figure 4. Each sent package (“Hello World #”), having a sequential number added, is received and output via the receiver UART. The HEX values as well as the ASCII characters are printed out. The receiver confirms the receptions by sending himself a reply (“And hello back to you”) that finally is showing up in the transmitter’s (now working for short while as receiver) debug window.
Figure 3: Debug output of transmitter (COM13)
Figure 4: Debug output of receiver (COM24)
After the initial test worked fine to bridge approx. 10cm (see Figure 1) using LoRa communication the transmitter has then been put into the basement while the receiver was running in 4th floor (opposite site of department) – it still was working without packets getting lost. Awesome!
The LoRa communication has been established successfully by the given setup.
This project should be taken as a very basic proof-of-concept, allowing to validate mainly the hardware required for LoRa communication that is needed for future LoRaWAN projects.
It does not claim to cover all LoRa aspects, especially related to distance range or low power considerations. Those investigations must be done within one of the next steps.
The appendix below gives details on the hard- and software used for the described system.
Within this section detailed information is given to reproduce the system described above.
The following hardware is needed:
- 2 pcs PSoC 6 CY8CKIT-062-BLE Pioneer Kit
- 2 pcs Dragino LoRa Shields incl. RFM95W radio module
This shield is well documented and has its own website (Wiki-page) where all project details are listed: https://wiki.dragino.com/index.php
To use the shield on the PSoC 6 MCU Pioneer kit the following jumper settings are required:
Jumper setting to be used for CY8CKIT-062 and Dragino LoRa (Picture source: https://wiki.dragino.com)
The shield uses a radio module RFM95W manufactured by HopeRF, based on Semtech SX1276.
Do not forget to mount the antenna and add the Dragino LoRa shield carefully to the PSoC 6 MCU pioneer kit, as shown in Figure 5.
Figure 5: CY8CKIT-062-BLE with Dragino LoRa Shield and included RFM95W radio module
The complete software project is attached to this project. Nevertheless, newer versions of the used library may exist. The following section describes the used compilation:
- PSoC Creator v4.2 (www.cypress.com)
The following software library modules are required
- RH_RF95.cpp/.h -> ported to RH_RF95PSoC6.c /.h
- RHSPIDriver.cpp/.h -> ported to RHSPIDriverPSoC6.c / .h
Most modifications have been required for the RHSPIDriver in order to adapt to the PSoC 6 MCU UART peripheral using the PDL API.
Further modifications are caused by the Arduino naming conventions that needed to be changed for standard-‘C’.
The main project has been ported from the Arduino based project found here: https://learn.adafruit.com/adafruit-rfm69hcw-and-rfm96-rfm95-rfm98-lora-packet-padio-breakouts/rfm9x-test#basic-rx-and-tx-example
The completely ported software project is attached to this memo.
Next step to enter a network... Coming soon. Stay tuned!
Software: Cypress PSoC Creator