Using SparkFun's RFM69HCW and Bi-Directional Logic Level Converter with Teensy 3.2

Status
Not open for further replies.
O_O That is indeed a major bummer :(
I was going t say that you could drill the holes yourself with a precise drill-press, but I noticed that some of the via's aren't drilled either, which makes it quite infeasible :( Are they going to remake that panel and sent it out to everyone involved in it?
 
Yes, I contacted Erik and he promptly replied and offered a refund - or to have it rebuilt on tomorrow's panel. Since I wasn't going to have time to touch it for some weeks - waiting for the fixed version won't hurt me as much as him correcting and reshipping whatever else was affected.

I meant to ask if anyone else is seeing progress with this RFM## family and Teensy?
 
Sorry to see that with those boards. I had a similar issue with one of the last boards I had done by OSHPark.
Bad-drills.jpg

Which they also were great and did a refund. Thought I would mention that I also just ordered a set of the above boards from Eric to see how they compare to the OSHPark boards. They were a bit cheaper (4 for $30) than OSHPark (3 for $37)

I did have the Sparkfun RFM69HCW breakout boards talking to each other using Teensy. Actually might get back to that soon as sort-of waiting to figure out what to test on T3.6 beta...

So I might start working on my Well Pumps monitoring stuff. Right now trying to decide if to go Teensy route (currently don't have any LoRa versions of the modules), or to go with the Feather M0 with LoRa (https://www.adafruit.com/products/3178), which I do have two of... But I like working with Teensy!
 
Last edited:
Yep - Don't want to hijack here.

But price of Feather M0 with LoRa $40. Adafruits LoRa by itself $30, so you get the processor for an extra $10. Did not see any at Sparkfun, which is why I picked up their standard RFM69HCW breakout. Also looked up at Pesky Products (https://www.tindie.com/stores/onehorse/) and did not see any. Maybe I need to order the adapters and either order from Ebay or for a bit more from Amazon ($15), both of which I believe ship from China. Also in the end for this project, may do my own board... Anyway may talk more about it up on the my Well System thread.

However still monitoring this thread to see the resolution.
 
Hello, it's been a while since I've posted anything on this topic. Here's what's happened on my end:

- Purchased one Moteino-USB
- Downloaded the latest Low Power Lab libraries
- Testing with two Low Power Lab sketches

Result this far:
- The Moteino sends messages with no problem.
- The Teensy/RFM69HCW receives the Moteino's message with no problem. LEDs are blinking happily on both.
- Unfortunately, the Teensy/RFM69HCW does not seem to be acknowledging the Moteino's acknowledgement request, nor will it transmit other messages to the Moteino.

More head scratching to do. Will report back when I have more progress....
 
Bugye60:

It would be interesting to see what sketch you are using to try this out.

Note: Right now I am playing with RFM95s, both with Teensy as well as the Teensy Feather M0 boards and also hacking on the RADIOHEAD library. Yesterday I talked about it on the thread: https://forum.pjrc.com/threads/3583...-multiple-buss?p=111616&viewfull=1#post111616

One thing I found is if I use the Simple sketches, that do the simple:
Code:
 rf95.send(data, sizeof(data));
Which do the broadcast no retry, not guarantee of delivery, I am seeing the same results you are mentioning. The one board (Feather) sends the messages, the other board (Teensy or Feather), receives and displays the message, and respond. The respond message appears to complete as the RFM board signals back to the processor it is done with the write, but the message is not received at the other end...

However if instead I use the Reliable Data-gram versions of these programs, where the send messages look more like:
Code:
manager.sendtoWait(data, sizeof(data), SERVER_ADDRESS))

I am getting proper communications going both directions.

Still investigating, maybe there are some subtle differences in the program sets like maybe I did not properly set both frequency settings or maybe the setTXPower is wrong...
 
Quick update: On the rfs95.send issue, I think there is some form of timing problem.

That is if I change the Side running on the Teensy (or the feather that receives the message from the other one and then responds) and add a short delay between when it receives the message and when it responds it starts working.

That is my loop now looks like:
Code:
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("request: ", buf, len);
      Serial.print("got request: ");
      Serial.println((char*)buf);
      Serial.print("RSSI: ");
      Serial.println(rf95.lastRssi(), DEC);
      
      // Send a reply
      uint8_t data[] = "And hello back to you";
      delay(5);
      bool sent = rf95.send(data, sizeof(data));
      Serial.print("Send reply ");
      Serial.println((int)sent, DEC);
      rf95.waitPacketSent();
      Serial.println("Sent a reply");
//       digitalWrite(led, LOW);
    }
    else
    {
      Serial.println("recv failed");
    }
  }
}
Again this is for the 95s, but you might try the same on the 69s... Note: On the feather version it worked with delay(2);
Did not work on Teensy at 2, so I tried 5 and it worked. But might have worked at 3 or 4 as well.
 
