geen communicatie tussen twee arduino's nrf24l01

Arduino specifieke Software
Berichten: 21
Geregistreerd: 25 Mei 2016, 10:21

geen communicatie tussen twee arduino's nrf24l01

Berichtdoor tim- » 25 Mei 2016, 10:28

Hallo,

Ik probeer te communiceren tussen twee arduino's met de nrf24l01

het probleem

er is geen communicatie tussen de twee modules.

Deze tutorials heb ik al geprobeerd
Ik heb alles bekabeld zoals aangegeven per tutorial. Ik heb de library gebruik waar naar verwezen word in de tutorial en heb de oude eerst verwijderd.

https://maniacbug.wordpress.com/2012/03/30/rf24network/

https://www.youtube.com/watch?annotation_id=annotation_3313246909&feature=iv&src_vid=rBAIqAaRu0g&v=KZ5x1NF-Emc

Ik heb ook de example sketch van de Rf24 library gettingstarted geprobeerd maar dat deed ook niks


The set-up:

wiring of the nrf24l01 as mentioned in the tutorial.
(i double checked the wiring every time)

I tried a lot of different combinations
the adapter module contains a voltage stabilizer from 5v to 3.3v

both the nrf24l01s with adapter module and both without adapter module also one with and one without adapter module.

I connected both nrf24l01s to an arduino pro mini (3,3v)
I connected one nrf24l01 to an arduino uno and the other one to an arduino mini pro (3,3v)
I connected both nrf24l01s to an arduino uno

also adjusted some scripts to use PA_LOW, but still no results.

does someone have any thought what i am doing wrong.. or what i could try to make it work?

This is the code i use for the TX side
cpp code
#include <SPI.h>
#include <RF24.h>
#include <nRF24L01.h>
#include <printf.h>
// declare variables
RF24 radio(9,10); //ce,cs pin
const uint64_t add1 = 0x0a0c0a0c0aLL;
char msg[10];
void setup() {
 // put your setup code here, to run once:
 Serial.begin(9600);
 radio.begin();
 printf_begin();
 radio.openWritingPipe(add1);
 radio.printDetails(); //check if there is an error appear when you try to connect nRF to arduino
}

void loop() {
 // put your main code here, to run repeatedly:

}
void serialEvent()
{
 //memset(msg,' ',sizeof(msg));
 Serial.readBytesUntil('\n',msg,sizeof(msg));
 radio.write(msg,sizeof(msg));
}


this is the code i use for the RX side.
cpp code
#include <SPI.h>
#include <RF24.h>
#include <nRF24L01.h>
#include <printf.h>
// declare variables
RF24 radio(9,10); //ce,cs pin
const uint64_t add1 = 0x0a0c0a0c0aLL;
char msg[10];
void setup() {
 // put your setup code here, to run once:
 Serial.begin(9600);
 radio.begin();
 printf_begin();
 radio.openReadingPipe(1,add1);
 radio.startListening();
 radio.printDetails();
 
}

void loop() {
 // put your main code here, to run repeatedly:
 if(radio.available())
 {
   
   //memset(msg,' ',sizeof(msg));
   radio.read(msg,sizeof(msg));
   Serial.println(msg);
 }
}



RESULT:
TX zend wel iets maar tx ontvangt het niet.
dit bij alle tutorials of sketches.

iemand een oplossing?

Advertisement

Gebruikers-avatar
Berichten: 5043
Geregistreerd: 13 Mei 2013, 20:57
Woonplaats: Heemskerk

Re: geen communicatie tussen twee arduino's nrf24l01

Berichtdoor nicoverduin » 25 Mei 2016, 10:39

Dit probleem hebben we al eens eerder gehad met iemand. De oorzaak kan liggen in:
a) enorme verstoringen op de 2.4Ghz. Dit kan je zien door de scanner (een van die voorbeeld in de library) te draaien. Dan moet je op kanaal 6-13 genoeg zien en af en toe een van de anderen. bij de TS toen stond het vol van de rommel.
b) kan een defect nRF module zijn.

Wat krijg je bij de details? Zet die ook even hier van beide modules.
Docent HBO Technische Informatica, Embedded ontwikkelaar & elektronicus
http://www.verelec.nl

Berichten: 21
Geregistreerd: 25 Mei 2016, 10:21

Re: geen communicatie tussen twee arduino's nrf24l01

Berichtdoor tim- » 25 Mei 2016, 11:38

hier het resultaat van de details

gebruik deze tx
Code: Alles selecteren
#include <SPI.h>
#include <RF24.h>
#include <nRF24L01.h>
#include <printf.h>
// declare variables
RF24 radio(9,10); //ce,cs pin
const uint64_t add1 = 0x0a0c0a0c0aLL;
char msg[10];
void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
  radio.begin();
  printf_begin();
  radio.openWritingPipe(add1);
  radio.printDetails(); //check if there is an error appear when you try to connect nRF to arduino
}

void loop() {
  // put your main code here, to run repeatedly:

}
void serialEvent()
{
  memset(msg,' ',sizeof(msg));
  Serial.readBytesUntil('\n',msg,sizeof(msg));
  radio.write(msg,sizeof(msg));
}



resultaat
STATUS = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
RX_ADDR_P0-1 = 0x0a0c0a0c0a 0xcccccccc3c
RX_ADDR_P2-5 = 0x33 0xce 0x3e 0xe3
TX_ADDR = 0x0a0c0a0c0a
RX_PW_P0-6 = 0x20 0x20 0x20 0x20 0x20 0x20
EN_AA = 0x00
EN_RXADDR = 0x3f
RF_CH = 0x4c
RF_SETUP = 0x07
CONFIG = 0x0e
DYNPD/FEATURE = 0x00 0x00
Data Rate = 1MBPS
Model = nRF24L01+
CRC Length = 16 bits
PA Power = PA_MAX

rx
Code: Alles selecteren
#include <SPI.h>
#include <RF24.h>
#include <nRF24L01.h>
#include <printf.h>
// declare variables
RF24 radio(9,10); //ce,cs pin
const uint64_t add1 = 0x0a0c0a0c0aLL;
char msg[10];
void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
  radio.begin();
  printf_begin();
  radio.openReadingPipe(1,add1);
  radio.startListening();
radio.printDetails();
 
}

void loop() {
  // put your main code here, to run repeatedly:
  if(radio.available())
  {
   
    memset(msg,' ',sizeof(msg));
    radio.read(msg,sizeof(msg));
    Serial.println(msg);
  }
}


resultaat:
STATUS = 0x0f RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=1
RX_ADDR_P0-1 = 0x0000000fc3 0x00000000f0
RX_ADDR_P2-5 = 0x00 0x41 0xe3 0x70
TX_ADDR = 0x000000788c
RX_PW_P0-6 = 0x1e 0x3c 0x1e 0x78 0x00 0x78
EN_AA = 0x0f
EN_RXADDR = 0x3c
RF_CH = 0xf0
RF_SETUP = 0x78
CONFIG = 0x0f
DYNPD/FEATURE = 0x00 0x80
Data Rate = 1MBPS
Model = nRF24L01
CRC Length = 16 bits
PA Power = PA_MIN


met een heleboel vage tekens als of het nog probeert iets te doen.. (vierkantjes euro tekens iedere keer op een nieuwe regel..)

Berichten: 21
Geregistreerd: 25 Mei 2016, 10:21

Re: geen communicatie tussen twee arduino's nrf24l01

Berichtdoor tim- » 25 Mei 2016, 11:53

heb trouwens meerdere nrf modules liggen en weet zeker dat ze niet kapot zijn

Gebruikers-avatar
Berichten: 5043
Geregistreerd: 13 Mei 2013, 20:57
Woonplaats: Heemskerk

Re: geen communicatie tussen twee arduino's nrf24l01

Berichtdoor nicoverduin » 25 Mei 2016, 12:04

