Go Down

Topic: NRF24L01 Sending...failed. Problem (Read 552 times) previous topic - next topic

trkmml

Feb 10, 2018, 02:51 pm Last Edit: Feb 10, 2018, 03:02 pm by trkmml
Hi, Sorry for my english

i have problem on TX part


here is my working TX/RX. sorry for wire mess but working with SimpleRxAckPayload and SimpleTxAckPayload



there is another TX (not work)
i try everything like change arduino, change wires, with breadboard, without breadboard, change nrf with working other TX, try use RF24Network library use YwRobot on breadboard with good 3.3v etc.
there is lm1117T for 3.3v and 10uf cap. i use multimeter and 3.3v is good

when i upload helloworldtx sketch keep Sending.failed
when i remove miso and mosi pins keep Sending. ok. but not send anything
when upload SimpleTxAckPayload. data send ...... Acknowledge but no data

here is my other tx running properly sketch. but not work on this
Code: [Select]



// SimpleTxAckPayload - the master or the transmitter

#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
String Mesaj;
int sondurum=6;
int durum=2;
#define CE_PIN   7
#define CSN_PIN 8

const byte slaveAddress[5] = {'R','x','A','A','A'};

RF24 radio(CE_PIN, CSN_PIN); // Create a Radio

char dataToSend[10] = "30101Pe  ";
char txNum;
char ackData[8];  // to hold the two values coming from the slave
bool newData = false;

unsigned long currentMillis;
unsigned long prevMillis;
unsigned long txIntervalMillis = 1000; // send once per second

//===============

void setup() {

    Serial.begin(9600);
    Serial.println(F("Source File /mnt/sdb1/SGT-Prog/Arduino/ForumDemos/nRF24Tutorial/SimpleTxAckPayload.ino"));
    Serial.println("SimpleTxAckPayload Starting");
    pinMode(4,INPUT);
    radio.begin();
    radio.setDataRate( RF24_250KBPS );

    radio.enableAckPayload();

    radio.setRetries(3,5); // delay, count
    radio.openWritingPipe(slaveAddress);
}

//=============

void loop() {
durum=digitalRead(4);
//Serial.print(durum);
//Serial.print("-");
//Serial.print(sondurum);
if (durum != sondurum)
  {
   
    currentMillis = millis();
    if (currentMillis - prevMillis >= txIntervalMillis) {
        send();
        send();
         sondurum = durum;
    }
    showData();
  Mesaj=String(ackData);
if (digitalRead(4)==LOW && Mesaj=="30101 A")
{
  sondurum=-1;
}
else if(digitalRead(4)==HIGH && Mesaj=="30101 K")
        {
  sondurum=-1;
        }

}
}

//================

void send() {

    bool rslt;
    rslt = radio.write( &dataToSend, sizeof(dataToSend) );
        // Always use sizeof() as it gives the size as the number of bytes.
        // For example if dataToSend was an int sizeof() would correctly return 2

    Serial.print("Data Sent ");
    Serial.print(dataToSend);
    if (rslt) {
        if ( radio.isAckPayloadAvailable() ) {
            radio.read(&ackData, sizeof(ackData));
            newData = true;
        }
        else {
            Serial.println("  Acknowledge but no data ");
        }
        updateMessage();
    }
    else {
        Serial.println("  Tx failed");
    }

    prevMillis = millis();
 }


//=================

void showData() {
    if (newData == true) {
        Serial.print("  Acknowledge data ");
        Serial.print(ackData);
        //Serial.print(", ");
        //Serial.println(ackData[1]);
        Serial.println();
        newData = false;
    }
}

//================

void updateMessage() {
durum=digitalRead(4); 
 if ( durum == HIGH) {
      txNum = 'K';
    }
    else {
  txNum = 'A';
    }
//Serial.println(durum);//if
        // so you can see that new data is being sent
  //  txNum += 1;
    //if (txNum > '9') {
      //  txNum = '0';
    //}
    dataToSend[8] = txNum;
}







pins











ARDUINO NANO/MINI PRONRFL2401

