Introduction: Beacon/eddystone and Adafruit NRF52 ,Advertise Your Website/product Easily

About: Maker, PCB designer , electronics instructor from Jordan just one word ! I Adore electronics follow me on FB https://www.facebook.com/Mohannad-Rawashdeh-Raw-774983565988641/

Hi everyone , today I want to share with you a project I did recently , I looked for a device to connect it indoor/outdoor and let the people to connect to it using their smartphone , and give them an ability to visit a specific website or advertise a product for them.

the best solution was to use something Called "Eddystone" which allow you to send a url to a client devices "Smartphone /Tablet".

so in this article I will show you a step by step what I used and How i hooked up everything together and the software/apps I used in this project .

First : illustrate the problem .

to use any device indoor / outdoor you must make it:

  1. waterproof .
  2. power it from a battery
  3. battery life as long as possible
  4. re-charge a battery easily "through a micro USB for example"

to make it waterproof , the best solution was to find a 3d printed object that can hold the device inside and easy to open it and close it again , and for sure prevent the water from getting inside the device and damage it.

using Li-ion polymer Battery was the best choice , small size , high capacity and easy to recharge it since Adafruit nRF52 feather has built-in li-ion battery charger circuit.

let's start from the 3D printed object , I found this design on thingiversewebsite , designed by :Jorg Jorgensen "thank you Jorg" I printed with a scale of 100% but it was very small to fit all the components inside it so I print it with a scale of 200% and give me what I want exactly

I like this design because if you close it firmly well the water will not get inside.

download the design from this link below

https://www.thingiverse.com/thing:2246144

Step 1: Components for This Project

only a few components you need to do this project :

  1. Adafruit nRF52 feather board , comes with nRF52832 BE .
  2. Pin header , Female or male header "and it's optional ".
  3. Li-ion polymer battery , I used 3.7V / 1000mA battery, if the battery comes without connector , ensure to buy JST 2pin jack .
  4. mini Breadboard.
  5. UHU adhesive glue.

Step 2: Preparing the Hardware / Software

it's not too hard to hookup everything together , but first we need to install the mini breadboard and the battery inside the device using UHU adhesive glue , ensure to give it at least an hour to dry.

charge the Li-ion battery, in my case I soldered a wires to the battery to connect it to JST connector.

Now let's move to the software :

first you must have Arduino IDE "donwload it from here" and then go to file >> Preferences

Add https://www.adafruit.com/package_adafruit_index.js... as an 'Additional Board Manager URL' (see image below).

Then go to tools >> board >> boards manager and search for nRF52 and install it

now restart arduino IDE , and from boards select adafruit nRF52.

the software is ready to use and you can upload sketches to nRF52 board

Step 3: Beacon Mode

from Wikipedia I quote " Bluetooth beacons are hardware transmitters - a class of Bluetooth low energy (LE) devices that broadcast their identifier to nearby portable electronic devices. The technology enables smartphones, tablets and other devices to perform actions when in close proximity to a beacon" so we can transmit a UUID "universally unique identifier" to a nearby devices

you can send UUID , Major and Minor Number , and set the tx power and RSSI @ 1 meter .

upload this code to your nRF52 board

you can DOWNLOAD it from github