Het ziet er naar uit dat je zender op een andere pipe zit als de ontvanger. Default zend hij uit op pipe(lees subkanaal) 1 dacht ik. En de ids zijn volledig verschillend
Docent HBO Technische Informatica, Embedded ontwikkelaar & elektronicus
http://www.verelec.nl

Berichten: 21
Geregistreerd: 25 Mei 2016, 10:21

Re: geen communicatie tussen twee arduino's nrf24l01

Berichtdoor tim- » 25 Mei 2016, 12:12

Heb de code gewoon vanuit een filmpje van youtube gedownload https://www.youtube.com/watch?v=4GSCHz_Fmm8 bij hem werkt het wel..

Heb de code wel gelezen en ben de opleiding voor programmeren aan het doen. Ik zie dat er wel naar hetzelfde adres verwezen word maar dat het resultaat van de RX_ADDR_P0-1 = 0x0000000fc3 0x00000000f0 en de TX_ADDR = 0x0a0c0a0c0a idd niet over een komen... terwijl dit wel het geval zou moeten zijn toch? (rx schrijft naar tx en andersom)

Ben al een aantal dagen aan het zoeken naar een oplossing je hebt idd zoals hier die pipe communicatie maar las ook ergens dat er een rf24Network is.. weet niet welke makkelijker is om mee te beginnen?
Heb je toevallig een sketch waar je zeker van bent dat het werkt die ik evt zou kunnen proberen??

Gebruikers-avatar
Berichten: 5043
Geregistreerd: 13 Mei 2013, 20:57
Woonplaats: Heemskerk

Re: geen communicatie tussen twee arduino's nrf24l01

Berichtdoor nicoverduin » 25 Mei 2016, 12:46

Ik heb al eens eerder hier op gereageerd in een ander topic. Ff zoeken onder mijn naam of nrf24l01 vind je het zeker
Docent HBO Technische Informatica, Embedded ontwikkelaar & elektronicus
http://www.verelec.nl

Berichten: 21
Geregistreerd: 25 Mei 2016, 10:21

Re: geen communicatie tussen twee arduino's nrf24l01

Berichtdoor tim- » 25 Mei 2016, 13:20

Heb inderdaad het fora al gevonden waar het over iets vergelijkbaars gaat.