VCC (With lm1117T)VCC
GND (With lm1117T)GND
7CE
8CS
13SCK
11MOSI
12MISO


there is no other component




here is my helloworldtx code
Code: [Select]
/*
 Copyright (C) 2012 James Coliz, Jr. <maniacbug@ymail.com>

 This program is free software; you can redistribute it and/or
 modify it under the terms of the GNU General Public License
 version 2 as published by the Free Software Foundation.
 
 Update 2014 - TMRh20
 */

/**
 * Simplest possible example of using RF24Network
 *
 * TRANSMITTER NODE
 * Every 2 seconds, send a payload to the receiver node.
 */

#include <RF24Network.h>
#include <RF24.h>
#include <SPI.h>

RF24 radio(7,8);                    // nRF24L01(+) radio attached using Getting Started board

RF24Network network(radio);          // Network uses that radio

const uint16_t this_node = 01;        // Address of our node in Octal format
const uint16_t other_node = 00;       // Address of the other node in Octal format

const unsigned long interval = 2000; //ms  // How often to send 'hello world to the other unit

unsigned long last_sent;             // When did we last send?
unsigned long packets_sent;          // How many have we sent already


struct payload_t {                  // Structure of our payload
  unsigned long ms;
  unsigned long counter;
};

void setup(void)
{
  Serial.begin(57600);
  Serial.println("RF24Network/examples/helloworld_tx/");
 
  SPI.begin();
  radio.begin();
  network.begin(/*channel*/ 90, /*node address*/ this_node);
}

void loop() {
  
  network.update();                          // Check the network regularly

  
  unsigned long now = millis();              // If it's time to send a message, send it!
  if ( now - last_sent >= interval  )
  {
    last_sent = now;

    Serial.print("Sending...");
    payload_t payload = { millis(), packets_sent++ };
    RF24NetworkHeader header(/*to node*/ other_node);
    bool ok = network.write(header,&payload,sizeof(payload));
    if (ok)
      Serial.println("ok.");
    else
      Serial.println("failed.");
  }
}


 



and here is my helloworldrx code

Code: [Select]
/*
 Copyright (C) 2012 James Coliz, Jr. <maniacbug@ymail.com>

 This program is free software; you can redistribute it and/or
 modify it under the terms of the GNU General Public License
 version 2 as published by the Free Software Foundation.
 
 Update 2014 - TMRh20
 */

/**
 * Simplest possible example of using RF24Network,
 *
 * RECEIVER NODE
 * Listens for messages from the transmitter and prints them out.
 */

#include <RF24Network.h>
#include <RF24.h>
#include <SPI.h>


RF24 radio(7,8);                // nRF24L01(+) radio attached using Getting Started board

RF24Network network(radio);      // Network uses that radio
const uint16_t this_node = 00;    // Address of our node in Octal format ( 04,031, etc)
const uint16_t other_node = 01;   // Address of the other node in Octal format

struct payload_t {                 // Structure of our payload
  unsigned long ms;
  unsigned long counter;
};


void setup(void)
{
  Serial.begin(57600);
  Serial.println("RF24Network/examples/helloworld_rx/");
 
  SPI.begin();
  radio.begin();
  network.begin(/*channel*/ 90, /*node address*/ this_node);
}

void loop(void){
  
  network.update();                  // Check the network regularly

  
  while ( network.available() ) {     // Is there anything ready for us?
    
    RF24NetworkHeader header;        // If so, grab it and print it out
    payload_t payload;
    network.read(header,&payload,sizeof(payload));
    Serial.print("Received packet #");
    Serial.print(payload.counter);
    Serial.print(" at ");
    Serial.println(payload.ms);
  }
}



Robin2

I am guessing that you got the programs from my Simple nRF24L01+ Tutorial

The photos of your boards are not suitable for figuring out how you have things connected. You need to get pencil and paper and draw the connections and post a photo of the drawing - with all the connections clearly labelled.

I can't say I understand what your problem is from your description.

Are you saying that you have communication working correctly between Arduino A and Arduino B but not between Arduino A and Arduino C?

