|
1 | | -RadioHead Packet Radio library for embedded microprocessors |
2 | | -=========================================================== |
3 | | - |
| 1 | +RadioHead Packet Radio library for embedded microprocessors |
| 2 | +=========================================================== |
| 3 | + |
4 | 4 | ###Version 1.67 |
5 | 5 |
|
6 | | -This is a copy 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. |
7 | | - |
8 | | -Please read the full documentation and licensing from the original author [site][3], here it's just a copy to keep in sync my custom featured [version][1] with this [original version][4]. |
| 6 | +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. |
| 7 | + |
| 8 | +**Please read the full documentation and licensing from the original author [site][3]** |
| 9 | + |
| 10 | +### features added with this fork |
| 11 | +================================= |
| 12 | + |
| 13 | +**Compatible with boards** |
| 14 | + |
| 15 | +[LoRasPI][10], [Raspberry PI Lora Gateway][12], [Dragino Lora GPS HAT][13] |
| 16 | + |
| 17 | +<img src="https://raw.githubusercontent.com/hallard/LoRasPI/master/images/LoRasPI-on-Pi.jpg" height="25%" width="25%" alt="LoRasPI"> |
| 18 | +<img src="https://raw.githubusercontent.com/hallard/RPI-Lora-Gateway/master/images/RPI-Lora-Gateway-mounted.jpg" height="25%" width="25%" alt="Raspberry PI Lora Gateway/Node"> |
| 19 | +<img src="http://wiki.dragino.com/images/d/d6/Lora_GPS_HAT.png" height="25%" width="25%" alt="Raspberry PI Lora Gateway/Node"> |
| 20 | + |
| 21 | +- Added moteino modem setting on RF69 to be compatible with lowpowerlab RF69 configuration library |
| 22 | +- Added possibility to work with no IRQ connected for RF69 and RF95 |
| 23 | + - for example to get one more GPIO free |
| 24 | + - on Raspberry Pi, we do not have `attachInterrupt()` like with bcm2835 library |
| 25 | +- Added samples for multiples Raspberry Pi boards with RF69 and RF95 modules such as |
| 26 | + - [LoRasPI][10], simple RFM9x or RFM69HCW shield |
| 27 | + - [iC880A or Linklabs Raspberry PI shield][11] with RFM9x or RFM69HCW onboard |
| 28 | + - [Raspberry PI Lora Gateway][12] with multiple RFM9x or RFM69HCW shield |
| 29 | + - [Dragino Lora shield][13] |
| 30 | + - Sample code are in [rf95][21], [rf69][20], [nrf24][22] and [multi_server][23], note that old sample NRF24 sample has been moved to nrf24 folder for consistency. |
| 31 | +- Added 2 samples test tools (for Raspberry PI) do detect RF69 and RF95 modules and check IRQ rising edge |
| 32 | + - [spi_scan][9] sample code, scan and try to detect connected modules |
| 33 | + - [irq_test][8] sample code, check a rising edge on a GPIO |
| 34 | + |
| 35 | +Sample code for Raspberry PI is located under [RadioHead/examples/raspi][7] folder. |
| 36 | + |
| 37 | +### Installation on Raspberry PI |
| 38 | +================================ |
| 39 | + |
| 40 | +Clone repository |
| 41 | +```shell |
| 42 | +git clone https://github.com/hallard/RadioHead |
| 43 | +``` |
| 44 | + |
| 45 | +**Connection and pins definition** |
| 46 | + |
| 47 | +Boards pins (Chip Select, IRQ line, Reset and LED) definition are set in the new [RadioHead/examples/raspi/RasPiBoards.h][24] file. In your code, you need to define board used and then, include the file definition like this |
| 48 | +```cpp |
| 49 | +// LoRasPi board |
| 50 | +#define BOARD_LORASPI |
| 51 | + |
| 52 | +// Now we include RasPi_Boards.h so this will expose defined |
| 53 | +// constants with CS/IRQ/RESET/on board LED pins definition |
| 54 | +#include "../RasPiBoards.h" |
| 55 | + |
| 56 | +// Your code start here |
| 57 | +#ifdef RF_RST_PIN |
| 58 | +// Blah blah do reset line |
| 59 | +#endif |
| 60 | + |
| 61 | +``` |
| 62 | + |
| 63 | +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][25] sample code. |
| 64 | + |
| 65 | +So you have 3 options to define the pins you want |
| 66 | + |
| 67 | +- The board you have is already defined so just need to define it your source code (as explained above) |
| 68 | +- You can add your board into [RasPiBoards.h][24] and then define it your source code as above |
| 69 | +- You can manually define pins in your code and remove the board definition and `#include "../RasPiBoards.h"` |
| 70 | + |
| 71 | +To go further with examples : |
| 72 | + |
| 73 | +go to example folder here spi_scan |
| 74 | +```shell |
| 75 | +cd RadioHead/examples/raspi/spi_scan |
| 76 | +``` |
| 77 | +Build executable |
| 78 | +```shell |
| 79 | +root@pi03(rw):~/RadioHead/examples/raspi/spi_scan# make |
| 80 | +g++ -DRASPBERRY_PI -DBCM2835_NO_DELAY_COMPATIBILITY -c -I../../.. spi_scan.c |
| 81 | +g++ spi_scan.o -lbcm2835 -o spi_scan |
| 82 | +root@pi03(rw):~/RadioHead/examples/raspi/spi_scan |
| 83 | +``` |
| 84 | +And run |
| 85 | +```shell |
| 86 | +root@pi03(rw):~/RadioHead/examples/raspi/spi_scan# ./spi_scan |
| 87 | +Checking register(0x42) with CS=GPIO06 => Nothing! |
| 88 | +Checking register(0x10) with CS=GPIO06 => Nothing! |
| 89 | +Checking register(0x42) with CS=GPIO08 => SX1276 RF95/96 (V=0x12) |
| 90 | +Checking register(0x10) with CS=GPIO08 => Nothing! |
| 91 | +Checking register(0x42) with CS=GPIO07 => Nothing! |
| 92 | +Checking register(0x10) with CS=GPIO07 => Nothing! |
| 93 | +Checking register(0x42) with CS=GPIO26 => Nothing! |
| 94 | +Checking register(0x10) with CS=GPIO26 => Nothing! |
| 95 | +``` |
| 96 | +And voila! with [LoRasPi][10] board RFM95 dedected on SPI with GPIO8 (CE0) |
| 97 | + |
9 | 98 |
|
10 | | -**If you want to know what features have been added for my custom needs, please see my [repo version README][1]** |
11 | | - |
12 | | -[1]: https://github.com/hallard/RadioHead |
13 | | -[2]: https://hallard.me |
14 | | -[3]: http://www.airspayce.com/mikem/arduino/RadioHead/ |
| 99 | +If I'm doing same test with [PI Lora Gateway][12] with 2 RFM95 (one 433MHz and one 868MHz) and one RFMHW69 433MHz on board like this |
| 100 | + |
| 101 | +<img src="https://raw.githubusercontent.com/hallard/RPI-Lora-Gateway/master/images/RPI-Lora-Gateway-mounted.jpg" height="40%" width="40%" alt="Raspberry PI Lora Gateway/Node"> |
| 102 | + |
| 103 | +Here are the results when trying to detect the onboard modules: |
| 104 | + |
| 105 | +```shell |
| 106 | +root@pi01(rw):~/RadioHead/examples/raspi/spi_scan# ./spi_scan |
| 107 | +Checking register(0x42) with CS=GPIO06 => Nothing! |
| 108 | +Checking register(0x10) with CS=GPIO06 => Nothing! |
| 109 | +Checking register(0x42) with CS=GPIO08 => SX1276 RF95/96 (V=0x12) |
| 110 | +Checking register(0x10) with CS=GPIO08 => Nothing! |
| 111 | +Checking register(0x42) with CS=GPIO07 => SX1276 RF95/96 (V=0x12) |
| 112 | +Checking register(0x10) with CS=GPIO07 => Nothing! |
| 113 | +Checking register(0x42) with CS=GPIO26 => Unknown (V=0x01) |
| 114 | +Checking register(0x10) with CS=GPIO26 => SX1231 RFM69 (V=0x24) |
| 115 | +``` |
| 116 | + |
| 117 | +Voila! 3 modules are seen, now let's try listenning packets with PI Lora [Gateway][12]. |
| 118 | + |
| 119 | +My setup has another Raspberry Pi with RFM95 868MHZ [LoRasPI][10] shield running [`rf95_client`][25] sample and some [ULPnode][6] 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. |
| 120 | + |
| 121 | +Here the results starting from scratch |
| 122 | + |
| 123 | +**Client side** |
| 124 | + |
| 125 | +<img src="https://raw.githubusercontent.com/hallard/RadioHead/master/examples/raspi/pictures/rf95_client.png" alt="RF95 client"> |
| 126 | + |
| 127 | +**multi server side** |
| 128 | + |
| 129 | +<img src="https://raw.githubusercontent.com/hallard/RadioHead/master/examples/raspi/pictures/multi_server.png" alt="RF95 client"> |
| 130 | + |
| 131 | +It works! |
| 132 | + |
| 133 | +### Difference with original Author repo |
| 134 | +======================================== |
| 135 | + |
| 136 | +Due to easier maintenance to keep in sync with original author lib, I've got 2 repo: |
| 137 | + |
| 138 | +- My master one (this one) https://github.com/hallard/RadioHead that is the one you need if you want to use my projects or lib added features. |
| 139 | +- The one above has been forked to https://github.com/ch2i/RadioHead where I put the original version released by the author. |
| 140 | + |
| 141 | +Like this, I can do Pull Request from [ch2i][4] to [hallard][1] to add new features added by the author to my version. This mean that this [one][4] 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. |
| 142 | + |
| 143 | +[1]: https://github.com/hallard/RadioHead |
| 144 | +[2]: https://hallard.me |
| 145 | +[3]: http://www.airspayce.com/mikem/arduino/RadioHead/ |
15 | 146 | [4]: http://www.airspayce.com/mikem/arduino/RadioHead/RadioHead-1.67.zip |
| 147 | +[5]: https://github.com/ch2i/RadioHead |
| 148 | +[6]: http://hallard.me/category/ulpnode/ |
| 149 | +[7]: https://github.com/hallard/RadioHead/tree/master/examples/raspi |
| 150 | +[8]: https://github.com/hallard/RadioHead/tree/master/examples/raspi/irq_test |
| 151 | +[9]: https://github.com/hallard/RadioHead/tree/master/examples/raspi/spi_scan |
| 152 | + |
| 153 | +[10]: https://github.com/hallard/LoRasPI |
| 154 | +[11]: https://github.com/ch2i/iC880A-Raspberry-PI |
| 155 | +[12]: https://github.com/hallard/RPI-Lora-Gateway |
| 156 | +[13]: https://github.com/dragino/Lora |
| 157 | + |
| 158 | +[20]: https://github.com/hallard/RadioHead/tree/master/examples/raspi/rf69 |
| 159 | +[21]: https://github.com/hallard/RadioHead/tree/master/examples/raspi/rf95 |
| 160 | +[22]: https://github.com/hallard/RadioHead/tree/master/examples/raspi/nrf24 |
| 161 | +[23]: https://github.com/hallard/RadioHead/tree/master/examples/raspi/multi_server |
| 162 | +[24]: https://github.com/hallard/RadioHead/tree/master/examples/raspi/RasPiBoards.h |
| 163 | +[25]: https://github.com/hallard/RadioHead/tree/master/examples/raspi/rf95/rf95_client.cpp |
| 164 | + |
| 165 | + |
0 commit comments