Did any of these scenarios happened to you lately?
- Left your wallet in the taxi?
- Missed your phone in the cinema?
- Dropped your keys somewhere?
It’s estimated that each of us will spend six months of our lives looking for things we’ve lost. So to prevent this I and my friends came with a prototype wearable device - BluTag, which in a way uses the existing idea of Bluetooth Beacons.
This "BluTag" consists of MediaTek's LinkitOne based wearable hardware and Texas Instrument's CC2541 based Bluetooth Low Energy [BLE4.0] beacon / Tag. The tags are coin cell powered and can be attached to your keys, wallet, umbrella etc. as they are tiny. These tags when powered ON, can be detected by the BLE4.0 Compatible LinkItOne board and monitors the specific tag's RSSI value. RSSI - Received Signal Strength Indicator value is a function of distance from the source/Tag and hence can be used to tell if the Tag is out of a particular range if the RSSI value is greater than a certain threshold value. Thus, when your keys/wallet [with BluTag tag] is out of range of the LinkItOne BluTag, the device alerts the user by audio-visual indication and also by SMS, that your belonging is possibly LOST!
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: Materials Required
Step 2: Building the Tag
The CC2541 is one of the most popular BLE4.0 chips. [Other one is Nordic's NRF51xx]. Commercially, these chips are sold as modules called HM-10/11/12 online. They are cheap around $4-5 each and pretty good with onboard PCB antenna.
In my project, since i am not familiar with iBeacon or other Beacon standards, I just use raw RSSI value from the default firmware of this HM-10. For advanced users, to save power and other uses of iBeacon, can switch to iBeacon firmware with this same module. [http://www.blueluminance.com/HM-10-as-iBeacon.pdf]
Initially, I just configured the HM-10 modules via a PL2303 USB-TTL converter using AT commands. Ex. Change the name of the device/change baud rate / power levels etc. But, the default configurations should be enough.
The pdf contains specifics of the module and AT-commands.
To power the module, i just sticked it to the CR2032 battery holder's backside and soldered the VCC and GND pins accordingly. A switch is present on the battery holder for ON-OFF.
After power-ON, you can quickly check if the module is fine and transmitting, by searching for bluetooth devices on your phone. The device name by default is CC-2541A/HM-10./configured name.
Step 3: Setting Up LinkItOne
LinkItOne has now become a popular IoT/Wearable device platform, as its arduino compatible and has an extensive feature list : Bluetooth/GSM/GPRS/GPS/WiFi/Audo/SD card etc. And pretty worth the cost for all these ultimate features.
The Getting started guide at Mediatek Labs website is simple and comprehensive for setting up the SDK:
After the LinkItOne board is up and running, we can connect the I2C LCD display, buzzers / LED's as needed.
LCD: Connect SDA pin on LCD display to I2C SDA port on the LinkItOne and the CLK (SCL) pin on LCD to I2C SCL port of LinkitOne. VCC and GND of LCD to +5V and GND of LinkItOne. Its pretty straightforward.
We will use D11 and D13 GPIO pins for LED's. D13 already has a green LED connected on board. Connect a RED led between D11 and GND of LinkitOne.
Also make sure to plugin the GSM and Bluetooth Antennas to the board. Now we are ready to write the program and flash on to the LinkitOne board.
Step 4: Programming the LinkitOne
I would like to use the Microsoft's Visual Micro IDE interface for programming the LinkItOne. Its basically Arduino engine at the back and Visual Studio UI in the front and is quite good and easy to use for beginners like me too. The main advantage for me to prefer Visual Micro over the original Arduino interface is that, Visual Micro provides auto-suggestions of commands while typing. Also, the COM serial monitor terminal can always be kept opened and it updates automatically each time the board resets. [In arduino, every time we have to open it before and after programming the board].
The code is built from basic snippets/examples provided by Mediatek as a part of its SDK, which is really useful and easy to follow. Also you can download the Developer Guide to know in detail.
The .ino file is uploaded and just use it to compile and upload to the board. Thats it! But, one thing needs to be changed. In my trials, while we can scan for all bluetooth devices available, we can connect only to the HM-10 tags that we use. If we let the LinkitOne to connect to other unknown bluetooth devices, the board sometimes goes to reset state. So I have hardcoded the Bluetooth Tag's Address. So the user needs to modify the hex address of the Tag being used!
Step 5: BluTag in Action
After the code is uploaded on the LinkitOne board, the board resets and starts to execute the program.
Turn on the Bluetooth CC2541 / HM-10 Tag too and restart the LinkItOne board. Now the LCD should show the sequence of events happening..
BluTag is ON! and the Bluetooth GATT service is initiated.
The GATT UUID is registered and starts scanning for bluetooth devices if everything is successful.
Once the desired Tag's address is known, the LinkitOne connects to it and if successful, reads the RSSI value of the Tag. The LCD display would constantly show the RSSI value in dBm. [smaller the value, nearer the tag to the LinkItOne board/antenna] every 1 second. Now you can try to move the bluetooth tag away from the board and should see the RSSI value increasing.
The threshold value is set as -85dBm. If the tag is a bit far [1.5-3m] away from the LinkItOne board for sometime, the LinkItOne board knows that its out-of-range and initiates alert procedures. The LCD would blink and the RED led glows. Also, an SMS is sent to the number in the code.
If the tag comes back in range, the process continues forever.. Here the video shows my BluTag's working :)
Thats it! Now you can save your valuables from theft/loss by attaching BluTag's to them and monitoring them. I have not tested the battery life yet, but i believe it should be short since the tags are continuosly ON. In future, I am looking on using iBeacon firmware on the Tag to reduce power by transmitting at specified intervals only.
Thanks to my friends Jack & Cammy in helping to build this prototype :)