system
June 16, 2014, 7:04am
#1
Transmitter
#include <SPI.h>
#include "nRF24L01.h"
#include "RF24.h"
#define tempPin 0
RF24 radio(9,10);
int temp;
float tempC;
const uint64_t pipe = 0xE8E8F0F0E1LL;
void setup()
{
Serial.begin(9600);
Serial.print("LM35 Test Program");
Serial.println();
radio.begin();
radio.openWritingPipe(pipe);
}
void loop()
{
temp = analogRead(tempPin);
tempC = (temp * 5.0 * 100.0/1024.0);
Serial.print("Read Sensor : ");
Serial.print(tempC);
Serial.println(" C");
radio.write(&tempC,sizeof(tempC));
delay(1000);
}
receiver
#include <SPI.h>
#include "nRF24L01.h"
#include "RF24.h"
RF24 radio(9,10);
float temp;
const uint64_t pipe = 0xE8E8F0F0E1LL;
void setup(void)
{
Serial.begin(9600);
radio.begin();
radio.openReadingPipe(1,pipe);
radio.startListening();
}
void loop(void)
{
if(radio.available())
{
bool done = false;
while(!done)
{
done = radio.read(&temp,sizeof(temp));
Serial.print("Suhu : ");
Serial.print(temp);
Serial.println(" C");
}
}
else
{
Serial.println("No Radio Available");
}
delay(1000);
}
in rx just no radio avaible
help thx
this the screenshot http://imgur.com/GeflQk7
Hi granzil
Does it help if you add this after radio.begin()?
radio.powerUp() ;
There was a recent thread where the OP had the same "radio not available" problem. He fixed it by using code from this thread:
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...
Regards
Ray
system
June 16, 2014, 9:25am
#3
ok thx for respon..
im adding radio power up remain same no radio avaible
system
June 16, 2014, 11:54am
#4
hi… already follow in other forum but
transmitter
#include <SPI.h>
#include <RF24.h>
#include <dht11.h>
#define CE 9
#define CSN 10
#define dht11Pin 2
RF24 radio(CE, CSN);
dht11 suhu;
int nilai;
int temp;
const uint64_t pipes[2] = { 0xF0F0F0F0E1LL, 0xF0F0F0F0D2LL };
void setup()
{
Serial.begin(9600);
radio.begin();
radio.openWritingPipe(pipes[0]);
radio.openReadingPipe(1,pipes[1]);
radio.enableDynamicPayloads() ;
radio.setAutoAck(true);
radio.setDataRate(RF24_1MBPS);
radio.powerUp();
}
void loop()
{
nilai = suhu.read(dht11Pin); //baca data sensor
temp = suhu.temperature;
Serial.print("Suhu = ");
Serial.print(temp);
Serial.println(" C");
Serial.println();
radio.write(&temp, sizeof(int));
delay(1000);
}
receiver
#include <SPI.h>
#include <RF24.h>
#define CE 9
#define CSN 10
RF24 radio(CE, CSN);
int suhu;
const uint64_t pipes[2] = { 0xF0F0F0F0E1LL, 0xF0F0F0F0D2LL };
void setup()
{
Serial.begin(9600);
radio.begin();
radio.openWritingPipe(pipes[1]);
radio.openReadingPipe(1,pipes[0]);
radio.enableDynamicPayloads() ;
radio.setAutoAck(true);
radio.setDataRate( RF24_1MBPS );
radio.powerUp() ;
radio.startListening();
Serial.println("RX ready...");
Serial.println();
}
void loop()
{
while (radio.available())
{
radio.read(&suhu, sizeof(int));
Serial.print("Suhu = ");
Serial.print(suhu);
Serial.println(" C");
Serial.println();
}
delay(20);
}
tenperatur sent if I close monitor tx and re open and in rx only get 1 or 2 information temperature
need help thx b4
system
June 16, 2014, 7:17pm
#5
I don’t think those pin assignments are correct for RF24 lib. They look like the NRF24 LIB pin assignments.
http://arduino-info.wikispaces.com/Nrf24L01-2.4GHz-HowTo
According to the second link they are correct.
arduino-RF24- Nrf24L01-2.4GHz-PINOUTS.htm (86.6 KB)
system
June 19, 2014, 9:48am
#6
thx for respon bro.my pin is right .. but.. i think i cannot join nrf and 433mhz.... it will wrong information.. so i wanna asking using nrf24l01 im want using for send value temperature if temp >30 fan on.. and can i send back.. for turn off the fan. the fan using relay.. onliy using nrf24l01 half duplex
and my friend asking how to he send a sensor data to receiver and the receiver send data back using nrf24l01
thx b4
system
June 20, 2014, 1:08am
#7
Look at the examples in the RF24 LIBRARY. There is an example that controls a led connected to receiver based on a button pressed on transmitter. There is also an example with six buttons controlling six leds on receiver end.
system
June 20, 2014, 3:20pm
#8
ok thx raschemmel, so this my coding for transmit the dht11 sensor using nrf but for send back… what i need?
transmitter
#include <nRF24L01.h>
#include <RF24.h>
#include <RF24_config.h>
#include <SPI.h>
int msg;
RF24 radio(9,10);
const uint64_t pipes[2] = { 0xF0F0F0F0E1LL, 0xF0F0F0F0D2LL };
void setup(void)
{
Serial.begin(9600);
radio.begin();
radio.openWritingPipe(pipes[0]);
radio.openReadingPipe(1,pipes[1]);
radio.startListening();
}
void loop(void)
{
if (radio.available())
{
bool done = false;
done = radio.read(&msg,sizeof(msg));
Serial.print("Suhu : ");
Serial.println(msg);
}
}
receiver
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
#include <RF24_config.h>
#include <dht11.h>
#define dht11Pin 2
int msg[1];
dht11 suhu;
int temp;
RF24 radio(9,10);
const uint64_t pipes[2] = { 0xF0F0F0F0E1LL, 0xF0F0F0F0D2LL };
void setup(void)
{
Serial.begin(9600);
radio.begin();
radio.openWritingPipe(pipes[0]);
radio.openReadingPipe(1,pipes[1]);
}
void loop(void)
{
temp = suhu.read(dht11Pin);
Serial.println(suhu.temperature);
msg[0] = suhu.temperature;
radio.write(msg,1);
radio.powerDown();
delay(1000);
radio.powerUp();
}
system
June 20, 2014, 4:53pm
#9
Did you look at the examples ?
system
June 20, 2014, 8:31pm
#10
system
June 20, 2014, 9:31pm
#11
Hi ,please put a radio.printDetails() in the setup void , and with that at the top #include "printf.h" and before radio.begin put a printf_begin(). Attach the serial output , and some information about your connections would be good (eg. MOSI=pin x, SCK=pin y ).
Andrei