Nerfnet Tunnels TCP/IP Over NRF24L01 Radios

There’s an excellent chance you’ve already worked with the nRF24L01. These little modules are an easy and cheap way to shuffle data across a 2.4 GHz radio link at a respectable rate, making them great for remote control projects. But after seeing that others had experimenting with using these radios to transmit digital audio, [Andrew Rossignol] got to wondering if some software trickery could push the envelope even further.

The result is nerfnet, a Linux program that allows you to tunnel TCP/IP over a pair of nRF24L01 modules. The link appears as a virtual interface, meaning everything happens transparently as far as other programs are concerned. Anything that uses TCP/IP to communicate on Linux can take advantage of this low-cost link, albeit at speeds that most of us haven’t had to deal with in decades.

Though it’s not quite as bad as you might think. Latency is around 50 ms, and after some tweaks, [Andrew] has been able to squeeze almost 300 Kbps out of the link. That’s more than enough for terminal work, and some light audio and video streaming isn’t out of the question.

In terms of range, he was able to maintain a fairly reliable connection at a distance of up to 60 meters (200 feet) outdoors. It might not sound like much, but again, you’ve got to take the cost of these radios into account. If you’re looking to SSH into a Raspberry Pi weather station you’ve got in the backyard, a pair of these could get the job done for just a couple of bucks.

The blog post [Andrew] has put together explains the software in fantastic detail if you’re interested in the nuts and bolts of it all. But if you just want to play around with the idea, you just need to connect some nRF24L01 modules to a pair of Raspberry Pis with short SPI wires to cut down any interference, and follow the instructions. Ideally the radios would have external antennas, but it’s not strictly required.

We’ve seen these modules pushed into service as impromptu Bluetooth Low Energy transmitters in the past, but nothing quite like this. While the latency and bandwidth offered by this technique might seem antiquated to modern eyes, it could be the perfect dedicated communication channel for your sensors, smart devices, or home automation projects.

31 thoughts on “Nerfnet Tunnels TCP/IP Over NRF24L01 Radios

  1. “at a distance of up to 60 meters”
    Wouldn’t that be achievable through a regular WiFi with a half decent antenna?
    If anything, I would use some 433/868MHz long range LoRa modules – perhaps now that he’s got that nerfnet software ready it could easily be adapted to work with them.

  2. I wonder if he’s heard of AX.25, rather than reinventing the wheel with protobuf etc?
    I’ve done something similar with micro-bits + AX.25, it’s pretty straightforward, of course you need a uC to implement 6pack or KISS rather than doing SPI (though I guess you can use named pipes for a userspace driver)

    1. And also, while the article bemoans the 300 kbps speed, they obviously have never been on TCP/IP over AX.25 where the entire packet went over the air at less than 1200 Baud (due to coding overhead) with latency that could approach a minute depending on the number of hops.

      Funny how AMPR.org turned 1/4 of their IP block into 50 Million Dollars, and is now giving 5 Million a year to worthy projects. https://www.ampr.org/giving/

    2. Even implementing AX.25 is waaay overkill. This is a simple data-link layer (OSI Layer-2) point-to-point connection that should take next to no time to set up and use with existing tools (Nerfnet Shmerfnet). Geeez whaddaya know, there’s this thing exactly for this called (drum-roll – wait for it) the Point-to-Point Protocol[1], a.k.a. PPP (RFC 1661[2]). Whooda thunk it, eh? The only thing “special” about PPP is that the provided connection must be full-duplex (transmit + receive). AFAIK those nRF24L01 transceivers are full duplex, so no prob there. PPP has been around almost forever in networking terms, it’s a tried and true workhorse that’s easy to use.

      * References:

      1. https://en.wikipedia.org/wiki/Point-to-Point_Protocol

      2. https://tools.ietf.org/html/rfc1661

  3. “f you’re looking to SSH into a Raspberry Pi weather station you’ve got in the backyard, a pair of these could get the job done for just a couple of bucks.” Or you just use the integrated WiFi and that’s it.

    1. Assuming you have decent network coverage. Otherwise a struggling device in the outermost edge of the 802.11 range will seriously impact the whole network (which can limit the total bandwidth to as low as 1Mbps).

  4. Very cool project. Always like a new way to share internet ever since i cut up to parrellel cables and networked a pair of computers over that. I have a few of these nrf24’s, maybe give it a shot. next up tcip over those ask ook modules?

  5. I did this with AX.25 using the same BELL202 used by APRS on some custom hardware (CC1200 + ESP32). The ESP32 use the SPP profile for integration into APRSdroid or my computer using the kissattach programs. I wanted to go farther with this, but I never really saw the point w/o a PA. I wanted something which could RX / TX APRS packets, but also switch over to a higher speed and more practical modulation scheme for data transfers. The fun part was having the CC1200 RX / TX APRS AFSK packets :)

    Everything is open if you want to explore.

    https://repo.curiouselectron.com/curiousmuch/arrow-firmware

  6. I have a strong dislike for this chip.
    I once wrote a software stack for it, which was overly complex to work around the very convoluted “6 pipe” idea implemented in that chip. It also has other flaws such as a very badly implemented (and unusable) signal strength meter.
    This chip should be put in the obsolete parts bin together with the L298 and ua741.

  7. Does ESP8266 and ESP32 made Nordic 2.4GHz chips largely pointless? I’m currently comparing the reach of the Nordic solution compared to ESP32 and other technology like DD-WRT repeater bridging. The promise is that Nordic 2.4GHz has much longer reach. We’ll see I guess.

    A lot of other commenters are referencing Arduino solutions. Not a good comparison since nerfnet can be used to extend an IP LAN with all the flexibility of a full linux network stack including firewall and cryptography.

    Doesn’t matter at the moment since I can’t get nerfnet to work using a NanoPi NEO Core2 (linux) and Raspberry Pi Zero (linux). Raised an issue at the author’s github. It’s likely an RF library configuration issue, for example, using linux drivers as opposed to Broadcom direct SPI access. I am investigating. Author did call this a weekend project so I was fairly warned.

    1. >Does ESP8266 and ESP32 made Nordic 2.4GHz chips largely pointless?

      I would say not (which I think agrees with you James), although for many applications espressif chips will be better. However, low-ish data rate, longer range and the pretty low current consumption (15mA or lower tx without the pa/lna) there is definitely a place for “those Nordic 2.4GHz” chips. Which also includes a bunch of clones now.

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.