Raspberry and NRF24L01 transceiver device


19 posts
by crystal13 » Tue Jan 22, 2013 3:59 pm
Hi to all,

I'm Italian and I'm new of Raspberry...and I'm very excited for have discovered this board.
;)

I'm writing because I'm doing a system of wireless communication based on Arduino board and transceiver device NRF24L01, using the SPI interface. In particular, I thought at this system:

Arduino (with webserver) + NRF24L01 (TX) <------> Arduino + NRF24L01 (RX)

Now, the problem, is that I need of a PHP webserver and unfortunately Arduino has not the PHP interpreter. So I can't use Arduino with webserver in TX side.

So, I find Raspberry. With Raspberry I can built a PHP webserver and I can connect a NRF24L01 transceiver because the Raspberry has the SPI inteface.

Now, what I ask you, is if someone of you have used the Raspberry with the transceiver NRF24L01 (or if you know other compatible transceiver) and, consequently, if is possible the system:

Raspberry (with webserver) + NRF24L01 (TX) <------> Arduino + NRF24L01 (RX)


Thank you to all in advance!!
Posts: 67
Joined: Tue Jan 22, 2013 2:13 pm
by bertux » Fri Jan 25, 2013 2:38 am
Hi!
Did you already can connect Rpi and Arduino using nRF24L01 module?
Posts: 6
Joined: Fri Jan 25, 2013 2:10 am
by dauhee » Mon Jan 28, 2013 8:51 am
Great idea. I am going to attempt this in the next few weeks. It is more reliable than using 433 and can sent larger messages.

Please let us know your progress.
Posts: 57
Joined: Fri Sep 07, 2012 1:50 pm
by sysjay » Tue Jan 29, 2013 12:06 pm
Hi.. I have been working on a similar project to have remote arduino send data to rpi via nrf2l01. I have just gotten the communications to work --- except i have to run as root on the pi. RIght now i am trying to write udev rules to reset the permissions on /sys/class/gpio and /sys/devices/virtual/gpio.

Eitherway, with root access, i have successfully been transmitting data packets from aruduino with no data loss.
Posts: 3
Joined: Tue Jan 29, 2013 1:48 am
by crystal13 » Tue Jan 29, 2013 12:42 pm
dauhee wrote:Great idea. I am going to attempt this in the next few weeks. It is more reliable than using 433 and can sent larger messages.

Please let us know your progress.


In theory, the 433mhz module transmits farther far of the NRF24L01 (that works on 2.4-2.5GHz) and should suffer less the interferences in the home of the other electrodomestics.

What do you think about it?

I have not connected nothing at moment :) I'm waiting for a RPi, and I'm already viewing what to buy: 433mhz transceiver or NRF24L01 transceiver?
:)

Thank you very much,
bye
Posts: 67
Joined: Tue Jan 22, 2013 2:13 pm
by dauhee » Tue Jan 29, 2013 10:12 pm
From what I've researched so far, NRF24L01 has a lot of reliability built in with acks, retries etc all functionality built into the chip. Also its library has lots of powerful settings and can even set up a repeating swarm simular to xbee

and while the range is shorter, its more robust. It supports the transfer of larger amounts of data (even audio). While it is in the 2.4Ghz band, there are channels available that are outside wifi etc.

I have used virtualwire library and its only designed for short messages, and need to code for message reliability. 433Mhz is subject to background noise and interference and is not 100% reliable. If trying to build in reliability in code, it might be too much to do in microcontrollers limited processing capability.
Posts: 57
Joined: Fri Sep 07, 2012 1:50 pm
by sysjay » Wed Jan 30, 2013 1:37 am
I chose the nrf24l01 becasue it was much cheaper that xbee. I bought a pair of r24 transceivers from ebay for less that $7.

I also chose because of the library support. I was able to find more info for r24 online especially for the rpi interfacing.
Posts: 3
Joined: Tue Jan 29, 2013 1:48 am
by dauhee » Mon Feb 04, 2013 4:01 pm
I have been testing with a number of different RF433 chips with very disappointing results. I'm not getting a reliable connection between 2 virtualwire arduino units. I have tried using different antenna types such as 1/4 wave and helical with no success, and also using pre-built helical antennas. Basically I'm loosing a third of all transmissions. Waiting on my NRF24L01 delivery to see how that works.
Posts: 57
Joined: Fri Sep 07, 2012 1:50 pm
by prussia » Wed Feb 13, 2013 2:56 pm
Hi,
How have you fared in the last few months? I'd like to create an RF node that reads sensor data and just sends it to the Pi. Price is a factor and was hoping this chip would work better then the Xbee to save on costs?

