Go Down

Topic: NRF24L01+ Worked then stopped (Read 119 times) previous topic - next topic

slarosa

Good day,

I have been working on a project to have a control glove send data to a central Arduino in order to play a corresponding sound. Currently I am using 1 Arduino nano with a NRF24L01+ module to transmit test data and a second Arduino nano with a NRF24L01+ to receive the data. This second Arduino is also use an MicroSD card breakout from adafruit and a 8ohm speaker.

I had this setup successfully working, however now the receiving module is not being seen by the Arduino. I have attempted to replace both the Arduino and NRF24L01+ module. I have also reverted the code to a state that did work and still having the error.

Currently im hitting the "Radio initialization failed!"

Any constructive criticism is welcome. I plan on using this forum more and would like to make valuable posts.

The pin out for The NRF24 and sd module...
NRF24|#|SD
GNDGND|#|5V5V
VCC3.3V|#|GNDGND
CED7|#|CLKD13
CSND8|#|DOD12
SCKD13|#|DID11
MOSID11|#|CSD10
MISOD12|#|


The speaker is using GND and D9

Code: [Select]

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

//SD config
#define SD_ChipSelectPin 10

//Radio Config
RF24 radio(7 , 8); // CE, CSN
const byte address[6] = "00001";

//Speaker Config
TMRpcm tmrpcm;

void setup() {
  Serial.begin(9600);
  //Radio Setup
  radio.begin();
  radio.openReadingPipe(0, address);
  radio.setPALevel(RF24_PA_MIN);
  radio.startListening();

  //SD Setup
  if (!SD.begin(SD_ChipSelectPin)) {
    Serial.println("SD initialization failed!");
    while (1);
  }
  else {
    Serial.println("SD initialization done.");
  }

  //Radio Setup
  if (!radio.available()){
    Serial.println("Radio initialization failed!");
    while (1);
  }
  else {
    Serial.println("Radio initialization done.");
  }
 
  //Speaker Setup
  tmrpcm.speakerPin = 9;
  tmrpcm.setVolume(3);
}

void loop(){ 

  //Listneing on the radio
  char gloveInput[32] = "";
  radio.read(&gloveInput, sizeof(gloveInput));

  //Testing to see the data coming in
  Serial.println(gloveInput);

  //Play Sound based on input
  if(strcmp(gloveInput,"rightOne")==0){
    tmrpcm.play("Lycoris_Hello.wav");
  }
  if(strcmp(gloveInput,"rightTwo")==0){
    tmrpcm.play("Lycoris_Yes.wav");
  }
  if(strcmp(gloveInput,"rightThree")==0){
    tmrpcm.play("Lycoris_No.wav");
  }
  if(strcmp(gloveInput,"rightFour")==0){
    tmrpcm.play("Lycoris_GoodBye.wav");
  }
  if(strcmp(gloveInput,"leftOne")==0){
    tmrpcm.play("Lycoris_Hug.wav");
  }
  if(strcmp(gloveInput,"leftTwo")==0){
    tmrpcm.play("Lycoris_Picture.wav");
  }
  if(strcmp(gloveInput,"leftThree")==0){
    tmrpcm.play("Lycoris_Help.wav");
  }
  if(strcmp(gloveInput,"leftFour")==0){
    tmrpcm.play("Lycoris_Introduction");
  }
}

Robin2

Have a look at this Simple nRF24L01+ Tutorial.  Especially try the connection test program in Reply #29.

In other Threads I have read that the regular SD card library does not work nicely with other SPI devices.

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

slarosa

#2
Aug 09, 2018, 10:56 pm Last Edit: Aug 09, 2018, 11:02 pm by slarosa Reason: Added Picture
Hi Robin2,

Thanks for the input on this issue! I had seen your reply's around when researching and troubleshooting for this project.

I did check out your tutorial before and found it very helpful during my initial and continued learning.

I am dumbfounded with my project due to it working for a solid hour and after making a change with what channel is used, it stopped working.

I figured restoring back to a working setup would have helped but it did not. I have tried reconnecting everything and found that the issue is probably SPI. I found that the SD and radio modules are working when the other is not plugged in now.


swe-dude

#1 I don't see any extra caps on the pictures if you don't have any add 0,1uf and 10uf+ on the 3v3 power.

#2 try adding a delay in setup to let everything power-up in peace before you initialize anything.

#3 try re-initializing the radio something like this mayby:

Code: [Select]

  while (!radio.available()){
    Serial.println("Radio initialization failed! trying again....");
    delay(3000);

  radio.begin();
  radio.openReadingPipe(0, address);
  radio.setPALevel(RF24_PA_MIN);
  radio.startListening();
  }


Best of luck!

Robin2

I am dumbfounded with my project due to it working for a solid hour and after making a change with what channel is used, it stopped working.
Your Reply does not provide any information that I can use to help you.

My suggestion is to disconnect everything and then set up the minimum necessary to get my first tutorial example working.

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

Go Up