+ Post New Thread
Results 1 to 10 of 10
-
11th February 2019, 12:49 #1
- Join Date
- Feb 2019
- Posts
- 5
- Helped
- 0 / 0
- Points
- 31
- Level
- 1
nRF24L01 and ESP8266 in Arduino UNO
I have been trying to push data into my API from Arduino UNO with ESP8266. The device connects to WiFi but fails in performing the data push after acquiring from sensor node via the nRF24L01 module attached to the arduino. Any idea?
-
Advertisment
-
11th February 2019, 13:00 #2
- Join Date
- Nov 2006
- Location
- Brazil
- Posts
- 8,476
- Helped
- 1078 / 1078
- Points
- 28,512
- Level
- 41
- Blog Entries
- 6
Re: nRF24L01 and ESP8266 in Arduino UNO
Are you sure that nRF24L01 is compliant with 802.11 such as ESP8266 is ? It seems like you are trying to connect modules having different wireless communication standards.
--------------------------------------------------------------------------------------------------
Part of the world that you live in, You are the part that you're giving ( Renaissance )
-
11th February 2019, 13:24 #3
- Join Date
- Feb 2019
- Posts
- 5
- Helped
- 0 / 0
- Points
- 31
- Level
- 1
Re: nRF24L01 and ESP8266 in Arduino UNO
Since Arduino is working as a medium between both can't I send the acquired data using the esp module
-
Advertisment
-
11th February 2019, 13:40 #4
- Join Date
- Nov 2006
- Location
- Brazil
- Posts
- 8,476
- Helped
- 1078 / 1078
- Points
- 28,512
- Level
- 41
- Blog Entries
- 6
Re: nRF24L01 and ESP8266 in Arduino UNO
Initially I assumed a scenario with only one module of each of the above mentioned. Anyway, what do you think of, instead of giving short details, how about showing a description of the overall architecture in a slightly more elaborate way, such as a sketch, scribble or something like that?
--------------------------------------------------------------------------------------------------
Part of the world that you live in, You are the part that you're giving ( Renaissance )
-
Advertisment
-
12th February 2019, 07:30 #5
- Join Date
- Feb 2019
- Posts
- 5
- Helped
- 0 / 0
- Points
- 31
- Level
- 1
Re: nRF24L01 and ESP8266 in Arduino UNO
i am sending here the receiver node code that gets the sent data from a remote node via nRF24L01 module and updates the thingspeak API with the esp8266 module. Arduino Uno is the interface
Code:#include <SPI.h> #include <nRF24L01.h> #include <RF24.h> #include <Wire.h> #include <printf.h> #include <SoftwareSerial.h> #define RX 10 #define TX 11 //for SoftwareSerial to communicate with the Tx and Rx of the WiFi module RF24 radio(8,9); //CE,CSN const byte address[6] = "00001"; String AP = "*******"; String PASS = "******"; String API = "9O1EQOC9QR5LMSS9"; String HOST = "api.thingspeak.com"; String PORT = "80"; String field1 = "field1"; int countTrueCommand; int countTimeCommand; boolean found = false; int data; SoftwareSerial esp8266(RX, TX); void setup() { Serial.begin(9600); Serial.println(F("This is the central receiving node")); esp8266.begin(115200); sendCommand("AT",5,"OK"); sendCommand("AT+CWMODE=1",5,"OK"); sendCommand("AT+CWJAP=""+AP+"",""+PASS+""",20,"OK"); countTrueCommand = 0; radio.begin(); radio.openReadingPipe(0, address); //setting the address at which we will receive the data radio.setPALevel(RF24_PA_MIN); //can set this as minimum or maximum depending on the distance between the transmitter and the receiver radio.startListening(); //it sets the module to receiver mode Serial.print("Radio set for communication"); radio.printDetails(); } void loop() { if (radio.available()) //looking for the data { radio.read(&data, sizeof(data)); //reading the data sendCommand("AT+CWJAP?=0",5,"OK"); String getData1 = "GET /update?api_key="+ API +"&"+ field1 +"="+String(data); Serial.print("data received: "); Serial.println(getData1); sendCommand("AT+CIPMUX=1",5,"OK"); sendCommand("AT+CIPSTART=0,"TCP",""+ HOST +"","+ PORT,15,"OK"); sendCommand("AT+CIPSEND=0," +String(getData1.length()+4),4,">"); } delay(5); } void sendCommand(String command, int maxTime, char readReply[]) { Serial.print(countTrueCommand); Serial.print(". at command => ?"); Serial.print(command); Serial.print(" "); Serial.print("inside sendCommand loop"); while(countTimeCommand < (maxTime*1)) { esp8266.println(command); //at+cipsend if(esp8266.find(readReply)) //ok { found = true; break; } countTimeCommand++; } if(found == true) { Serial.println("Found!"); countTrueCommand++; countTimeCommand = 0; } if(found == false) { Serial.println("Fail"); countTrueCommand = 0; countTimeCommand = 0; } delay(500); found = false; }
Last edited by KlausST; 12th February 2019 at 07:58. Reason: added code tags
-
12th February 2019, 12:36 #6
- Join Date
- Nov 2006
- Location
- Brazil
- Posts
- 8,476
- Helped
- 1078 / 1078
- Points
- 28,512
- Level
- 41
- Blog Entries
- 6
Re: nRF24L01 and ESP8266 in Arduino UNO
Sorry to say, but you are not so clear with the words to make explicit what you meant, so once again:
how about showing a description of the overall architecture in a slightly more elaborate way, such as a sketch, scribble or something like that?--------------------------------------------------------------------------------------------------
Part of the world that you live in, You are the part that you're giving ( Renaissance )
-
12th February 2019, 12:46 #7
- Join Date
- Feb 2019
- Posts
- 5
- Helped
- 0 / 0
- Points
- 31
- Level
- 1
Re: nRF24L01 and ESP8266 in Arduino UNO
My architecture:
there's a remote sensor node and a receiver node. The sensor node is communicating data to the receiver node with nRF24 module. Now the receiver node, along with nRF24 module also has a wiFi module (esp8266) with which it has to update the APIs.
What I meant is that the receiver is displaying data sent from sensor node, it also connects to WiFi. But I feel the WiFi connection disconnects before uploading the data. Is it any delay related issue the code might have?Last edited by anneshabaruah; 12th February 2019 at 13:10.
-
12th February 2019, 13:09 #8
- Join Date
- Nov 2006
- Location
- Brazil
- Posts
- 8,476
- Helped
- 1078 / 1078
- Points
- 28,512
- Level
- 41
- Blog Entries
- 6
Re: nRF24L01 and ESP8266 in Arduino UNO
I feel the WiFi connection disconnects before uploading the data. Is it any delay related issue the code might have?--------------------------------------------------------------------------------------------------
Part of the world that you live in, You are the part that you're giving ( Renaissance )
-
12th February 2019, 13:17 #9
- Join Date
- Feb 2019
- Posts
- 5
- Helped
- 0 / 0
- Points
- 31
- Level
- 1
-
Advertisment
-
12th February 2019, 13:32 #10
- Join Date
- Nov 2006
- Location
- Brazil
- Posts
- 8,476
- Helped
- 1078 / 1078
- Points
- 28,512
- Level
- 41
- Blog Entries
- 6
Re: nRF24L01 and ESP8266 in Arduino UNO
--------------------------------------------------------------------------------------------------
Part of the world that you live in, You are the part that you're giving ( Renaissance )
+ Post New Thread
Please login