Silicon ChipEl Cheapo Modules 12: 2.4GHz Wireless Data Modules - January 2018 SILICON CHIP
  1. Outer Front Cover
  2. Contents
  3. Publisher's Letter: Autonomous vehicles will need to be very secure
  4. Feature: Monitoring our world – and beyond – with tiny satellites by Dr David Maddison
  5. Project: Make your own Theremin – then make music! by John Clarke
  6. Project: The Lathe-E-Boy: high power Lathe Controller by Peter Bennett & Nicholas Vinen
  7. Project: Arduino LC Meter Shield Kit by Bao Smith
  8. Product Showcase
  9. Serviceman's Log: The stereo recorder that wasn't by Dave Thompson
  10. Project: High Power DC Fan Controller has loads of applications by Nicholas Vinen
  11. Feature: El Cheapo Modules 12: 2.4GHz Wireless Data Modules by Jim Rowe
  12. Vintage Radio: "Restoring" a pile of hydrated ferric oxide. It will never work again – but it looks great by Associate Professor Graham Parslow
  13. PartShop
  14. Subscriptions
  15. Market Centre
  16. Advertising Index
  17. Notes & Errata: GPS-based Frequency Reference, March 2007; VS1053 Arduino Music Player, July 2017; Touchscreen 6GHz+ Frequency Counter, October-December 2017; Kelvin the Cricket, October 2017; Vintage Radio, November 2017
  18. Outer Back Cover

This is only a preview of the January 2018 issue of Silicon Chip.

You can view 37 of the 104 pages in the full issue, including the advertisments.

For full access, purchase the issue for $10.00 or subscribe for access to the latest issues.

Items relevant to "Make your own Theremin – then make music!":
  • Theremin PCB [23112171] (AUD $12.50)
  • Theremin PCB pattern (PDF download) [23112171] (Free)
  • Theremin box cutting and drilling diagram (PDF download) (Panel Artwork, Free)
  • Theremin front panel artwork (PDF download) (Free)
Items relevant to "The Lathe-E-Boy: high power Lathe Controller":
  • Firmware (BASIC code) for the Lathe-E-Boy High Power Lathe Controller (Software, Free)
Items relevant to "Arduino LC Meter Shield Kit":
  • Firmware (Arduino sketch) for the LC Meter (Mega Box) (Software, Free)
  • Firmware (Arduino sketch) for the VS1053 Music Player (Mega Box) (Software, Free)
  • Firmware (Arduino sketch) for the LC Meter (Mega Box) (Software, Free)
Articles in this series:
  • The Arduino MegaBox from Altronics (December 2017)
  • The Arduino MegaBox from Altronics (December 2017)
  • Arduino LC Meter Shield Kit (January 2018)
  • Arduino LC Meter Shield Kit (January 2018)
  • The Arduino Mega Box Music Player revisited (February 2018)
  • The Arduino Mega Box Music Player revisited (February 2018)
  • Altronics New MegaBox V2 Arduino prototyping system (December 2019)
  • Altronics New MegaBox V2 Arduino prototyping system (December 2019)
Items relevant to "High Power DC Fan Controller has loads of applications":
  • High Power DC Fan Speed Controller PCB [05111171] (AUD $2.50)
  • PIC12F675-E/P programmed for the High Power DC Fan Speed Controller [0511117A.HEX] (Programmed Microcontroller, AUD $10.00)
  • Firmware (HEX and C) file for the High Power DC Fan Speed Controller [0511117A.HEX] (Software, Free)
  • High Power DC Fan Speed Controller PCB pattern (PDF download) [05111171] (Free)
Items relevant to "El Cheapo Modules 12: 2.4GHz Wireless Data Modules":
  • NRF24L01+PA+LNA with SMA connector & antenna (Component, AUD $12.50)
  • Firmware (Arduino sketch and Micromite BASIC code) for the nRF24L01 modules (Software, Free)