Which do the broadcast no retry, not guarantee of delivery, I am seeing the same results you are mentioning. The one board (Feather) sends the messages, the other board (Teensy or Feather), receives and displays the message, and respond. The respond message appears to complete as the RFM board signals back to the processor it is done with the write, but the message is not received at the other end...

I'm not sure if this is your issue, but one problem that's been noticed several times with the Feather radio boards is that the receiver sends the acknowledgement message too quickly, before the transmitter has a chance to change back from transmit to receive mode. If you insert at least a 10 msec delay before sending the acknowledgement packet, that's enough time for the transmitter to switch back to receive mode.

See this thread and the other threads I point to in my reply as well: https://forums.adafruit.com/viewtopic.php?f=57&t=99760

EDIT: I was writing my reply just before you posted that you'd discovered this yourself.
 
I'm not sure if this is your issue, but one problem that's been noticed several times with the Feather radio boards is that the receiver sends the acknowledgement message too quickly, before the transmitter has a chance to change back from transmit to receive mode. If you insert at least a 10 msec delay before sending the acknowledgement packet, that's enough time for the transmitter to switch back to receive mode.

See this thread and the other threads I point to in my reply as well: https://forums.adafruit.com/viewtopic.php?f=57&t=99760

EDIT: I was writing my reply just before you posted that you'd discovered this yourself.
Thanks for the confirmation.

Note: On the other program I removed 10ms second after it sent the message before it then tried to receive a response.
 
Hello KurtE,

Thanks for the note. I've attached the two sketches used. They are more complicated than they need to be, but I think Node-Moteino-01 is nearly untouched from the original example other than specifying RFM69HCW and 915 MHz. The Gateway-Teensy-01 has been tweaked for a Teensy 3.2 instead of a Moteino.

Sample output from the Moteino sketch is:
Code:
 nothing...
Sending[1]: 1 nothing...
Sending[2]: 12 nothing...
Sending[3]: 123 nothing...
Sending[4]: 123  nothing...
Sending[5]: 123 A nothing...
Sending[6]: 123 AB nothing...
Sending[7]: 123 ABC nothing...
Sending[8]: 123 ABCD nothing...
Sending[9]: 123 ABCDE nothing...
Sending[10]: 123 ABCDEF nothing...
Sending[11]: 123 ABCDEFG nothing...
Sending[12]: 123 ABCDEFGH nothing...
Sending[13]: 123 ABCDEFGHI nothing...
Sending[14]: 123 ABCDEFGHIJ nothing...
Sending[15]: 123 ABCDEFGHIJK nothing...
Sending[16]: 123 ABCDEFGHIJKL nothing...
Sending[17]: 123 ABCDEFGHIJKLM nothing...
Sending[18]: 123 ABCDEFGHIJKLMN nothing...
Sending[19]: 123 ABCDEFGHIJKLMNO nothing...
Sending[20]: 123 ABCDEFGHIJKLMNOP nothing...
Sending[21]: 123 ABCDEFGHIJKLMNOPQ nothing...
Sending[22]: 123 ABCDEFGHIJKLMNOPQR nothing...
Sending[23]: 123 ABCDEFGHIJKLMNOPQRS nothing...
Sending[24]: 123 ABCDEFGHIJKLMNOPQRST nothing...
Sending[25]: 123 ABCDEFGHIJKLMNOPQRSTU nothing...
Sending[26]: 123 ABCDEFGHIJKLMNOPQRSTUV nothing...
Sending[27]: 123 ABCDEFGHIJKLMNOPQRSTUVW nothing...
Sending[28]: 123 ABCDEFGHIJKLMNOPQRSTUVWX nothing...
Sending[29]: 123 ABCDEFGHIJKLMNOPQRSTUVWXY nothing...
Sending[30]: 123 ABCDEFGHIJKLMNOPQRSTUVWXYZ nothing...
 nothing...


Sample output from the Teensy sketch is:
Code:
#[3063][2] FLASH_MEM_ID:0xEF30   [RX_RSSI:-33] - ACK sent. Pinging node 2 - ACK...nothing
#[3064][2] FLASH_MEM_ID:0xEF30   [RX_RSSI:-34] - ACK sent.
#[3065][2] 1   [RX_RSSI:-31] - ACK sent.
#[3066][2] 1   [RX_RSSI:-33] - ACK sent. Pinging node 2 - ACK...nothing
#[3067][2] 123    [RX_RSSI:-33] - ACK sent.
#[3068][2] 123 A   [RX_RSSI:-34] - ACK sent.
#[3069][2] 123 A   [RX_RSSI:-34] - ACK sent. Pinging node 2 - ACK...nothing
#[3070][2] 123 AB   [RX_RSSI:-34] - ACK sent.
#[3071][2] 123 ABCD   [RX_RSSI:-32] - ACK sent.
#[3072][2] 123 ABCDE   [RX_RSSI:-33] - ACK sent. Pinging node 2 - ACK...nothing
#[3073][2] 123 ABCDEFG   [RX_RSSI:-32] - ACK sent. Pinging node 2 - ACK...nothing
#[3074][2] 123 ABCDEFG   [RX_RSSI:-34] - ACK sent.
#[3075][2] 123 ABCDEFGH   [RX_RSSI:-34] - ACK sent.
#[3076][2] 123 ABCDEFGH   [RX_RSSI:-32] - ACK sent. Pinging node 2 - ACK...nothing
#[3077][2] 123 ABCDEFGHI   [RX_RSSI:-34] - ACK sent.
#[3078][2] 123 ABCDEFGHIJ   [RX_RSSI:-34] - ACK sent.
#[3079][2] 123 ABCDEFGHIJK   [RX_RSSI:-33] - ACK sent. Pinging node 2 - ACK...nothing
#[3080][2] 123 ABCDEFGHIJKL   [RX_RSSI:-33] - ACK sent.
#[3081][2] 123 ABCDEFGHIJKLM   [RX_RSSI:-34] - ACK sent.
#[3082][2] 123 ABCDEFGHIJKLMN   [RX_RSSI:-32] - ACK sent. Pinging node 2 - ACK...nothing
#[3083][2] 123 ABCDEFGHIJKLMN   [RX_RSSI:-35] - ACK sent.
#[3084][2] 123 ABCDEFGHIJKLMNO   [RX_RSSI:-32] - ACK sent.
#[3085][2] 123 ABCDEFGHIJKLMNOP   [RX_RSSI:-32] - ACK sent. Pinging node 2 - ACK...nothing
#[3086][2] 123 ABCDEFGHIJKLMNOPQRSTU   [RX_RSSI:-31] - ACK sent.
#[3087][2] 123 ABCDEFGHIJKLMNOPQRSTU   [RX_RSSI:-34] - ACK sent.
#[3088][2] 123 ABCDEFGHIJKLMNOPQRSTUVW   [RX_RSSI:-33] - ACK sent. Pinging node 2 - ACK...nothing
#[3089][2] 123 ABCDEFGHIJKLMNOPQRSTUVWXY   [RX_RSSI:-31] - ACK sent.
#[3090][2] FLASH_MEM_ID:0xEF30   [RX_RSSI:-31] - ACK sent.

