pradeep_k_b
Full Member level 3
- Joined
- Dec 21, 2011
- Messages
- 160
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,306
- Location
- Nilambur, India
- Activity points
- 2,509
Hi,I have already designed a RF remote control using 433Mhz RF transmitter&receiver + pic16f628.And this remote control is working fine.Now I am trying to replace the 433Mhz RF transmitter&receiver with nRF24L01 tranciever.But when I bought this one seems entirely different from the old RF transmitter and receiver.Actually I am trying to extend the range of remote control by using 4 nRF24L01 and I want to use 2 of them as repeaters.My idea is like this,there will be 4 units,the first one will be transmitter and the last one receiver,the remaining two will act as repeater
Transmitter-->>repeater-->>repeater--->>receiver ,
The two of them (repeaters) need to receive the signal and want to transmit again the same signal.In this way i think I will be able to increase the range.This is why i decided to replace 433Mhz one with nRF24L01
If you don't mind let me ask you something,
How to connect nRF24L01 to PIC16F628?
Can I use the same code here that I used for 433MHz?.Or can I modify that code easily to a nRF24L01 compatible one?
I am attaching the code(I am not great in coding and I wrote this with the help of my friend)
Transmitter
Receiver
I'd greatly appreciate if you could help me
Transmitter-->>repeater-->>repeater--->>receiver ,
The two of them (repeaters) need to receive the signal and want to transmit again the same signal.In this way i think I will be able to increase the range.This is why i decided to replace 433Mhz one with nRF24L01
If you don't mind let me ask you something,
How to connect nRF24L01 to PIC16F628?
Can I use the same code here that I used for 433MHz?.Or can I modify that code easily to a nRF24L01 compatible one?
I am attaching the code(I am not great in coding and I wrote this with the help of my friend)
Transmitter
Code:
void main()
{
int keyPressed;
TRISA = 0xFF; //set all pin of port A as an input
PORTA = 0x00;
TRISB = 0x00; //set all pin of port B as an output
PORTB = 0x00;
CMCON = 0x07;
UART1_Init(9600); // initialize UART module
Delay_ms(100);
while(1)
{
keyPressed = PORTA; //
Delay_ms(20); // software debouncing time
keyPressed = keyPressed & 0x1F; // masking higher 3 bits
switch(keyPressed)
{
case 0x1E: UART1_Write('F'); Delay_ms(500);break;
case 0x1D: UART1_Write('B'); Delay_ms(500);break;
case 0x1B: UART1_Write('R'); Delay_ms(500);break;
case 0x17: UART1_Write('L'); Delay_ms(500);break;
case 0x0F: UART1_Write('S'); Delay_ms(500);break;
}
}
}
Receiver
Code:
unsigned int receive;
void main()
{
TRISA = 0x00; //set all pin of port A as an input
TRISB = 0b00000010; //set all pin of port B as an output
PORTB=0x00;
UART1_Init(9600); // initialize UART module
Delay_ms(100);
PIE1.RCIE = 1; //
PIR1.RCIF = 0;
INTCON.GIE = 1;
INTCON.PEIE = 1;
while(1);
}
void Interrupt(void) //
{
unsigned char receive0x00;
if(PIR1.RCIF) //
{
receive = UART1_Read();
switch(receive)
{
case 'F': PORTA.F0=1; Delay_ms(500);PORTA.F0=0;break; // Switching On and Off a particular port pin with 100ms delay
case 'B': PORTA.F1=1; Delay_ms(500);PORTA.F1=0;break;
case 'R': PORTA.F2=1; Delay_ms(500);PORTA.F2=0;break;
case 'L': PORTA.F3=1; Delay_ms(500);PORTA.F3=0;break;
case 'S': PORTA.F4=1; Delay_ms(500);PORTA.F4=0;break;
}
}
}
I'd greatly appreciate if you could help me