Wireless problems can be very difficult to debug. All this chopping and changing
Quote
i try everything like change arduino, change wires, with breadboard, without breadboard, change nrf with working other TX, try use RF24Network library use YwRobot on breadboard with good 3.3v etc.
is unlikely to help and will usually just cause confusion.

You need to describe a lot more clearly what is and is not working.


...R
Two or three hours spent thinking and reading documentation solves most programming problems.

Danois90

If you have two senders and one receiver where only one sender works, there migt be an issue with identification. Maybe both senders use the same address / node id?
Instead of mocking what's wrong, teach what's right! ;)
When you get help, remember to thank the helper and give some karma!
Please, do NOT send me any private messages!!

trkmml

i m sorry for late reply

here is my schema

i use extra 10uf capacitor on nrf vcc-gnd pins. its not on the schema


when i use 2 arduino with robin's examples, i got  just 50cm-60cm range i need 5-6m indoor range. nrf's to be used in plastic box

I do not want to cross the walls


i try with nrf adapters but same

i read somewhere need current up to 200ma when tx

i have 7/24 online arduino with 220v-5v (700ma) buck converter.

what else can I do? i try several examples on youtube

thank you for help.

Robin2

when i use 2 arduino with robin's examples, i got  just 50cm-60cm range i need 5-6m indoor range. nrf's to be used in plastic box
I have had no trouble with a greater indoor range than 6m with both nRF24s inside plastic boxes.

How have you oriented the antennas relative to each other (they are directional) and are they very close to metal or electronics that might be shielding the transmissions?

When you say you are using my examples do you mean that you have not changed a single thing in them?

Your diagram shows a buck-converter (if I read it correctly - it was sideways) and I think sometimes they cause problems. Try powering the Arduinos from a pack of 6 x AA alkaline cells and see if that improves things.

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

trkmml

I have had no trouble with a greater indoor range than 6m with both nRF24s inside plastic boxes.

How have you oriented the antennas relative to each other (they are directional) and are they very close to metal or electronics that might be shielding the transmissions?

When you say you are using my examples do you mean that you have not changed a single thing in them?

Your diagram shows a buck-converter (if I read it correctly - it was sideways) and I think sometimes they cause problems. Try powering the Arduinos from a pack of 6 x AA alkaline cells and see if that improves things.

...R
i will use 3d printed custom box.

I will place one of the plastic boxes in the air conditioner.(near to the electrical component)

I used your code by changing the outgoing message and some of the incoming reply.

does not this buck converter match the EMC?

i will try with batteries

thank you for answer

Robin2

I used your code by changing the outgoing message and some of the incoming reply.
If you are having problems start with the unchanged code. When that works, then try changing things a little at a time.

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

Paul_KD7HB

i will use 3d printed custom box.

I will place one of the plastic boxes in the air conditioner.(near to the electrical component)

I used your code by changing the outgoing message and some of the incoming reply.

does not this buck converter match the EMC?

i will try with batteries

thank you for answer
Have you tested the plastic boxes to see how well they pass 2.4 GHz rf? When you say "in the air conditioning", I think a metal box with all the coils and compressor, fan, for the unit. What are you really doing with the box?

Paul

trkmml

Have you tested the plastic boxes to see how well they pass 2.4 GHz rf? When you say "in the air conditioning", I think a metal box with all the coils and compressor, fan, for the unit. What are you really doing with the box?

Paul
when i put nrf in box comminucations fail.
im try to do some smart home stuff,
e.g.  detect window open (with reed relay based window sensor) and cut off a.c. with relay. (wireless) i can do it with wire

this time i m going to try with esp8266
I found a similar product on google. Working with esp8266. "sonoff relay".
and this library https://github.com/tzapu/WiFiManager
I set up a circuit and I can control both the window sensor and the relay in the air conditioner with GPIO pins on esp8266 without arduino

I have tried with 433 rf relay before. the signals were mixed. I did not receive the required income from the NRF and gave up the NRF.
I am currently working on esp8266.

thank you for answer

Go Up