Articles in this series:
  • El Cheapo Modules From Asia - Part 1 (October 2016)
  • El Cheapo Modules From Asia - Part 1 (October 2016)
  • El Cheapo Modules From Asia - Part 2 (December 2016)
  • El Cheapo Modules From Asia - Part 2 (December 2016)
  • El Cheapo Modules From Asia - Part 3 (January 2017)
  • El Cheapo Modules From Asia - Part 3 (January 2017)
  • El Cheapo Modules from Asia - Part 4 (February 2017)
  • El Cheapo Modules from Asia - Part 4 (February 2017)
  • El Cheapo Modules, Part 5: LCD module with I²C (March 2017)
  • El Cheapo Modules, Part 5: LCD module with I²C (March 2017)
  • El Cheapo Modules, Part 6: Direct Digital Synthesiser (April 2017)
  • El Cheapo Modules, Part 6: Direct Digital Synthesiser (April 2017)
  • El Cheapo Modules, Part 7: LED Matrix displays (June 2017)
  • El Cheapo Modules, Part 7: LED Matrix displays (June 2017)
  • El Cheapo Modules: Li-ion & LiPo Chargers (August 2017)
  • El Cheapo Modules: Li-ion & LiPo Chargers (August 2017)
  • El Cheapo modules Part 9: AD9850 DDS module (September 2017)
  • El Cheapo modules Part 9: AD9850 DDS module (September 2017)
  • El Cheapo Modules Part 10: GPS receivers (October 2017)
  • El Cheapo Modules Part 10: GPS receivers (October 2017)
  • El Cheapo Modules 11: Pressure/Temperature Sensors (December 2017)
  • El Cheapo Modules 11: Pressure/Temperature Sensors (December 2017)
  • El Cheapo Modules 12: 2.4GHz Wireless Data Modules (January 2018)
  • El Cheapo Modules 12: 2.4GHz Wireless Data Modules (January 2018)
  • El Cheapo Modules 13: sensing motion and moisture (February 2018)
  • El Cheapo Modules 13: sensing motion and moisture (February 2018)
  • El Cheapo Modules 14: Logarithmic RF Detector (March 2018)
  • El Cheapo Modules 14: Logarithmic RF Detector (March 2018)
  • El Cheapo Modules 16: 35-4400MHz frequency generator (May 2018)
  • El Cheapo Modules 16: 35-4400MHz frequency generator (May 2018)
  • El Cheapo Modules 17: 4GHz digital attenuator (June 2018)
  • El Cheapo Modules 17: 4GHz digital attenuator (June 2018)
  • El Cheapo: 500MHz frequency counter and preamp (July 2018)
  • El Cheapo: 500MHz frequency counter and preamp (July 2018)
  • El Cheapo modules Part 19 – Arduino NFC Shield (September 2018)
  • El Cheapo modules Part 19 – Arduino NFC Shield (September 2018)
  • El cheapo modules, part 20: two tiny compass modules (November 2018)
  • El cheapo modules, part 20: two tiny compass modules (November 2018)
  • El cheapo modules, part 21: stamp-sized audio player (December 2018)
  • El cheapo modules, part 21: stamp-sized audio player (December 2018)
  • El Cheapo Modules 22: Stepper Motor Drivers (February 2019)
  • El Cheapo Modules 22: Stepper Motor Drivers (February 2019)
  • El Cheapo Modules 23: Galvanic Skin Response (March 2019)
  • El Cheapo Modules 23: Galvanic Skin Response (March 2019)
  • El Cheapo Modules: Class D amplifier modules (May 2019)
  • El Cheapo Modules: Class D amplifier modules (May 2019)
  • El Cheapo Modules: Long Range (LoRa) Transceivers (June 2019)
  • El Cheapo Modules: Long Range (LoRa) Transceivers (June 2019)
  • El Cheapo Modules: AD584 Precision Voltage References (July 2019)
  • El Cheapo Modules: AD584 Precision Voltage References (July 2019)
  • Three I-O Expanders to give you more control! (November 2019)
  • Three I-O Expanders to give you more control! (November 2019)
  • El Cheapo modules: “Intelligent” 8x8 RGB LED Matrix (January 2020)
  • El Cheapo modules: “Intelligent” 8x8 RGB LED Matrix (January 2020)
  • El Cheapo modules: 8-channel USB Logic Analyser (February 2020)
  • El Cheapo modules: 8-channel USB Logic Analyser (February 2020)
  • New w-i-d-e-b-a-n-d RTL-SDR modules (May 2020)
  • New w-i-d-e-b-a-n-d RTL-SDR modules (May 2020)
  • New w-i-d-e-b-a-n-d RTL-SDR modules, Part 2 (June 2020)
  • New w-i-d-e-b-a-n-d RTL-SDR modules, Part 2 (June 2020)
  • El Cheapo Modules: Mini Digital Volt/Amp Panel Meters (December 2020)
  • El Cheapo Modules: Mini Digital Volt/Amp Panel Meters (December 2020)
  • El Cheapo Modules: Mini Digital AC Panel Meters (January 2021)
  • El Cheapo Modules: Mini Digital AC Panel Meters (January 2021)
  • El Cheapo Modules: LCR-T4 Digital Multi-Tester (February 2021)
  • El Cheapo Modules: LCR-T4 Digital Multi-Tester (February 2021)
  • El Cheapo Modules: USB-PD chargers (July 2021)
  • El Cheapo Modules: USB-PD chargers (July 2021)
  • El Cheapo Modules: USB-PD Triggers (August 2021)
  • El Cheapo Modules: USB-PD Triggers (August 2021)
  • El Cheapo Modules: 3.8GHz Digital Attenuator (October 2021)
  • El Cheapo Modules: 3.8GHz Digital Attenuator (October 2021)
  • El Cheapo Modules: 6GHz Digital Attenuator (November 2021)
  • El Cheapo Modules: 6GHz Digital Attenuator (November 2021)
  • El Cheapo Modules: 35MHz-4.4GHz Signal Generator (December 2021)
  • El Cheapo Modules: 35MHz-4.4GHz Signal Generator (December 2021)
  • El Cheapo Modules: LTDZ Spectrum Analyser (January 2022)
  • El Cheapo Modules: LTDZ Spectrum Analyser (January 2022)
  • Low-noise HF-UHF Amplifiers (February 2022)
  • Low-noise HF-UHF Amplifiers (February 2022)
  • A Gesture Recognition Module (March 2022)
  • A Gesture Recognition Module (March 2022)
  • Air Quality Sensors (May 2022)
  • Air Quality Sensors (May 2022)
  • MOS Air Quality Sensors (June 2022)
  • MOS Air Quality Sensors (June 2022)
  • PAS CO2 Air Quality Sensor (July 2022)
  • PAS CO2 Air Quality Sensor (July 2022)
  • Particulate Matter (PM) Sensors (November 2022)
  • Particulate Matter (PM) Sensors (November 2022)
  • Heart Rate Sensor Module (February 2023)
  • Heart Rate Sensor Module (February 2023)
  • UVM-30A UV Light Sensor (May 2023)
  • UVM-30A UV Light Sensor (May 2023)
  • VL6180X Rangefinding Module (July 2023)
  • VL6180X Rangefinding Module (July 2023)
  • pH Meter Module (September 2023)
  • pH Meter Module (September 2023)
  • 1.3in Monochrome OLED Display (October 2023)
  • 1.3in Monochrome OLED Display (October 2023)
  • 16-bit precision 4-input ADC (November 2023)
  • 16-bit precision 4-input ADC (November 2023)
  • 1-24V USB Power Supply (October 2024)
  • 1-24V USB Power Supply (October 2024)
  • 14-segment, 4-digit LED Display Modules (November 2024)
  • 0.91-inch OLED Screen (November 2024)
  • 0.91-inch OLED Screen (November 2024)
  • 14-segment, 4-digit LED Display Modules (November 2024)
  • The Quason VL6180X laser rangefinder module (January 2025)
  • TCS230 Colour Sensor (January 2025)
  • The Quason VL6180X laser rangefinder module (January 2025)
  • TCS230 Colour Sensor (January 2025)
  • Using Electronic Modules: 1-24V Adjustable USB Power Supply (February 2025)
  • Using Electronic Modules: 1-24V Adjustable USB Power Supply (February 2025)

