Hi everyone, I am working with NRF24 connected with Arduino Uno and OPenCM9.04 board as transmitter and receiver respectively or vice versa, using Arduino IDE to upload the code. I had used the same example codes (attached below) on two Arduino Uno and it worked fine. However, now problem is after uploading the codes on OpenCM and Arduino Uno when I open the serial monitor I am not receiving or I can't send any data from OpenCM. The code and hardware setup can be seen below;
Hardware Setup:
Arduino Uno : NRF24
5v --> VCC
GND --> GND
D8 --> CE
D10 --> CSN
D11 --> MOSI
D12 --> MISO
D13 --> SCK
OpenCM904 : NRF24
5v --> VCC
GND --> GND
D16 --> CE
D17 --> CSN
A7 --> MOSI
A6 --> MISO
A1 --> SCK
Transmitter Code:
/*
* Arduino Wireless Communication Tutorial
* Example 1 - Transmitter Code
*
* by Dejan Nedelkovski, www.HowToMechatronics.com
*
* Library: TMRh20/RF24, https://github.com/tmrh20/RF24/
*/
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
RF24 radio(8, 10); // CE, CSN, SCK->13, MOSI->11, MISO->12 For arduino UNO
const byte address[6] = "00001";
int time1;
void setup() {
Serial.begin(115200);
radio.begin();
radio.openWritingPipe(address);
radio.setPALevel(RF24_PA_MIN);
radio.stopListening();
Serial.println ("Setup Done");
}
void loop() {
time1=millis();
radio.write(&time1, 32);
Serial.println(time1);
delay(1);
}
Receiver Code:
/*
* Arduino Wireless Communication Tutorial
* Example 1 - Receiver Code
*
* by Dejan Nedelkovski, www.HowToMechatronics.com
*
* Library: TMRh20/RF24, https://github.com/tmrh20/RF24/
*/
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
RF24 radio(16, 17); //CE, CSN (16,17), SCK->A1, MOSI->A7, MISO->A6 FOr OpenCM
const byte address[6] = "00001";
int time1;
void setup() {
Serial.begin(115200);
radio.begin();
radio.openReadingPipe(0, address);
//radio.setDataRate(RF24_250KBPS);
radio.setPALevel(RF24_PA_MIN);
radio.startListening();
Serial.println("Setup Done");
}
void loop() {
if (radio.available()) {
Serial.print("Received: ");
radio.read(&time1, 10);
Serial.println(time1);
Serial.println("loop running");
}
else {
Serial.println("Receiving Failed");
}
}
Serial monitor (Receiver):
Receiving Failed
Receiving Failed
Receiving Failed
Serial monitor (Transmitter):
Setup Done
10
43
75
108
The problem must should be with the OpenCM board as the code can also be uploaded but it isn't receiving any data from transmitter. I also don't know whether we can connect NRF24 with OpenCM or not, also may be the way I have wired the NRF24 with OpenCM904 is not correct.
It would be great if any one can help and thanks.