Dec 052016
 

It’s been quite a while since I last posted anything here but I finally started an interesting project using the new LoRa long range wireless communication protocol.

I had recently received two LoRa based Kickstarter projects, one being the Sodaq One LoRa/GPS tracker which is using the Microchip RN2483 LoRa transceiver and the Pycom LoPy which is based on the Espressif ESP32 and uses a Semtech SX1272 LoRa transceiver. As I had trouble establishing communications between the two different chipsets I also got the Dragino LoRa/GPS hat which uses the same SX1272 as the LoPy.

To get the Dragino hat to fully work I had to do some hardware modifications. First I added a cable to feed 5V to the centre pin of the external GPS antenna connector to use an active antenna. Then I had to add a solder bridge between pins 22 and 24 as explained here. Next up I connected D1 from the LoRa transceiver to PIN16 and D2 to PIN18 as explained here.

This is the final setup on my Raspberry Pi3:

lora_hat_gps

Picture 2 of 3

I started out with the instructions and software found here but I didn’t have a DS18B20 temperature sensor to hand. I modified the software somewhat to either send 3 bytes or to listen and print the received bytes. I uploaded the sources to github. In subdirectory “simple” you can find the sender and receiver. Run make to build the software and sudo ./lora_sender or sudo ./lora_receiver to launch. The RadioHead library used in this code adds a 4byte header to the lora packet. This can be changed in RH_RF95.h and for receiving this can be set to 0 but it seems when sending it is necessary. The header by default is 0xff 0xff 0x00 0x00 and when receiving the first byte received needs to be 0xff or you don’t see it.

As for the LoPy I have also uploaded the lopy_sender.py and lopy_receiver.py files to the same folder. Both sides either listen to LoRa P2P messages on 868.1Mhz and print anything they receive in hex or they send 0x7 0xi 0xab (with i continuously incrementing from 0 to 255) every 5 seconds. The LoPy is adding the 4 byte header 0xff 0xff 0x00 0x00 when sending and it will be visible in the console output when receiving.

 Posted by at 22:48

Leave a Reply