SlideShare a Scribd company logo
1 of 51
Download to read offline
1 / 51
Local Connectivity
nRF24L01+
Eueung Mulyana
https://eueung.github.io/012017/nrf24
CodeLabs | Attribution-ShareAlike CC BY-SA
Outline
Introduction
Getting Started - Preparation
Getting Started - Code & Play
Simple Remote Control
Gateway
2 / 51
3 / 51
Introduction
4 / 51
5 / 51
nRF24L01+
nRF24L01+ is a highly integrated, ultra
low power (ULP) 2Mbps RF
transceiver IC for the 2.4GHz ISM
(Industrial, Scienti c and Medical)
band 2.400 - 2.4835GHz.
The Nordic nRF24L01+ integrates a complete 2.4GHz RF
transceiver, RF synthesizer, and baseband logic including the
hardware protocol accelerator (Enhanced ShockBurst)
supporting a high-speed SPI interface for the application
controller.
With peak RX/TX currents lower than 14mA, a sub uA power
down mode, advanced power management, and a 1.9 to 3.6V
supply range, the nRF24L01+ provides a true ULP solution
enabling months to years of battery life from coin cell or AA/AAA
batteries.
Ref: Nordic Semiconductor
6 / 51
nRF24L01+
1. ISM Frequency Band at 2.400 - 2.4835 GHz (Spacing at 1 or
2 MHz, GFSK)
2. 126 RF Channels
3. Air Data Rate Con gurable to 2 Mbps (Options: 250 kbps, 1
Mbps)
4. 4-Pin Hardware SPI
5. 5V Tolerant Inputs
6. 6 Data Pipe MultiCeiver for 1:6 star networks
Notes: Power still at 3.3V!
Pin Map
7 / 51
Important Notes
Radio is sensitive to Noises! Make sure that the circuit (wire,
solder, etc.) is stable.
Anything uxtuates is bad!
8 / 51
Preparation
Getting Started
9 / 51
This setup is for demo purpose only. Can be any MCUs.
10 / 51
Getting
Started
Arduino IDE, NodeMCU &
Nano
1. Install RF24 Library
2. Prepare the First Node - NodeMCU
3. Prepare the Second Node - Arduino Nano
RF24 Library
11 / 51
RF24 Library
12 / 51
First Node - NodeMCU
13 / 51
First Node - NodeMCU 14 / 51
Second Node - Nano
15 / 51
Second Node - Nano 16 / 51
Code & Play
Getting Started
17 / 51
Simple Transmit & Receive
NodeMCU - Transmit | Nano - Receive
Ref: Example Sketches
18 / 51
#include <SPI.h>
#include "nRF24L01.h"
#include "RF24.h"
RF24 myRadio (2, 15);
byte addresses[][6] = {"1Node"};
int dataTransmitted;
void setup()
{
Serial.begin(115200);
delay(1000);
Serial.println(F("RF24/Simple Transmit data Test"));
dataTransmitted = 100;
myRadio.begin();
myRadio.setChannel(108);
myRadio.setPALevel(RF24_PA_MIN);
myRadio.openWritingPipe( addresses[0]);
delay(1000);
}
void loop()
{
myRadio.write( &dataTransmitted, sizeof(dataTransmitted) );
Serial.print(F("Data Transmitted = "));
Serial.print(dataTransmitted);
Serial.println(F(" No Acknowledge expected"));
dataTransmitted = dataTransmitted + 1;
delay(500);
}
19 / 51
NodeMCU
20 / 51
NodeMCU
Serial
1384, room 16
tail 8
chksum
Data Transmitted = 100 No Acknowledge expected
Data Transmitted = 101 No Acknowledge expected
Data Transmitted = 102 No Acknowledge expected
Data Transmitted = 103 No Acknowledge expected
Data Transmitted = 104 No Acknowledge expected
Data Transmitted = 105 No Acknowledge expected
...
#include <SPI.h>
#include "nRF24L01.h"
#include "RF24.h"
RF24 myRadio (7, 8);
byte addresses[][6] = {"1Node"};
int dataReceived;
void setup()
{
Serial.begin(115200);
delay(1000);
Serial.println(F("RF24/Simple Receive data Test"));
myRadio.begin();
myRadio.setChannel(108);
myRadio.setPALevel(RF24_PA_MIN);
myRadio.openReadingPipe(1, addresses[0]);
myRadio.startListening();
}
void loop()
{
if (myRadio.available())
{
while (myRadio.available())
{
myRadio.read( &dataReceived, sizeof(dataReceived) );
}
Serial.print("Data received = ");
Serial.println(dataReceived);
}
}
21 / 51
Nano
22 / 51
Nano
Serial
RF24/Simple Receive data Test
Data received = 100
Data received = 101
Data received = 102
Data received = 103
Data received = 104
Data received = 105
...
RF24 Sample Code
23 / 51
RF24 Sample Code - GettingStarted
24 / 51
#include <SPI.h>
#include "nRF24L01.h"
#include "RF24.h"
byte addresses[][6] = {"1Node","2Node"};
RF24 radio(2,15);
bool radioNumber = 0;
bool role = 1;
/**********************************************************/
void setup() {
Serial.begin(115200);
Serial.println(F("RF24/examples/GettingStarted"));
Serial.println(F("*** PRESS 'R' to begin receiving from the other node"));
radio.begin();
radio.setChannel(108);
radio.setPALevel(RF24_PA_MIN);
if(radioNumber){
radio.openWritingPipe(addresses[1]);
radio.openReadingPipe(1,addresses[0]);
}else{
radio.openWritingPipe(addresses[0]);
radio.openReadingPipe(1,addresses[1]);
}
radio.startListening();
}
void loop() {
/****************** Ping Out Role ***************************/
if (role == 1) {
radio.stopListening();
Serial.println(F("Now sending"));
unsigned long start_time = micros();
//radio.write( &start_time, sizeof(unsigned long));
if (!radio.write( &start_time, sizeof(unsigned long) )){
Serial.println(F("failed")); 25 / 51
NodeMCU
26 / 51
NodeMCU
Serial
^$#%$#@*&%)# Why??
Nevermind for now!
Unplug NodeMCU, Plug-In Nano ..
Now sending
failed
Failed, response timed out.
Now sending
failed
Failed, response timed out.
Now sending
failed
Failed, response timed out.
Now sending
failed
Failed, response timed out.
Now sending
failed
Failed, response timed out.
Now sending
failed
Failed, response timed out.
...
#include <SPI.h>
#include "nRF24L01.h"
#include "RF24.h"
byte addresses[][6] = {"1Node","2Node"};
RF24 radio(7,8);
bool radioNumber = 1;
bool role = 0;
/**********************************************************/
void setup() {
Serial.begin(115200);
Serial.println(F("RF24/examples/GettingStarted"));
Serial.println(F("*** PRESS 'T' to begin transmitting to the other node"));
radio.begin();
radio.setChannel(108);
radio.setPALevel(RF24_PA_MIN);
if(radioNumber){
radio.openWritingPipe(addresses[1]);
radio.openReadingPipe(1,addresses[0]);
}else{
radio.openWritingPipe(addresses[0]);
radio.openReadingPipe(1,addresses[1]);
}
radio.startListening();
}
void loop() {
...
...
}
27 / 51
Nano
28 / 51
Nano
Serial
Get Back to NodeMCU, Switch It On!
RF24/examples/GettingStarted
** PRESS 'T' to begin transmitting to the other node
# After NodeMCU Switched ON
Sent response 9284083
Sent response 10286475
Sent response 11288847
Sent response 12291268
Sent response 13293653
...
29 / 51
NodeMCU
Serial - Take 2
Find Another Serial Console..
Now It Looks Good.. Explain!
Now sending
Sent 18612291, Got response 18612291, Round-trip delay 1828 microseconds
Now sending
Sent 19614686, Got response 19614686, Round-trip delay 1840 microseconds
Now sending
Sent 20617552, Got response 20617552, Round-trip delay 1803 microseconds
Now sending
Sent 21619866, Got response 21619866, Round-trip delay 1800 microseconds
Now sending
Sent 22622153, Got response 22622153, Round-trip delay 1806 microseconds
Now sending
Sent 23624535, Got response 23624535, Round-trip delay 1840 microseconds
...
Simple Remote Control
30 / 51
NodeMCU - Remote Controller 31 / 51
Nano - Local Controller 32 / 51
Simple Remote Control
33 / 51
#include <SPI.h>
#include "nRF24L01.h"
#include "RF24.h"
RF24 myRadio (2, 15);
const int SW1 = 5;
byte addresses[][6] = {"1Node"};
int dataTransmitted;
int button;
void setup()
{
pinMode(SW1, INPUT);
dataTransmitted = 10;
button = 0;
Serial.begin(115200);
delay(1000);
myRadio.begin();
myRadio.setChannel(108);
myRadio.setPALevel(RF24_PA_MIN);
myRadio.openWritingPipe( addresses[0]);
delay(1000);
}
void loop()
{
int newButton = digitalRead(SW1);
if (newButton != button) {
button = newButton;
if (button == HIGH){
dataTransmitted = 20;
}
else {
dataTransmitted = 10;
}
myRadio.write( &dataTransmitted, sizeof(dataTransmitted) );
Serial.print(F("Data Transmitted = "));
Serial.println(dataTransmitted);
} 34 / 51
NodeMCU
35 / 51
NodeMCU
Serial
After Some ON-OFFs
1384, room 16
tail 8
chksum
Data Transmitted = 20
Data Transmitted = 10
Data Transmitted = 20
Data Transmitted = 10
Data Transmitted = 20
Data Transmitted = 10
Data Transmitted = 20
#include <SPI.h>
#include "nRF24L01.h"
#include "RF24.h"
RF24 myRadio (7, 8);
const int LED = 2;
byte addresses[][6] = {"1Node"};
int dataReceived;
void setup()
{
pinMode(LED, OUTPUT);
Serial.begin(115200);
delay(1000);
myRadio.begin();
myRadio.setChannel(108);
myRadio.setPALevel(RF24_PA_MIN);
myRadio.openReadingPipe(1, addresses[0]);
myRadio.startListening();
}
void loop()
{
if (myRadio.available())
{
while (myRadio.available())
{
myRadio.read( &dataReceived, sizeof(dataReceived) );
}
Serial.print("Data received = ");
Serial.println(dataReceived);
if (dataReceived == 10) {
digitalWrite(LED, LOW);
} else {
digitalWrite(LED, HIGH);
}
}
} 36 / 51
Nano
37 / 51
Nano
Serial
After Some ON-OFFs
Data received = 20
Data received = 10
Data received = 20
Data received = 10
Data received = 20
Data received = 10
Data received = 20
Data received = 10
Data received = 20
Data received = 10
Simple Remote Control
38 / 51
Nano - Attach a Device 39 / 51
Nano - Attach a Device
40 / 51
Connecting to Blynk Cloud
Gateway
41 / 51
Notes
This is only an example of integration of local-connected sensors
and actuators to other (cloud-based) services. This is applicable
not only for Blynk or Firebase, but also for other services.
42 / 51
#include <SPI.h>
#include "nRF24L01.h"
#include "RF24.h"
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
RF24 myRadio (2, 15);
const int SW1 = 5;
byte addresses[][6] = {"1Node"};
int dataTransmitted;
int button;
char auth[] = "c5d0dea217cd49539d7bed14d1234567";
char ssid[] = "emAP-01";
char pass[] = "1010101010";
BLYNK_WRITE(V1)
{
int pinValue = param.asInt();
if (pinValue == HIGH){
dataTransmitted = 20;
}
else {
dataTransmitted = 10;
}
myRadio.write( &dataTransmitted, sizeof(dataTransmitted) );
Serial.print(F("pinValue = "));
Serial.println(pinValue);
Serial.print(F("Data Transmitted = "));
Serial.println(dataTransmitted);
}
void setup()
{
Serial.begin(115200);
Blynk.begin(auth, ssid, pass);
delay(1000);
pinMode(SW1, INPUT); 43 / 51
NodeMCU
Blynk Button with Virtual Pin V1 44 / 51
45 / 51
NodeMCU
Serial
After Some ON-OFFs via Physical
Button and Blynk Virtual Button
1384, room 16
Data Transmitted = 20
Data Transmitted = 10
pinValue = 1
Data Transmitted = 20
pinValue = 0
Data Transmitted = 10
pinValue = 1
Data Transmitted = 20
pinValue = 0
Data Transmitted = 10
pinValue = 1
Data Transmitted = 20
pinValue = 0
Data Transmitted = 10
pinValue = 1
Data Transmitted = 20
Data Transmitted = 20
Data Transmitted = 10
pinValue = 0
Data Transmitted = 10
Data Transmitted = 20
pinValue = 1
Data Transmitted = 20
pinValue = 0
Data Transmitted = 10
Data Transmitted = 10
Refs/Resources
46 / 51
Refs/Resources
1. Nordic Semiconductor
2. Example Sketches @arduino-info
3. Connecting the Radio | MySensors
4. nRF24/RF24: Optimized fork of nRF24L01 for Arduino & Raspberry Pi/Linux Devices
47 / 51
NodeMCU V1.0 Pin Map
48 / 51
Nano V3.0 Pin Map
49 / 51
Nano V3.0 Pin Map (?) 50 / 51
51 / 51
ENDEueung Mulyana
https://eueung.github.io/012017/nrf24
CodeLabs | Attribution-ShareAlike CC BY-SA

More Related Content

What's hot

Lcd module interface with xilinx software using verilog
Lcd module interface with xilinx software using verilogLcd module interface with xilinx software using verilog
Lcd module interface with xilinx software using verilogsumedh23
 
LinuxCNC 入門簡介
LinuxCNC 入門簡介LinuxCNC 入門簡介
LinuxCNC 入門簡介roboard
 
Audio led bargraph equalizer
Audio led bargraph equalizerAudio led bargraph equalizer
Audio led bargraph equalizerdouglaslyon
 
SAS (Secure Active Switch)
SAS (Secure Active Switch)SAS (Secure Active Switch)
SAS (Secure Active Switch)Security Date
 
Digital system design lab manual
Digital system design lab manualDigital system design lab manual
Digital system design lab manualSanthosh Poralu
 
Mobile Development For Arduino 201 - ConnectTech
Mobile Development For Arduino 201 - ConnectTechMobile Development For Arduino 201 - ConnectTech
Mobile Development For Arduino 201 - ConnectTechstable|kernel
 
37471656 interrupts
37471656 interrupts37471656 interrupts
37471656 interruptstt_aljobory
 
Standard cells library design
Standard cells library designStandard cells library design
Standard cells library designBharat Biyani
 
B tech Final Year Projects & Embedded Systems Training
B tech Final Year Projects & Embedded Systems Training B tech Final Year Projects & Embedded Systems Training
B tech Final Year Projects & Embedded Systems Training Technogroovy India
 
Dsd lab Practical File
Dsd lab Practical FileDsd lab Practical File
Dsd lab Practical FileSoumya Behera
 
codings related to avr micro controller
codings related to avr micro controllercodings related to avr micro controller
codings related to avr micro controllerSyed Ghufran Hassan
 
Cisco IOS shellcode: All-in-one
Cisco IOS shellcode: All-in-oneCisco IOS shellcode: All-in-one
Cisco IOS shellcode: All-in-oneDefconRussia
 
Network security Lab manual
Network security Lab manual Network security Lab manual
Network security Lab manual Vivek Kumar Sinha
 
A meta model supporting both hardware and smalltalk-based execution of FPGA c...
A meta model supporting both hardware and smalltalk-based execution of FPGA c...A meta model supporting both hardware and smalltalk-based execution of FPGA c...
A meta model supporting both hardware and smalltalk-based execution of FPGA c...ESUG
 

What's hot (20)

W10: Interrupts
W10: InterruptsW10: Interrupts
W10: Interrupts
 
Lcd module interface with xilinx software using verilog
Lcd module interface with xilinx software using verilogLcd module interface with xilinx software using verilog
Lcd module interface with xilinx software using verilog
 
LinuxCNC 入門簡介
LinuxCNC 入門簡介LinuxCNC 入門簡介
LinuxCNC 入門簡介
 
Audio led bargraph equalizer
Audio led bargraph equalizerAudio led bargraph equalizer
Audio led bargraph equalizer
 
SAS (Secure Active Switch)
SAS (Secure Active Switch)SAS (Secure Active Switch)
SAS (Secure Active Switch)
 
Digital system design lab manual
Digital system design lab manualDigital system design lab manual
Digital system design lab manual
 
Mobile Development For Arduino 201 - ConnectTech
Mobile Development For Arduino 201 - ConnectTechMobile Development For Arduino 201 - ConnectTech
Mobile Development For Arduino 201 - ConnectTech
 
IT6712 lab manual
IT6712 lab manualIT6712 lab manual
IT6712 lab manual
 
FPGA Tutorial - LCD Interface
FPGA Tutorial - LCD InterfaceFPGA Tutorial - LCD Interface
FPGA Tutorial - LCD Interface
 
37471656 interrupts
37471656 interrupts37471656 interrupts
37471656 interrupts
 
FINISHED_CODE
FINISHED_CODEFINISHED_CODE
FINISHED_CODE
 
Standard cells library design
Standard cells library designStandard cells library design
Standard cells library design
 
B tech Final Year Projects & Embedded Systems Training
B tech Final Year Projects & Embedded Systems Training B tech Final Year Projects & Embedded Systems Training
B tech Final Year Projects & Embedded Systems Training
 
Dsd lab Practical File
Dsd lab Practical FileDsd lab Practical File
Dsd lab Practical File
 
8051
80518051
8051
 
codings related to avr micro controller
codings related to avr micro controllercodings related to avr micro controller
codings related to avr micro controller
 
Cisco IOS shellcode: All-in-one
Cisco IOS shellcode: All-in-oneCisco IOS shellcode: All-in-one
Cisco IOS shellcode: All-in-one
 
Class8
Class8Class8
Class8
 
Network security Lab manual
Network security Lab manual Network security Lab manual
Network security Lab manual
 
A meta model supporting both hardware and smalltalk-based execution of FPGA c...
A meta model supporting both hardware and smalltalk-based execution of FPGA c...A meta model supporting both hardware and smalltalk-based execution of FPGA c...
A meta model supporting both hardware and smalltalk-based execution of FPGA c...
 

Similar to Connectivity for Local Sensors and Actuators Using nRF24L01+

What will be quantization step size in numbers and in voltage for th.pdf
What will be quantization step size in numbers and in voltage for th.pdfWhat will be quantization step size in numbers and in voltage for th.pdf
What will be quantization step size in numbers and in voltage for th.pdfSIGMATAX1
 
Gaztea Tech Robotica 2016
Gaztea Tech Robotica 2016Gaztea Tech Robotica 2016
Gaztea Tech Robotica 2016Svet Ivantchev
 
CC2500 Wireless Trans-receiver Module
CC2500 Wireless Trans-receiver ModuleCC2500 Wireless Trans-receiver Module
CC2500 Wireless Trans-receiver ModuleAarya Technologies
 
8051 TIMER COUNTER SERIAL COMM. INTERUPT PROGRAMMING.pdf
8051 TIMER COUNTER SERIAL COMM. INTERUPT PROGRAMMING.pdf8051 TIMER COUNTER SERIAL COMM. INTERUPT PROGRAMMING.pdf
8051 TIMER COUNTER SERIAL COMM. INTERUPT PROGRAMMING.pdfShashiKiran664181
 
Udp socket programming(Florian)
Udp socket programming(Florian)Udp socket programming(Florian)
Udp socket programming(Florian)Flor Ian
 
Linux Serial Driver
Linux Serial DriverLinux Serial Driver
Linux Serial Driver艾鍗科技
 
Temperature Sensor with LED matrix Display BY ►iRFAN QADOOS◄ 9
Temperature Sensor with LED matrix Display BY ►iRFAN QADOOS◄ 9Temperature Sensor with LED matrix Display BY ►iRFAN QADOOS◄ 9
Temperature Sensor with LED matrix Display BY ►iRFAN QADOOS◄ 9Irfan Qadoos
 
m.tech esd lab manual for record
m.tech esd lab manual for recordm.tech esd lab manual for record
m.tech esd lab manual for recordG Lemuel George
 
Distributed Computing Patterns in R
Distributed Computing Patterns in RDistributed Computing Patterns in R
Distributed Computing Patterns in Rarmstrtw
 
Capturing NIC and Kernel TX and RX Timestamps for Packets in Go
Capturing NIC and Kernel TX and RX Timestamps for Packets in GoCapturing NIC and Kernel TX and RX Timestamps for Packets in Go
Capturing NIC and Kernel TX and RX Timestamps for Packets in GoScyllaDB
 
Arduino Meetup with Sonar and 433Mhz Radios
Arduino Meetup with Sonar and 433Mhz RadiosArduino Meetup with Sonar and 433Mhz Radios
Arduino Meetup with Sonar and 433Mhz Radiosroadster43
 
Real Time Clock Interfacing with FPGA
Real Time Clock Interfacing with FPGAReal Time Clock Interfacing with FPGA
Real Time Clock Interfacing with FPGAMafaz Ahmed
 
VoiceBootcamp Ccnp collaboration lab guide v1.0 sample
VoiceBootcamp Ccnp collaboration lab guide v1.0 sampleVoiceBootcamp Ccnp collaboration lab guide v1.0 sample
VoiceBootcamp Ccnp collaboration lab guide v1.0 sampleFaisal Khan
 
Simulation and Performance Analysis of AODV using NS-2.34
Simulation and Performance Analysis of AODV using NS-2.34Simulation and Performance Analysis of AODV using NS-2.34
Simulation and Performance Analysis of AODV using NS-2.34Shaikhul Islam Chowdhury
 

Similar to Connectivity for Local Sensors and Actuators Using nRF24L01+ (20)

What will be quantization step size in numbers and in voltage for th.pdf
What will be quantization step size in numbers and in voltage for th.pdfWhat will be quantization step size in numbers and in voltage for th.pdf
What will be quantization step size in numbers and in voltage for th.pdf
 
Gaztea Tech Robotica 2016
Gaztea Tech Robotica 2016Gaztea Tech Robotica 2016
Gaztea Tech Robotica 2016
 
Product catlog
Product catlogProduct catlog
Product catlog
 
CC2500 Wireless Trans-receiver Module
CC2500 Wireless Trans-receiver ModuleCC2500 Wireless Trans-receiver Module
CC2500 Wireless Trans-receiver Module
 
8051 TIMER COUNTER SERIAL COMM. INTERUPT PROGRAMMING.pdf
8051 TIMER COUNTER SERIAL COMM. INTERUPT PROGRAMMING.pdf8051 TIMER COUNTER SERIAL COMM. INTERUPT PROGRAMMING.pdf
8051 TIMER COUNTER SERIAL COMM. INTERUPT PROGRAMMING.pdf
 
Udp socket programming(Florian)
Udp socket programming(Florian)Udp socket programming(Florian)
Udp socket programming(Florian)
 
Linux Serial Driver
Linux Serial DriverLinux Serial Driver
Linux Serial Driver
 
Packet Radio Overview
Packet Radio OverviewPacket Radio Overview
Packet Radio Overview
 
GNU Radio
GNU RadioGNU Radio
GNU Radio
 
Temperature Sensor with LED matrix Display BY ►iRFAN QADOOS◄ 9
Temperature Sensor with LED matrix Display BY ►iRFAN QADOOS◄ 9Temperature Sensor with LED matrix Display BY ►iRFAN QADOOS◄ 9
Temperature Sensor with LED matrix Display BY ►iRFAN QADOOS◄ 9
 
m.tech esd lab manual for record
m.tech esd lab manual for recordm.tech esd lab manual for record
m.tech esd lab manual for record
 
Distributed Computing Patterns in R
Distributed Computing Patterns in RDistributed Computing Patterns in R
Distributed Computing Patterns in R
 
rfio
rfiorfio
rfio
 
Capturing NIC and Kernel TX and RX Timestamps for Packets in Go
Capturing NIC and Kernel TX and RX Timestamps for Packets in GoCapturing NIC and Kernel TX and RX Timestamps for Packets in Go
Capturing NIC and Kernel TX and RX Timestamps for Packets in Go
 
Arduino Meetup with Sonar and 433Mhz Radios
Arduino Meetup with Sonar and 433Mhz RadiosArduino Meetup with Sonar and 433Mhz Radios
Arduino Meetup with Sonar and 433Mhz Radios
 
Certification
CertificationCertification
Certification
 
Real Time Clock Interfacing with FPGA
Real Time Clock Interfacing with FPGAReal Time Clock Interfacing with FPGA
Real Time Clock Interfacing with FPGA
 
VoiceBootcamp Ccnp collaboration lab guide v1.0 sample
VoiceBootcamp Ccnp collaboration lab guide v1.0 sampleVoiceBootcamp Ccnp collaboration lab guide v1.0 sample
VoiceBootcamp Ccnp collaboration lab guide v1.0 sample
 
Em s7 plc
Em s7 plcEm s7 plc
Em s7 plc
 
Simulation and Performance Analysis of AODV using NS-2.34
Simulation and Performance Analysis of AODV using NS-2.34Simulation and Performance Analysis of AODV using NS-2.34
Simulation and Performance Analysis of AODV using NS-2.34
 

More from Eueung Mulyana

Hyper-Connectivity and Data Proliferation - Ecosystem Perspective
Hyper-Connectivity and Data Proliferation - Ecosystem PerspectiveHyper-Connectivity and Data Proliferation - Ecosystem Perspective
Hyper-Connectivity and Data Proliferation - Ecosystem PerspectiveEueung Mulyana
 
Industry 4.0 And Beyond The A.I* For Surviving A Tech-Accelerated World
Industry 4.0 And Beyond The A.I* For Surviving A Tech-Accelerated WorldIndustry 4.0 And Beyond The A.I* For Surviving A Tech-Accelerated World
Industry 4.0 And Beyond The A.I* For Surviving A Tech-Accelerated WorldEueung Mulyana
 
Blockchain Introduction
Blockchain IntroductionBlockchain Introduction
Blockchain IntroductionEueung Mulyana
 
Bringing Automation to the Classroom: A ChatOps-Based Approach
Bringing Automation to the Classroom: A ChatOps-Based ApproachBringing Automation to the Classroom: A ChatOps-Based Approach
Bringing Automation to the Classroom: A ChatOps-Based ApproachEueung Mulyana
 
FinTech & Cryptocurrency Introduction
FinTech & Cryptocurrency IntroductionFinTech & Cryptocurrency Introduction
FinTech & Cryptocurrency IntroductionEueung Mulyana
 
Open Source Networking Overview
Open Source Networking OverviewOpen Source Networking Overview
Open Source Networking OverviewEueung Mulyana
 
ONOS SDN Controller - Clustering Tests & Experiments
ONOS SDN Controller - Clustering Tests & Experiments ONOS SDN Controller - Clustering Tests & Experiments
ONOS SDN Controller - Clustering Tests & Experiments Eueung Mulyana
 
Open stack pike-devstack-tutorial
Open stack pike-devstack-tutorialOpen stack pike-devstack-tutorial
Open stack pike-devstack-tutorialEueung Mulyana
 
ONOS SDN Controller - Introduction
ONOS SDN Controller - IntroductionONOS SDN Controller - Introduction
ONOS SDN Controller - IntroductionEueung Mulyana
 
OpenDaylight SDN Controller - Introduction
OpenDaylight SDN Controller - IntroductionOpenDaylight SDN Controller - Introduction
OpenDaylight SDN Controller - IntroductionEueung Mulyana
 
Android Programming Basics
Android Programming BasicsAndroid Programming Basics
Android Programming BasicsEueung Mulyana
 
Cloud Computing: Overview and Examples
Cloud Computing: Overview and ExamplesCloud Computing: Overview and Examples
Cloud Computing: Overview and ExamplesEueung Mulyana
 
Connected Things, IoT and 5G
Connected Things, IoT and 5GConnected Things, IoT and 5G
Connected Things, IoT and 5GEueung Mulyana
 
NodeMCU with Blynk and Firebase
NodeMCU with Blynk and FirebaseNodeMCU with Blynk and Firebase
NodeMCU with Blynk and FirebaseEueung Mulyana
 
Trends and Enablers - Connected Services and Cloud Computing
Trends and Enablers  - Connected Services and Cloud ComputingTrends and Enablers  - Connected Services and Cloud Computing
Trends and Enablers - Connected Services and Cloud ComputingEueung Mulyana
 
Digital Ecosystems - Connected Services and Cloud Computing
Digital Ecosystems - Connected Services and Cloud ComputingDigital Ecosystems - Connected Services and Cloud Computing
Digital Ecosystems - Connected Services and Cloud ComputingEueung Mulyana
 
Services Convergence - Connected Services and Cloud Computing
Services Convergence - Connected Services and Cloud ComputingServices Convergence - Connected Services and Cloud Computing
Services Convergence - Connected Services and Cloud ComputingEueung Mulyana
 

More from Eueung Mulyana (20)

FGD Big Data
FGD Big DataFGD Big Data
FGD Big Data
 
Hyper-Connectivity and Data Proliferation - Ecosystem Perspective
Hyper-Connectivity and Data Proliferation - Ecosystem PerspectiveHyper-Connectivity and Data Proliferation - Ecosystem Perspective
Hyper-Connectivity and Data Proliferation - Ecosystem Perspective
 
Industry 4.0 And Beyond The A.I* For Surviving A Tech-Accelerated World
Industry 4.0 And Beyond The A.I* For Surviving A Tech-Accelerated WorldIndustry 4.0 And Beyond The A.I* For Surviving A Tech-Accelerated World
Industry 4.0 And Beyond The A.I* For Surviving A Tech-Accelerated World
 
Blockchain Introduction
Blockchain IntroductionBlockchain Introduction
Blockchain Introduction
 
Bringing Automation to the Classroom: A ChatOps-Based Approach
Bringing Automation to the Classroom: A ChatOps-Based ApproachBringing Automation to the Classroom: A ChatOps-Based Approach
Bringing Automation to the Classroom: A ChatOps-Based Approach
 
FinTech & Cryptocurrency Introduction
FinTech & Cryptocurrency IntroductionFinTech & Cryptocurrency Introduction
FinTech & Cryptocurrency Introduction
 
Open Source Networking Overview
Open Source Networking OverviewOpen Source Networking Overview
Open Source Networking Overview
 
ONOS SDN Controller - Clustering Tests & Experiments
ONOS SDN Controller - Clustering Tests & Experiments ONOS SDN Controller - Clustering Tests & Experiments
ONOS SDN Controller - Clustering Tests & Experiments
 
Open stack pike-devstack-tutorial
Open stack pike-devstack-tutorialOpen stack pike-devstack-tutorial
Open stack pike-devstack-tutorial
 
Basic onos-tutorial
Basic onos-tutorialBasic onos-tutorial
Basic onos-tutorial
 
ONOS SDN Controller - Introduction
ONOS SDN Controller - IntroductionONOS SDN Controller - Introduction
ONOS SDN Controller - Introduction
 
OpenDaylight SDN Controller - Introduction
OpenDaylight SDN Controller - IntroductionOpenDaylight SDN Controller - Introduction
OpenDaylight SDN Controller - Introduction
 
Mininet Basics
Mininet BasicsMininet Basics
Mininet Basics
 
Android Programming Basics
Android Programming BasicsAndroid Programming Basics
Android Programming Basics
 
Cloud Computing: Overview and Examples
Cloud Computing: Overview and ExamplesCloud Computing: Overview and Examples
Cloud Computing: Overview and Examples
 
Connected Things, IoT and 5G
Connected Things, IoT and 5GConnected Things, IoT and 5G
Connected Things, IoT and 5G
 
NodeMCU with Blynk and Firebase
NodeMCU with Blynk and FirebaseNodeMCU with Blynk and Firebase
NodeMCU with Blynk and Firebase
 
Trends and Enablers - Connected Services and Cloud Computing
Trends and Enablers  - Connected Services and Cloud ComputingTrends and Enablers  - Connected Services and Cloud Computing
Trends and Enablers - Connected Services and Cloud Computing
 
Digital Ecosystems - Connected Services and Cloud Computing
Digital Ecosystems - Connected Services and Cloud ComputingDigital Ecosystems - Connected Services and Cloud Computing
Digital Ecosystems - Connected Services and Cloud Computing
 
Services Convergence - Connected Services and Cloud Computing
Services Convergence - Connected Services and Cloud ComputingServices Convergence - Connected Services and Cloud Computing
Services Convergence - Connected Services and Cloud Computing
 

Recently uploaded

The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI AgeCprime
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfIngrid Airi González
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...AliaaTarek5
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Strongerpanagenda
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demoHarshalMandlekar2
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfNeo4j
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPathCommunity
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentPim van der Noll
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality AssuranceInflectra
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 

Recently uploaded (20)

The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI Age
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdf
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demo
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdf
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to Hero
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 

Connectivity for Local Sensors and Actuators Using nRF24L01+

  • 1. 1 / 51 Local Connectivity nRF24L01+ Eueung Mulyana https://eueung.github.io/012017/nrf24 CodeLabs | Attribution-ShareAlike CC BY-SA
  • 2. Outline Introduction Getting Started - Preparation Getting Started - Code & Play Simple Remote Control Gateway 2 / 51
  • 5. 5 / 51 nRF24L01+ nRF24L01+ is a highly integrated, ultra low power (ULP) 2Mbps RF transceiver IC for the 2.4GHz ISM (Industrial, Scienti c and Medical) band 2.400 - 2.4835GHz. The Nordic nRF24L01+ integrates a complete 2.4GHz RF transceiver, RF synthesizer, and baseband logic including the hardware protocol accelerator (Enhanced ShockBurst) supporting a high-speed SPI interface for the application controller. With peak RX/TX currents lower than 14mA, a sub uA power down mode, advanced power management, and a 1.9 to 3.6V supply range, the nRF24L01+ provides a true ULP solution enabling months to years of battery life from coin cell or AA/AAA batteries. Ref: Nordic Semiconductor
  • 6. 6 / 51 nRF24L01+ 1. ISM Frequency Band at 2.400 - 2.4835 GHz (Spacing at 1 or 2 MHz, GFSK) 2. 126 RF Channels 3. Air Data Rate Con gurable to 2 Mbps (Options: 250 kbps, 1 Mbps) 4. 4-Pin Hardware SPI 5. 5V Tolerant Inputs 6. 6 Data Pipe MultiCeiver for 1:6 star networks Notes: Power still at 3.3V!
  • 8. Important Notes Radio is sensitive to Noises! Make sure that the circuit (wire, solder, etc.) is stable. Anything uxtuates is bad! 8 / 51
  • 10. This setup is for demo purpose only. Can be any MCUs. 10 / 51 Getting Started Arduino IDE, NodeMCU & Nano 1. Install RF24 Library 2. Prepare the First Node - NodeMCU 3. Prepare the Second Node - Arduino Nano
  • 13. First Node - NodeMCU 13 / 51
  • 14. First Node - NodeMCU 14 / 51
  • 15. Second Node - Nano 15 / 51
  • 16. Second Node - Nano 16 / 51
  • 17. Code & Play Getting Started 17 / 51
  • 18. Simple Transmit & Receive NodeMCU - Transmit | Nano - Receive Ref: Example Sketches 18 / 51
  • 19. #include <SPI.h> #include "nRF24L01.h" #include "RF24.h" RF24 myRadio (2, 15); byte addresses[][6] = {"1Node"}; int dataTransmitted; void setup() { Serial.begin(115200); delay(1000); Serial.println(F("RF24/Simple Transmit data Test")); dataTransmitted = 100; myRadio.begin(); myRadio.setChannel(108); myRadio.setPALevel(RF24_PA_MIN); myRadio.openWritingPipe( addresses[0]); delay(1000); } void loop() { myRadio.write( &dataTransmitted, sizeof(dataTransmitted) ); Serial.print(F("Data Transmitted = ")); Serial.print(dataTransmitted); Serial.println(F(" No Acknowledge expected")); dataTransmitted = dataTransmitted + 1; delay(500); } 19 / 51 NodeMCU
  • 20. 20 / 51 NodeMCU Serial 1384, room 16 tail 8 chksum Data Transmitted = 100 No Acknowledge expected Data Transmitted = 101 No Acknowledge expected Data Transmitted = 102 No Acknowledge expected Data Transmitted = 103 No Acknowledge expected Data Transmitted = 104 No Acknowledge expected Data Transmitted = 105 No Acknowledge expected ...
  • 21. #include <SPI.h> #include "nRF24L01.h" #include "RF24.h" RF24 myRadio (7, 8); byte addresses[][6] = {"1Node"}; int dataReceived; void setup() { Serial.begin(115200); delay(1000); Serial.println(F("RF24/Simple Receive data Test")); myRadio.begin(); myRadio.setChannel(108); myRadio.setPALevel(RF24_PA_MIN); myRadio.openReadingPipe(1, addresses[0]); myRadio.startListening(); } void loop() { if (myRadio.available()) { while (myRadio.available()) { myRadio.read( &dataReceived, sizeof(dataReceived) ); } Serial.print("Data received = "); Serial.println(dataReceived); } } 21 / 51 Nano
  • 22. 22 / 51 Nano Serial RF24/Simple Receive data Test Data received = 100 Data received = 101 Data received = 102 Data received = 103 Data received = 104 Data received = 105 ...
  • 24. RF24 Sample Code - GettingStarted 24 / 51
  • 25. #include <SPI.h> #include "nRF24L01.h" #include "RF24.h" byte addresses[][6] = {"1Node","2Node"}; RF24 radio(2,15); bool radioNumber = 0; bool role = 1; /**********************************************************/ void setup() { Serial.begin(115200); Serial.println(F("RF24/examples/GettingStarted")); Serial.println(F("*** PRESS 'R' to begin receiving from the other node")); radio.begin(); radio.setChannel(108); radio.setPALevel(RF24_PA_MIN); if(radioNumber){ radio.openWritingPipe(addresses[1]); radio.openReadingPipe(1,addresses[0]); }else{ radio.openWritingPipe(addresses[0]); radio.openReadingPipe(1,addresses[1]); } radio.startListening(); } void loop() { /****************** Ping Out Role ***************************/ if (role == 1) { radio.stopListening(); Serial.println(F("Now sending")); unsigned long start_time = micros(); //radio.write( &start_time, sizeof(unsigned long)); if (!radio.write( &start_time, sizeof(unsigned long) )){ Serial.println(F("failed")); 25 / 51 NodeMCU
  • 26. 26 / 51 NodeMCU Serial ^$#%$#@*&%)# Why?? Nevermind for now! Unplug NodeMCU, Plug-In Nano .. Now sending failed Failed, response timed out. Now sending failed Failed, response timed out. Now sending failed Failed, response timed out. Now sending failed Failed, response timed out. Now sending failed Failed, response timed out. Now sending failed Failed, response timed out. ...
  • 27. #include <SPI.h> #include "nRF24L01.h" #include "RF24.h" byte addresses[][6] = {"1Node","2Node"}; RF24 radio(7,8); bool radioNumber = 1; bool role = 0; /**********************************************************/ void setup() { Serial.begin(115200); Serial.println(F("RF24/examples/GettingStarted")); Serial.println(F("*** PRESS 'T' to begin transmitting to the other node")); radio.begin(); radio.setChannel(108); radio.setPALevel(RF24_PA_MIN); if(radioNumber){ radio.openWritingPipe(addresses[1]); radio.openReadingPipe(1,addresses[0]); }else{ radio.openWritingPipe(addresses[0]); radio.openReadingPipe(1,addresses[1]); } radio.startListening(); } void loop() { ... ... } 27 / 51 Nano
  • 28. 28 / 51 Nano Serial Get Back to NodeMCU, Switch It On! RF24/examples/GettingStarted ** PRESS 'T' to begin transmitting to the other node # After NodeMCU Switched ON Sent response 9284083 Sent response 10286475 Sent response 11288847 Sent response 12291268 Sent response 13293653 ...
  • 29. 29 / 51 NodeMCU Serial - Take 2 Find Another Serial Console.. Now It Looks Good.. Explain! Now sending Sent 18612291, Got response 18612291, Round-trip delay 1828 microseconds Now sending Sent 19614686, Got response 19614686, Round-trip delay 1840 microseconds Now sending Sent 20617552, Got response 20617552, Round-trip delay 1803 microseconds Now sending Sent 21619866, Got response 21619866, Round-trip delay 1800 microseconds Now sending Sent 22622153, Got response 22622153, Round-trip delay 1806 microseconds Now sending Sent 23624535, Got response 23624535, Round-trip delay 1840 microseconds ...
  • 31. NodeMCU - Remote Controller 31 / 51
  • 32. Nano - Local Controller 32 / 51
  • 34. #include <SPI.h> #include "nRF24L01.h" #include "RF24.h" RF24 myRadio (2, 15); const int SW1 = 5; byte addresses[][6] = {"1Node"}; int dataTransmitted; int button; void setup() { pinMode(SW1, INPUT); dataTransmitted = 10; button = 0; Serial.begin(115200); delay(1000); myRadio.begin(); myRadio.setChannel(108); myRadio.setPALevel(RF24_PA_MIN); myRadio.openWritingPipe( addresses[0]); delay(1000); } void loop() { int newButton = digitalRead(SW1); if (newButton != button) { button = newButton; if (button == HIGH){ dataTransmitted = 20; } else { dataTransmitted = 10; } myRadio.write( &dataTransmitted, sizeof(dataTransmitted) ); Serial.print(F("Data Transmitted = ")); Serial.println(dataTransmitted); } 34 / 51 NodeMCU
  • 35. 35 / 51 NodeMCU Serial After Some ON-OFFs 1384, room 16 tail 8 chksum Data Transmitted = 20 Data Transmitted = 10 Data Transmitted = 20 Data Transmitted = 10 Data Transmitted = 20 Data Transmitted = 10 Data Transmitted = 20
  • 36. #include <SPI.h> #include "nRF24L01.h" #include "RF24.h" RF24 myRadio (7, 8); const int LED = 2; byte addresses[][6] = {"1Node"}; int dataReceived; void setup() { pinMode(LED, OUTPUT); Serial.begin(115200); delay(1000); myRadio.begin(); myRadio.setChannel(108); myRadio.setPALevel(RF24_PA_MIN); myRadio.openReadingPipe(1, addresses[0]); myRadio.startListening(); } void loop() { if (myRadio.available()) { while (myRadio.available()) { myRadio.read( &dataReceived, sizeof(dataReceived) ); } Serial.print("Data received = "); Serial.println(dataReceived); if (dataReceived == 10) { digitalWrite(LED, LOW); } else { digitalWrite(LED, HIGH); } } } 36 / 51 Nano
  • 37. 37 / 51 Nano Serial After Some ON-OFFs Data received = 20 Data received = 10 Data received = 20 Data received = 10 Data received = 20 Data received = 10 Data received = 20 Data received = 10 Data received = 20 Data received = 10
  • 39. Nano - Attach a Device 39 / 51
  • 40. Nano - Attach a Device 40 / 51
  • 41. Connecting to Blynk Cloud Gateway 41 / 51
  • 42. Notes This is only an example of integration of local-connected sensors and actuators to other (cloud-based) services. This is applicable not only for Blynk or Firebase, but also for other services. 42 / 51
  • 43. #include <SPI.h> #include "nRF24L01.h" #include "RF24.h" #include <ESP8266WiFi.h> #include <BlynkSimpleEsp8266.h> RF24 myRadio (2, 15); const int SW1 = 5; byte addresses[][6] = {"1Node"}; int dataTransmitted; int button; char auth[] = "c5d0dea217cd49539d7bed14d1234567"; char ssid[] = "emAP-01"; char pass[] = "1010101010"; BLYNK_WRITE(V1) { int pinValue = param.asInt(); if (pinValue == HIGH){ dataTransmitted = 20; } else { dataTransmitted = 10; } myRadio.write( &dataTransmitted, sizeof(dataTransmitted) ); Serial.print(F("pinValue = ")); Serial.println(pinValue); Serial.print(F("Data Transmitted = ")); Serial.println(dataTransmitted); } void setup() { Serial.begin(115200); Blynk.begin(auth, ssid, pass); delay(1000); pinMode(SW1, INPUT); 43 / 51 NodeMCU
  • 44. Blynk Button with Virtual Pin V1 44 / 51
  • 45. 45 / 51 NodeMCU Serial After Some ON-OFFs via Physical Button and Blynk Virtual Button 1384, room 16 Data Transmitted = 20 Data Transmitted = 10 pinValue = 1 Data Transmitted = 20 pinValue = 0 Data Transmitted = 10 pinValue = 1 Data Transmitted = 20 pinValue = 0 Data Transmitted = 10 pinValue = 1 Data Transmitted = 20 pinValue = 0 Data Transmitted = 10 pinValue = 1 Data Transmitted = 20 Data Transmitted = 20 Data Transmitted = 10 pinValue = 0 Data Transmitted = 10 Data Transmitted = 20 pinValue = 1 Data Transmitted = 20 pinValue = 0 Data Transmitted = 10 Data Transmitted = 10
  • 47. Refs/Resources 1. Nordic Semiconductor 2. Example Sketches @arduino-info 3. Connecting the Radio | MySensors 4. nRF24/RF24: Optimized fork of nRF24L01 for Arduino & Raspberry Pi/Linux Devices 47 / 51
  • 48. NodeMCU V1.0 Pin Map 48 / 51
  • 49. Nano V3.0 Pin Map 49 / 51
  • 50. Nano V3.0 Pin Map (?) 50 / 51
  • 51. 51 / 51 ENDEueung Mulyana https://eueung.github.io/012017/nrf24 CodeLabs | Attribution-ShareAlike CC BY-SA