Particle Photon / Electron + RFN95W Long Range Radio


in your application rf95-server.ino you have to get rid of the spi.h --> //#include <SPI.h>
the wring diagram you can use this as reference

I see your RadioHead.h file is not exactly like mine, maybe your is not the latest version.


@luisgcu OK, I got the library to compile after a few tweaks.

First, on the RadioHead.h file I had to change lines 916 and 918 instead lines 859 & 861. See below:

I had to delete these 2 files from the scr folder because they were referencing a RF24 folder that I did not import or need to import because I’m not using RF24 radios so this threw a compile error.

Now I can successfully compile the RF95_server example .ino

Now I just need to figure out how to properly connect the RF95 chip to the Photon :slight_smile:


Thanks for the wiring diagram! That’s perfect.

I’ll have to order up a few RF95 breakout boards and give it a go!

I noticed in the to of the RF95_server example that you need to add the digital line numbers that you use to connect to the NSS & DIO0 pins on the RF95 chip.

For instance on the Rocket Scream Breakout, they use digital pin 5 and 2 for pins NSS & DIO0.

The schematic for the RF95 chip on the RocketScream board is here:

For the Adafruit Board they using digital pins 8 and 3:

The RF95 board schematic for the Adafruit M0 board is here:

So you just need to change those pin numbers to whatever digital pins you use on the Photon or Electron when wiring up your RF95 chip to it.

Did you have the RF95 connected to a Photon with successful communication?


@RWB & @luisgcu, the easiest way to set up a new project in Dev is via the dedicated button.
This will provide you with the correct file structure and create a file which adds a new layer of convenience in regards of importing and using libraries.
To add dependencies (for libs) without the need to actually download the sources of already published libraries, just use the library manager


we definitely need to play more with this platform.


FYI for anyone using an RFM95 on the non default SPI config eg. SPI1

I have managed to get the radiohead library to compile by simply replacing all SPI with SPI1 in the RHHardwareSPI.cpp file. I have only just started testing this but so the it appears initialize the device correctly.

I also didn’t seem to need to include the atomic.h or half of the other source files? The compiler never asked for most of them so I assume that they are dependencies for other platforms

Hopefully someone with more experience will be able to do a better port job than this in the future though! :joy:

Farm Irrigation System
Electron, nRF24L01 and Pro Mini

@dalymople That does not surprise me that you got it to compile without all the extra files for the other radios.

Can you provide a screenshot of the file structure for the code your using so we can get an idea of what exactly you did?

I’m only interested in using the RF95 modules so there is no need for all the other files really.


@RWB sure thing. Here is the directory, I am testing the RHReliableDatagram and the RHMesh managers so I have both of them included here.

The includes in the .ino are;

and initializing the driver and manager (this is just the reliable data-gram manager);


@dalymople Thanks for posting that!

So the only thing left is to replace SPI with SPI1 in the RHHardwareSPI.cpp file based on your first post.

Are you going to or have you already tested this with RF95 modules yet?


@RWB I am in the process of physically testing a few modules. I’ll reply when I have finished testing them…


I had a terrible range with 2 RF95 modules using the reliable datagram sample code. Not sure why but I couldn’t get two units to communicate more than a few meters apart successfully.

The standard client / Server library code worked great at up to 1 mile away in the suburbs.


@RWB are you sure to set the correct frequency for the RFM95?/ by default the library set the frequency at 433MHZ, you should have to change that to 915.
if (!manager.init())
Serial.println(“init failed”);
// Defaults after init are 434.0MHz, 13dBm, Bw = 125 kHz, Cr = 4/5, Sf = 128chips/symbol, CRC on
driver.setFrequency(915.0); //
// you can set transmitter powers from 5 to 23 dBm:
driver.setTxPower(5, false);
with 5dbm you can get hundreds meters of range


Yes I had all those settings correct. I tested on the Arduino platform.

Have not had the free time or need to test this on the Particle devices but it does look like the Radio Head library works now on Particle?

Have you tested the radio head library with the Photon yet?


@RWB yes i did a test a moth ago and it work perfect… I will try later to share you one entire project folder

Electron, nRF24L01 and Pro Mini


I would like to see your code and pin to pin hookup diagram.


Hello @RWB sorry the delay in sharing the radiohead files that Iam using with photon.
here is the link with the files
Photon RFM96
3V3---------->3.3V IN

I have report from a friend that tested the RFM96 (433MHZ) and get the incredible range of 60km, he learned about the Hope-RF transceiver because of me… now he is in love with LORA, he is been doing very cool stuff…he was able to send data and encoded audio(voice) using LORA… he is not using the radio-head library… he created his own configuration for the RFM95, 96.


Sending audio over Lora sounds interesting. Provide a link to that if you can.

Thank you very much for providing your working library and wiring guide for the RFM96 modules!

It’s nice to confirm the RFM95/96 LORA modules work directly with the Particle Devices now!

In your code did you tweak any of the RFM95 settings to get better performance at longer distances? Or did you leave it at the default settings?


basically what I did is add several combination of spreading factors vs bandwidth . have a look at RH_RF95.cpp line 120-136 and RH_RF95.h line 579-597. what called my attention if that you mention that you barely get a few meter distance range… and the library without any modification allow you to communicate with devices several hundred meters apart each other.


Good to know. I never came across any info online that gave any idea on how to change these settings or which ones to pick.

So which one do you recommend based on your testing for the following two scenarios?

1 - Longest Range + Short Sensor Data Burst?

2 - Shorter Ranges + Higher Data Rates?

I do see the 2 default settings in the original library now. I never tried the 2nd longer range option because I didn’t know it was an option.

Do you normally set the TX power to 23 for the RFM95 modules running 915mhz?

And have you tested this function any?

I figured it would be useful if you had multiple radios transmitting on the same channel if it actually worked.


this is for very long range but it take 1.5 seconds to send just two double ( Latitude + longitude)

setModemConfig(Bw125Cr48Sf4096); // Bw = 125kHz, Cr = 4/8, Sf12 = 4096 chips/symbol,CRC on Slow+long range

setModemConfig(BW125CR46SF9); // BW = 125 Khz, Cr = 4/6, SF9 = 512 chips/symbol this faster that the previous.

setModemConfig(Bw125Cr45Sf128); // 2: Bw = 125kHz, Cr = 4/5, Sf7 = 128 chips/symbo and this one even faster: ( short data burst)

when testing at home I set power at 5dbm is ok … with 5 dbm and good line of sight one easy get a mile range… I used 23 dbm a few times to test the range … believe or not i do all this just to have fun and learn… I don’t have any of those test currently working in something usefully.
You can use one SDR radio to actually graph the radio signals LINK

i was able to use radio head library (inlcude RHMesh) having 2 moteinos with RFM96 sending data to photon.

#include <RHMesh.h>
#include <RH_RF95.h>

char publishString[100];

RH_RF95 driver;//(10,2);  //moteino mega

RHMesh manager(driver, CLIENT_ADDRESS);

Photon LoRaWAN node?