Hello, I am making some experiment to work with FANET+ network. I would like to publish wind data from a Photon connected anemometer to the FANET network (is a LoRa application for paragliding devices).
I have two devices working on this network (they are talking togheter) and I would like to add a custom Photon with RFM95W transceiver.
This is the FANET specification:
868.2Mhz
Syncword 0xF1
250kHz Bandwidth
Spreading Factor 7
ExplicitHeader: Coding Rate CR 5-8/8 (depending on #neighbors), CRC for Payload
This my code, it compile, it runs (no error on RF95 init) but I can’t see any raw data.
// This #include statement was automatically added by the Particle IDE.
#include <RH_RF95.h>
#include <SPI.h>
#define RFM95_RST 1
#define RFM95_CS 6
#define RFM95_INT 2
#define SERIAL_DEBUG
// Singleton instance of the radio driver
RH_RF95 rf95(RFM95_CS, RFM95_INT);
#define LED 7
SYSTEM_THREAD(ENABLED);
void setup()
{
delay(5000);
pinMode(LED, OUTPUT);
pinMode(RFM95_RST, OUTPUT);
digitalWrite(RFM95_RST, HIGH);
Serial.begin(115200);
while (!Serial) {
delay(1);
}
delay(100);
Serial.println("Feather LoRa RX Test!");
// manual reset
digitalWrite(RFM95_RST, LOW);
delay(10);
digitalWrite(RFM95_RST, HIGH);
delay(10);
while (!rf95.init()) {
Serial.println("LoRa radio init failed");
Serial.println("Uncomment '#define SERIAL_DEBUG' in RH_RF95.cpp for detailed debug info");
while (1);
}
Serial.println("LoRa radio init OK!");
// Defaults after init are 434.0MHz, modulation GFSK_Rb250Fd250, +13dbM
if (!rf95.setFrequency(RF95_FREQ)) {
Serial.println("setFrequency failed");
while (1);
}
Serial.print("Set Freq to: "); Serial.println(RF95_FREQ);
rf95.setSignalBandwidth(250E3);
rf95.setSpreadingFactor(7);
rf95.setCodingRate4(8);
rf95.setPreambleLength(12);
rf95.setPayloadCRC(1);
// The default transmitter power is 13dBm, using PA_BOOST.
// If you are using RFM95/96/97/98 modules which uses the PA_BOOST transmitter pin, then
// you can set transmitter powers from 5 to 23 dBm:
rf95.setTxPower(23, false);
}
void loop()
{
if (rf95.available())
{
// Should be a message for us now
uint8_t buf[RH_RF95_MAX_MESSAGE_LEN];
uint8_t len = sizeof(buf);
if (rf95.recv(buf, &len))
{
digitalWrite(LED, HIGH);
RH_RF95::printBuffer("Received: ", buf, len);
Serial.print("Got: ");
Serial.println((char*)buf);
Serial.print("RSSI: ");
Serial.println(rf95.lastRssi(), DEC);
// Send a reply
uint8_t data[] = "And hello back to you";
rf95.send(data, sizeof(data));
rf95.waitPacketSent();
Serial.println("Sent a reply");
digitalWrite(LED, LOW);
}
else
{
Serial.println("Receive failed");
}
}
}
Where I am wrong? How can I deal with it?