So you're curious about the NRF5 series boards huh? Let's dive in!
// updates can be found below.
WHAT IS THE NRF5
It's a tiny Arm processor based board that can work like an Arduino. There are a few flavours.
NRF51 $3
NRF52 $3
NRF52840 $20 (new, has built in usb support)
Advantages:
- Arduino with built in NRF24 for just $3.
- The size of a postage stamp.
- Powerful enough to use the simple encryption functionality easily.
- Antenna socket: just plug in antenna for more range.
- Ultra low power use.
- You get to decide which pins do what. For example, you can decide through software which pins should be hardware serial pins. There's a small pin router built in.
- Built in support for NFC (swiping smart cards and tags).
Neutral:
- Has 3.3v internal logic. Most new sensors use 3.3v for logic too.
Negative:
- Relatively new, so there might still be some bugs in MySensors.
- The pins cannot handle as much current (5ma) as the Arduino's could (40ma).
- Smaller pin spacing (1.27mm instead of 2.54mm), so harder to solder. Fewer expansion boards available.
- Unlike the Arduino Nano, the programmer doesn't also function as a serial monitor. To get serial output you have to set some pins as the serial output, and then connect to those pins with a separate usb serial port adapter. It's a bit like the Arduino Pro Mini in that sense.
- The EByte module has no onboard LED, which makes it difficult to know it's on, or to test things with a simple blink sketch.
INSTALLATION
Open the Arduino software and install these two boards in the Arduino IDE:
(click on the links to get installation instructions).
Carefully soldered some wires to your board, and connected it a programming tool. The cheapest simplest option is to get an ST-Link v2 ($3).
Connect:
gnd ->gnd (in the corner)
3.3v -> vcc (in the same corner)
SWDIO -> SWDIO
SWDCLK -> SWDCLK
Software
In the Arduino IDE open an example (file -> examples -> myboardNRF5 -> myboardNRF5). You will now have three files:
- Main file <- your main code goes here.
- MyBoardNRF5.h <- here you can set which goodies you want, on which pins.
- MyBoardNRF5.cpp <- probably no reason to change anything here.
In the main file make sure it has these lines:
#define MY_RADIO_NRF5_ESB
#include <MySensors.h>
Upload settings
In the Arduino IDe click on the tools dropdown and start set things up like this:
- Board: "MyBoardNRF5 NRF52832"
- Reset: "don't enable"
- Bootloader/SD: "none"
- Low frequency clock: "Crystal Oscilator" (RC Oscillator might work too).
- Port: none
- Programmer: ST-Link V2
First the chip you are using must be 'wiped'. This removes the bluetooth functionality. Wipe the chip by clicking "tools -> burn bootloader". You'll get an error but that's normal.
Next, when your sketch is complete, choose "sketch -> upload via programmer".
POWER HUNGRY SENSORS
If you were using an Arduino Nano before, then you might have powered your sensors directly from the Arduino's 5v pin. With these boards you can't run the power through the NRF5 board first. Make the 5V go 'around it'. Only use these boards to collect and send signals. To get a steady power supply, depending on how much you need, you could try:
- An AMS1117 regulator. It can generate a max of 800ma at 3.3v. Here's a small version.
- Special power supply boards such as this one.
TROUBLESHOOTING
- Timed out while waiting for target halted: are your pins connected ok?
- Unable to reset target: are your pins connected ok?
ADVANCED KNOWLEDGE
- Some things, like turning on a pin when you press a button, can be handled by (programmed into) the 'periphery' of the chip. Not having to wake up the main chip saves some power. An example of this can be found here.
POPULAR BOARDS
- Cheap: $3
- Is missing some parts that allows for super low power usage. Those can be added manually though.
- Forum users have created some nice pre-made prototyping boards, like this small one or this big one.
- Uses 91 milli amps max (while transmitting).
Fanstel BT832X
- Can't find the price
- Better range than the EByte
- Has the required 'DCDC' parts built in, allowing for super low battery usage.
- Uses 250ma max
Holyiot TinyBLE
UPDATE
The easiest way to get started with NRF5 might actually be the BCC Microbit.