Curious to see how you've progressed on the RF front :)
Posts: 29
Joined: Sun Jan 13, 2013 12:03 am
by dauhee » Wed Feb 13, 2013 9:45 pm
I have tested tonight between RPi and Arduino with poor results (worse than RF433 message losses). I don't know if its RPi code missing commands/timing etc so am going to try Arduino to Arduino and see how that goes. There is a bit of WiFi activity where I am and also baby monitor etc so there could be a lot of interference.

I am using ultra cheap chips but I have the units side by side and still dropping messages. I'll keep you posted . . .
Posts: 57
Joined: Fri Sep 07, 2012 1:50 pm
by dauhee » Thu Feb 14, 2013 8:57 pm
Success!!! It works. Check this post to see what went wrong for me:

viewtopic.php?f=45&t=17061&p=288057#p288057
Posts: 57
Joined: Fri Sep 07, 2012 1:50 pm
by prussia » Fri Feb 15, 2013 7:25 pm
Very cool,
My use though will not be interfacing two chips like a raspberrypi and an arduino.

My question is can I use this transceiver to have a raspberry pi communicate directly with sensors (like the jeenode minus the chp)..

aka can I received data from my p remote transceiver to get data from sensors and "do some action"

I don't need much thinking on the remote end. It needs to read data from an MCP3008 ADC and possibly tigger some action remotely to an i2c attached chip.

I was considering the xbee, and the jeenodes (similar price i think) as RF protocols but if I can cut out the chip middleman my costs and complexities go down.
Posts: 29
Joined: Sun Jan 13, 2013 12:03 am
by pico » Fri Sep 13, 2013 5:19 am
Embeddedcoolness.com is now selling a nRF24L01+ <--> TCP/IP gateway that is hosted using a Raspberry Pi, allowing you to get WiFi capability on Arduinos using nRF24 modules.
Posts: 6
Joined: Sun Sep 16, 2012 2:49 pm
by dauhee » Fri Sep 13, 2013 9:11 am
fantastic - does it support asynchronous communications?
Posts: 57
Joined: Fri Sep 07, 2012 1:50 pm
by pico » Fri Sep 13, 2013 9:52 am
dauhee wrote:fantastic - does it support asynchronous communications?

You mean as in AJAX? If so, then yes, there is an demo AJAX webserver sketch under "Docs" "Example Programs" here.
Last edited by pico on Fri Sep 13, 2013 10:03 am, edited 1 time in total.
Posts: 6
Joined: Sun Sep 16, 2012 2:49 pm
by dauhee » Fri Sep 13, 2013 9:59 am
as in 2-way communication so that arduino can initiate send/receive and also RPi can initiate send/receive. I had tried that but could only send on one side and receive on the other - if trying to send on either side at random times, messages would be lost.
Posts: 57
Joined: Fri Sep 07, 2012 1:50 pm
by pico » Fri Sep 13, 2013 10:18 am
The gateway connects to the Arduinos, and each Arduino is allocated a TCP/IP port connection, with a full duplex stream. So you can do what you like with each port connection... use it like a virtual USB serial connection to the Arduino if you want.

And because it's a TCP/IP port, remote clients can connect to it. So the Raspberry Pi can access the Arduinos, but if the Raspberry Pi is connected to a LAN, then anything on the LAN can access the port, and if the LAN is connected to the Internet, then (assuming port forwarding is set up), it can be accessed from anywhere on the Internet.

So the simplest sort of connection would probably be connecting to a port belonging to an Arduino with a terminal emulator like PuTTY, and talking to the Arduino as if you were connected via a USB serial connection.

A more sophisticated connection would be connecting to that port with a web browser, and (if the sketch running on the Arduino was set-up as a web server), you could interact with the Arduino that way.

So, yes, it's a fully bi-directional, buffered asynchronous stream connection, so you aren't limited to short 32-byte packet communications.
Posts: 6
Joined: Sun Sep 16, 2012 2:49 pm
by dauhee » Fri Sep 13, 2013 12:48 pm
wow - that is powerful and elegant. Really great product!
Posts: 57
Joined: Fri Sep 07, 2012 1:50 pm
by crystal13 » Wed Sep 25, 2013 4:11 pm
Hello,

I resume this my post because after 8 month I see that you have made a lot of progress!!

That "pico" have done is own that I had in my mind 8 month ago. I suppose that his work isn't open source.

Anyway, I ordered the NRF24L01 mentioned:
1 x NRF24L01+PA+LNA SMA Antenna 2.4G Wireless Transceiver
1 x NRF24L01 Wireless Transceiver

I will connect the NRF24L01+ with antenna to RPi and the NRF24L01+ to Arduino.

Meanwhile, I have a question: how is possible to control Arduino from a webserver installed on RPi via NRF24L01+? Someone have done or thought to do this? Is there any tutorial?

Thank you very much and good job!
Posts: 67
Joined: Tue Jan 22, 2013 2:13 pm