I only just now noticed some duplicated messages and some skipped messages. Not sure if I experienced the same behavior yesterday or not.

There are a couple of things that make me think the Teensy is not actually sending anything.
  • The fact that Teensy sketch (as Gateway) shows "ACK...nothing" instead of "ACK...ok!"
  • When I swapped the Teensy to be Node and Moteino to be Gateway (with modified code), the Moteino did not receive the '123 ABCDE..." messages from Teensy.

I should greatly simplify the sketches I'm using and continue trying.
 

Attachments

  • Node-Mot.ino
    6.2 KB · Views: 72
  • Gateway-Teensy-01.ino
    6.4 KB · Views: 77
Warning as I mentioned we are using different radios, sketches and libraries... But as a test I would try something like:
Code:
  if (radio.receiveDone())
  {
    Serial.print('[');Serial.print(radio.SENDERID, DEC);Serial.print("] ");
    for (byte i = 0; i < radio.DATALEN; i++)
      Serial.print((char)radio.DATA[i]);
    Serial.print("   [RX_RSSI:");Serial.print(radio.RSSI);Serial.print("]");

    if (radio.ACKRequested())
    {[COLOR="#FF0000"]
[B]      delay(10)[/B];[/COLOR]
      radio.sendACK();
      Serial.print(" - ACK sent");
    }
    Blink(LED,3);
    Serial.println();
  }
i.e. I added the delay in before you send the ack back. Then see if you get anything at other side...

Again we are using different stuff, but probably wouldn't be hard to try
 
Still no apparent response from the Teensy in the COM port of the Moteino sketch...

Moteino (sender node) loop:
Code:
long lastPeriod = 0;

void loop() 
{
  //process any serial input
  if (Serial.available() > 0)
  {
    char input = Serial.read();  //Allow user to alter delay between messages
    if (input >= 48 && input <= 57) //[0,9]
    {
      TRANSMITPERIOD = 100 * (input-48);
      if (TRANSMITPERIOD == 0) TRANSMITPERIOD = 1000;
      Serial.print("\nChanging delay to ");
      Serial.print(TRANSMITPERIOD);
      Serial.println("ms\n");
    }
  }

  //check for any received packets
  if (radio.receiveDone())
  {
    Serial.print("[Sender Node ID = ");
    int TeensyID = radio.SENDERID;
    Serial.print(TeensyID);
    Serial.print("] ");
    
    for (byte i = 0; i < radio.DATALEN; i++)
      Serial.print((char)radio.DATA[i]);
    Serial.print("   [RX_RSSI:");Serial.print(radio.RSSI);Serial.print("]");

    if (radio.ACKRequested())
    {
      delay(10);
      radio.sendACK();
      Serial.print(" - ACK sent");
    }
    Blink(LED,3);
    Serial.println();
  }

  int currPeriod = millis()/TRANSMITPERIOD;
  if (currPeriod != lastPeriod)
  {
    lastPeriod=currPeriod;
    if (radio.sendWithRetry(TONODE, "Hello Teensy!", 13))
    {
     Serial.println( "nothing sent...");
    }
    else
    {
     Serial.println("Sent:  'Hello Teensy!'");
    }
 }

 Blink(LED,3);
}

Moteino COM port:
Code:
Sent:  'Hello Teensy!'
Sent:  'Hello Teensy!'
Sent:  'Hello Teensy!'
Sent:  'Hello Teensy!'
Sent:  'Hello Teensy!'
Sent:  'Hello Teensy!'
Sent:  'Hello Teensy!'
Sent:  'Hello Teensy!'
Sent:  'Hello Teensy!'
Sent:  'Hello Teensy!'
Sent:  'Hello Teensy!'

Teensy (receiver node) loop:

