One of the concern about the monbaby device is radiation safeness, especially it is going to be used on the little babies who are more sensitive to environmental stimulus.

Radiation of radio frequency (RF) devices are measured by Special absorption rate (SAR). It is a measure of the rate at which energy is absorbed by the body when exposed to a radio frequency electromagnetic field. It is defined as the power absorbed per mass of tissue and has units of watts per kilogram (W/kg). A general rule of thumb is, higher emission power would increase the SAR measurement.

Here are some sample facts and measurement of SAR for different RF devices:

Cellphones in US are limited to 1.6W/kg by regulation

Apple iPhone 4 : 1.17W/kg

Baby monitors range between 0.01-0.08W/kg

Bluetooth devices about 0.001W/kg

There is no public measurement data found for BLE yet, but given BLE has even lower power emission than Bluetooth, the SAR number should be very insignificant to be compared.

Bluetooth technology has such an insignificant radiation that in fact, this is one of the reason why a lot of bluetooth earpieces came out in the market after cellphones become our daily routine, to reduce the radiation we are exposing to when making calls.

Bluetooth and Bluetooth low energy technology are both using 2.4-2.5GHz band, which is the same as the common FM radio.

Texas Instrument manufactures an integrated BLE chip called CC2540. This chip contains not only the bluetooth LE radio, but also programmable 8051 core. They provide complete development tools, and they come in two forms:

The larger of the devkit CC2540DK contains general-purpose development / evaluation board called SmartRF05EB. These boards are also used for their line of wireless modules created by ChipCon (subsidiary of TI). As such, it’s compatible with other wireless evaluation modules CCxxxx.

The CC2540DK kit comes with two CC2540EM evaluation modules and two SmartRF05EB boards. The SmartRF05EB contains lots of peripherals such as LCD, Joystick, LEDs, Potentiometer, switches, etc.. In addition, it has necessary components to flash and debug the target chip. The target chip is any compatible CC device as previously mentioned, which is surface mounted onto the evaluation module PCBs.

A noteworthy aspects about this kit

Only BLE hardware implementation that has coupled host microcontroller in a single chip (SoC: System On Chip)

Significant sofware stack for interfacing with the hardware

Development project workspaces available for testing on IAR Workbench

Bluetooth v4.0 compliant profile implementations and examples

In order to test out different examples provided with TI’s ble stack download, several other tools need to be setup:

As for this writing, this is the only dev kit that provides both the hardware and the necessary software stack to test out BLE functionality in a single package. The only downside is that the software stack is written only for IAR Workbench, which requires license to create compiled hex beyond 4Kb (free version limit). We would love to see an opensource version of the software stack written for compilers such as SDCC.

The Chip

There are 2 variants of CC2540 : CC2540F128, CC2540F256. The only different between the two is the flash space as the name indicates. (128kB vs 256kB). This chip has all major peripherals and hardware capability of modern microcontrollers, as you can see from the functional diagram below. Some highlights:

USB controller

2 hardware UART

Hardware encryption engine

bunch of timers

ADC’s go upto 14bit resolution

Next, the CC2540′s pin labels in the current package:

The evaluation module that houses the actual CC2540 chip has all of the IO pins brought out to accessible debug headers. Most of the IO ports are routed to the first SMD socket (evaluation module socket), and is accessible from one of the debug headers located on P18 on SmartRF05EB.

Connectors for Peripherals

The pins that are brought out via evaluation module connectors are mapped to various peripherals on SmartRF05EB board. The mapping is as follows. On my rev 1.8 board, these pin outs correspond to board connectors P5 and P6, respectively. More details can be found on SmartRF05EB board’s user guide.

The probe connectors give access to these pins, but the mapping from the EM -> Probe pinouts are not straight forward. The probe pin mapping is as follows:

To access a specific pin on from CC2540, we need to do a little mapping of the ports specified from the tables shown above. For example, the IO pin P0.1 from CC2540 corresponds to EM_BUTTON1/EM_LED4_SOC at EM connector pin 5. The same pin corresponds to the pin 7 on the prob connector. I wish the mapping of the pins from the debug headers to the actual chip was more straight forward. I had to trudge through 3 different technical documentations to find this.

