Is it possible to make the rf24l01 to work like a car key? I mean, when voltage is given/button pushed/ON, the transmitter will transmit a single & simple signal/output. I wanted to make it work like a beacon. So the transmitter will always transmit signal continuously, until forever. But the condition is, to make it without Arduino. Is that possible?
If you mean using the nrf24l01 alone without arduino connected the answer is kinda,
if you use a arduino to setup the nrf24l01 and then remove the arduino but keep the nrf24l01 powered the whole time the nrf24l01 will keep the settings until you remove the power or until the voltage fall below 1.6v-+
I will start with giving you a clue so you can try and figure it out for yourself, but YES it will work.
This is from the nrf24l01 data sheet:
REUSE_TX_PL 11100011 0 Used for a PTX device
Reuse last sent payload. Packets will be repeatedly resent
as long as CE is high.
TX payload reuse is active until W_TX_PAYLOAD or
FLUSH TX is executed. TX payload reuse must not be
activated or deactivated during package transmission
So start reading the data sheet to start with...
Good luck!!
swe-dude:
This is from the nrf24l01 data sheet:REUSE_TX_PL 11100011 0 Used for a PTX device
Reuse last sent payload. Packets will be repeatedly resent
as long as CE is high.
TX payload reuse is active until W_TX_PAYLOAD or
FLUSH TX is executed. TX payload reuse must not be
activated or deactivated during package transmission
Oh really? Thanks because that I'm just searching for this for a long time. The reply from other people was saying that the NRF24L01+ is unable to work without a controller/Arduino.
I had referred to the datasheet at Topic 7.5 Auto Retransmit.
It says that to enter PTX mode, I have to set the CE = 1
So I will connect the pin 1 - GND, pin 2 - 3.3Vcc, pic 3 - On/Vcc, to start transmitting a single signal?
what about enabling the Auto Retransmitting with the ACK packet thing?
Sorry if I'm a slow learner and didn't understand much from the datasheet.
You have to use a arduino or some other mcu to setup the nrf24l01 first after that, with the right settings, the nrf24l01 will happily spew out messages continually without any arduino or other mcu connected as long as the ce pin are high and as long as the nrf don't loose power, if it loses power the settings will be lost and you will have to setup the nrf24l01 again.
Auto Retransmit have a max limit of how many messages it will send, REUSE_TX_PL don't have any limit
I will take a look and see if i can find the code i used for setup and for receiver.
I did not find the old code but i pieced this together and gave it a fast test and it seems to be working.
This is the main setup part
#define CEq 13
// CE_BIT: Digital Input Chip Enable Activates RX or TX mode
#define CSNq 12
// CSN BIT: Digital Input SPI Chip Select
#define SCKq 11
// SCK BIT: Digital Input SPI Clock
#define MOSIq 10
// MOSI BIT: Digital Input SPI Slave Data Input
#include "API.H"
//***************************************************
#define TX_ADR_WIDTH 5 // 5 unsigned chars TX(RX) address width
#define TX_PLOAD_WIDTH 5 // 5 unsigned chars TX payload
unsigned char TX_ADDRESS[TX_ADR_WIDTH] =
{
0x34,0x43,0x10,0x10,0x01
}; // Define a static TX address
unsigned char rx_buf[TX_PLOAD_WIDTH] = {0}; // initialize value
unsigned char tx_buf[TX_PLOAD_WIDTH] = {0};
//***************************************************
void setup()
{
pinMode(CEq, OUTPUT);
pinMode(SCKq, OUTPUT);
pinMode(CSNq, OUTPUT);
pinMode(MOSIq, OUTPUT);
init_io(); // Initialize IO port
tx_buf[0]='H';
tx_buf[1]='E';
tx_buf[2]='L';
tx_buf[3]='L';
tx_buf[4]='O';
digitalWrite(CEq, 0);
SPI_Write_Buf(WRITE_REG + TX_ADDR, TX_ADDRESS, TX_ADR_WIDTH); // Writes TX_Address to nRF24L01
SPI_Write_Buf(WRITE_REG + RX_ADDR_P0, TX_ADDRESS, TX_ADR_WIDTH); // RX_Addr0 same as TX_Adr for Auto.Ack
SPI_RW_Reg(WRITE_REG + EN_AA, 0x00); // Disable Auto.Ack:Pipe0
SPI_RW_Reg(WRITE_REG + EN_RXADDR, 0x01); // Enable Pipe0
SPI_RW_Reg(WRITE_REG + SETUP_RETR, 0x1a); // 500us + 86us, 10 retrans...//not used when aa=0...
SPI_RW_Reg(WRITE_REG + RF_CH, 40); // Select RF channel 40
SPI_RW_Reg(WRITE_REG + RF_SETUP, 0x27); // TX_PWR:0dBm, Datarate:250kbps, LNA:HCURR
SPI_RW_Reg(WRITE_REG + CONFIG, 0x0e); // Set PWR_UP bit, enable CRC(2 unsigned chars) & Prim:TX. MAX_RT & TX_DS enabled..
SPI_Write_Buf(WR_TX_PLOAD,tx_buf,TX_PLOAD_WIDTH);
digitalWrite(CEq, 1);
delay(2);
SPI_RW_Reg(0xE3,0);//reuse payload
}
void loop()
{
digitalWrite(CEq, 1);
delayMicroseconds(500);
digitalWrite(CEq, 0);
delay(5000);
}
This will setup the nrf24l01 to re-transmit the last used payload in this case hello
after that it will toggle ce pin for 500us every 5sec just to test so it is working..., you can remove the data leads at any time after the setup part are done and it will still transmit as long as ce pin are high
You can change the pins it use to whatever suits you
Good luck and let me know if you have any other questions
You have the complete code here below, i added a simple receiver code too have fun.
Nrf24l01_reuse_payload.zip (6.89 KB)
Wow! This really help me a big big step forward!
I followed your instructions and had my first time transmit succeed!
At the TX, it works well when I removed the MOSI - pin 10/SCK pin 11
But there is some little questions/problems at the TX:
Condition: CSN - pin 12/ CE - pin 13
Each problem is based on the condition above
-
When I unplugged the CSN from the Arduino, it stopped transmitting.
And when I place it to GND, it started to transmit again.
Should I just let the CSN/SCK/MOSI Grounded right after I turn it on? -
I tried to pull up the CE pin.
It didnt stop transmit but it started to transmit extremely fast.
It was like 1sec could transmit up to more than 100 lines. -
When I exchange the CSN pin to GND, and remove CE,
The transmitter also won't stop as usual.
Transmitter continued to transmit data like 1sec 5lines
Maybe I still need to refer to the data sheet for CE and CSN
Hello i just did some more tests and it appears some modules have a pull up on ce pin integrated so with ce unconnected it will continually transmit,
So to stop transmitting you have to pull CE pin low, If you use a 10k resistor to pull it low you can pull it high with a button to vcc to make it transmit, or just to be safe maybe use a 1k resistor from button to vcc, that way you wont have any problem if you punch the button and have it connected to arduino at the same time...
As for csn and mosi and sck i don't have any problem leaving those unconnected on any module i have tried.
But yours might be different or something not sure.
The standard status of the pins on the arduino connected to the nrf are.
CSNq high
SCKq low
MOSIq can be either high or low depending on the last transmitted bit.
So pull up resistor on CSN and down on SCK wont hurt any but i cant see that it should be needed.
Happy experimenting!!!