Skip to content

RadioHead Packet Radio library for embedded microprocessors

License

Notifications You must be signed in to change notification settings

hallard/RadioHead

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

68 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RadioHead Packet Radio library for embedded microprocessors

###Version 1.67

This is a fork of the original RadioHead Packet Radio library for embedded microprocessors. It provides a complete object-oriented library for sending and receiving packetized messages via a variety of common data radios and other transports on a range of embedded microprocessors.

Please read the full documentation and licensing from the original author site

features added with this fork

=================================

Compatible with boards

LoRasPI, Raspberry PI Lora Gateway, Dragino Lora GPS HAT

LoRasPI  Raspberry PI Lora Gateway/Node  Raspberry PI Lora Gateway/Node

  • Added moteino modem setting on RF69 to be compatible with lowpowerlab RF69 configuration library
  • Added possibility to work with no IRQ connected for RF69 and RF95
    • for example to get one more GPIO free
    • on Raspberry Pi, we do not have attachInterrupt() like with bcm2835 library
  • Added samples for multiples Raspberry Pi boards with RF69 and RF95 modules such as
  • Added 2 samples test tools (for Raspberry PI) do detect RF69 and RF95 modules and check IRQ rising edge
    • spi_scan sample code, scan and try to detect connected modules
    • irq_test sample code, check a rising edge on a GPIO

Sample code for Raspberry PI is located under RadioHead/examples/raspi folder.

Installation on Raspberry PI

================================

Clone repository

git clone https://github.com/hallard/RadioHead

To avoid system hangs/instability starting with kernel 4.14, disable all GPIO kernel interrupts by adding this line to your /boot/config.txt:

dtoverlay=gpio-no-irq

This works around an issue with the design of the bcm2835 library and how it handles rising/falling edge detection events, but has some downsides as well. For more information, see this issue and this discussion.

Connection and pins definition

Boards pins (Chip Select, IRQ line, Reset and LED) definition are set in the new RadioHead/examples/raspi/RasPiBoards.h file. In your code, you need to define board used and then, include the file definition like this

// LoRasPi board 
#define BOARD_LORASPI

// Now we include RasPi_Boards.h so this will expose defined 
// constants with CS/IRQ/RESET/on board LED pins definition
#include "../RasPiBoards.h"

// Your code start here
#ifdef RF_RST_PIN
// Blah blah do reset line
#endif

Then in your code you'll have exposed RF_CS_PIN, RF_IRQ_PIN, RF_RST_PIN and RF_LED_PIN and you'll be able to do some #ifdef RF_LED_LIN for example. See rf95_client sample code.

So you have 3 options to define the pins you want

  • The board you have is already defined so just need to define it your source code (as explained above)
  • You can add your board into RasPiBoards.h and then define it your source code as above
  • You can manually define pins in your code and remove the board definition and #include "../RasPiBoards.h"

To go further with examples :

go to example folder here spi_scan

cd RadioHead/examples/raspi/spi_scan

Build executable

root@pi03(rw):~/RadioHead/examples/raspi/spi_scan# make
g++ -DRASPBERRY_PI -DBCM2835_NO_DELAY_COMPATIBILITY -c -I../../.. spi_scan.c
g++ spi_scan.o -lbcm2835  -o spi_scan
root@pi03(rw):~/RadioHead/examples/raspi/spi_scan

And run

root@pi03(rw):~/RadioHead/examples/raspi/spi_scan# ./spi_scan
Checking register(0x42) with CS=GPIO06 => Nothing!
Checking register(0x10) with CS=GPIO06 => Nothing!
Checking register(0x42) with CS=GPIO08 => SX1276 RF95/96 (V=0x12)
Checking register(0x10) with CS=GPIO08 => Nothing!
Checking register(0x42) with CS=GPIO07 => Nothing!
Checking register(0x10) with CS=GPIO07 => Nothing!
Checking register(0x42) with CS=GPIO26 => Nothing!
Checking register(0x10) with CS=GPIO26 => Nothing!

And voila! with LoRasPi board RFM95 dedected on SPI with GPIO8 (CE0)

If I'm doing same test with PI Lora Gateway with 2 RFM95 (one 433MHz and one 868MHz) and one RFMHW69 433MHz on board like this

Raspberry PI Lora Gateway/Node

Here are the results when trying to detect the onboard modules:

root@pi01(rw):~/RadioHead/examples/raspi/spi_scan# ./spi_scan
Checking register(0x42) with CS=GPIO06 => Nothing!
Checking register(0x10) with CS=GPIO06 => Nothing!
Checking register(0x42) with CS=GPIO08 => SX1276 RF95/96 (V=0x12)
Checking register(0x10) with CS=GPIO08 => Nothing!
Checking register(0x42) with CS=GPIO07 => SX1276 RF95/96 (V=0x12)
Checking register(0x10) with CS=GPIO07 => Nothing!
Checking register(0x42) with CS=GPIO26 => Unknown (V=0x01)
Checking register(0x10) with CS=GPIO26 => SX1231 RFM69 (V=0x24)

Voila! 3 modules are seen, now let's try listenning packets with PI Lora Gateway.

My setup has another Raspberry Pi with RFM95 868MHZ LoRasPI shield running rf95_client sample and some ULPnode prototypes always running with on board RFM69 configured as Group ID 69 on 433MHz. I don't have a Lora 433MHz sender running so we won't receive anything on this one.

Here the results starting from scratch

Client side

RF95 client

multi server side

RF95 client

It works!

Difference with original Author repo

========================================

Due to easier maintenance to keep in sync with original author lib, I've got 2 repo:

Like this, I can do Pull Request from ch2i to hallard to add new features added by the author to my version. This mean that this one is just a github copy version of the latest original done by Mike, I don't do any change on this one. I know it's not the best way, but I didn't found a better solution for now, if you have better idea, just let me know.

About

RadioHead Packet Radio library for embedded microprocessors

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages