The nRF shield allows the Digispark Pro to communicate with the popular RF24 modules. The shield includes a 3.3 Volt regulator to power the module and passes through the Digispark Pro's SPI pins to command the radio. The module also includes filtering capacitors to make sure that the radio sees a consistent 3.3 V while operating.
This is an unassembled kit and requires basic soldering. This is designed for use with the Digispark development board, which is not included.
Part | Quantity | Identification |
---|---|---|
Pro nRF PCB | 1 | |
nRF24L01+ Module | 1 | |
MCP1700-3302E 3.3V LDO Regulator | 1 | |
0.1uf Ceramic Capacitor | 1 | |
1uf Electrolyitic Capacitor | 1 | |
2×4 pin female 0.1“ pitch header | 1 | |
1x40pin male 0.1” pitch header | 25 pins worth |
Soldering: If you are new to soldering we recommend the following tutorials: Soldering Basics (http://www.sparkfun.com/tutorials/106) and Soldering Crash Course from the folks at Sparkfun (http://www.sparkfun.com/tutorials/354). How to solder from the Curious Inventor: http://store.curiousinventor.com/guides/How_to_Solder
Adafruit has this excellent guide that starts with the tools needed and then shows detailed pictures, including some of the common problems that beginners experience (http://learn.adafruit.com/adafruit-guide-excellent-soldering)
We assume for these assembly instructions that you know the basics of thru-hole soldering. If you don't check out the links above, these boards are very easy to solder - we promise!
NOTE: Before you start: If you have a multimeter check for shorts between the GND pin hole and the other pin holes - if you find any please send us an email at support at digistump dot com and we will replace the board.
Check the contents of your kit and ensure you have all of the parts listed.
Insert the 3.3v regulator, matching it with the outline on the board. Solder the leads on the bottom of the board and clip off any excess.
Insert the 10uf Capacitor - ensuring the lead on the side of the capacitor that is labeled with a grey stripe and minus signs is going into the hole that DOES NOT have the plus sign next to it. Bend capacitor over as shown, to reduce its height. Solder the leads on the bottom of the board and clip off any excess.
Insert the 0.1uf capacitor as shown (lead oreientation doesn't matter). Solder the leads on the bottom of the board and clip off any excess.
Insert the 2×4 female header as shown. Solder the leads on the bottom of the board.
Cut two lengths of male headers each 9 pins long and one 3 pins long. Insert into corresponding positions (on the bottom of the board) and solder each pin.
Tip: Inserting the headers into a breadboard and then placing the board on top can make this process easier.
Note: If you are using stackable headers, use them here instead of the standard male headers.
Insert the nRF24L01+ module into the socket - as shown.
Use the RF24 library to control the module. You can download the latest version here. Copy the contents of the zip to your libraries directory. Examples below.
A simple mesh networking tutorial, layer, and example can be found here: nRF Mesh Network Example
Sketches:
You'll need two Digispark Pros with nRF modules to execute these sketches. Select one Digispark to be the sender and load this code:
#include <SPI.h> #include "nRF24L01.h" #include "RF24.h" RF24 radio(9,12); const int LED = 1; const uint64_t pipes[2] = { 0xF0F0F0F0E1LL, 0xF0F0F0F0D2LL }; // The various roles supported by this sketch typedef enum { role_ping_out = 1, role_pong_back } role_e; // The role of the current running sketch role_e role = role_pong_back; void setup() { // put your setup code here, to run once: pinMode(LED, OUTPUT); digitalWrite(LED, LOW); radio.begin(); radio.setRetries(15, 15); radio.openWritingPipe(pipes[1]); digitalWrite(LED, HIGH); } void loop() { unsigned long value = 2000; bool ok = radio.write(&value, sizeof(unsigned long)); if(ok) { digitalWrite(LED, LOW); delay(2000); digitalWrite(LED, HIGH); } }
The other Digispark should be the receiver. Upload this code:
#include <SPI.h> #include "nRF24L01.h" #include "RF24.h" RF24 radio(9,12); const int LED = 1; const uint64_t pipes[2] = { 0xF0F0F0F0E1LL, 0xF0F0F0F0D2LL }; // The various roles supported by this sketch typedef enum { role_ping_out = 1, role_pong_back } role_e; // The role of the current running sketch role_e role = role_pong_back; void setup() { // put your setup code here, to run once: pinMode(LED, OUTPUT); digitalWrite(LED, LOW); radio.begin(); radio.setRetries(15, 15); radio.openReadingPipe(1, pipes[1]); radio.startListening(); digitalWrite(LED, HIGH); } void loop() { if(radio.available()) { unsigned long value; bool done = false; while(!done) { done = radio.read(&value, sizeof(unsigned long)); delay(20); } digitalWrite(LED, LOW); delay(1000); digitalWrite(LED, HIGH); } }
Now, when both units are powered up the LEDs on both should start blinking. If either is unplugged then the LED on the other will revert to solid on.