Giter Site home page Giter Site logo

Unable to connect radio about node-nrf24 HOT 14 CLOSED

ludiazv avatar ludiazv commented on June 15, 2024
Unable to connect radio

from node-nrf24.

Comments (14)

ironwren avatar ironwren commented on June 15, 2024 1

Thank you so much @ristomatti ! My eyes are opened. I can't believe I was trying to get signals from a piece of plastic.

from node-nrf24.

ludiazv avatar ludiazv commented on June 15, 2024

I did not test on b+. But in principle it should work. By the trace you show seems is a wiring problem. Have you test a plain cpp version?

from node-nrf24.

ironwren avatar ironwren commented on June 15, 2024

I've checked the pins again: Here's my setup.
image
image
image
image
image

I haven't tested the cpp version. The docs are terrible. What do you recommend?
Thank you, and sorry if this is irritating.

from node-nrf24.

ironwren avatar ironwren commented on June 15, 2024

OMG... am I missing this: https://www.amazon.com/gp/product/B01IK78PQA ?
and the jumpers need to goto the female pins on the chip?

from node-nrf24.

ristomatti avatar ristomatti commented on June 15, 2024

@bjrenfrow Yes, unfortunately you only have the adapter that is required if NRF24L01 modules are used with microcontrollers that use 5V logic (like Arduino Uno or Arduino Mega). The modules expect 3.3V logic signals, that a Raspberry Pi uses. So you won't need or should use the adapter with a Raspberry Pi.

There are a few different types of NRF24L01 radios available. There are the ones you linked, then smaller ones with a lower range that are probably the most common which look like this:

image

There's also a shielded version of the longer range one you linked that looks like this (antenna is not shown in the picture but it typically comes with a similar longer antenna):

image

If you need the modules to communicate over longer distances, I would recommend the above one. It is the most expensive one though but from my experience it is much easier to work with. The unshielded modules are more sensitive to external factors like other nearby components or electric devices.

from node-nrf24.

ludiazv avatar ludiazv commented on June 15, 2024

Just one comment, if you are going to use the power adaptor connect VIN with 5V of your PI. The power power adaptor will regulate the voltage down 3.3V.

Without the power adaptor using the 3.3V power of the PI would work but possibly you need to solder some cap on the radio as the power supply of the PI have current and line regulation limitations. Using PA/LNA radios (longer range as you show) will not work stable as this radios require considerable more power.

If you are looking for more permanent solution check the phat I designed. It solves not only wiring but also power issues with dedicated beefe capacitor. Also supports dual radio configuration. Check it here: https://github.com/ludiazv/borosRF2

from node-nrf24.

ironwren avatar ironwren commented on June 15, 2024

This is slick. I most likely will want to start producing lots of these, and having a hat I can just plugin will be essential to me. Thanks @ludiazv!

from node-nrf24.

ludiazv avatar ludiazv commented on June 15, 2024

@bjrenfrow I still have some boards for a small batch i made. If you are insterested let me know.

Regards,

from node-nrf24.

ironwren avatar ironwren commented on June 15, 2024

Please let me know if I'm abusing this issue channel. I'm stuck on one more thing, if I can get this to work I definitely will be purchasing some units.

I got the arduino to send to the raspberry pi! I want to send something back to the arduino now. The following happens with this code:

PI:

const lib = require('nrf24');
const radio = new lib.nRF24(22, 0);

radio.begin(true);
radio.config({
  PALevel: lib.RF24_PA_MAX,
  DataRate: lib.RF24_1MBPS,
  Channel: 76,
  CRCLength: lib.RF24_CRC_16,
}, true);

console.log("Radio connected:" + radio.present());

radio.useWritePipe("0x0F0F0F0F0F");

setInterval(() => {
  radio.write(
    Buffer.from('Hello'),
    (...args) => console.log(args)
  );
}, 5000);

Arduino:

//Send.ino
#include<SPI.h>
#include<RF24.h>

// ce, csn pins
RF24 radio(9, 10);

const uint64_t initialReadingPipe = 0x0F0F0F0F0FLL;

void setup(void){
  Serial.begin(115200);
  delay(1000);
  radio.begin();
  radio.setCRCLength(RF24_CRC_16);
  radio.setPALevel(RF24_PA_MAX);
  radio.setChannel(76);
  radio.setDataRate(RF24_1MBPS);
  radio.setAutoAck(true);
  radio.openReadingPipe(1, initialReadingPipe);
  radio.powerUp();
  radio.startListening();
  Serial.println("Start...");
}

