Using Bluetooth Low Energy (BLE) /iBeacon on Spark to read out BLE/iBeacon tags

Hello everyone,

I would like to connect a Bluetooth Low Energy module to the Spark core to scan BLE chips/tags in proximity.
When reading tutorials about using Bluetooth Low Energy on Spark or Arduino they always state that a mobile device iOS or Android device is needed.

But i would like to make a direct connection between Spark and the tags. So when the Spark is close enough to a tag i want it to read out the tag’s data (UUID) and send this data to my database using the cloud service and return information returned from the database to the Spark and probably display this information on a screen of some sort.

An example of such a BLE tag:

BLE tag on Alibaba

In theory it is similar to this:

So essentially, i would like the spark (with a Bluetooth Module) to replace the Mobile Device. And i would like to use custom BLE tags(like in the link above) as item identifiers (the pebble in the image) by reading out the UUID.

My question is:
Is this even possible?

If yes,
Could you recommend me any BLE Reader?
I was thinking of getting the Adafruit’s BLE Bluefruit or Redbearlab’s BLE Shield. Combining these with the tags from Alibaba would these do the job you think?

Please feel free to share any additional thoughts you might have.

And If you have any suggestions on how to get this going, i would greatly appreciate it if you could share that as well.

Thanks!

1 Like

@jnijstad, from my understanding both these supports BLE Peripheral mode only, what you are looking for is a BLE Central role. I am experimenting with BLE Mini from RedBearLab with HCI Firmware and Arduino and will post my results here.

Thanks for your swift reply.

Awesome, please do let me know your experience with this.

What kind of tags do you use if any?

And in short, what i’m trying to achieve in theory is possible am i correct?

@jnijstad, to be honest I am not an expert in Hardware and basically a Software guy, just doing something with information gathered from Internet. Whether it is possible or not someone from the Elite/Spark team or an expert in Hardware should reply. I am also looking for such a solution and is very much interested.

What I am trying to do is to detect whether my iPhone/other device of my choice is in range and if it is in range do something (it vary based on my choice).

I have some locally made iBeacons and BLE Mini with iBeacon firmware.

I’m on my way to the airport so just a quick reply.

The shields should work well with the cores but it’s kist 2.4Ghz interference we are more concerned of.

Like what @AndyW mentioned, the CC3000 doesn’t have a feature to…I can’t remember the term off my head but basically to take turns to tx/rx.

1 Like

@kennethlimcp, co-existence interface, I suppose.

Also @jnijstad is asking about shield in BLE Central mode, from RedBearLab’s site it does not support Central mode. Am I correct or something I am missing here?

  1. Support Peripheral (Slave) role operation only – nRF8001 IC
    limitation.
1 Like

@krvarma I’m in the same position as you are… I’m actually a full-stack webdeveloper, but at the office we are looking at ways to make hardware interact with the web.
That’s why we really love Spark.

I know that the bluetooth topic is hard to tackle especially when just embarking this hardware road, but basically I just need to figure out if the above is possible or not for some fun projects we have at the office…

But @krvarma, i’m glad you interest in this topic as well and it would be great if we can learn from each others experiences in this.

Thank you @kennethlimcp for your reply while in a state of hurry.
I see what you’re getting at.

Could you give us/me more info about this and what we do need in order to achieve this? And if that hardware does even exist at all? Thanks!

I’m not the best person to ask but i know some people in the community tried and it worked fine.

Sometimes you know, you just have to try and see :wink:

I’ve been playing with the PunchThrough Bean recently. Basically, it’s an Arduino with BTLE. What’s nifty is that the BTLE chipset can actually do a lot of the work while the AVR is in deep sleep mode. You can set the RGB LED and read the status of the internal temperature and accelerometer sensors independently of the AVR.

The main stumbling block for most is the nature of how BTLE works. It’s basically asynchronous and event driven. I’m playing around with the noble library for nodejs, and tinkering with trying to create a Bean library for node to simplify communicating with it from my MacBook Pro. The main problem is that there are a few things that aren’t fully documented yet.

Anyhow, I think that the BTLE chipset in the Bean is capable of operating as both peripheral or central. However, the current firmware only does peripheral mode. PunchThrough has suggested that they may add central mode capability in the future, though.

5 Likes

You are correct @jnijstad, the Bluetooth topic is hard to understand and need help from guys like @kennethlimcp.

:spark: is a wonderful platform to explore and we have a wonderful community here.

3 Likes

I think my LightBlue Bean shipment is back in my house already. Indeed, i plan to hook up to the core and see if we can have a BLE shield working :wink:

Just keep coming back if you need help. We might not know everything but let’s all learn together.

Cheers! :wink:

2 Likes

I was just looking at the TI CC2540 and it supports everything:

Complete Power-Optimized Stack, Including Controller and Host:
GAP – Central, Peripheral, Observer, or Broadcaster
(Including Combination Roles)

So I would suspect that anything that uses this TI part and is open-sourced would do the job :smile:

2 Likes

@dougal Thank you for the useful information! Punchthrough’s Bean looks really useful!
And thanks for refering Noble. Combined with Bleno it is especially useful for the testing phase I’m in right now.

@kennethlimcp @krvarma Yeah i noticed this is a great community, so many helpful replies in so little time :smile:

@kennethlimcp Your plan sounds great and if you got it working please do share it. A tutorial on it would probably be appreciated by a lot of people.

@peekay123 Wow thanks for the heads up, i think this is exactly what i need.
I noticed that this BLE Mini by redbearlab incorporates the TI CC2540.

I guess i’ll try to hookup this one.

So to recap and to check if this is the right answer to my question:
I would be purchasing the BLE/iBeacon Tags and the BLE Mini