I’ll be connecting the pulsesensor to pin P0.7, which corresponds to EM_POT_R (potentiometer) on pin 17 @ P5 on the EM connector and pin 17 @ P18 on the probe connector. In order to disable the onboard potentiometer, I needed to take the jumper off on connector P10 on SmartRF05EB, at position 33-34. The connector P10 is where you can sever or link each individual peripheral that connects to the evaluation board housing CC2540.

Pulsesensor is an open-source heart rate monitoring sensor built to work with the Arduino. The underlying mechanism uses periodic sampling of ADC value from the light intensity sensor, and signal filtering to detect the peak-to-peak length in the data. The current Arduino code requires relatively high rate of sample polling, and thus prone to heavier power consumption compared to low-powered designs.

While the method used to detect the pulse is not new, the pulsesensor is the first open source product we’ve seen for heart rate sensors. As such, we felt the product was a good fit for our first prototype design for Monbaby. However, the platform we will be using isn’t Arduino. Hence, we will need to examine the algorithm used, and understand its pros and cons. There should be other signal filtering algorithms that are appropriate in finding out peak-to-peak length in the noisy raw data from the light intensity sensor. Once the signal processing algorithm is fully understood, we can then reimplement the logic within the CC2540 software stack.

The Algorithm

The latest release of pulsesensor code is posted in its entirety below. This code is meant to compile under Arduino IDE. Hence, it’s missing headers and normal format of typical AVR firmware C source. It uses the timer interrupt every 1ms to read the analog value from the sensor. It averages out the readings at every 300 run, and de-means the raw signal by subtracting it by the calculated mean.

This normalized (de-meaned) data is then refined further. A signal processing method called “Butterworth filter” is used to reduce the noise in the normalized raw data. I have yet to read more about the algorithm, but it seems akin to ARIMA time series model, where the predicted value (Y_hat) is a function of past values and the forecast error term (residual) between the real and prediction values. The way Butterworth filter is used, however, is through “Band-Pass” filtering process. It defines low-pass and high-pass bands that eliminate frequencies that are outside of those bounds. We will be reading more about these signal processing techniques in the coming days.

The result shows the effect of “smoothing” that Butterworth algorithm carries out on the raw data as you increase the number of sample count per cycle. In our case, the number of samples per sinusoidal wave was 10 ( pi * 100 / 5 = 20 pi = 10 waves ). With 100 total samples, that gives you 10 samples per wave. As you throttle the freq argument from 3 to 6, you can see how the filtering is taking out the random noise I added in.

By default, the bwfilter function uses order 2. The order basically determines how “complex” your model can get. Higher the order, more accurate the filtering will be, but at a computational cost. Below is the printout of bwfilter R function.

Hmm.. the guts of the function looks somewhat familiar to me. It contains matrix manipulation that seems to construct the coefficient matrix that models the relationship among variables on a "moving window". The matrix multiplication is carried out between this coefficient matrix and the actual data, which gives the values to the right-hand side of the equation : Ax = b. The problem is then treated as an inverse problem. The function "solve" is used when you have the model and the output, but you do not know which inputs you need to make the output hold true given the relationships defined in your linear model. The coefficients, or the loadings of the variables are calculated this way, and it is a common technique used in numerical computing when the model parameters are fit to the existing dataset.

Further investigation is necessary to understand the system of equations used and what objective function this filter is trying to optimize.

TI’s CC2540 is both the host microcontroller and a bluetooth LE chip, commonly referred to as SoC (System on Chip). You would think that the host microcontroller might be just tacked-on, an after-thought, since the bluetooth LE chip is the star of the show. If that might have been your first impression, you’d be dead wrong. The microcontroller (SoC) component of CC2540 is a full-blown 8051 core with impressive array of peripherals and functionalities. This 8051 chip boasts 256kB flash for programming space, 8kB ram, USB driver, 2 hardware controlled UART, and many more features. In comparison, the ever-popular Arduino Uno only has 32Kb, merely 8 time smaller than this 8051 core in CC2540.

With such a beefy spec on their 8051 core, Chipcon (subsidiary of TI since 2006) developers went all-out designing a significant software stack for their line of newer chips. This software stack relies on abstracted layers of software, delineating the logical separation of hardware interface, operating system, and user application. With the exception of the BLE stack, the part of the library that implements Bluetooth LE communication, rest of the source code is provided with the download. The code is well-thought out and nicely laid out, with ample comments that serve as documentation in itself.

