The RF-TRX-2.4G transceiver is using the nRF24L01+ chip which is a highly integrated, ultra low power (ULP) 2Mbps RF transceiver IC for the 2.4GHz ISM (Industrial, Scientific and Medical) band. With peak RX/TX currents lower than 14mA, a sub μA power down mode, advanced power management, and a 1.9 to 3.6V supply range.It includes the basic operating component and on board antenna . You can use it in you project without any wireless design , just need to leave a 8 pins interface to this module including the Enhanced ShockBurst hardware protocol accelerator supporting a high-speed SPI interface for the application controller.No external loop filter, resonators, or VCO varactor diodes are required, only a low cost ±60ppm crystal, matching circuitry, and antenna. Based on the tested result, the range for this device to operate normally is around 10-20m in Wifi region and 100m in an open area. By the ways, it offers low cost wireless alternative compared to Bluetooth and XBee transceiver.
The SPI interface uses four pins, CSN, SCK, MISO, and MOSI for data transmission and reception. The CSN (chip select not) pin is active-low, and is normally kept high. When this pin goes low, the 24L01 begins listening on its SPI port for data and processes it accordingly. The remaining three pins should be tied to the user’s hardware SPI interface, to the same pins as their name suggests (SCK to SCK, MISO to MISO, and MOSI to MOSI).
The remaining two pins are CE and IRQ. CE is used to control data transmission and reception when in TX and RX modes, respectively. IRQ is the interrupt pin, and is active-low. There are three internal interrupts that can cause this pin to go low when they are active. Each of these bits can be masked out such that when the bit’s respective interrupt becomes active, the status of the IRQ pin is not changed.In this tutorial, a project on creating the wireless communication in between SK28A and BBFuino was implemented by using two RF-TRX-2.4Gs.Based on the connection shown as the above, keypad on the BBfuino board will send data via RF-TRX-2.4G and received by another RF-TRX-2.4G on the SK28A board or vice versa.
*Note: Before getting started, please read the nRF24L01+ data sheet.
*Note: 3.3V Operating module. Vcc should be power with 3.3V (5V will burn the module). However, communication pin is 5V compatible.
Hardware And Accessories1 x BBFuino 1 x SK28A 2 x RF-TRX-2.4G 2 x SW-KEYPAD-4X4 2 x LCD (8×2) 2 x VR-1117-3.3 v regulator
Figure 1: nRF24L01+ Pin assignment
Part I: BBFuino and RF-TRX-2.4G setup
1. A cutter used to cut the 2×40 header pin (Male) into 2×8 ways. The pins was soldered to the 2×8 LCD as shown below. Before (Front view) After (Back view)
Figure 1: Soldering the header pins onto the 2×8 LCD2. A 2×40 header pins (Female) was cutting into 2×8 ways and being soldered onto the LCD pad (DS3) of BBFuino board as shown below. Front view Back view
Figure 2: Soldering the header pin onto the BBFuino Board3. Soldered the JP8 on the BBFuino as shown below in order the LCD backlight can be function properly. Before After
Figure 3: Soldering the JP8 on the BBFuino board
4. Connect the circuit as the schematic provided
a) The schematic between the BBFuino and the RF-TRX-2.4Gb) Circuit connection between BBFuino and RF-TRX-2.4G**Note: Due to the 2×8 LCD shared 2 pins(pin4-RS and pin6-E) with the RF-TRX-2.4G(pin3-CE and pin4-CSN), hence the pin4 and pin6 of the 2×8 LCD were connected to D2 and D3 of the BBFuino respectively. c) Actual circuit connection
Part II: Sk28A with nRF24L01 setup
1. Repeat the step from 1 to 3 as the above (BBFuino and RF-TRX-2.4G setup section).
2. Connect the devices as the schematic provided.
a)Schematic between RF-TRX-2.4G with SK28A
b) Circuit connection between SK28A and nRF24L01c) Actual circuit connection
Part III: Source code
The sample source code provided will result a character display on LCD when the button of 4×4 keypad is pressing.a) BBFuino source code The following source code was compiled by using Arduino Ide version 0021. Arduino Ide version 0021 for BBFuino can be download from here The following show the main part of the source code. LCD pin initialize:
- The LCD pin initialize for RS-D2, E-D3, DB4-D4, DB5-D5, DB6-D6, DB7-D7
- In this part of sample source code, the SPI had been initialize for activating the transmit mode.
- While the keypad was pressed, the data (character )will be store in an array and next store it to a register address.
- Next, check the Mask interrupt caused by TX_DS and Mask interrupt caused by MAX_RT.
- The following part of sample source code showed that RX mode had activated first. It read the register status’s value and check whether the register receive data or not. It will display the data(charcter) on the LCD if RF-TRX-2.4G did received data. Clear the interrupt flag in order for it to receive the next data and change it back to transmit mode.
Note: The sample source file can be downloaded from the attachment below.b) SK28A source code The following source code was compiled by using the MPlab X version 1.20 and XC8 compiler version 1.0. Please refer to here for MPlab X tutorial The following show the main part of the source code. Receiving mode:
- In this part of sample source code,the receive mode will be activated as data in the register read out sucessfully by checking the IRQ pin.
- As the keypad was being pressed, the transmit mode being activated and the data will be store in the register.
- Change it back to RX mode in order for it to receive data.
Part IV: Resulta) Transmit from BBFuino and received by the Sk28A via RF-TRX-2.4G
Figure 4.1: e.g<Display character ‘2’ on LCD(on SK28A board) as pressing the ‘2’ keypad button on the BBFuino board>
b) Transmit from SK28A and received by BBFuino via RF-TRX-2.4G
Figure 4.2: e.g<Display character ‘3’ on LCD(on BBFuino Board) as pressing the ‘3’ keypad button on the SK28A board>