Code:
byte ackCount=0;
uint32_t packetCount = 0;
void loop() {
  //process any serial input
  if (Serial.available() > 0)
  {
    char input = Serial.read();
    if (input == 'r') //d=dump all register values
      radio.readAllRegs();
    
    if (input == 't')
    {
      byte temperature =  radio.readTemperature(-1); // -1 = user cal factor, adjust for correct ambient
      byte fTemp = 1.8 * temperature + 32; // 9/5=1.8
      Serial.print( "Radio Temp is ");
      Serial.print(temperature);
      Serial.print("C, ");
      Serial.print(fTemp); //converting to F loses some resolution, obvious when C is on edge between 2 values (ie 26C=78F, 27C=80F)
      Serial.println('F');
    }
  }

  if (radio.receiveDone())
  {
    Serial.print("#[");
    Serial.print(++packetCount);
    Serial.print(']');
    
    Serial.print("[Sender Node ID = ");
    int MoteinoID = radio.SENDERID;
    //Serial.print(radio.SENDERID, DEC);
    Serial.print(MoteinoID);
    Serial.print("] ");

    for (byte i = 0; i < radio.DATALEN; i++)
      Serial.print((char)radio.DATA[i]);
    Serial.print("   [RX_RSSI:");Serial.print(radio.RSSI);Serial.print("]");
    
    if (radio.ACKRequested())
    {
      delay(10);
      byte theNodeID = radio.SENDERID;
      radio.sendACK();
      Serial.print(" - ACK sent.");

      Serial.print(" Pinging node ");
      Serial.print(theNodeID);
      Serial.print(" - ACK...");
      delay(10); //need this when sending right after reception .. increased from 3 to 10
      if (radio.sendWithRetry(theNodeID, "ACK TEST", 8, 0))  // 0 = only 1 attempt, no retries
        Serial.print("ok!");
      else Serial.print("nothing");
    }
    Serial.println();
    Blink(LED,3);  
  }
}

Teensy COM port:
Code:
#[21][Sender Node ID = 2] Hello Teensy!   [RX_RSSI:-28] - ACK sent. Pinging node 2 - ACK...nothing
#[22][Sender Node ID = 2] Hello Teensy!   [RX_RSSI:-28] - ACK sent. Pinging node 2 - ACK...nothing
#[23][Sender Node ID = 2] Hello Teensy!   [RX_RSSI:-28] - ACK sent. Pinging node 2 - ACK...nothing
#[24][Sender Node ID = 2] Hello Teensy!   [RX_RSSI:-28] - ACK sent. Pinging node 2 - ACK...nothing
#[25][Sender Node ID = 2] Hello Teensy!   [RX_RSSI:-28] - ACK sent. Pinging node 2 - ACK...nothing
#[26][Sender Node ID = 2] Hello Teensy!   [RX_RSSI:-28] - ACK sent. Pinging node 2 - ACK...nothing
#[27][Sender Node ID = 2] Hello Teensy!   [RX_RSSI:-28] - ACK sent. Pinging node 2 - ACK...nothing
#[28][Sender Node ID = 2] Hello Teensy!   [RX_RSSI:-27] - ACK sent. Pinging node 2 - ACK...nothing
#[29][Sender Node ID = 2] Hello Teensy!   [RX_RSSI:-28] - ACK sent. Pinging node 2 - ACK...nothing
#[30][Sender Node ID = 2] Hello Teensy!   [RX_RSSI:-29] - ACK sent. Pinging node 2 - ACK...nothing
#[31][Sender Node ID = 2] Hello Teensy!   [RX_RSSI:-28] - ACK sent. Pinging node 2 - ACK...nothing
#[32][Sender Node ID = 2] Hello Teensy!   [RX_RSSI:-28] - ACK sent. Pinging node 2 - ACK...nothing
#[33][Sender Node ID = 2] Hello Teensy!   [RX_RSSI:-29] - ACK sent. Pinging node 2 - ACK...nothing
#[34][Sender Node ID = 2] Hello Teensy!   [RX_RSSI:-28] - ACK sent. Pinging node 2 - ACK...nothing
#[35][Sender Node ID = 2] Hello Teensy!   [RX_RSSI:-29] - ACK sent. Pinging node 2 - ACK...nothing
#[36][Sender Node ID = 2] Hello Teensy!   [RX_RSSI:-28] - ACK sent. Pinging node 2 - ACK...nothing
#[37][Sender Node ID = 2] Hello Teensy!   [RX_RSSI:-28] - ACK sent. Pinging node 2 - ACK...nothing
#[38][Sender Node ID = 2] Hello Teensy!   [RX_RSSI:-28] - ACK sent. Pinging node 2 - ACK...nothing
#[39][Sender Node ID = 2] Hello Teensy!   [RX_RSSI:-28] - ACK sent. Pinging node 2 - ACK...nothing
#[40][Sender Node ID = 2] Hello Teensy!   [RX_RSSI:-30] - ACK sent. Pinging node 2 - ACK...nothing

To me, this means Teensy's supposed acknowledgement of the message did not get sent successfully, evident by the lack of any message from Teensy in the Moteino's COM port.

I also began to think that the "ACK...nothing" in the Teensy's COM port meant acknowledgement wasn't sent, but when looking at the Moteino code I see that the "else" portion of the "if (radio.sendWithRetry(TONODE, "Hello Teensy!", 13))" statement is the one that is true, which is opposite of the similar if statement in the Teensy's ping response. So which is correct? I assume that since the message is sent from the Moteino to the Teensy successfully, the "else" portion of the if (radio.sendWithRetry()) statement is the true one. Am I wrong?

What does RSSI stand for?

What does "radio.sendACK();" actually do in terms of a visible response?
 
At this point not sure what to tell you. Maybe in a few days I will try my RFM69 (not hcw) ones again.

But as I mentioned, I am currently using (learning/modifying) RADIOHEAD library. So I don't know any specifics on that library. Which one are you using? It was probably mentioned somewhere in this thread.

Looks like in the test you can tell the library to retry the ACK or only try once. Looks like you have only try once.

RSSI: Is the signal strength. I would have to look it up for sure, but probably something like: Received Signal Strength Indicator

Again if it were me, would probably try with simple RADIOHEAD examples to see if you can get it working.


Or again try looking again at sample code to see if something missing? Example in the above code you have: radio.receiveDone())
But is there anything you need to do to tell the radio to go into receive mode?

Sorry I am not much help here
 
Hi KurtE,

Thanks for the reply. I'll keep hacking and will report back if I learn anything new or achieve success.

-Bugeye60
 
Conclusion of my SparkFun RFM69HCW trials:

I wrote previously that I had purchased a Moteino to help debug my problems with the Teensy/SparkFun combo. Even though the SparkFun radio received the Moteino's messages I could never get the SparkFun to acknowledge receipt or send a message to the Moteino. Probably something I just wasn't getting set right.

So...I bought another Moteino and now I have two radios that talk to one another right out of the box. So simple!

I still love my Teensy 3.2 and am already using it with other sensors. Thanks to everyone who attempted to help me get the Teensy/SparkFun radios going. Even though I didn't get that combo to work, I learned a lot along the way!
 
KurtE, I haved to modify a lot to get really working SPI with transactions with radiohead library, even paul's version have issues with SPI transactions.
Unfortunatly this library is a big mess, put hands on it's a nighmare and author seems don't like github so there's tons of unofficial forks and pulls to official one are not easy. I've modded a more updated version of radiohead in my github (paul's one is very old) and was working really good with RFN devices, didn't try yet wìith RFM69HCW but I'm working to mod the newest one in these days.
 
Thanks Sumotoy. As I mentioned, I have the latest (as of at least as of maybe a week ago), where I added in SPI transaction stuff. I added a begin/end transaction members, which I hope work OK.

WIll have to compare my version with yours. My replacement for the fried radio arrived yesterday, so will try again soon with two Teensy's
 
Thanks Sumotoy. As I mentioned, I have the latest (as of at least as of maybe a week ago), where I added in SPI transaction stuff. I added a begin/end transaction members, which I hope work OK.

WIll have to compare my version with yours. My replacement for the fried radio arrived yesterday, so will try again soon with two Teensy's
Amazing KurtE, this is a great new! Version in my github is from last year, I remember that I had some troubles to add transactions, had to move things in code to get the right SPI flow.
 
Status
Not open for further replies.
Back
Top