The nRF8002 break out board is a simple to use module to develop Bluetooth 4.0 based applications. The nRF8002 has 3 digital outputs, 1 pulse width modulated(PWM) output, and 2 digital inputs. This module supports the proximity profile and can create immediate alerts and link loss alerts. The module also supports the battery profile and the host can query the device for the battery state of charge. In this tutorial we will be developing a simple proximity application.
Image may be NSFW.
Clik here to view.
Hardware Setup
The components needed for this application are:
FTDI Serial to USB Converter
Push buttons
LEDs
THDZ Buzzer
330Ω Resistor
2N3904 NPN Transistor
Jumper Cables
Breadboard
The various components are assembled as follows
1) The TX and RX pin of the nRF8002 breakout board is connected to the RX and TX pin of the FTDI USB
(Change to 3.3V operation) to serial converter respectively.
2) The IN1 and IN2 pins are connected to the pushbuttons.
3) The OUT1, OUT2 and OUT3 pins are connected to the LEDs via 330Ω resistors
4) The buzzer is controlled via transistor 2N3904 whose base is connected to the PWM output of the Bluetooth module via a 330Ω resistor.
The final assembled setup is shown below:
Clik here to view.

A photograph of the assembled board is shown below:
Image may be NSFW.
Clik here to view.
Software Setup
To program the various parameters in the Bluetooth module to control the inputs and outputs, we will be using the nRFStudio tool available from Nordic Semiconductor at (http://www.nordicsemi.com/eng/nordic/download_resource/14964/43/10909484).
Once the program is installed, it communicates to the Bluetooth module using the FTDI Basic board. When the program is launched for the first time, the screen below is seen. Click on nRF8002 in the “Features” menu on the left to begin configuring the device.
Device Tab
In this tab, we will set the “Local Name” parameter to “myFirstBLE”. This value will be displayed on the host device during the initial pairing process. The remaining parameters in the “Identification” section of this tab can be used to uniquely identify the device. The parameter values can be queried by the host system. In this application, the remaining parameters are left unchanged.
Image may be NSFW.
Clik here to view.
Inputs Tab
An input pin connected to a button can generate three events determined by the amount of time the button is pressed.
1) A press shorter than t1 is interpreted as a Short press.
2) A press longer than t1, but shorter than t2, is interpreted as a Medium press.
3) A press longer than t2 is interpreted as a Long press.
Clik here to view.

The polarity section is used to determine if active low or active high should be used for signaling. The default setting is active low. This screen is also used to provide immediate feedback for the various button press events. In the default settings, a simple beep is heard after a short press and a double beep is heard after a long press. Custom blinking and beeping patterns can be developed using the “Outputs tab”
Output Tab
The output tab is used to develop custom blinking and beep patterns that can be assigned to the various output pins.
Image may be NSFW.
Clik here to view.
State Machine Tab
This tab is used to configure the state machine of the module. The device has 4 states namely sleep, bonding, connecting and connected. For each state, the three digital outputs and PWM output of the module can be configured. Similarly, the inputs that will trigger the entry into the various states can also be controlled.
Image may be NSFW.
Clik here to view.
Profile – On Slave Tab
This tab is used to control the proximity and battery related functions. For proximity there are two main types of responses namely Immediate and Link Loss. Each of these responses can be further configured at run time by the host as mild or high. For example, with the default setup, when the master device sets the Immediate alert to Off, the output pin is disabled. This happens because the output pin is set to use the pattern Fixed output to the PWM but inverts it.
For example, the default setup uses the PWM to trigger 3 short beeps when the master device has
activated Immediate alert with level set to Mild.
Image may be NSFW.
Clik here to view.
Profile – On Master Tab
This tab is used to select the output you want when the peer device sends an Alert notification. For example, in the setup shown in the figure Pin 3 will be set to 5 blinks, 300 ms on, 200 ms off when an Alert notification is received and the SMS/MMS. When the Call flag is set, Pin 3 will use the 3 blink, 200 ms on 500 ms off setting.
Image may be NSFW.
Clik here to view.
Upload Configuration Tab
This tab is used to upload to upload the final configuration into the device for testing. During debugging, the radio box for “Upload to RAM” must be selected. If the device is powered off or reset for any reason, the settings must be reloaded. Once the system has been debugged, the settings can be permanently stored on the device by using the “Upload to OTP” option. This will permanently store the configuration in the one time programmable (OTP) memory and will be available even after power off or reset conditions.
Image may be NSFW.
Clik here to view.
Testing
We have put together our own android app to test this setup. You can check out the code and full explanation of the app here! This project can also be tested using an iPhone running iOS 6.0 or greater using the nRFReady app provided by Nordic Semiconductors. It can also be tested on an Android phone running Android version 4.3 or greater using the nRF Utillity app also provided by Nordic Semiconductors.