Close

BLE Beacons with nRF24 and Arduino

A project log for analog.io - A full stack IoT platform

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

luke-benoLuke Beno 09/28/2015 at 20:170 Comments

Introduction

I've spent a lot of time showing the MSP430 Sensor nodes and their capability of transmitting BLE packets. I wanted to clarify one thing because I don't think that I've done a great job so far highlighting how exactly this is done.

The Sensor nodes use a very inexpensive RF Transceiver chip from HopeRF called RF75. Maybe you have seen the HopeRF RFM73 or RFM75 modules that are typically very low cost on eBay or other sites. With a few exceptions, these chips are cheaper clones of the venerable Nordic Semi nRF24 transceiver.

NRF24 has been in the hobbyist community for a very long time. There are many different libraries for it and all kinds of exciting projects. Not only that but you can get nRF24 modules for many times less money than the individual chips on Digikey.

I'm sure many of you just have some laying around your lab right now!

Knowing this, I decided to to a quick project log about how you can test the BLE capabilities of nRF24 in less than 15 minutes.

The Hack

Let's start out by acknowledging the excellent work and creative thinking of Dimitry Grinberg detailed here on his blog: http://dmitry.gr/index.php?r=05.Projects&proj=11. Bluetooth LE fakery

In my opinion, this is hacking at its best: use something for a purpose that it most certainly wasn't designed for but still works well. Dimitry made a connection here between the BLE standard and a nRF24 datasheet which is very impressive!

Please try this at home:

So here it is, super simple as demonstrated in the video above. Here is the Fritzing diagram for my setup:

With the wires hooked up, it is just a matter of importing the following github library: analog_io_lib

Then the code for the Arduino Uno goes a little something like this:

#include <analog_io.h>
#include <SPI.h>

uint8_t x = 0;
analog_io radio(9, 10, 8);   // CE, CSN, IRQ

void setup()
{
  // put your setup code here, to run once:
  //Serial.begin(9600);
  SPI.begin();
  SPI.setDataMode(SPI_MODE0);
  SPI.setBitOrder(MSBFIRST);
}

void loop()
{
  // put your main code here, to run repeatedly:
  radio.print("Beacon #");
  radio.print(x);
  radio.flushBle();
  x++;
  delay(500);
}

And that is it, BLE packets in no time!

You can pretty much use any BLE scanner app to see the packets. I use Light Blue Explorer or the Bluetooth Smart Scanner on iPhone.

Enjoy! Skulls, Follows and your Comments are appreciated!

Discussions