How to make RFM69 work on Photon? [SOLVED - new library RFM69-Particle]


@RWB Is this Photon to Photon or how are you using the RFM96? To my frustration I discovered today with RFM69 difference between Arduino and Photon. For desk testing in Arduino if I don’t specify a transmit power level it works 100%, but for Photon if transmit power level is unspecified packets are only received 0% - 50% of the time when 3-6 feet apart.

I’ve not dug deeper into the ported library but I suspect in Arduino there’s a register or base default value that gets set, and in the Photon it isn’t set or set to the lowest possible value. Sorry, can’t help more with UDP vs reliable.

EDIT: RFM69 does offer options on acknowledgement, retries, encryption and error checking if that helps.


My range testing was done with these modules.

With unreliable communication, I can get the receiver to acknowledge receipt of the message up to 1 mile away. Using the Reliable Datagram code I can’t get more than 10 feet away. It’s the same with this module also:

Here is an article they have on range testing the RFM69 you have:


Thanks @RWB that was good reading.

I came across this and wondered if the same may resolve your issue of reliable datagram not getting over 10 feet. This is for RFM95 instead of RFM96.

"Found the fix. I had set the power incorrectly based on the module I had. Here’s what was needed:
driver.setTxPower(20); "


Thanks for the info.

I made the changes but I still get the 10 feet range before dropping out.

The guy in the link you provided seems to have figured it out so at least I know who to contact when I want to try this again.


@bloukingfisher Somebody got the RadioHead library to work with the Particle DEV.


I have tested both modules RFM95 and RFM 96 and in not perfect line of sight and the range is 5-8km at 20dbm, at 5dbm I got a decent range of 1.5km.
I did some modification to spreading factors(SF) and bandwidth on the RFM95 library.
see the links and sample codes.!!!/!!/


@luisgcu I have seen your range test before and they are impressive ranges! I’ve seen 1 mile range with simple copper wire antennas on the RF95 915 Mhz models.

I see these as an easy way to add remote sensors up to 1-3 miles away from Web-connected Photons or Electrons


Thanks for putting in all the work to get the photon with Rfm69 chip.
I decided I would try to revisit this. I am hopefully going to get the photon to receive info. via the rfm69 chip so the photon can relay mqtt info to my openhab setup.
I am still having trouble getting your example on the the particle IDE to work consistently.
I have tried photon to photon with the RFM69HCW chips.
I got a few seconds of transmission and then it stopped. Nothing has worked since?
I copied the the examples rx and tx verbatim.
Have you used this set up for MQTT at all?
Any pointers?


You’re welcome @Webzter30

I’ve not set it up with MQTT. OK, so sounds like you’re on the right path if you successfully transmitted for a few seconds. What happens after a few seconds. Is the TX unit still showing incrementing transmissions or is it stuck? If the TX unit is still transmitting, is it just that the RX unit stopped receiving?

Before you test again, or after each of the below efforts completely unplug your Photon/RFM board from power. In my experience the RFM board can get stuck in a transmit state and only a power down will reset it.

How are you powering the Photons? Have you tried a capacitor on the RFM69HCW board? What is the power level you are transmitting at (defined in the setup section)?

