Aventuras y Desventuras de un hobbyist

Aventuras y Desventuras de un hobbyist....

nRF24L01 + Arduino

I will keep working on the concept of IOT(internet of things).

Wireless connections are the standard of todays comunications therfore the IOT should follow this path.

Xbee are very reliable way of comunicating wirelessly however this devices are very expensive, I set myself to find a cheap and reliable way of comunicating devices using RF, so after sometime I expend reading on Internet I finally found the nRF24L01 module from Iteadstudio for $ 5.50 nRF24L01 module

They provide a couple of code examples but they pretty poor.
Luckily I found one library in the Arduino website called MIRF and another most powerfull library created named nRFL2401 http://maniacbug.wordpress.com the later the one I am going to use in this write up.

-----Descarga la libreria nRFL2401 ----

First of all we are going to setup the hardware connections;


nRFL01 Arduino nRFL01 Arduino
MOSI 11 SCK 13
CSN 10 CE 9
Vcc 3.3V Gnd Gnd

As per the datasheet specs it is very important to provided 3.3 Volts to the module(Do not provide 5V as it will damage your module)

Once we have the connections set we are going to start by loading the "Getting started" example  from the nRFL01 library.

Once you have loaded the example open up the Serial Monitor on the Arduino IDE a 57600 , if all went OK you should see something like this:

ROLE: Pong back
RX_ADDR_P0-1 = 0xf0f0f0f0d2 0xf0f0f0f0e1
RX_ADDR_P2-5 = 0xc3 0xc4 0xc5 0xc6
TX_ADDR = 0xf0f0f0f0d2
RX_PW_P0-6 = 0x08 0x08 0x00 0x00 0x00 0x00
EN_AA = 0x3f
EN_RXADDR = 0x03
RF_CH = 0x4c
RF_SETUP = 0x07
CONFIG = 0x0f
DYNPD/FEATURE = 0x00 0x00
Data Rate = 1MBPS
Model = nRF24L01
CRC Length = 16 bits
PA Power = PA_HIGH

Si los resultados de las variables son un montón de Ceros "0" revisa tus conexiones porque algo no debe estar conectado correctamente.
Este primer modulo sera el receptor.
Si todo va bien carga el mismo sketch"Getting started" a otro arduino.
y sigue el mismo procedimiento este segundo  modulo sera el transmisor, para ponerlo en modo transmision abre el Serial  Monitor de Arduino y escribe una 'T' y veras que los transmisores empiezan a comunicarse:

Now sending 9369...ok...Got response 9369, round-trip delay: 27
Now sending 10399...ok...Got response 10399, round-trip delay: 29
Now sending 11431...ok...Got response 11431, round-trip delay: 27
Now sending 12462...ok...Got response 12462, round-trip delay: 28