After that i’m planning to do these steps to achieve my goal

  1. Hookup BLE Mini to the Spark Core accordingly
  2. Listen for the BLE/iBeacons tags it signals
  3. When a signal is close enough read out the UUID
  4. Using the Spark’s Wifi i would do an API request to a database
  5. Return database data and display this data on a screen using the Spark Cloud service
    connected to the Spark Core

Am i overlooking something or would the above be possible?

I’m thinking of doing this for the testing:

  1. Hookup BLE Mini to the Spark Core accordingly
  2. Listen for the BLE/iBeacons tags signals
  3. When a signal is close enough read out the UUID
    **4. Let the Spark send the UUID again using the BLE Mini
  4. Let my MacBook receive this signal from the BLE Mini using Noble**

Thanks everybody and please share any thought you might have on this! :wink:

1 Like

@jnijstad, @kennethlimcp, @dougal, @peekay123, I have done experiment with BLE Mini and TI SensorTag. I updated the BLE Mini with HCI_USBCDC_115200_20130429.bin provided by RedBearLab and connected on a Windows PC. Then I used their python script SensorTag_Central_HCI.py to detect the SensorTag button press.

To detect the SensorTag, first press ‘d’ to start discovering, then once it finds the SensorTag, press ‘e’ to establish the link and then ‘n’ to enable notification. Now we can detect the button presses. Sometimes you have to press ‘d’ 2-3 times to get it detected.

So basically BLE Mini works as central and it will work with Arduino and :spark:. @peekay123, @kennethlimcp, @dougal please correct me if I am wrong.

I am going to do the same with Arduino and then :spark:, I will post my findings here.

2 Likes

Hi All, There is a little progress, I am able to do a scan using Arduino Uno by following the same SensorTag_Central_HCI.py path and able to see SensorTag, establish connection. Now trying to detect the button press as a first step. I will post the updates and code here.

1 Like

I am able to connect and get the button presses of SensorTag by following their own python sample SensorTag_Central_HCI.py. The sample is upload to GiHub and also posted here as a separate topic https://community.spark.io/t/ble-mini-and-spark-core/5377.

To use this sample BLE Mini should be updated with HCI_UART_57600bps_20130502 firmware. I didn’t check the 115200 version and not sure it will work or not. The purpose of this sample is to try Spark Core to detect other BLE devices and connect.

@jnijstad, please see whether this will help you anyway to achieve your goals.

The code is very cryptic and not that ordered, and also it is very specific to SensorTag. Also I didn’t try with multiple devices and not sure whether it will work or not.

Following are some of the things I like to implement:

  1. Find out the name of the BLE Device (like TI BLE SensorTag what is showing in SensorTag iOS application).
  2. Try to list all the characteristics like IR Temperature, Humidity, etc…

Any insight will be very helpful.

Thanks everyone for all the support.

@jnijstad, did you get a chance to work on the BLE Mini and Noble?

Thank you for sharing the updates and the code on your progress @krvarma! Really awesome.

Unfortunately i don’t have the equipment here yet for messing around. I’m still in the research phase and trying to make a final decision on what i have to order.

But now that you were able to confirm that the BLE Mini works i will definitely put this on my orderlist, thank you for that!

I will give updates on my progress after receiving my order and made some notable progress.

And btw does anyone know if BLE central (BLE Mini) could be able to connect to multiple peripherals (tags)?

1 Like

@jnijstad, from this forum it can connect up to 3 peripherals, but I don’t know how to. You raised a very important point, me too waiting for an answer.

https://redbearlab.zendesk.com/entries/72966016-BLE-Mini-Tutorials

@thebaldgeek Thanks for your long reply.

Cool what you did to the SensorTag!

Yes from the information i got, the SensorTag and the BLE tags i have in mind are different in many ways.

At the moment i do not have access to the hardware (tags and BLE mini) yet, but i’m trying to discover if these would do the job like said before.
So at the moment i’m experimenting with Noble and the iOS app Beecon (which is available for free on the App Store) to see what’s possible.

  1. Noble makes it possible to discover & connect iBeacons using your Mac. (i.e. acting as the BLE Mini)
  2. the Beecon app makes it possible to turn your phone into a virtual iBeacon (i.e. acting as a BLE tag)

Now i discovered it is possible to read out multiple “tags” its UUID and RSSI @krvarma (by using multiple phones at my office) without connecting. It must be different when you use the SensorTag cause you want to read out different values than just the UUID and RSSI…
With this information you can data crunch using its UUID, like said before, when e.g. a tag is in your desired RSSI range.

The catch is, you can’t.
As yet, after hours of Googling and forum lurking I have not been able to find a single device outside of an Android or iOS device that can receive an iBeacon… And even then, most apps can only track or receive UUID of your registered tag… Which means picking up and finding, say, your visitors UUID of their BLE device is a no no. (Yes, there are ‘scanner’ apps that will pick up everything, but not actual apps, apps that we could leverage to do the work of pushing the iBeacon data to a central server).

I contacted the supplier of the initial BLE tags i have in mind… They told me it will definitely work with any BLE receiver… Let’s hope they are telling me the truth.

So if the supplier is right we could, in theory, use the BLE mini and the BLE tags to:

  1. detect several BLE tags with the BLE Mini
  2. if the BLE tag’s RSSI is under you desired RSSI (i.e. close enough from your receiver)
  3. Do something with these BLE tags its ID’s
  4. Unlimited possibilities

Am i missing or misunderstanding something here?

Also what came into my mind which might be suitable for a new topic:
Isn’t my initial idea (track UUID and RSSI) also possible with a RFID receiver and RFID tags? The only drawback i found is the range capabilities vs price ratio for the RFID receiver.
Anyone have a comprehensive understanding of this and is able to give a short answer on if my initial idea is possible using RFID? And if RFID is more preferable than using BLE in this case?

2 Likes