nRF24 <-> ESP8266 Hub Development

A project log for - A full stack IoT platform

A full stack project dedicated to easily collecting, analyzing and sharing IoT sensor data.

Luke BenoLuke Beno 08/29/2015 at 15:003 Comments

So at this point the MSP430 Sensor nodes are coming along quite well. This week I built and shipped off 10 units to other members of the forum. The first revision of the analog_io_lib was also released and other people are starting to play around with it.

Back in April I released this ESP8266 Mini Dev Kit on Tindie, it is intended to be a ultra compact and convenient way to develop for ESP8266 (pics below).

At that time I was doing development with NodeMCU which is also a great environment! I was looking for a lower cost alternative to Electric Imp and something that was easier to deploy with customers. One thing that I came to realize with NodeMCU was that it wasn't the most reliable thing, it tended to run out of heap space very often when doing simple WiFi transactions. I determined then that if I was going to do a product, that I would need to program directly in C/C++.

After reading about it setting up a ESP8266 dev environment for awhile, I realized that it was going to be a lot of fiddling around. I really don't enjoy setting up toolchains, especially when there are such low friction alternatives like Arduino, Energia, Simplicity Studio, etc, etc. So I started working on something else instead...

Fast forward to August and there is now this beautiful Arduino port for ESP8266! Last night I took a chance to sit down a explore. Very quickly I was able to solder up a nRF24 module to the dev kit:

Merging some of the demo code from the ESP8266WiFi lib and my own, I was able to quickly merge this demo where the ESP8266 talks directly to nRF24 via SPI, takes packets received from the a MSP430 sensor node and pushes them directly to!

Very cool, heres my code:

 *  This sketch sends data via HTTP GET requests to service.
 *  You need to get streamId and privateKey at and paste them
 *  below. Or just customize this script to talk to other HTTP servers.
#include <analog_io.h>
#include <SPI.h>
#include <ESP8266WiFi.h>

const char* ssid     = "...";
const char* password = "...";

const char* host = "";
const char* streamId   = "VGQ7n2Ww2Mhx5NNnVooE";
const char* privateKey = "...................................................";

analog_io radio(2, 15, 18); // CE, CSN, IRQ pins
const uint8_t rxaddr[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0x01 };
char inbuf[33];

void setup() {


  // We start by connecting to a WiFi network

  Serial.print("Connecting to ");
  WiFi.begin(ssid, password);
  while (WiFi.status() != WL_CONNECTED) {

  Serial.println("WiFi connected");  
  Serial.println("IP address: ");

  radio.begin();  // Defaults 1Mbps, channel 0, max TX power

  radio.enableRX();  // Start listening

int value = 0;

void loop() {
  while (!radio.available(true))
  if ( {
    Serial.print("Received packet: ");

  Serial.print("connecting to ");
  // Use WiFiClient class to create TCP connections
  WiFiClient client;
  const int httpPort = 80;
  if (!client.connect(host, httpPort)) {
    Serial.println("connection failed");
  // We now create a URI for the request
  String url = "/input/";
  url += streamId;
  url += "?private_key=";
  url += privateKey;
  url += "&value=";
  url += inbuf;
  Serial.print("Requesting URL: ");
  // This will send the request to the server
  client.print(String("GET ") + url + " HTTP/1.1\r\n" +
               "Host: " + host + "\r\n" + 
               "Connection: close\r\n\r\n");
  // Read all the lines of the reply from server and print them to Serial
    String line = client.readStringUntil('\r');
  Serial.println("closing connection");
Lots more of code to write here but this is extremely promising towards creating a super low cost IoT hub and bridging the sensor nodes to the web service! I even started a new board for it (work in progress).

More to come on this one :)


khaled wrote 08/14/2016 at 12:01 point

very amazing to know that you did make the esp8266 talk to the nrf24l01.

but I have a question I have done all what you posted here and nothing happened on my esp can give me a little bit of advice.


  Are you sure? yes | no

lageos wrote 09/25/2015 at 23:59 point

Great looking forward to try that as well :)

  Are you sure? yes | no

chadclick wrote 09/01/2015 at 21:13 point

Looks fun!

  Are you sure? yes | no