void loop(void){
  if (radio.available()){
    char text[32] = "";
    radio.read(&text, sizeof(text));
    Serial.println(text);
  }
}

The PI outputs:

===========================
Radio details after config:
===========================
STATUS		 = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
RX_ADDR_P0-1	 = 0xe7e7e7e7e7 0xc2c2c2c2c2
RX_ADDR_P2-5	 = 0xc3 0xc4 0xc5 0xc6
TX_ADDR		 = 0xe7e7e7e7e7
RX_PW_P0-6	 = 0x00 0x00 0x00 0x00 0x00 0x00
EN_AA		 = 0x3f
EN_RXADDR	 = 0x03
RF_CH		 = 0x4c
RF_SETUP	 = 0x07
CONFIG		 = 0x7e
DYNPD/FEATURE	 = 0x00 0x00
Data Rate	 = 1MBPS
Model		 = nRF24L01+
CRC Length	 = 16 bits
PA Power	 = PA_MAX
IRQ gpio (negative if disabled):-1(0)
Config internals:
check the values as incorrect values fallback to default values.
 PALevel:3 DataRate:0 Channel:76 CRCLength:2 Retries:(5+1*250us,15 attempts) PayloadSize:32 AddressWidth:5 AutoAck:1 TxDelay:250 PollBaseTime:35000
===========================
Radio connected:true
[ false, 0, 0, 1, 32, false ]
[ false, 0, 0, 1, 32, false ]
[ false, 0, 0, 1, 32, false ]
[ false, 0, 0, 1, 32, false ]

The Arduino only outputs

start...

Because it sent to the pi, I'm sure everything is wired correctly. Any ideas why I cannot send back to the arduino. Thanks!

from node-nrf24.

ironwren avatar ironwren commented on June 15, 2024

@ludiazv how do you mount the borosRF2 onto the pi, it looks like its sitting on top of a special case. Do you have any recommendations?

from node-nrf24.

ludiazv avatar ludiazv commented on June 15, 2024

Hi @bjrenfrow ,
Your code is ok (assuming that you are using current master branch) I tested on my rig and works fine. The only difference is that I use a different pinout for arduinio (7,8 pins for ce & cs) and gpio 24 for the Pi. I used a nano & rpi3b (not b+). So I don't think is sw related.

As for your description, I understood that you can send frames from arduino -> Pi but not from Pi -> arduino. TX problems are usually related with insufficient/poor filtered power to the radio. Specially on PA/LNA radios. They require a lot power to transmit for a brief period. Are your correctly rcv ACKs from the Pi when sending from the ardunino->pi?

Try some of this:

On the hw side:

  1. Check again the wiring and try to make shorter the wires specially VCC & GND.

  2. Put a big Cap, say 100uf-1000uF close to VCC&GND of the radio:
    Typical cap hack

  3. Use other PSU for the radio and do not power the radio from 3.3V rail of the PI (use the adaptors with 5V power).

  4. Interchange the radio modules or test with new ones. I think is better to start with cheap clones with on-board antenna.

  5. To be sure that your modules are ok. test with 2 arduinos using the gettingstarted example of the library.

on SW side:

  1. reduce TX power to PA_MIN when testing. if they are close it wont be a problem.
  2. Reduce payload size.
  3. Reduce transfer speed to 250KBPS

As regards, the case you need a case with high clearance, or use stackable board based on stand offs and acrylic covers. This case you can adapt the height of the box to your needs. I personally don't use any commercial solution as I normally print a specific case that will fit to the project needs.
One caveat: AVOID metal cases they block radio signals. if metal case is a must use a external antennas.

Regards,

from node-nrf24.

ironwren avatar ironwren commented on June 15, 2024

You are a genus! The fix was to #3. You should write a book. I have two way communication now!

If I want to just plug in your module into my bare pi, will these settings work:

image

from node-nrf24.

ludiazv avatar ludiazv commented on June 15, 2024

In the second box chose "soldered pin headers".

Regards,

from node-nrf24.

ironwren avatar ironwren commented on June 15, 2024

Just ordered 5. I will be ordering a lot more if our project is successful. Thanks again for your help.

from node-nrf24.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.