Forum Rule: Always post complete source code & details to reproduce any issue!
Page 2 of 2 FirstFirst 1 2
Results 26 to 41 of 41

Thread: Does anybody get Teensy 3 working with NRF24L01+?

  1. #26
    Senior Member
    Join Date
    Jun 2013
    Location
    So. Calif
    Posts
    2,825
    Frenchy... are you looking for the Zigbee protocols, or just 802.15.4 simple messages where you don't even have to have a PAN coordinator (it's an option). Zigbee is all about mesh routing at the network layer. XBee series 1 are non-Zigbee; series 2 are zigbee-only.
    Digimesh is a good alternative to Zigbee - works better.

    Most simple RF comms in hobby-land can be done with series 1 and no zigbee- far simpler. And series 1 has the built-in firmware to do I/O and data acquistion, recurring, without an attached microprocessor at the sensor end.
    there is no equivalent to the XBee as above, where you have that firmware free, already written.
    The XBee Pro modules have 60mW vs. 2mW for the non-Pro. But a gain antenna on one or both ends of the link can offset. Battery life is limited by the receiver rather than transmitter - except when you use a very chatty protocol like Zigbee.

    Atmel's 802.15.4 is the product previously known as Meshnetics. Not well documented/supported, IMO. Perhaps OK for high volume OEMs.

    Anaren has modules, using TI's CC2530, but they are hardware only. you're DIY for all firmware, and serial port/SPI interface is a problem for small quantities.

    This is in the context of 2.4GHz. In the US, there are a few 802.15.4 and more yet proprietary modules for 902-928 unlicensed. In the EU, that has to be 868MHz.
    Last edited by stevech; 08-20-2013 at 03:44 AM.

  2. #27
    Junior Member VoltVisionFrenchy's Avatar
    Join Date
    Feb 2013
    Location
    Warren, PA
    Posts
    13
    Stevech,
    Thanks for the answer and the question! Honestly I was not looking for the Zigbee protocols nor 802.15.4 at the time of my inquiry...

    Stage1 = I was just thinking about a low latency way to wirelessly send sensor info from Teensy3/RF to RaspberryPi/RF. An immediate application that I would like to build very soon is a Teensy3 with a microphone inside of a timpani drum sending amplitude information at a reasonable rate with *hopefully* 10ms latency. I was hoping a general purpose 2.4GHz serial link would suffice. Those NRF24L01+ modules can be had for approx US$2 which makes for a nice wireless serial link at a pricepoint way below the Zigbee stuff. Regarding battery, I can afford to run one power cable into the Timpani...therefore no battery necessary....what I wanted to avoid, however, was various signal cables going in and out (I will be sending other low latency data back to the timpani also).

    Stage2 = I think you are bringing up a good point though... after I get one node talking, it is only a matter of time before I want a network of nodes talking. Something tells me Zigbee's meshability will be very bad for guaranteed low latency traffic. Also, I was reading that the NRF24L01+ supports multiple pipes of data, so this might be worth me looking into for several low latency serial links.

    I need to spend some time with the NRF24L01+ datasheet to understand the possibilities/limitations better.
    thx!
    frenchy

  3. #28
    Senior Member
    Join Date
    Jun 2013
    Location
    So. Calif
    Posts
    2,825
    I have a Raspberry PI - so you're planning to put an Xbee it the RPi's serial port? I fiddled with that once. In my job, I did a very large/complex Python program (not on the RPi, but similar python).

    If you have point to point links, no relay/repeater (meshing), then I'd suggest avoiding the complexity of Zigbee and just use the XBee binary API and a star topology. Don't even need a PAN coordinator; all nodes can be end nodes. And use the 64 bit addresses rather than the DHCP-like 16 bit addresses.

    meaning you need one A/D sample every 10mS? In 2.4GHz, there is a lot of wifi you'll be competing with, in most spots.
    Last edited by stevech; 08-20-2013 at 04:48 AM.

  4. #29
    Quote Originally Posted by VoltVisionFrenchy View Post
    [bump]

    Hello! Is anyone still interested in these NRF24L01+ modules with the Teensy3? The pricing of these is very, very intriguing and people seem to love them from a technical standpoint because of their ease of use and special features. The most interesting (and recently updated) software I have seen for the Teensy is here, but he doesn't say if its for the Teensy2 or Teensy3 (maybe it doesnt matter?)

    Paul, what is your recommendation for a low-cost zigbee-esque, xbee replacement type solution?
    Thanks!
    frenchy
    Hey Frenchy,

    I'm the one that is coding the RF24SH library. It is for Teensy 3 version, RPi, Arduino . Sorry about the lack of information. I just received your e-mail and replied it, now I'm checking the Teensy forums. Since my Teensy 'burned' I'm not able to test it anymore.

    Recently I add to RF24SH, a variable message size using templates, more complex examples... for now, I'm kind of stopped thinking how to move forward with it, there is a lot of problems on a tree network that is hard to solve with small amount of memory.

    The RF24SH library, has the RF24 library adapted to Teensy, RPi and Arduino, so if you need something simpler you could extract the RF24 library from RF24SH and use it directly.

    Best Regards,
    Matheus

  5. #30
    Junior Member VoltVisionFrenchy's Avatar
    Join Date
    Feb 2013
    Location
    Warren, PA
    Posts
    13
    Matheus,
    Thank you for your reply! I will check your modified RF24 library again on Monday. Can you tell me, did you comment out all of the diagnostic printf statements or did you change them to use some other serial print method which Teensy3 understands? Thanks!
    -frenchy

  6. #31
    Yes, I commented all teensy 3 rf24 printfs. Sorry.

  7. #32

    Serial.printf

    Latest Teensy libraries have printf available.
    Call it with
    Code:
    Serial.printf(blablabla)
    So. Using the maniacbug RF24 library is as easy as doing a find & replace of printf to Serial.printf

    Peace!

  8. #33
    Senior Member
    Join Date
    Aug 2016
    Posts
    150
    Assay the library RF24 at teensy 3.6 and there is no communication between the transmitter-receiver.

    code transmitter(teensy 3.6)
    Code:
    #include <SPI.h>
    #include <nRF24L01.h>
    #include <RF24.h>
    
    RF24 radio(9, 10);
    
    const byte rxAddr[6] = "00001";
    
    void setup()
    {
    
      SPI1.begin();
      SPI1.setSCK(32);
      SPI1.beginTransaction(SPISettings(8000000, MSBFIRST, SPI_MODE0));
    
      radio.begin();
      radio.setRetries(15, 15);
      radio.openWritingPipe(rxAddr);
      
      radio.stopListening();
    }
    
    void loop()
    {
      const char text[] = "Hello World";
      radio.write(&text, sizeof(text));
      
      delay(1000);
    }
    code receiver(arduino mega)

    Code:
    #include <SPI.h>
    #include <nRF24L01.h>
    #include <RF24.h>
    
    RF24 radio(7, 8);
    
    const byte rxAddr[6] = "00001";
    
    void setup()
    {
      while (!Serial);
      Serial.begin(9600);
      
      radio.begin();
      radio.openReadingPipe(0, rxAddr);
      
      radio.startListening();
    }
    
    void loop()
    {
      if (radio.available())
      {
        char text[32] = {0};
        radio.read(&text, sizeof(text));
        
        Serial.println(text);
      }
    }
    The problem is that it does not displays nothing in my serial port.

  9. #34
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    11,423
    Thanos,

    You probably need to provide a little more information. Like how do you have the RF24 hooked up to your Teensy 3.6? Your program looks like it is doing some initializing of SPI1, but have no idea of that library directly support SPI1 or not ...

    Also unclear from your description if your Arduino mega receiver has worked to talk to a another one or not...

  10. #35
    Senior Member
    Join Date
    Aug 2016
    Posts
    150
    KurtE just use the spi0 and works fine.
    In spi1 why not working;

  11. #36
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    11,423
    Because in the library there would have to be stuff in place that would allow it to call SPI1.transfer instead of SPI.transfer...

    Unfortunately there is no base class for SPI and SPI1 that allows you to pass in which one you wish to use, so code has to be setup to handle it.

    For example as I mentioned in my Well Monitoring thread, I hacked up the radiohead library for the RFM95 to allow me to do it...

    Likewise earlier I made a new library for myself (SPIN), which created an abstract SPIN class and then made subclasses for the main SPI, SPI1 and SPI2 and then made a version of ILI9341_t3 library which allowed me to pass in a SPIN object so I could use any of the busses...

    Hope that helps.

    Kurt

  12. #37
    Senior Member
    Join Date
    Aug 2016
    Posts
    150
    I understood KurtE,thank you very much.

  13. #38
    Junior Member
    Join Date
    Mar 2017
    Posts
    10
    This code works on the arduino uno but not on the teensy 3.2 The OLD Display works. Do you have any suggestions? The RF24 is from Maniabug

    //NRF24L01_DS18S20_RX_Temperature_Teensy3.2
    #include <SPI.h> // Comes with Arduino IDE
    #include <RF24.h> // Download and Install (See above)
    #include <Wire.h>
    #include <Adafruit_GFX.h>
    #include <Adafruit_SSD1306.h>
    #define OLED_RESET 4
    Adafruit_SSD1306 display(OLED_RESET);
    RF24 myRadio (9, 10); // "myRadio" is the identifier you will use in following methods
    byte addresses[][6] = {"1Node"}; // Create address for 1 pipe.
    float dataReceived; // Data that will be received from the transmitter
    float temperature;
    void setup() /****** SETUP: RUNS ONCE ******/
    {
    display.begin(SSD1306_SWITCHCAPVCC, 0x3c); // initialize with the I2C addr 0x3C (for the 128x64)
    Serial.begin(115200);
    delay(1000);
    myRadio.begin(); // Start up the physical nRF24L01 Radio
    myRadio.setChannel(108); // Above most Wifi Channels
    myRadio.setPALevel(RF24_PA_MAX); // Uncomment for more power
    myRadio.setDataRate(RF24_250KBPS); // Fast enough.. Better range
    myRadio.openReadingPipe(1, addresses[0]); // Use the first entry in array 'addresses' (Only 1 right now)
    myRadio.startListening();
    }
    void loop(){
    if ( myRadio.available()) // Check for incoming data from transmitter
    {
    {
    myRadio.read( &dataReceived, sizeof(dataReceived) ); // Get the data payload (You must have defined that already!)
    temperature = dataReceived;
    }
    display.clearDisplay();
    display.setTextSize(1);
    display.setTextColor(WHITE);
    display.setCursor(20, 0);
    display.println("Temperature");
    display.setCursor(20, 7);
    display.println("in degrees C");
    display.setTextSize(1);
    display.setCursor(40, 20);
    display.println(temperature);
    display.display();
    }
    }

  14. #39
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    27,659
    @OE8PCK - I see you've posted essentially the same question 3 times on 3 different thread, all within a several hours of each other. Which should I try to answer? And which get left unanswered for people to find in the future? I'm going to post this same reply on all 3 locations. Please, if you reply, keep it all on 1 thread, ok?

    First, look at this thread where a similar problem was recently solved.

    https://forum.pjrc.com/threads/42711...l=1#post137080

    The code originally written for Arduino Uno prints all the info too quickly, before you can open the Arduino Serial Monitor. Read that thread for the solution, and more followup about things needed to make this really work communicating between 2 boards.

  15. #40
    Senior Member
    Join Date
    Jul 2014
    Posts
    3,481
    ?
    Quote Originally Posted by PaulStoffregen View Post
    @OE8PCK - I see you've posted essentially the same question 3 times on 3 different thread, all within a several hours of each other.
    OE8PCK or matheusbrat ?

  16. #41
    Junior Member
    Join Date
    Mar 2017
    Posts
    10
    Quote Originally Posted by WMXZ View Post
    ?


    OE8PCK or matheusbrat ?


    Sorry for the confusion

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •