Hi all, I need some help/pointers please:
I have 2 cheap NF24L01 modules I bought from eBay. I am trying them out by connecting them up as follows:
- One connected to a Pro Micro, also attached to a 16x2 character LCD. This will be the receiver, and will display characters received over RF on the screen.
- The other connected to a Nano 3. This will be the transmitter and will transmit, over RF, the characters it receives from the Serial Monitor. (It also echoes the characters back to the Serial Monitor for debugging purposes)
Nothing is happening when I try to send characters. I am at a bit of a loss what to try next for testing/debugging.
This is what I have tried so far: Ignoring both RF modules, I amended the receiver (the Pro Micro) sketch to pick up characters sent to its RXI pin and display these on the LCD (using Serial1.available() and Serial1.read() commands). Then, with a length of wire, I connected the TX pin on the transmitter (the Nano) to the RXI pin on the receiver (the Pro Micro). When I send characters from the Serial Monitor, they are displayed on the LCD. So at least that works.
Here are the 2 sketches. I have used a library called "Mirf", which I found on the Playground. I will create a couple of quick schematics and post them later, if you think that would help.
Transmitter sketch:
#include <SPI.h>
#include <Mirf.h>
#include <nRF24L01.h>
#include <MirfHardwareSpiDriver.h>
void setup() {
Serial.begin(9600);
Mirf.cePin = 10;
Mirf.csnPin = A6;
Mirf.spi = &MirfHardwareSpi;
Mirf.init();
Mirf.setRADDR((byte *)"clie2");
Mirf.payload = sizeof(char);
Mirf.config();
}
void loop() {
while (Serial.available()) {
char c = Serial.read();
Mirf.setTADDR((byte *)"clie1");
Mirf.send((byte *)&c);
while(Mirf.isSending()){
}
Serial.write(c);
}
}
Receiver Sketch:
#include <SPI.h>
#include <nRF24L01.h>
#include <Mirf.h>
#include <MirfSpiDriver.h>
#include <MirfHardwareSpiDriver.h>
#include <LiquidCrystal.h>
LiquidCrystal lcd(A3, A2, A1, A0, 10, 9);
void setup() {
Mirf.cePin = 8;
Mirf.csnPin = 7;
Mirf.spi = &MirfHardwareSpi;
Mirf.init();
Mirf.setRADDR((byte *)"clie1");
Mirf.payload = sizeof(char);
Mirf.config();
lcd.begin(16, 2);
lcd.print("Ready...");
}
void loop() {
while (Mirf.dataReady()) {
char c;
Mirf.getData((byte *) &c);
if (c == 13) lcd.clear(); else lcd.write(c);
}
}
Also attached are pictures of the transmitter and receiver circuits. Note that since the Pro Micro has no 3.3V output, I have used two diodes to drop the 5V down to about 3.1V (according to my DMM) to supply the RF module.
Any help would be appreciated!
Paul


