Transceiver nRF24AP1 connect with Arduino

Hi all
I am trying to set up a wireless network - ANT. I got 2 sets of "Transceiver nRF24AP1 with Trace Antenna" that I bought from SparkFun. They were connected with 2 arduinoes seperately. One of them I set it to transmit data (Master) and the other one I set it to receive data (Slave). Following are the connections between the Transceiver and Arduino :
MASTER :
Arduino 3.3v --> Transceiver vcc
Arduino TX --> Transceiver RX
Arduino GND --> Transceiver GND
SLAVE :
Arduino 3.3v --> Transceiver vcc
Arduino RX --> Transceiver TX
Arduino GND --> Transceiver GND
On the Arduinoes I installed following codes :

//// Master Arduino code ///
void setup()
{
Serial.begin(4800);
//reset()
Serial.print(0xa4); // SYNC Byte
Serial.print(0x01); // LENGTH Byte
Serial.print(0x4a); // Message ID Byte ( ANT_RestSystem() )
Serial.print(0x00); // Data Byte N (N=LENGTH)
Serial.print(0xef); // Checksum
delay(1000); //delay 1sec
}
void loop(){
//assignch()
Serial.print(0xa4); // SYNC Byte
Serial.print(0x03); // LENGTH Byte
Serial.print(0x42); // Message ID Byte ( ANT_AssignChannel() )
Serial.print(0x00); // Channel no. 0
Serial.print(0x10); // Channel type
Serial.print(0x00); // Network no. 0
Serial.print(0xf5); // Checksum
delay(1000); //delay 1sec
//setchid()
Serial.print(0xa4); // SYNC Byte
Serial.print(0x05); // LENGTH Byte
Serial.print(0x51); // Message ID Byte ( ANT_SetChannelId() )
Serial.print(0x00); // Channel no. 0
Serial.print(0x31); // Device no. = 0x0031
Serial.print(0x00); // Device no.
Serial.print(0x01); // Device Type Id
Serial.print(0x05); // Man Id
Serial.print(0xc5); // Checksum
delay(1000); //delay 1sec
//opench()
Serial.print(0xa4); // SYNC Byte
Serial.print(0x01); // LENGTH Byte
Serial.print(0x4b); // Message ID Byte ( ANT_OpenChannel() )
Serial.print(0x00); // Channel no. 0
Serial.print(0xee); // Checksum
delay(1000); //delay 1sec
//send()
Serial.print(0xa4); // SYNC Byte
Serial.print(0x09); // LENGTH Byte
Serial.print(0x4e); // Message ID Byte ( ANT_SendBroadcastData->ChannelEventFunc() )
Serial.print(0x00); // Channel no. 0
Serial.print(0xaa); //Data
Serial.print(0xaa); //Data
Serial.print(0xaa); //Data
Serial.print(0xaa); //Data
Serial.print(0xaa); //Data
Serial.print(0xaa); //Data
Serial.print(0xaa); //Data
Serial.print(0xaa); //Data
Serial.print(0xe3); // Checksum
Serial.println();
Serial.print("Hello world. I am master");
Serial.println();
}
---
///// Slave Arduino code ///
void setup()
{
Serial.begin(4800);
//reset()
Serial.print(0xa4); // SYNC Byte
Serial.print(0x01); // LENGTH Byte
Serial.print(0x4a); // Message ID Byte ( ANT_RestSystem() )
Serial.print(0x00); // Data Byte N (N=LENGTH)
Serial.print(0xef); // Checksum
delay(1000); //delay 1sec
}
void loop(){
//assignch()
Serial.print(0xa4); // SYNC Byte
Serial.print(0x03); // LENGTH Byte
Serial.print(0x42); // Message ID Byte ( ANT_AssignChannel() )
Serial.print(0x00); // Channel no. 0
Serial.print(0x00); // Channel type
Serial.print(0x00); // Network no. 0
Serial.print(0xe5); // Checksum
delay(1000); //delay 1sec
//setchid()
Serial.print(0xa4); // SYNC Byte
Serial.print(0x05); // LENGTH Byte
Serial.print(0x51); // Message ID Byte ( ANT_SetChannelId() )
Serial.print(0x00); // Channel no. 0
Serial.print(0x00); // Device no. = 0x0000
Serial.print(0x00); // Device no.
Serial.print(0x00); // Device Type Id
Serial.print(0x00); // Man Id
Serial.print(0xf0); // Checksum
delay(1000); //delay 1sec
//opench()
Serial.print(0xa4); // SYNC Byte
Serial.print(0x01); // LENGTH Byte
Serial.print(0x4b); // Message ID Byte ( ANT_OpenChannel() )
Serial.print(0x00); // Channel no. 0
Serial.print(0xee); // Checksum
delay(1000); //delay 1sec
//receive()
// read the incoming byte:
int incomingByte = Serial.read();
// say what you got:
Serial.print("I received: ");
Serial.println(incomingByte, DEC);
*} *