This software stack takes up over 100kB of 256kB total flash space. On my machine, the compiled code took up about 110kB. It could be the differences between the IAR version and the library version (mine’s on 1.1a).

HAL Layer

The HAL (Hardware Abstraction Layer) sits on top of IAR’s device-specific defines for CC2540 (ioCC2540.h). It gives convenient mappings for IO peripherals, and macros for accessing hardware functions within CC2540 such as UART, SPI, USB, Timers, etc.

This layer also defines which ports are tied to which peripherals are mapped to which IO modules on the Evaluation board. The Chipcon’s SmartRF05EB Evalulation Board is the one that comes with CC2540 development kit. This board as many IO goodies such as LCD, led’s, eeprom, push buttons, directional joy stick. The file hal_board_cfg.h defines these mappings, and the documentation suggests modifying this file when using CC2540 on a different board (obviously!).

OSAL Layer

The development of CC2540 requires knowledge of layers of software stack that are rather involved. For example, series of tasks are handled by event-based operating system layer called OSAL (Operating System Abstract Layer). This layer is not a full operating system, however.

The OSAL layer gives wrappers and interfaces to execute linear set of operations in an organized manner. It does this by largely defining actions into 2 categories: tasks and events. Each task can handle multiple events, and each event corresponds to a specific task. You can think of this as array of tasks, each task item containing 16 bits. Each bit per task would correspond to an event that is associated with such task. Thus, you can define at most 15 (-1 for reserved) events per task.

The implementation of this task / event handling is found under OSAL.c, within the function osal_run_system.

Notice it scans from the lowest idx (highest priority task), finds the task with any event set on it. It then drops into the if block that checks to make sure the idx of the task is not the max of tasks registered. Within this block, it simply calls the callback function registered within tasksArr which is a global variable containing all registered callback functions. Prior to the execution of this function, the data arrays tasksEvents and tasksArr needs to be created during compile time.

The Bluetooth LE’s protocol is comprised of several layers of both hardware and software implemented inter-communication paradigm. The picture below describes how the protocol stack is organized:

The developers typically deal with both GAP and GATT layers when implementing their applications. The GAP layer defines several roles the bluetooth LE end-device will be classified as. The GATT layer defines profiles, which is organized set of data and services the end-device will support. Through these layers, each BLE device can not only be identified, but its characteristics and attributes can be determined by other nodes wanting to pair against it. The lower layers of the protocol stack is both a combination of hardware implementation and software enforced interface.

New GATT profile specifications are being proposed and adopted by the members of Bluetooth SIG. These specifications provide guidelines across wide range of end-user applications and scenarios. A complete list of these profiles can be found here.

In order to draw a parallel against the internet world, the GAP can be thought of as a type of application protocol such as FTP, HTTP, SSH. Furthermore, once an application has been classified as HTTP, it would support protocol specific commands such as GET or POST requests, among others. These protocol-specific set of functions and data can be thought of as GATT in the BLE world.

For more detailed description of the BLE protocol stack, the following documents by TIcan be very useful in understanding the basic concepts.

Bluetooth Low Energy, or otherwise known as Bluetooth v4.0, is the new wireless standard targeted for new generation of low-power applications. With the advent of smartphone technologies and mobile computing, the need for portable sensors and near-communication networks have become a new found interest among vendors as well as consumers.

We are at the cusp of technological convergence and advancement that will make significant impact in the way we live. Low-power wireless sensors can be literally embedded everywhere, from wearable devices to buildings, and common objects that we associate with day-to-day. These monitors can be designed to transmit useful data from their physical surroundings and environments, and the collected data can be harvested for practical applications.

One of the primary areas where we envision the use of this wireless technology is within the medical industry. Bluetooth LE can enable telemonitoring, or remote monitoring, of patients. The vital signals such as heartrate, blood pressure, body temperature and be monitored and the data can be transmitted wirelessly. These sensors can not only provide detailed data for personnel caring for the patients, but also trigger alerts upon patient-specific body conditions. This will allow continuous active monitoring of patients who need intensive care and will help improve the quality of diagnose and treatment.

There are many useful resources online in order to learn more about Bluetooth LE. To list a few:

We will focus on developing useful and exciting devices with Bluetooth LE. While our products will not be limited to using Bluetooth LE, it will be interesting to see cool applications come out of this new wireless standard in the coming few years. Stay tuned!