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
Hello @RWB sorry the delay in sharing the radiohead files that Iam using with photon.
here is the link with the files https://www.4shared.com/zip/uF6KmdiUei/RadioHead_Photon_tested_-.html
Connections:
Photon RFM96
D2----------->DIO0
A2----------->NSS
A3----------->SCK
A4----------->MISO
A5----------->MOSI
GND--------->GND
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.
@RWB
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.
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.
I’m going to see if I can get the Reliable Datagram to work now at longer distances without issues.
I downloaded the Mesh code you posted so I can try that also.
For the Mesh code would the Client be the Web Connected Photon who is the end receiver of all the messages coming in from the Server’s 1,2,3 that are Meshed together to get the message back to the main Client radio?
Did you hook up the RFM96 exactly like you have mentioned above and get it working with the code you posted?
I’m asking because I tried this last night but the code is not working completely and I think it may be because the DIO1 should be DIO0 because that is the interrupt pin that the Rocket Scream Pro & Adafruit 32u4 + RFM95/96 modules work off of to notify the uC when a new message arrives.
Also in the code you added nothing to tell the Photon what pin you are using for the SPI Chip Select or the interrupt pin as shown in the screen shot below:
I figured if we do this like Adarfruit & Rocket Scream Pro then we also need to tell it what the CS & Interrupt pin were using on the Photon. I figured that would be these settings.
I just did a test using the example rf95_reliable_datagram, just to make sure what it work.
on photon put the client… and on arduino or moteino the server… it work perfect…
//PHOTON
/ this the client running on photon
#include <RHReliableDatagram.h>
#include <RH_RF95.h>
//#include <SPI.h>
#define CLIENT_ADDRESS 1
#define SERVER_ADDRESS 2
// Singleton instance of the radio driver
RH_RF95 driver; //(A2,D2)-->you don't nee set this
//RH_RF95 rf95(5, 2); // Rocket Scream Mini Ultra Pro with the RFM95W
// Class to manage message delivery and receipt, using the driver declared above
RHReliableDatagram manager(driver, CLIENT_ADDRESS);
// Need this on Arduino Zero with SerialUSB port (eg RocketScream Mini Ultra Pro)
//#define Serial SerialUSB
void setup()
{
delay(4000);
Serial.begin(9600);
while (!Serial) ; // Wait for serial port to be available
if (!manager.init())
Serial.println("init failed");
driver.setTxPower(10, false);
driver.setFrequency(915.0); // hay que setear frecuencia para los rfm96 915
Serial.println("..this is the Photon as CLient");
}
uint8_t data[] = "Hello World!";
// Dont put this on the stack:
uint8_t buf[RH_RF95_MAX_MESSAGE_LEN];
void loop()
{
Serial.println("Sending to rf95_reliable_datagram_server");
// Send a message to manager_server
if (manager.sendtoWait(data, sizeof(data), SERVER_ADDRESS))
{
// Now wait for a reply from the server
uint8_t len = sizeof(buf);
uint8_t from;
if (manager.recvfromAckTimeout(buf, &len, 2000, &from))
{
Serial.print("got reply from : 0x");
Serial.print(from, HEX);
Serial.print(": ");
Serial.println((char*)buf);
}
else
{
Serial.println("No reply, is rf95_reliable_datagram_server running?");
}
}
else
Serial.println("sendtoWait failed");
delay(500);
}
Arduino or moteino +RFM96
#include <RHReliableDatagram.h>
#include <RH_RF95.h>
#include <SPI.h>
#define CLIENT_ADDRESS 1
#define SERVER_ADDRESS 2
// Singleton instance of the radio driver
RH_RF95 driver;
//RH_RF95 driver(5, 2); // Rocket Scream Mini Ultra Pro with the RFM95W
// Class to manage message delivery and receipt, using the driver declared above
RHReliableDatagram manager(driver, SERVER_ADDRESS);
void setup()
{
Serial.begin(9600);
while (!Serial) ; // Wait for serial port to be available
if (!manager.init())
Serial.println("init failed");
driver.setTxPower(10, false);
driver.setFrequency(915.0);
Serial.println("..this is the Moteino or arduino as server +RFM96 @915mhz");
}
uint8_t data[] = "And hello back to you";
// Dont put this on the stack:
uint8_t buf[RH_RF95_MAX_MESSAGE_LEN];
void loop()
{
if (manager.available())
{
// Wait for a message addressed to us from the client
uint8_t len = sizeof(buf);
uint8_t from;
if (manager.recvfromAck(buf, &len, &from))
{
Serial.print("got request from : 0x");
Serial.print(from, HEX);
Serial.print(": ");
Serial.println((char*)buf);
// Send a reply back to the originator client
if (!manager.sendtoWait(data, sizeof(data), from))
Serial.println("sendtoWait failed");
}
}
}