Go Down

Topic: nodemcu and rfm69HW-S2 (Read 616 times) previous topic - next topic

LOOIIS

Hello everyone,
I would like to use my nodemcu with the modul rfm69HW-S2.
I found for example to library:
https://github.com/LowPowerLab/RFM69
https://github.com/bbx10/nanohab

Someone know how I have to connect the pins from the rfm69 to my nodemcu with the mentioned library? Unfortunately, I did not find anything on the internet :smiley-sad:

For example in this library I found this code but I don' t know how I have connect the pins from the modul to the nodemcu because I don' t understand for example what does mean "RFM69_IRQ".
Code: [Select]
#elif defined(ESP8266)
// ESP8266
#define RFM69_CS      15  // GPIO15/HCS/D8
#define RFM69_IRQ     4   // GPIO04/D2
#define RFM69_IRQN    digitalPinToInterrupt(RFM69_IRQ)
#define RFM69_RST     2   // GPIO02/D4
#define LED           0   // GPIO00/D3, onboard blinky for Adafruit Huzzah
#else
#define RFM69_CS      10
#define RFM69_IRQ     2
#define RFM69_IRQN    digitalPinToInterrupt(RFM69_IRQ)
#define RFM69_RST     9
#define LED           13  // onboard blinky
#endif



Thank you in advance for your answers.

wvmarle

A quick google search gave this suggestion.

It's basically SPI plus some extras.
Quality of answers is related to the quality of questions. Good questions will get good answers. Useless answers are a sign of a poor question.

LOOIIS

Thank you for your answer.
I had found this link but I don't understand which library they are using and how I have to modify the defines or where I have to insert the defines....
When I use this library and I haven't conect the rfm69 modul the nodemcu just restart (wdt reset).... :smiley-confuse:
Someone have experience witch nodemcu and rfm69 or know I link where I can find a good instruction?

Thank you in advance for your answers.

wvmarle

The module works fine for me using the RadioHead library and an ESP12 module (the same as used on the NodeMCU).

A wdt reset means your code blocks too long somewhere, somehow.
Quality of answers is related to the quality of questions. Good questions will get good answers. Useless answers are a sign of a poor question.

LOOIIS

#4
Jun 29, 2019, 01:00 pm Last Edit: Jun 29, 2019, 02:17 pm by LOOIIS
Do you use this library?

wvmarle

Yes, exactly.
Love it.
Makes it so easy to use the same code on vastly different radios! (RFM69, RFM95 and HC-12, for example, become interchangeable).
Quality of answers is related to the quality of questions. Good questions will get good answers. Useless answers are a sign of a poor question.

LOOIIS

#6
Jun 29, 2019, 07:05 pm Last Edit: Jun 30, 2019, 10:40 am by LOOIIS
Thank you for the answer :smiley-wink:
So I try to use it 8)

LOOIIS

#7
Jul 04, 2019, 03:19 pm Last Edit: Jul 06, 2019, 02:26 pm by LOOIIS
Hello,
I try to use for my nodemcu an the rfm69 868 S2 this code but in the outputs a get unfortunately no output. I use this library.
The modul work with a other library.
Someone know where is the error?
Thanks a lot!

Code: [Select]
#include <Arduino.h>

//http://www.airspayce.com/mikem/arduino/RadioHead/classRH__RF69.html

// rf69_client.pde
// -*- mode: C++ -*-
// Example sketch showing how to create a simple messageing client
// with the RH_RF69 class. RH_RF69 class does not provide for addressing or
// reliability, so you should only use RH_RF69  if you do not need the higher
// level messaging abilities.
// It is designed to work with the other example rf69_server.
// Demonstrates the use of AES encryption, setting the frequency and modem
// configuration
// Tested on Moteino with RFM69 http://lowpowerlab.com/moteino/
// Tested on miniWireless with RFM69 www.anarduino.com/miniwireless
// Tested on Teensy 3.1 with RF69 on PJRC breakout board

#include <SPI.h>
#include <RH_RF69.h>


// Singleton instance of the radio driver
//RH_RF69 rf69;

RH_RF69 rf69(15, 0);    //Nodemcu ESP8266 http://www.airspayce.com/mikem/arduino/RadioHead/classRH__RF69.html

//RH_RF69 rf69(15, 16); // For RF69 on PJRC breakout board with Teensy 3.1
//RH_RF69 rf69(4, 2); // For MoteinoMEGA https://lowpowerlab.com/shop/moteinomega
//RH_RF69 rf69(8, 7); // Adafruit Feather 32u4