Purchase a printed copy of this issue for $10.00.

Using Cheap Asian Electronic Modules Part 12: by Jim Rowe nRF24L01+ 2.4GHz Wireless Data Transceiver Modules This month we’re looking at a number of modules based on the nRF24L01+ chip, a complete wireless data transceiver capable of up to 2Mb/s over modest distances, in the 2.4-2.5GHz ISM (industrial/ scientific/medical) band. It has a standard SPI interface, making it easy to use with any microcontroller. C onnecting a couple of Arduino, Micromite or other popular micros via a wireless data link, can be done by making use of a pair of low-cost modules, based on Nordic Semiconductor’s ultra-low power nRF24L01+ chip. There are quite a few of these modules around, most of them costing just a few dollars, with the more expensive units generally giving longer range (often due to a better antenna). We published a Circuit Notebook entry in the September 2016 issue titled “Ultra-low-power, long-range Arduino communications”, which you can read online at www.siliconchip. com.au/Article/10146 This circuit used an nRF24L01+ module, available with a whip antenna, from www.siliconchip.com.au/ Shop/7/3979 All modules based on the nRF24L01+ device operate in the internationally unlicensed 2.4-2.5GHz ISM band and use the same kind of modulation, described below. So they can all communicate with each other. It’s important to realise that the 2.42.5GHz band is also used by Bluetooth devices, most WiFi devices and is also subject to various sources of noise like microwave ovens. We have directly observed serious WiFi speed degradation while a microwave oven was operating, so this isn’t just a theoretical issue. Because it’s basically a “free-for-all”, this is a noisy band and becoming noisier all the time. Still, there are ways to minimise the risk of interaction and interference, as we’ll explain later. While you may not have heard of Nordic Semiconductor before, many of their chips are found in all kinds of 78 Silicon Chip common devices like non-Bluetooth wireless PC peripherals such as keyboards and mice, gaming controllers, sports and fitness sensors, toys and set-top box wireless remote controls. Based in Trondheim, Norway, Nordic Semiconductor was established in 1983 as a spin-off from the Technical University of Trondheim. It’s now a publicly listed global Norwegian company with full ISO 9001:2008 certification. Inside the nRF24L01+ IC Essentially, the nRF24L01+ is a complete single-chip 2.4GHz wireless data transceiver in a 20-pin QFN (4 x 4mm) package. Fig.1 shows a block diagram depicting the internal circuitry of the nRF24L01+ chip, on the left, while that of the additional circuitry used to augment performance in the higherpower modules is shown on the right. For the present, let’s just concentrate on the left-hand side. On the left is the baseband section which provides a full bi-directional SPI (serial peripheral interface) port plus an embedded “protocol engine” (using Nordic’s “Enhanced ShockBurst” technology), transmit and receive data FIFO (first-in, first-out registers/memory buffers), a radio control section and an array or “map” of control and configuration registers The simplest nRF24L01+ module, with its circuit diagram shown in Fig.2. Variants of this module might instead have a slightly different antenna track or SMA connector for an external antenna, Celebrating 30 Years siliconchip.com.au Fig.1: the internal block diagram of the nRF24L01+ IC to the left, with the additional circuitry used for performance improvements in higher-power modules shown at right. The chip also includes a feature called Enhanced ShockBurst, which implements a bidirectional data communication protocol that is primarily used for transferring data between two of Nordic’s nRF51 chips (Bluetooth & 2.4GHz) or between an nRF51 and nRF24. On the right is the RF section, which includes an RF transmitter and receiver plus an RF synthesiser, a power amplifier (PA) and a low noise amplifier (LNA) for signal reception. The chip’s SPI interface allows it to be controlled by a micro while the Enhanced ShockBurst baseband engine provides a range of packet data communication protocols, from manual to advanced autonomous operation. Basically, it handles all of the highspeed link layer operations. The two FIFO buffers ensure a smooth data flow between the RF front end and the microcontroller (via the SPI interface), in both directions, storing data until it can be processed. The RF sections employ GFSK modulation, which stands for Gaussian Frequency-Shift Keying, an en- hanced form of frequency-shift keying in which the modulating data is passed through a Gaussian filter to make the transitions smoother, before modulation. This reduces sideband power and cross-channel interference, at the cost of increasing inter-symbol interference, which effectively limits the maximum data rate to about 2Mb/s. GFSK was the original type of modulation used in Bluetooth and is still used in BR (basic rate) Bluetooth devices. The nRF24L01+ can operate at data rates of 250Kb/s, 1Mb/s and 2Mb/s, although the 2Mb/s rate is not compatible with devices based on the earlier nRF24L01 chip. The transmitter is also programmable in terms of output power, with four options available: 0dBm (1mW), Fig.2: circuit diagram for the NRF24L01+. All connections are made via an 8-pin male header (CON1) which carries power and SPI connections. siliconchip.com.au Celebrating 30 Years -6dBm, -12dBm or -18dBm (320µW). This makes the chip very suitable for ultra-low-power wireless links. The RF sections of the chip can be programmed to operate on any of 125 frequency channels between 2.400GHz and 2.525GHz, with the channels spaced 1MHz apart. However, the channels above 2.500GHz are strictly out of the ISM band, leaving only the lower 100 for legal use. In addition, since WiFi devices use the spectrum between 2.400GHz and 2.484GHz fairly heavily, modules using the nRF24L01+ are best programmed to use upper channels 85100 to ensure minimum interference and the most reliable operation. Also note that when the nRF24L01+ is being used at the highest data rate of 2Mb/s, it can only use every second 1MHz channel because the modulation bandwidth is larger than 1MHz. The selected channel frequency is generated by the RF synthesiser section at lower right in Fig.1, using an external 16MHz crystal connected between pins XC1 and XC2. Despite its internal complexity and multiple functions, the chip is surprisingly economical in terms of power consumption. Operating from a 3.3V DC supply, the RF transmitter section draws only 11.3mA when set for the highest 0dBm output power, while the receiver section draws only 13.5mA when receiving at the highest 2Mb/s data rate and drops to 12.6mA at 250Kb/s. So the nRF24L01+ is suitable for all kinds of portable and battery-powered applications, especially since the chip is inexpensive. January 2018  79 One of the fancier nRF24 modules that sports a reverse-SMA socket with whip antenna and three extra SMD ICs to boost RF signals. This module uses a combination of a TI CC2500/ CC2530 and SI4432, but not all modules will use the same set. Complete modules Quite a few wireless data transceiver modules based on the nRF24L01+ chip are currently available, falling into two main categories: • Those using only the chip itself together with a handful of passive components; • and those which provide one or more additional ICs to give higher RF output and additional receiver preamplification, for longer range operation. The basic types are the cheapest and most popular but the higher-power types are also quite widely used. Fig.2 shows the complete circuit for one of the basic modules. This module is quite small, measuring just 15 x 29mm, including both the 8-pin DIL header for SPI and pow- er connections and the zig-zag PCB track antenna. There are other variations of this basic module which may have a hookshaped PCB track antenna instead of the zig-zag pattern. Jaycar have this latter module (Cat XC4508). These have a slightly longer PCB, measuring 15 x 33mm. Yet another variant has an SMA socket for connection to an external antenna (instead of the PCB track antenna) on a smaller PCB measuring 10.6 x 23.8mm. There’s very little in one of these modules apart from the nRF24L01+ chip itself. The 16MHz crystal (X1) is at lower left (in Fig.2), while the 2.4GHz antenna and the passive components used to match the chip to it are at upper right. All of the connec- tions to and from the micro are made via CON1 at upper left. The remaining passive components are mainly for supply bypassing. Fancier versions As with the basic versions, there are a number of variations when it comes to the longer-range versions. They all seem to consist of the basic nRF24L01+ transceiver chip coupled to a transmit/receive “front end” circuit, along the lines of what is shown on the right-hand side of Fig.1. The differences are mainly with regard to the IC or ICs used in the added front end and the antenna arrangements. Fig.3 shows the circuit for one of these augmented versions. The lefthand side is virtually identical to the basic nRF24L01+ module circuit shown in Fig.2 and so these modules generally use much the same software and I/O connections to the micro. In this particular module, all of the additional RF matching, filtering, transmit/receive switching, power amplification and input preamplification is done inside IC2 (shown on the right). This is an RFaxis/Skyworks RFX2401C device, rated to provide 25dB of transmit gain at 2.45GHz plus 12dB of receive gain with a noise figure of 2.5dB. Both features should give a very useful extension of the module’s operating range. Some of the other longer-range modules seem to use a combination of three ICs in place of the RFX2401C. Some use the TI CC2500 and CC2530 chips together with an SI4432, but we haven’t been able to find a circuit for these. Fig.3: circuit diagram for one of the fancier nRF24L01+ variants (photo at upper right, labelled YJ-13039). While the left half of this circuit may be identical to Fig.2, there is additional circuitry around the RFX2401C (IC2) that sets it apart. 80 Silicon Chip Celebrating 30 Years siliconchip.com.au Above: one of the fancier nRF24L01+ based modules featuring a monopole ceramic chip antenna at the end of the PCB. It also has CON1 in the form of a single row of PCB pads. Right: a different nRF24 module featuring a metal shield around the circuitry to reduce EMI; it also comes with a simple wire antenna. Although one of the longer-range modules shown in the photos has a reverse-SMA socket for the antenna connection and comes with a matching “rubber ducky” whip antenna, this is not always the case. Some modules simply come with copper pads on the end of the PCB to either solder on an SMA connector or else have a short piece of wire soldered directly to the centre pad to act as a DIY whip antenna. Still others have a monopole ceramic chip antenna mounted on the end of the PCB. One of these is also shown in the photos. One further point: most of the modules, whether basic or enhanced, have a copper ground plane on the underside of the PCB (but not under the antenna) to reduce the level of EMI from and into the nRF24L01+ and its associated circuitry. A small number of the enhanced units also have a screening can over the whole of the circuitry on the top of the PCB and these modules have been found to be somewhat better for reliable long-range operation. Apparently, some users have achieved similar results with the modules which lack an upper screening can by wrapping the electronics part of the module with thin brass or aluminium metal foil. The foil should be covered on the inside with a thin layer of plastic to make sure it doesn’t cause any short circuits, and should ideally also be connected to the module’s PCB earth (eg, via pin 1 of CON1). Just make sure you don’t wrap the foil around the end of the module’s PCB with the antenna, or you’ll seriously reduce its range rather than increase it! Working with an Arduino Fig.4 shows how to connect any of these modules up to an Arduino or Arduino clone, taking advantage of the fact that most of the connections needed for interfacing to an SPI bus are made available on the 6-pin ICSP header fitted to most Arduino variants. The connections to the ICSP header are consistent with many Arduino variants, including Uno, Leonardo and Nano, the Freetronics Eleven and LeoStick and the Duinotech Classic or Nano. Fig.4: wiring diagram showing how to connect an nRF24-based module to an Arduino board. On the next page there is a photo showing one of these modules hooked up to a Freetronics ProtoShield, which can then be plugged directly into a compatible Arduino board. siliconchip.com.au Celebrating 30 Years January 2018  81 Left: you can see the header, 10µF tantalum capacitor and various wires that need to be soldered to the Freetronics ProtoShield that is plugged into an Arduino. The module is then plugged into the 4x2-pin DIL female header. Fig.5 (above): example output from running the Arduino sample program. The upper half of the screen grab shows one of the modules in “transmit” mode, while the lower half is in “receive” mode. The only connections that are not available via the ICSP header are those for +3.3V, CE and CSN which need to be connected to the IO7 and IO8 pins respectively. The reason why they need to be connected to those particular pins of the Arduino is that these are expected by the most popular and easy to use Arduino Library for nRF24L01+ based modules. More on that later. Before we move on to the firmware, in the photos above you’ll see a Freetronics ProtoShield wired up to connect an nRF24L01+ based module to an Arduino Uno or its equivalent. It’s fitted with a 4x2 DIL header socket near the centre of the shield to accept the nRF24L01+ module’s plug, 82 Silicon Chip with short lengths of hookup wire to make the connections between the header socket pins and the appropriate Arduino pins. The 10µF tantalum bypass is fitted very close to the pin 1 end of the header socket, to keep its leads as short as possible. This little shield cost less than $5, took very little time to make and works well. Having built it, the next step was to install the RF24 Library in the Arduino IDE. The Arduino RF24 Library Written by a programmer with the moniker of “TMRh20”, the Library is called RF24. The latest version is available in zipped-up form from https:// github.com/maniacbug/RF24 Click on Celebrating 30 Years the green “Clone or download” button and then “Download ZIP”. To help you get started using a couple of nRF24L01+ modules to set up a wireless link between two Arduinos, I have adapted one of the “Getting Started” sketches provided by TMRh20 to show how to make use of his/her RF24 library. The revised sketch is called “sketch_to_check_nRF24L01_modules.ino”, and is available for download from the Silicon Chip website. Having downloaded the RF24 library zip, fire up the Arduino IDE, open up the sketch and then get the IDE to add the RF24 to its list of libraries. This is done by clicking on the “Sketch” drop-down menu, then clicking on “Include Library” down siliconchip.com.au The sample program running on a Micromite LCD BackPack. Unlike the Arduino program, setting which device is the receiver or transmitter is done via the touchscreen, rather than serial input. Fig.6: connections required for the NRF24L01+ to a Micromite. The 10µF capacitor between pins 1 & 2 is optional but recommended near the bottom, and then on “Add .ZIP Library”. The IDE will then provide a dialog to let you select the RF24 ZIP library you’ve downloaded, whereupon it will automatically unpack and install the library. The sketch has been written so that it can be uploaded to two Arduinos, one at each end of your proposed wireless link. The only thing that needs to be changed is the value of the parameter “radioNumber”, in the first line of code after the introductory comments and the five #include lines. As supplied, the line looks like this: bool radioNumber = 0; but for the second Arduino, it should be changed to: bool radioNumber = 1; Then when you power up both Arduinos (each with an nRF24L01+ module connected), they can communicate with each other. The software is controlled via the Arduino IDE’s Serial Monitor utility. To start one Arduino pinging the other, press the T key on that PC’s keyboard, and then the Enter key. That Arduino will then begin sending a number (the time it has been powered up in microseconds) to the other, via the wireless link. The other should then respond by returning the same number, after a short delay. This should be visible in the Serial Monitor dialog, which should look like the screen grab shown in Fig.5. If you then press the R key, siliconchip.com.au followed by Enter again, the Arduinos should swap roles, with the local one becoming the receiver and the other one becoming the transmitter. The display in the Serial Monitor dialog should change, as shown halfway down the screen grab, with a series of lines showing when it sends each response back to the other Arduino. So this sketch shows how a couple of Arduinos can be hooked up via a 2.4GHz wireless link, using a pair of nRF24L01+ based modules. Doing it with a Micromite Connecting one of these modules up to a Micromite is done using the connections shown in Fig.6. The MOSI, MISO and SCK lines are connected to pins 21, 22 and 24 of the Micromite as shown. The CE and CSN lines are connected to Micromite pins 17 and 18 respectively in this example. As with the Arduinos, it’s also a good idea to connect a 10µF tantalum capacitor between pins 1 and 2 of the nRF24L01+ module. Now if you’re wondering why these SPI connections to the Micromite are a little different from those you’ve seen in other projects, that’s because we’re making use of an “additional” SPI port on the Micromite, provided by means of an embedded C function in Geoff Graham’s MMBasic. This is being used as an alternative to the SPI port already built into MMBasic, to prevent timing conflicts when you’re using an LCD BackPack version of the Micromite. Celebrating 30 Years The reasoning behind this is that there doesn’t seem to be available at present any pre-written Micromite applications or libraries available to control and exchange data with the nRF24L01+ chip – so basically, I’ve had to write one myself. This took quite a while, as programming the nRF24L01+ turned out to be surprisingly complex and confusing. I ended up having to get help from Geoff Graham, as well as from the support engineers at Nordic Semiconductor. By the way, if you want to see how complex programming the chip really is, you can download a copy of the 78page product specification called “nRF24L01+ Product Specification v1.0” for free from Nordic Semiconductor’s website (www.nordicsemi.com/eng/ Products/2.4GHz-RF/nRF24L01P). Anyway, I finally got the program to work, with two Micromite LCD BackPacks exchanging data in both directions without problems. Whew! You can see the display it provides on the Micromite’s LCD screen in the photo above, allowing the Micromite to be configured as either Radio #0 or Radio #1; and for either RECEIVE or TRANSMIT. This is configured using the LCD touchscreen, but as with the Arduino sketch, the actual data being transmitted or received is printed/displayed on the PC in the MMChat windows for each device. The program is not very fancy, but it should at least provide a good starting place for writing more complex programs of your own. The program is called “nRF24L01 checkout.bas”, and is available to download from the Silicon Chip webSC site. January 2018  83