In this blog post I will show you how to configure the RN4020 module from Microchip as an Eddystone Bluetooth beacon, using one BLE2 click and one USB-UART click board from MikroElektronika. Of course, this tutorial applies to any other RN4020 breakout boards and can be used with almost any FTDI-based USB-UART which provides RTS and CTS data pins.
Warning: Use of undefined constant ICL_LANGUAGE_CODE - assumed 'ICL_LANGUAGE_CODE' (this will throw an Error in a future version of PHP) in /home/teodorc8/public_html/wp-content/plugins/insert-php/includes/class.execute.snippet.php(456) : eval()'d code on line 19
Warning: Use of undefined constant ICL_LANGUAGE_CODE - assumed 'ICL_LANGUAGE_CODE' (this will throw an Error in a future version of PHP) in /home/teodorc8/public_html/wp-content/plugins/insert-php/includes/class.execute.snippet.php(456) : eval()'d code on line 22
As a prerequisite, the RN4020 module must be updated to the latest firmware version BTLE v1.33.4 BEC. If your RN4020 module comes with an older firmware version you have to upgrade it first – see also the RN4020 firmware upgrade tutorial for instructions.
Before we go to the RN4020 configuration, a few words about Bluetooth beacon technologies…
First of all, what the heck is a Bluetooth beacon? Well, it’s a small device that exist for the sole purpose to broadcast information to nearby smart devices that are listening for those advertisement packets. So, to use a beacon one must have a smart device with Bluetooth enabled, and depending on the beacon type you might need a dedicated app that listens to those broadcasted packets and performs different actions.
The most obvious use is as a shopping aid, broadcasting special offers, etc. Museums can use beacons to act like a virtual guide, allowing for a dedicated app to display personalized information. Packets broadcasted by beacons can be used to provide accurate location. And those are only a few possible applications of the Bluetooth beacon…
One must observe that actually the beacon itself is a “dumb device” – it does only broadcast messages, the rest is done by the application installed on the smart device. The beacon does not track you. It simply can’t, as it’s a broadcast-only device. If there’s any user tracking, that is done within the application on the smart device.
By now three major beacon technologies are on the market: iBeacon, AltBeacon and Eddystone.
iBeacon is a technology developed by Apple in 2013. An advertised packet consists on a standard iBeacon prefix, 16-byte UUID, followed by a 2-byte major and 2-byte minor. Although any beacon can be regarded as an Ibeacon if it broadcasts according to the Apple standard, the use of iBeacons is limited by the strict Apple licensing policies.
AltBeacon is a standard developed by Radius networks as an open and inter-operable specification for proximity beacons.
Eddystone beacon technology was developed by Google in 2015 and brings some nice enhancements over the AltBeacon standard. Eddystone beacons can be detected by both Android and iOS devices. Eddystone is an open standard, the specifications being available on https://github.com/google/eddystone. In many ways the Eddystome beacons can be regarded as the foundation of the physical web, which aims to be an “open approach to enable quick and seamless interactions with physical objects and locations”.
An interesting aspect of the Eddystone beacons is that it provides several different advertising frames:
- Eddystone-UID: A unique, static ID with a 10-byte Namespace component and a 6-byte Instance component.
- Eddystone-EID: A time-varying beacon frame that can be resolved to a stable identifier by a linked resolver.
- Eddystone-URL: A compressed URL that, once parsed and decompressed, is directly usable by the client.
- Eddystone-TLM: Beacon status data that is useful for beacon fleet maintenance, and powers Google Proximity Beacon API’s diagnostics endpoint. TLM frames are usually interleaved with an identifying frame such as Eddystone-UID or Eddystone-EID.
From a maker’s point of view, one of the most interesting aspects of the Eddystone beacon technology is the ability to broadcast URL information. Thus, many smart devices that run Google Chrome with physical web enabled can receive the URL information, without the need of a dedicated app.
With Eddystone I can simply place one beacon outside my maker space, advertising it to anyone in the close proximity. All I have to do is broadcast a short URL to my blog page. Simple as that. And you will see that it’s so easy to implement such a beacon, and it uses only one RN4020 and a pair of AA batteries.
Going for a such simple approach means that some sacrifices must be done – the beacon I propose today broadcasts only URL frames. No TLM (telemetry) frames are broadcasted, so you can’t check the beacon status from a distance. Also no UID frames, as those are usable only with a dedicated app, and writing apps for iOS and Android is beyond the purpose of this blog.