void setup()
{
  Serial.begin(115200);
  while (!Serial)
    ;
  if (!rf69.init())
    Serial.println("init failed");
  // Defaults after init are 434.0MHz, modulation GFSK_Rb250Fd250, +13dbM (for low power module)
  // No encryption
  if (!rf69.setFrequency(868.0))
    Serial.println("setFrequency failed");
  // If you are using a high power RF69 eg RFM69HW, you *must* set a Tx power with the
  // ishighpowermodule flag set like this:
  //rf69.setTxPower(14, true);
  // The encryption key has to be the same as the one in the server
  uint8_t key[] = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
                    0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08};
  rf69.setEncryptionKey(key);
}
void loop()
{
  Serial.println("Sending to rf69_server");
  // Send a message to rf69_server
  uint8_t data[] = "Hello World!";
  rf69.send(data, sizeof(data));
  
  rf69.waitPacketSent();
  // Now wait for a reply
  uint8_t buf[RH_RF69_MAX_MESSAGE_LEN];
  uint8_t len = sizeof(buf);
  if (rf69.waitAvailableTimeout(500))
  {
    // Should be a reply message for us now  
    if (rf69.recv(buf, &len))
    {
      Serial.print("got reply: ");
      Serial.println((char*)buf);
    }
    else
    {
      Serial.println("recv failed");
    }
  }
  else
  {
    Serial.println("No reply, is rf69_server running?");
  }
  delay(400);
}


I connected like this:
ESP8266      RFM69W
GND-----------GND   (ground in)
VIN-----------3.3V  (3.3V in)
interrupt D0 pin GPIO0-----------DIO0  (interrupt request out)
SS pin GPIO15----------NSS   (chip select in)
SCK SPI pin GPIO14----------SCK   (SPI clock in)
MOSI SPI pin GPIO13----------MOSI  (SPI Data in)
MISO SPI pin GPIO12----------MISO  (SPI Data out)

LOOIIS

#8
Jul 06, 2019, 02:32 pm Last Edit: Jul 06, 2019, 05:16 pm by LOOIIS
I detect that sometime the skatch after the upload work but after a reset (press button rst) the sketch doesn' t continue. Sometime when i press again the button it works.
The same skatch on my arduino nano with
Code: [Select]
RH_RF69 rf69;
// Slave Select is pin 15, interrupt is Pin 0
//RH_RF69 rf69(15, 0);       //Nodemcu ESP8266 http://www.airspayce.com/mikem/arduino/RadioHead/classRH__RF69.html

work fine.
Can somebody help my? :smiley-confuse:
Thanks in advance! :smiley-wink:

wvmarle

If you have weird problems with an ESP8266 the first place to look at very hard is your power supply.
Quality of answers is related to the quality of questions. Good questions will get good answers. Useless answers are a sign of a poor question.

LOOIIS

#10
Jul 06, 2019, 07:41 pm Last Edit: Jul 06, 2019, 08:13 pm by LOOIIS
Thanks for your answer.
To begin I believe the same but:
-My arduino nano is connected with a display (1,8") and the rf69 and works.
-My nodemcu is connected (on my pc or a power supply (5V,2A)) only with the rf69 and I have the problems. for example sometimes the skatch dont' start... :smiley-mad:  :smiley-sad-blue:

LOOIIS

#11
Jul 06, 2019, 08:14 pm Last Edit: Jul 06, 2019, 08:25 pm by LOOIIS
When I use the pin 4 instead of the pin 0 it works without problems!!!
Code: [Select]
// Slave Select is pin 15, interrupt is Pin 4
RH_RF69 rf69(15, 4);       //Nodemcu ESP8266 http://www.airspayce.com/mikem/arduino/RadioHead/classRH__RF69.html


Can someone explain me the reason? :o I found this for example:
"Using these pins (GPIO0, GPIO2 and GPIO15) as inputs is a bit tricky. As noted above on power up, and during reset, these pins must be pulled up or down as required to have the ESP8266 module start up in normal running mode."

In this link they write to use the pin 15 and 0.

wvmarle

NodeMCU pin D4 is GPIO2 which is indeed involved in the boot process.
NodeMCU pin D0 is GPIO16 which does not have an interrupt available.

More info on the ESP8266.
Quality of answers is related to the quality of questions. Good questions will get good answers. Useless answers are a sign of a poor question.

LOOIIS

Thanks for your answer.
I use the GPIO 15 (D8) and GPIO 4 (D2).
D8 is a Outputpin (Slave select) and D2 is a Inputpin (Interrupt).

Rob_Muller

if you wired like this
GND-----------GND   (ground in)
VIN-----------3.3V  (3.3V in)

you may have fried your radio. VIN on a nodeMCU is 5V!!


you should have used the pin marked 3V
Regards,

Rob

Go Up