I recently discovered the OLP425 BLE module from Swedish company connectBlue, based on the CC2540 chip from Texas Instruments. While there’s a wide variety of BLE modules available today based on the CC2540, such as the BLE112 from Bluegiga, most of them are quite similar – they simply provide a more accessible hardware interface to the CC2540, as well as the necessary radio and telecommunications certifications. Unlike other basic BLE modules, the connectBlue BLE Platform Module OLP425 is available in a configuration with the following additional options:
- Temperature sensor
- 2 LEDs
- JST connector
- Battery holder for CR1632
This is a very appealing package, since you can now purchase one of these pre-configured OLP425 modules with many of the basic sensors already attached and ready for development. No longer do you have to worry about designing your own PCB and soldering a tiny 2mm by 2mm Ball Grid Array accelerometer onto it.
The OLP425 can be configured to include a JST connector, which allows you to use a JST 6-poles to IDC 10-poles adapter cable (part number cB-ACC-71) to connect the OLP425 to the TI CC debugger for programming and debugging, as shown in the following image:
The OLP425 comes in 4 different variants, as described in the very informative data sheet:
|Antenna||Internal||U.fl connector||Internal||U.fl connector|
|LEDs||2 LEDs||2 LEDs||No LEDs||No LEDs|
I ended up purchasing the cB−OLP425i−26 module (Max equipped, internal antenna), from M2M connectivity in Victoria, Australia, for $48, plus $17 for the cB-ACC-71 CC Debugger adapter cable and $20 for shipping.
At $48 for the module, it’s quite a bit more expensive than the $19.19 AUD charged by Glynstore for the BLE112. However, if you’re looking to produce large quantities of these devices, it’s possible to get them custom made with different accessories, thereby reducing the cost.
I should mention at this point that Blueradios has been selling a similar sensor device for quite a while now, named the BR-BUTTON-S2A SensorBug, which includes an accelerometer, water detector, light sensor and temperature sensor. However, at the current list price of $149 USD, it’s over $100 more expensive than the OLP425.
The physical size of the OLP425 is quite small at only 15×22 mm, however, the battery holder for the CR1632 takes up the majority of the space. To be honest, I was quite surprised at the large size of the battery holder, since I assumed it would use a low profile metal retention style, like the CC2540 Keyfob uses. They may have opted for the larger plastic battery holder due to fact that there isn’t much space between the battery and the CC2540 chip, and RF interference may have been an issue.
Having said that, I’m glad they decided to use a CR1632 instead of CR2032, since it would’ve been even bigger if it used a CR2032, as you can see in the following image:
Compiling the Demo Software
The OLP425 comes pre-programmed with a demo application based on the Keyfob code from the CC2540 dev kit. connectBlue provides a great getting started document which explains all the functionality of the demo software, available here.
Unfortunately for myself, I didn’t bother reading the documentation, and I tried flashing the demo application to the OLP425 device, without realising that the module already came programmed with it. This wouldn’t have been a problem, except for the fact that I encountered numerous errors from IAR when attempting to compile the demo software.
The reason I had difficulty compiling the demo code was because I didn’t read the cB-OLP425 Development Kit Getting started document, or more specifically, the section entitled Installation of cB-OLP425 SDK zip-archive. If I had, I would’ve noticed that you’re supposed to “extract the cB-OLP425 SDK zip-archive into the installation folder for the Texas Instruments CC2540 BLE Software Development Kit”. Once I did this, all my problems were solved.
So assuming you’ve extracted the OLP425 SDK as described in the getting started document, you should now be able to open the IAR project file C:\Texas Instruments\BLE-CC254x-1.2.1\Projects\ble\cB-OLP425Demo\CC2540DB\Demo.eww, connect your OLP425 to the CC Debugger using the cB-ACC-71 adapter cable, and hit the “Download and Debug” button to compile the demo code.
A word of Caution: make sure you don’t insert a battery into the OLP425 if it’s hooked up to the CC Debugger. You can either use a battery, or connect the OLP425 to the CC Debugger – never both at the same time.
Using the demo software
Whereas the CC2540 KeyfobDemo required you to press one of the buttons to enable advertising, the cB-OLP425 demo software is much smarter and uses an accelerometer interrupt generated when the device is moved, to wake up the CC2540 and enter advertising mode. If you open up the cb_demo.c file in IAR and uncomment the following code on line 666, it’ll cause the green LED on the OLP425 to flash whenever it enters advertising mode, which can be helpful when debugging:
cbLED_flash(cbLED_GREEN, 1, 100, 0);
So now that we’ve flashed the OLP425 with the demo software, it’s time to test it using the Texas Instruments BTool application (C:\Texas Instruments\BLE-CC254x-1.2.1\Projects\BTool\BTool.exe), along with the USB BLE adapter from the CC2540 Mini Dev Kit.
The Getting Started guide provides very good instructions on using BTool to establish a connection with the OLP425 and describes how to use the Characteristic Write operation to modify the state of the LEDs, so I won’t duplicate that information here. Instead, I’ll briefly describe how to enable the notifications for the Temperature sensor.
Enabling Notifications for the Temperature Service
If we consult the Texas Instruments Bluetooth Low Energy CC2540 Mini Development Kit User’s Guide (swru270b.pdf) under section 4.3.6, Enabling Notifications, we’ll see that it’s possible for a GATT server device to “push” characteristic value data to a client device, without being prompted for a read request. We can configure the demo software on the OLP425 to push a new temperature value if it detects a change, or accelerometer data if the device is moved.
According to the CC2540 Mini Development Kit User’s Guide, in order to enable the notification for the changes in temperature, we need to first find the handle of the characteristic for the temperature service. If we consult the Temperature Service section of the cB-OLP425 Development Kit Getting started guide, we see that the characteristic UUID is 0xFFE1. We could also have found this value by looking at the C:\Texas Instruments\BLE-CC254x-1.2.1\Projects\ble\Profiles\Temperature\cb_temperature_service.h file, since this is where the Profile for the Temperature service and UUIDs are defined. Note that this UUID (as well as the UUIDs for the LED Service and Accelerometer Service) do not conform to any specifications in the Bluetooth SIG.
Now that we know the characteristic UUID, we can obtain the handle of the UUID as well the properties of the characteristic. We do this by using the Discover Characteristic by UUID process outlined in section 4.3.4 of the CC2540 Mini Dev Kit User’s Guide. In short, we welect the “Read/Write” tab in BTool, then set the “Sub-Procedure” to “Discover Characteristic by UUID” and enter E1:FF for the Characteristic UUID in BTool (note that the Least Significant Byte is entered first, and the Most Significant Byte is entered last), then click the “Read” button. On my machine, I get the hexadecimal values “12 37 00 E1 FF”, as shown the following image:
If we consult Section 3.3.1 of the Core v4.0 Specification from the Bluetooth SIG website, we see that the first byte of this value is the Characteristic Properties, and the value 0x12 represents a Read property (0x02) as well as the Notify property (0x10), since 0x02 + 0x10 = 0x12. The second and third bytes “37 00″ tell us that the handle of the characteristic value is 0x0037. The fourth and fifth bytes tell the UUID of the characteristic, 0xFFE1.
Going back to the CC2540 Mini Development Kit User’s Guide, we see that we can enable notifications of the Temperature Service by writing a value of 0x0001 to the client characteristic configuration descriptor for the particular characteristic. The handle for the client characteristic configuration descriptor immediately follows the characteristic value’s handle. Therefore, a value of 0x0001 must be written to handle 0x0038 (since this value immediately follows the handle of the characteristic value 0x0037 as found above). Enter “0x0037” into the “Characteristic Value Handle” box in the “Characteristic Write” section, and enter “01:00” in the “Value” section (note that the LSB is entered first, and the MSB is entered last). Click the “Write Value” button. The status box will display “Success”, indicating that the write was successful.
After enabling notifications on the Temperature Service, I then moved the OLP425 module near my desktop halogen lamp and within a second, I received a notification in the BTool log window showing that the temperature had increased from 25° C to 26° C, as shown in the following image:
We can remove the notification by writing the value “00:00″ to the Characteristic Value handle 0x0038 as in the procedure outlined above.
I’m very impressed with the small size of the cB-OLP425i-26, as well as the ease of programming the unit with the adapter cable, making it much easier to download software to the module without requiring a breakout board. I also really liked the documentation provided by the cB-OLP425 Development Kit Getting started guide, which was well written and straightforward. The cB-OLP425 cB-OLS425 cB-OLS426 Electrical Mechanical Data Sheet also provides a wealth of very useful information. I liked the fact that the code example used an accelerometer driven interrupt to wake up the module and enable advertising, which provides a useful starting point for people wanting to create a BLE device without a button.
The only downside to the OLP425 is the higher cost compared to other basic sensor-free BLE modules, but that’s the price you pay for the convenience of having the sensors, battery retainer and debugging connector provided for you.
In closing, I’m glad to see a new module on the market that provides something different than all the other standard BLE modules, and I’ve already got several projects in mind that the OLP425 will be perfect for.
UPDATE (December 9, 2012)
After writing the above post, it was explained by Kalle in the comments section that connectBlue have an iOS demo application, as well as source code available. At the time of writing this blog post, this wasn’t very apparent, however, connectBlue have now updated the landing page for the OLP425 to provide a link to the iOS demo application, which can be found here.
If you’d like to obtain the source code, you’ll need to send an email to firstname.lastname@example.org and ask them for it. They were pretty quick to respond to my request, and I received access to the source code within a few days of sending them an email.
I’ve been playing around with the demo app for the past few days, and it’s pretty slick. It scans and pairs with the OLP425 much faster than the Texas Instruments demo iPhone application does with the keyfob, and from the screenshots, it looks like it supports connecting to multiple OLP425 devices as well. Hopefully connectBlue will decide to post the source code for the demo application directly on their website in the future, in order to make it easier to obtain. I’ve got a feeling that they may just end up doing this after they start to receive thousands of requests from anxious developers!