Features and usage notes
Also known as Bluetooth Low Energy, BLE is intended for small smart devices like home automation sensor and fitness applications that need to have really low power consumption and long battery life. The BLE 3 click communicates with the target board MCU through the UART, SPI and I2C interface, with the addition of 7 GPIO pins. It uses 3.3V power supply only.
The NINA-B1 module has different power saving modes to conserve battery life – standby mode and power off mode. The module usually spends most of the time in power off mode (it is the primary mode) and wakes up to send small packages of data, and then powers off again. The following events can be used to bring the module out of standby-mode:
- External wake-up event
- RTC event
- Analog or digital sensor event (programmable voltage level or edge detection)
During standby mode, the module is clocked at 32 kHz reference clock, which is generated by an internal 32 kHz oscillator.
The module is fully Bluetooth qualified and provides global modular approval. The ADC can sample up to 200 kHz using different inputs as sample triggers and it supports 8/10/12 bit resolution. Any of the 8 analog inputs can be used both as single-ended inputs and as differential pairs for measuring the voltage across them. The ADC supports full 0 V to VCC input range.
The NINA-B112 modules have an integrated antenna mounted on the PCB (10.0 x 14.0 mm). The RF signal pin is not connected to any signal path. You can configure NINA-B1 modules through U-Blox S-Center toolbox software using AT commands. The s-center evaluation software is available free of charge and can be downloaded from the U-Blox website.
This table shows how the pinout on BLE 3 click ccorresponds to the pinout on the mikroBUS™ socket (the latter shown in the two middle columns).
The board also has an additional pinout with 7 GPIOs:
The demo code available on Libstock sets up the BLE 3 click to broadcast the state of pins on a desired port. A smartphone and BLE 3 can communicate when a connection is established, and the smartphone can chage the state of the pins over bluetooth low energy.
The code snippet sets up the BLE 3 click in data mode, and sends the state of the pins of a port over BLE. Also, when BLE 3 receives a value from the smartphone, it will send the value over UART to the MCU, the MCU then sets that value as the value of the pins of a desired port.
1 #include <stdint.h>
2 #include <stdbool.h>
4 sbit BLE3_RTS_MCU at GPIOD_IDR.B13;
5 sbit BLE3_CTS_MCU at GPIOD_ODR.B10;
6 sbit BLE3_RST at GPIOC_ODR.B2;
9 uint16_t porte_read = 0;
11 void main()
14 GPIO_Digital_Input( &GPIOD_BASE, _GPIO_PINMASK_10 );
15 GPIO_Digital_Output( &GPIOD_BASE, _GPIO_PINMASK_13 );
16 GPIO_Digital_Output ( &GPIOC_BASE, _GPIO_PINMASK_2 );
17 GPIO_Digital_Output(&GPIOE_BASE, _GPIO_PINMASK_ALL); // Set PORTE as digital output
19 UART3_Init_Advanced( 115200, _UART_8_BIT_DATA, // Initialize UART
25 BLE3_RTS_MCU = 0; // set RTS to 0
26 BLE3_RST = 1; // pull reset pin high
29 Uart3_Write_Text("AT+UBTLN="); // set the device name to "mikroE"
35 Uart3_Write_Text("ATO1r"); // set BLE 3 into data mode, all bytes sent from UART will be sent over BLE
36 delay_ms(1000); // all bytes received from BLE will be sent to UART
39 RXNEIE_USART3_CR1_bit = 1; // setup UART interrupt
40 NVIC_IntEnable( IVT_INT_USART3 );
45 GPIOE_ODR = porte_read << 8;
46 Uart3_Write(porte_read); // send the updated value of the PORT over BLE
53 // if smartphone/tablet writes to BLE 3, update the port with the value sent from the smartphone/tablet
55 void LO_RX_ISR() iv IVT_INT_USART3 ics ICS_AUTO
57 if( RXNE_USART3_SR_bit )
59 porte_read = USART3_DR;
Code examples for BLE 3 click, written for MikroElektronika hardware and compilers are available on Libstock