Add Bluetooth Low Energy (BLE) to Spark Core

Yes, bad choice for an example. The point I was trying to make was that if you were to use a BLE module that can run at 3.3V, then one can directly interface it to the :spark: Core without the need for a Shield Shield.

Thanks for the correction!

Where can I found a tutorial or a course to learn how interface external part with the spark core ?

If you have the spark shield then you may be able to use the BLEshield from RedBearLabs. It is a implementation of Bluetooth 4.0 (BLE).

Do you mean the shield shield ? If yes I don’t have it. And would like to interface BLE directly to the spark core.

If you have little experience developing on embedded platforms or electronics in general, I would suggest undertaking some simpler projects before jumping on to BLE, etc.

Sparkfun has excellent set of tutorials: Tutorials - SparkFun Learn

These tutorials go from basics to advanced in a nice progression. You can jump to wherever you want. It also has a nice section on bluetooth and interfacing.

Hope this helps.

We have integrated the Nordic Semiconductor nRF8001 module with the spark core and have provided a simple UART over BLE interface to connect the Spark core to a phone. The BLE can be used to get WiFi credentials and also to return debug information for issues the Spark have when connecting to WiFi.
So this is useful for troubleshooting and is an easier method to set WiFi credentials.

This is now available as a spark.io library (NRF8001-BLE-UART-SPARK-IO) so you can play with it.

You can use the Adafruit BLE module or the Rebearlab shield to or the Jaycon nRF8001 breakout board to connect to the Spark core.
More documentation is on our github repo for the NRF8001-BLE-UART-SPARK-IO library.

You can use the nRF UART apps in the Apple app store and Google play to communicate over BLE to the Spark Core.

Please remember that in today’s spark configuration, the Core checks WiFi before it runs the BLE module, so getting WiFi credentials over BLE would require that the BLE library is run before checking the WiFi.

6 Likes

Wow @daviddedwin,

great job! Just wondering if you can share more information on why you are integrating them? :wink:

I have a BLE shield on my TO-DO list and would be great to hear your experience!

Like, aren’t you worried about co-existence for Wifi and BLE?

Awesome!

In this integration, we will use the Phone to push WiFi credentials to the Spark at that point. WiFi interference is not a problem when the Phone is connected to the same WiFi access point or can see the access point the Spark is going to get connected to. During this time the phone will manage the BLE and keep it clear of the WiFi channels automatically.
:slight_smile:

During troubleshooting of WiFi the BLE can send status information of the WiFi to the end user’s phone so this provides a better interface, than just the LED.

2 Likes

It sounds like i finally can open my RFduino parcel? :stuck_out_tongue:

I have the RFduino and Bean but the 1st time experience is kind of a turn off you know :wink:

Awesome! Thanks for sharing! Very excited to see what comes from this! :slight_smile:

This is a wonderful project @daviddedwin!. I can’t wait to get Adafruit BLE BOB and use it.

My son has a disability and constantly misplaces his binder around school. I’ve 3D printed a three-ring binder case for the spark and battery. I was hoping to use the school’s wifi/routers to pinpoint where the binder is (closest IP address). That proved to be impossible with the school’s network and/or my programming fu.

I purchased six ibeacons hoping I could place them in the ceiling at various locations throughout the school and somehow get the spark (plus BLE) to send to the cloud the closest ibeacon id (I’m using estimotes). Would this (nRF8001 + library) possibly help me do this without a shield (trying to keep the whole package thin so it can fit inside the 3" binder rings)?

1 Like

Perhaps you could put a small piezo buzzer inside so you could go on sounds for the exact location, after you guesstimated it using the beacons. Just an idea though.

One possible option(1) would be to place this nRF8001 device in the binder, this can most likely be battery powered and be able transmit periodically (once in 1.28 seconds). The ceiling devices need to be BLE devices like the estimote but they need some additional software to run a mesh over BLE so they can say, “I see they binder” and relay that information to the BLE node with the Spark.io via the BLE mesh, which can then send it to cloud.

Another option(2) would be use a mesh based on the mysensors system and use the spark.io and mysensors to get to the cloud. This would not use BLE so any phone based tracking will not work over BLE but the spark cloud will know. I do not see mysensors and spark.io integration yet, but that should be very simple to do as well, as mysensors is Arduino based.

Another option(3) would be to use a combo mysensors option to use the nRF8001 device and have a mesh which is BLE+mysensors so it will work with BLE and have a mesh.

The simplest option(4) would be to stick a ibeacon or nRF8001 board into the binder and use a phone based BLE app to search for the beacon using the RSSI of the signals coming from the binder. This however does not show the location immediately as you would need to search for it but it will make the search a more efficient.

Option (2) and Option(4) are very close to reality, Options 1 and 3 need more work before being available.

Thanks for all of your ideas. I’m running down this path at the moment: http://community.spark.io/t/detect-ibeacons-using-spark-core-and-ble-mini/5554. It seems promising. Cheers!

1 Like

@kennethlimcp I have been using the RFduino for a while now. It has some limitations on the BTLE interface as it has pre-defined characteristics and services. You can only use the ones they provide. That said you can accomplish BTLE communications very easily with the device. It also requires Arduino IDE. Let me know if you need any help with the RFduino.

1 Like

Spark forgive me for promoting other products on the Spark forum but in this case I think it’s important.

@jlr I wanted to suggest the RFduino for several reasons -

  • Its bluetooth low energy, probably only ~30 ma compared with ~200ma for WiFi
  • It has gazelle supported, this is a peer-peer mesh network
  • Its farily easy to get started with BTLE, you don’t have to learn all about the BT protocol.

You could setup a mesh network around the school as @daviddedwin suggested. It’s small and can operate from a pair of AAA batteries.

Happy to answer any questions

I also don’t want to advertise other products as such, but I think until the SparkLE comes out, its good to share other products that could help others or even be combined with a link between them (serial)

Today I received the Light Blue Bean from Punch Through Designs, and I must say initial impressions as awesome, the device is extremely small if you removed the breadboard at the base it would be smaller then the Spark Core!

Out of the box (or even in the box) load up the mobile apple on your iPhone and bam you already controlling the LED, taking accelerometer and temperature data! after that just load up some Arduino code and flash OTA with BLE and you can make it do anything

If you wanted to combine the two units I believe you could use a software serial between the units which in a way would allow you to use the best of both worlds :smile:

They also have a similar community to Spark.io and similar pricing to the original Core, but the Photon just beats everyone on price!

Will keep everyone updates post-christmas once I get to play with the toys :smile:

Looks like most if not all solutions out there (RFduino, LBB included) do not provide a BLE Central mode where the uP could initiate and collect data from other BLE peripherals. Could someone explain why? Is it because it is assumed a suitably powerful device (e.g. RPi) to be the star hub for heavy data lifting, that it just make no sense (technically & economically) to do it on a less powerful one such as the Photon?

It is because I am imagining the SparkBLE is receiving data from a few BLE peripherals that are gathering environmental data, and act upon those data according to some predefined logic (e.g. acceleration is zero and smoke detector turns HIGH) and may be upload some of them to the backend in case more decision power is required (e.g. motion history and air quality). Isn’t this use case so uncommon or impractical to perform let alone the more powerful processors such as the RPi or the Edison?

Do you have any idea why the nRF UART iOS application does not connect? I’m getting the same issue as described here.