How does it work?
RN4870 Click is based on the RN4870, a Bluetooth 4.2 low-energy module from Microchip. The Bluetooth radio works in 2402 up to 2480 GHz range and is secured with AES128 encryption. The user can create up to five public and four private services. In addition, the module features GAP, GATT, SM, L2CAP, and integrated public profiles. It can be configured by software as a Peripheral or Central and Client or Server. The onboard MODE switch is a system configuration input that allows you to enter application mode or test mode for Flash updates and EEPROM settings. The module will indicate whether the module is on/off over the STAT LED.
There are several available useful pins on two headers for the user’s configuration. On the left of the module, there is RX_I as a UART RX indication pin that you can use to enable communication with the UART when the module is in low-power mode. Here is also an RSSI pin as an RSSI indication pin used to indicate the quality of the link based on the RSSI level. On the right side, there is a PAIR pin as a pairing key that you can use to force the module to enter Standby mode. On this side, there is also a LINK or link drop pin that you can use to force the module to drop the current BLE link with a peer device.
RN4870 Click uses a standard UART interface to communicate with the host MCU with commonly used UART RX and TX pins. In addition, it uses UART control flow pins UART CTS and RTS. Besides the available software that we provide, you can communicate with the RN4870 using a set of ASCII commands. You can reset the module using the RST pin. There are two user-configurable pins, IO1 and IO2, that can be used for a standard 2-Wire I2C communication between the module and the host MCU. The RN4870 can also provide external PWM control with software-configurable PWM with 32 or 1024kHz, or 16MHz clock, available on the PWM pin on the mikroBUS™ socket.
This Click board™ can be operated only with a 3.3V logic voltage level. The board must perform appropriate logic voltage level conversion before using MCUs with different logic levels. However, the Click board™ comes equipped with a library containing functions and an example code that can be used as a reference for further development.
Specifications
Type
BT/BLE
Applications
Can be used for the development of health/medical devices, sports activity/fitness meters, beacon applications, internet of Things (IoT)sensor tags, remote controls, wearable smart devices and accessories, and more
On-board modules
RN4870 – Bluetooth 4.2 low-energy module from Microchip
Key Features
ASCII command interface API over UART, Bluetooth 4.2 with Low Energy stack, Secure AES128 encryption, GAP, GATT, SM, L2CAP, and integrated public profiles, custom up to five public and four private services, software configurable role as Peripheral or Central, and Client or Server, and more
Interface
I2C,UART
Feature
No ClickID
Compatibility
mikroBUS™
Click board size
M (42.9 x 25.4 mm)
Input Voltage
3.3V
Pinout diagram
This table shows how the pinout on RN4870 click corresponds to the pinout on the mikroBUS™ socket (the latter shown in the two middle columns).
Onboard settings and indicators
Label | Name | Default | Description |
---|---|---|---|
LD1 | PWR | – | Power LED Indicator |
LD2 | STAT | – | Module Active State LED Indicator |
SW1 | MODE | – | System Configuration Selection 1/0: Upper position 1, Lower position 0 |
RN4870 click electrical specifications
Description | Min | Typ | Max | Unit |
---|---|---|---|---|
Supply Voltage | – | 3.3 | – | V |
Frequency Range | 2402 | – | 2480 | MHz |
Data Rate | – | – | 10 | Kbps |
Software Support
We provide a library for the RN4870 Click as well as a demo application (example), developed using MIKROE compilers. The demo can run on all the main MIKROE development boards.
Package can be downloaded/installed directly from NECTO Studio Package Manager(recommended), downloaded from our LibStock™ or found on Mikroe github account.
Library Description
This library contains API for RN4870 Click driver.
Key functions
-
This function gets message from ‘void rn4870_receive function if flag was set. This function replaces ‘*’ (character with end of string) with ‘0x00’ and stores received message to process_buffer
-
The function receives character by waits for ‘#’ – character to start parsing message, waits for ‘*’ – character to stop parsing message and sets flag if whole and properly formated message is received.
-
The function connects to slave device with desired register address by secures the connection and entering data stream mode.
Example Description
This example reads and processes data from RN4870 clicks.
void application_task ( void )
{
rn4870_process( );
if ( dev_type == RN4870_DEVICETYPE_MASTER )
{
rn4870_connect( &rn4870, &RN4870_ADDR_SLAVE[ 0 ] );
log_printf( &logger, ">>> sending data <<<rn" );
rn4870_send( &rn4870, RN4870_MTYPE_MSG, RN4870_DTYPE_STRING, RN4870_ID_MASTER, &message_payload[ 0 ] );
rn4870_disconnect( &rn4870 );
}
else if ( dev_type == RN4870_DEVICETYPE_SLAVE )
{
msg_flag = rn4870_read( &rn4870, &receive_buffer[ 0 ] );
if ( msg_flag == 1 )
{
log_printf( &logger, ">>> data received <<<rn" );
log_printf( &logger, ">>> data : " );
log_printf( &logger, "%srn", ptr );
}
}
}
The full application code, and ready to use projects can be installed directly from NECTO Studio Package Manager(recommended), downloaded from our LibStock™ or found on Mikroe github account.
Other Mikroe Libraries used in the example:
- MikroSDK.Board
- MikroSDK.Log
- Click.Rn4870
Additional notes and informations
Depending on the development board you are using, you may need USB UART click, USB UART 2 Click or RS232 Click to connect to your PC, for development systems with no UART to USB interface available on the board. UART terminal is available in all MIKROE compilers.
mikroSDK
This Click board™ is supported with mikroSDK – MIKROE Software Development Kit. To ensure proper operation of mikroSDK compliant Click board™ demo applications, mikroSDK should be downloaded from the LibStock and installed for the compiler you are using.
For more information about mikroSDK, visit the official page.