I’m fairly sure you are seeing an issue related with power…not IDE or code specifically. You may see in the example code this little comment reference: “Note at 20dBm the radio sources up to 130 mA!”. I’m not sure the Photon is capable of delivering that, and even if you power it directly from the right voltage source something like a battery setup probably can’t deliver 130 mA or can’t deliver that level for very long which is probably the issue you are experiencing. Here is what I would try:

  1. See what happens if you dial down radio.setPowerLevel(X); where X is 0, or 5 or 7…something low. On the CW chip I find I can dial it up to 17-23 at the most before running into problems when battery powered. I’m assuming at this point you have both Photons in same room proximity - at least a couple of feet from each other but say no more than 15 feet?

  2. Since you transmitted for a few seconds, first try in the TX example to increase the delay after send from 2000 to say 5000 or 10000. That should be enough time for capacitors and power to settle down and get ready for another burst.

  3. Set the registry to transmit at a lower speed (line 107 in the example code “radio.writeReg(0x03,0x0D); //set bit rate to 9k6”. The comment above it provides a link on where to get info on setting this. In fact, maybe you even want to test increasing the bit rate - transmit more data in less time before you run into power issues?)

  4. If you’ve exhausted the above code efforts…hardware. Add capacitors to the radio, check antennas (you have used antennas right? Transmitting without an antenna I believe can ruin your chip). Try another power source. If you have, try the non-H version of RFM69CW. Basically between the code dial down power use, and on the hardware side beef up power supply until you get it to work reliably. From there you can step by step tune it up until you run into failures.

I’d love to hear if you come right, and how you solve it.


I tried all the above suggestions.
Thanks for your quick reply.
Is the example code in the particle web IDE for TX and RX the exact same that you used to get this to work?
If so, shouldn’t it work as long as I follow the pin out you listed in the example, and hook each photon to the RFM69HCW? Did you change anything in your set up?
Thanks so much for your help with this.


All I get back is “…” on the RX side.
I am using putty linked to each com port for the TX and the RX photon for debugging set at baud 115200.
Is this what you use to see the output of each photon?


Not sure if you got my last message?


Yes, the example is the exact same I used. Only difference is I used HCW (and CW) on TX side, but only CW on RX side (in code didn’t have HCW set to true). I only had one HCW version.

If you get the “…” on the RX side it is listening but not receiving any data. When it receives you’ll get something along the lines of: “…[2] ABC [RX_RSSI: 56] - ACK sent…[2] ABCD etc.”

Just checking your board is set to the right frequency, e.g. 433 or 915? (#define FREQUENCY RF69_915MHZ)
And you’re using the hello-photon-rx-rfm69 example on the RX side, and the hello-photon-tx-rfm69 on the TX side? (Sorry, I’m sure you have all of this covered just trying to think of every possible angle.)

I’d prefer to keep everything Particle based but in a situation like yours I’d take a step back to linking up the RFM69 board to an Arduino where you know a larger community have confirmed the code. Start by just switching out the TX side to an Arduino (the example is based off the same example so the network ID, encryption key etc. is all the same). See if the RX then receives data. If still not, switch out the RX side to an Arduino to confirm your hardware setup/antenna/power/distance is all in order.

BTW, what does the TX side show in your serial monitor? Does it show that it is transmitting the data, but not getting an ack?


I know this is an old thread, but I tried using your examples with a photon and an rfm69hcw as a reciever and a moteino with a rfm69hcw and I can’t get them to communicate for the life of me. Just getting dots on the Photon side. I’ve tried power settings from 0 to 30 with no difference. Any pointers on how to try an troubleshoot this? What should I be looking for? I used the same pin connections you show in the photon code.


No problem, makes sense to keep it in the same thread - at least for me.

I’ve used it with a Moteino too and worked fine. Do you have 2 Photons or 2 Moteinos? I always personally like to start with 2 of the same systems to make sure your wiring/coding works and you have RX/TX between same systems - then switch inter system.

That aside, are you SURE the networkID, nodeID and receiveID is set correctly on the Moteino? And you are using the same encryption key on both sides (I think “sampleEncryptKey”)? And you’ve set #define IS_RFM69HCW true? And obviously your frequency is set at the same? And for the Photon RFM board you are using an antenna and the right length if it is just wire (since the Moteino probably has a PCB antenna or came with an antenna depending on the version you’re using)?
Finally, is the Moteino broadcasting the same data as the Photon TX example? (May not make a difference but I haven’t re-looked the code).

EDIT: And the Moteino is set to the same bit rate too?
radio.writeReg(0x03,0x0D); //set bit rade to 9k6


I think I used the previous code sample for the arduino pro mini which I see does not set the data rate. That might be my issue as I’m using the moteino to send to the photon, so that’s why it’s not getting there because it doesn’t know what speed to send it at. I also noticed in the photon code above that there is not a similar statement, should I add the same statement in the photon code?


Please make sure you are using my Arduino code (post 18) and not @mhaider8 's code from the post above it (his didn’t work and thus I provided my working code). I’m not sure if he changed anything in the Photon code but to be safe please make sure you use the sample code in the library to guarantee compatibility.
I do see the bitrates in both codes though, check carefully in the setup function.


Ah ok, I’m sure that’s the problem. I’ll try this tonight. Thanks for responding.

As a side note, do you know if anyone has gotten the photon/rfm69 combo to work with RadioHead? I was able to get the code for the reliabledataserver to compile but the photon just blows up, I don’t even get anything to come out of the serial port when I flash it. Must be something in the library that it doesn’t like, but I followed to a T the other thread where they were using the rfm96 radios instead. What is the main advantage of using RadioHead?


I’m not familiar enough but I think the reliable datagram is what some users like. But, for my part, the RFM69 library provides auto acknowledgements and retransmissions (and ability to automatically adjust the power level down which is attractive if your project is battery powered).

I’ve started using RadioHead for a CC1101 project and thus far have not encountered advantages but I’m not using reliable datagram so that may make a difference.


Yeah, I think it may be more trouble than it’s worth, especially if I can’t get it working…lol.