Ik ben nu aan het kijken of ik die sketches kan gebruiken / aanpassen om communicatie te krijgen tussen de modules. Ik zal ook de uitkomst van mijn serial monitor even vergelijken met dat van u (paar reactie's verder)
hoop dat het exact overeenkomt en dat het nu gewoon eens gaat werken

Ik hou je op de hoogte of het gelukt is of niet.

Bedankt alvast!!

Gebruikers-avatar
Berichten: 5043
Geregistreerd: 13 Mei 2013, 20:57
Woonplaats: Heemskerk

Re: geen communicatie tussen twee arduino's nrf24l01

Berichtdoor nicoverduin » 25 Mei 2016, 13:22

suc6
Docent HBO Technische Informatica, Embedded ontwikkelaar & elektronicus
http://www.verelec.nl

Berichten: 21
Geregistreerd: 25 Mei 2016, 10:21

Re: geen communicatie tussen twee arduino's nrf24l01

Berichtdoor tim- » 25 Mei 2016, 13:33

dat ging sneller dan verwacht.. helaas..

Heb de sketches gebruikt die jij hebt gepost heb bij dit onderwerp (zonder aan te passen) een paar reacties later vermeld je ook de library dat je gebruikt hebt die heb ik ook gebruikt (andere allemaal verwijderd)
http://arduinoforum.nl/viewtopic.php?f=8&t=1633&hilit=nrf24l01&start=30
pagina 4.

en heb mijn resultaten vergeleken met die van u op pagina 5

Mijn resultaat:
TX kant
Code: Alles selecteren
Start zender
STATUS       = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
RX_ADDR_P0-1    = 0xe8e8f0f0e1 0x0a0c0a0c0a
RX_ADDR_P2-5    = 0x33 0xce 0x3e 0xe3
TX_ADDR       = 0xe8e8f0f0e1
RX_PW_P0-6    = 0x20 0x20 0x20 0x20 0x20 0x20
EN_AA       = 0x00
EN_RXADDR    = 0x3e
RF_CH       = 0x4c
RF_SETUP    = 0x07
CONFIG       = 0x0e
DYNPD/FEATURE    = 0x00 0x00
Data Rate    = 1MBPS
Model       = nRF24L01+
CRC Length    = 16 bits
PA Power    = PA_MAX


RX kant
Code: Alles selecteren
start ontvanger
STATUS       = 0x0f RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=1
RX_ADDR_P0-1    = 0x000000000f 0x000000000f
RX_ADDR_P2-5    = 0x0f 0x4c 0x0f 0x70
TX_ADDR       = 0x000000000f
RX_PW_P0-6    = 0x1e 0x31 0x3c 0x60 0x1e 0x3f
EN_AA       = 0x78
EN_RXADDR    = 0x0f
RF_CH       = 0x78
RF_SETUP    = 0x78
CONFIG       = 0x5f
DYNPD/FEATURE    = 0x00 0xf0
Data Rate    = 2MBPS
Model       = nRF24L01
CRC Length    = 16 bits
PA Power    = PA_MIN
Met nog heel veel getallen die er constant onder verschijnen (dus het leest of ontvang al iets dacht ik..)

heb de scan gedaan (lees overal dat er toch best veel storingen kunnen komen bij deze modules)

scan sketch:
cpp code
/*
Copyright (C) 2011 J. Coliz <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.
*/

/**
* Channel scanner
*
* Example to detect interference on the various channels available.
* This is a good diagnostic tool to check whether you're picking a
* good channel for your application.
*
* Inspired by cpixip.
* See http://arduino.cc/forum/index.php/topic,54795.0.html
*/

#include <SPI.h>
#include "nRF24L01.h"
#include "RF24.h"
#include "printf.h"

//
// Hardware configuration
//

// Set up nRF24L01 radio on SPI bus plus pins 7 & 8

RF24 radio(9,10);

//
// Channel info
//

const uint8_t num_channels = 126;
uint8_t values[num_channels];

//
// Setup
//

void setup(void)
{
//
// Print preamble
//

Serial.begin(115200);
printf_begin();
Serial.println(F("\n\rRF24/examples/scanner/"));

//
// Setup and configure rf radio
//

radio.begin();
radio.setAutoAck(false);

// Get into standby mode
radio.startListening();
radio.stopListening();

// Print out header, high then low digit
int i = 0;
while ( i < num_channels )
{
printf("%x",i>>4);
++i;
}
Serial.println();
i = 0;
while ( i < num_channels )
{
printf("%x",i&0xf);
++i;
}
Serial.println();
}

//
// Loop
//

const int num_reps = 100;

void loop(void)
{
// Clear measurement values
memset(values,0,sizeof(values));

// Scan all channels num_reps times
int rep_counter = num_reps;
while (rep_counter--)
{
int i = num_channels;
while (i--)
{
// Select this channel
radio.setChannel(i);

// Listen for a little
radio.startListening();
delayMicroseconds(225);


// Did we get a carrier?
if ( radio.testCarrier() ){
++values[i];
}
radio.stopListening();
}
}

// Print out channel measurements, clamped to a single hex digit
int i = 0;
while ( i < num_channels )
{
printf("%x",min(0xf,values[i]&0xf));
++i;
}
Serial.println();
}

// vim:ai:cin:sts=2 sw=2 ft=cpp


Resultaat:
Code: Alles selecteren
RF24/examples/scanner/
000000000000000011111111111111112222222222222222333333333333333344444444444444445555555555555555666666666666666677777777777777
0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcd


Ook die output is anders dan die van u..

Enig idee hoe dit kan komen?
zal zo nog even de sketch op de andere nrf24 module zetten om te kijken wat die output van de scan doet.. die zal ik binnen 10 min op het forum plaatsen.

Volgende

Terug naar Arduino software

Wie is er online?

Gebruikers in dit forum: Geen geregistreerde gebruikers en 74 gasten