Regret, they cannot communicate to each other. :cry:
Pls help!!

Really nobody knows it! :cry: :cry: :cry:

Hi toffee;

I am confused by this:

MASTER :
Arduino 3.3v --> Transceiver vcc
Arduino TX --> Transceiver RX
Arduino GND --> Transceiver GND

SLAVE :
Arduino 3.3v --> Transceiver vcc
Arduino RX --> Transceiver TX
Arduino GND --> Transceiver GND

I think you have to have both arduino's connected to both TX and RX, and arduino TX to transceiver TX and arduino RX to transceiver RX.

The transceivers should be crossing the data in the air, you shouldn't have to cross or half-connect the connections...

Like this:

MASTER :
Arduino 3.3v --> Transceiver vcc
Arduino TX --> Transceiver TX
Arduino RX --> Transceiver RX
Arduino GND --> Transceiver GND

SLAVE :
Arduino 3.3v --> Transceiver vcc
Arduino TX --> Transceiver TX
Arduino RX --> Transceiver RX
Arduino GND --> Transceiver GND

[/code]

Admittedly though, I haven't seen the data sheet on that transceiver. Can you check the data sheet and make sure your electrical connections are correct?

Also - I saw 3.3V for VCC. You may want to ensure the TX/RX on the transceiver supports 5V from the arduino's communications.

I'm in a similar position. Has anyone used these two together successfully? I'd love some example code to work from.

D

The nRF24 doesn't have a serial UART, but a SPI interface. This means you have to use the ATmega MISO, MOSI, SCK pins and an additional SELECT pin.

Please have a look at the playground: Arduino Playground - Nrf24L01

In the following thread you can find some more information: nrf24L01 with Atmega168 driving me crazy - SparkFun Electronics Forum. On the sparkfun site you can also find the documentation of the chip.

MikeT

The AP1 actually does- check the spec. That's sadly why we've been having more trouble interfacing with it than with the ubiquitous SPI-based Nordic chips. The advantage of the AP1 is the hardware implementation of ANT.

D

Hi,

I think there is a bug in your program. When you use Serial.print(0x00), this is identical to Serial.print(0x00, DEC) which means instead of sending the binary value zero, the digit '0' == 0x31 is printed.

You might have to change Serial.print() with Serial.write().

MikeT

Yep, I'm not the author of the above. My code currently uses Serial.print(0x00, BYTE); and that seems to work with other serial-using devices.

This thread was kind of left open ended. Did anyone ever get a successful communication of this transceiver to another one or an ANT+ device?

I'm actually kind of surprised that no one has developed an ANT+ library yet -- it seems to be a fairly forgiving standard.

I have the same problem, my code currently uses Serial.print(0x00, BYTE); , too, but I don't receive responses from the transceiver, to my setup commands...
Nobody has ever used the nrf24ap1 with Arduino?