<p>/*********************************************************************<br> MIT license, check LICENSE for more information
 All text above, and the splash screen below must be included in
 any redistribution</p><p> Original Code taken from Adafruit Bluefruit Example
 Modified By : Mohannad Rawashdeh 
 <a href="http://mb-raw.blogspot.com/"> <a href="http://mb-raw.blogspot.com/" rel="nofollow"> http://mb-raw.blogspot.com/
</a>
</a>
 this code will work on Android / IOS devices </p><p> Android App name : Beacon scanner 
 apple app name : core beacons
 
 go to beacon app and you will see the device name 
 (ibeacon /Rawashdeh) 
 UUID :  B3D6F818-DA71-09ED-EA80-F3C45FB19A50
 Major=0x01
 Minor=0x08
 Beacon_RSSI -73db;
*********************************************************************/
#include <bluefruit.h></bluefruit.h></p><p>#define MANUFACTURER_ID   0x004C  // Apple valid Manufacturer ID</p><p>int Major=0x01;
int Minor=0x08;
int Beacon_RSSI=-73;
int Tx_power=4;  
// AirLocate UUID: B3D6F818-DA71-09ED-EA80-F3C45FB19A50
uint8_t beaconUuid[16] = 
{ 
  0xB3, 0xD6, 0xF8, 0x18, 0xDA, 0x71, 0x09, 0xED, 
  0xEA, 0x80, 0xF3, 0xC4, 0x5F, 0xB1, 0x9A, 0x50, 
};
BLEBeacon beacon(beaconUuid, Major, Minor, Beacon_RSSI);</p><p>void setup() 
{
  Bluefruit.begin();
  Bluefruit.autoConnLed(false);
  Bluefruit.setTxPower(Tx_power);
  Bluefruit.setName("Rawashdeh");
  beacon.setManufacturer(MANUFACTURER_ID);
  Bluefruit.ScanResponse.addName();
  Bluefruit.Advertising.setBeacon(beacon);
  Bluefruit.Advertising.restartOnDisconnect(true);
  Bluefruit.Advertising.setInterval(160, 160);    // in unit of 0.625 ms
  Bluefruit.Advertising.setFastTimeout(15);      // number of seconds in fast mode
  Bluefruit.Advertising.start(0);                // 0 = Don't stop advertising after n seconds  
  // Suspend Loop() to save power
  suspendLoop();
}</p><p>void loop() 
{
 
}</p>

if you have an android Device

Go to play store and download beacon scanner app "I used 2 appshere andhere "

easily connect the battery to the device , and open the app and you will see a results "check the image above"

if you have IOS device "iphone/ipad"

the best app I found is Core beacons , download it form app store

other app "for beacons only " is beacon Ranging" ,not that good but I used it for a quick test.

for IOS devices , if you use beacon Ranging you need to add UUID first and then connect to the device "which is not reliable , so use Core beacon instead

Step 4: Eddystone , Share Your Website/product/service to Everyone

with eddystone , you can send a URL to a nearby device and direct them to your website or a web page or even a location url . ..etc

upload the code , you can download it from github

/*********************************************************************
MIT license, check LICENSE for more information All text above, and the splash screen below must be included in any redistribution

Original Code taken from Adafruit Bluefruit Example Modified By : Mohannad Rawashdeh http://mb-raw.blogspot.com/ this code will work on Android / IOS devices

Android App name : Beacon scanner apple app name : core beacons go to beacon app and you will see the device name (ibeacon /Rawashdeh) url:http://mb-raw.blogspot.com Beacon_RSSI -56db; *********************************************************************/ #include <bluefruit.h>

// my blog url #define URL "http://mb-raw.blogspot.com" //#define URL "https://www.instructables.com" int Tx_power=4; int Beacon_RSSI=-56; EddyStoneUrl eddyUrl(Beacon_RSSI, URL);

void setup() { Bluefruit.begin(); Bluefruit.setTxPower(Tx_power); Bluefruit.setName("Rawashdeh"); Bluefruit.ScanResponse.addName(); Bluefruit.Advertising.setBeacon(eddyUrl); Bluefruit.Advertising.restartOnDisconnect(true); Bluefruit.Advertising.setInterval(320, 320); // in unit of 0.625 ms Bluefruit.Advertising.setFastTimeout(15); // number of seconds in fast mode Bluefruit.Advertising.start(0);

}

void loop() {

}

if you have an android Device
Go to play store and download beacon scanner app "I used 2 apps hereandhere " easily connect the battery to the device , and open the app and you will see a results "check the image above"

if you have IOS device "iphone/ipad" the best app I found is Core beacons , download it form app store.

you can see the video for my quick test for the code.