I tried using the serial code in peripheral/examples to transmit At commands to the esp module but did no get any reply.Is there any reference example which I can use to connect the nrf52 kit to the internet using the esp8266 wifi module.
I tried using the serial code in peripheral/examples to transmit At commands to the esp module but did no get any reply.Is there any reference example which I can use to connect the nrf52 kit to the internet using the esp8266 wifi module.
Hi,
Unfortunately we don't have any AT commands examples. The UART example in our SDK is probably the best starting point, and you should make sure to read the ESP's datasheet and understand the AT protocol it uses.
i could configure the arduino to send At commands to the esp8266, Now i want to replicate the same using the nrf52840dk to uplaod data.
You don't give us much to go on. If you can show us comparison between your Arduino and Nordic code, then maybe we will be able to provide you with some help.
#include<SoftwareSerial.h> String apiKey = "-------------"; // Edit this API key according to your Account from thingsspeak String Host_Name = "Digisol" ; // Edit Host_Name Wifi Access point String Password = "-----------"; // Edit Password wifi password SoftwareSerial ser(2, 3); // RX, TX define rx ana tx to transmit data to the esp8266 int i=1; void setup() { Serial.begin(115200); // enable software serial ser.begin(115200); // baud rate for esp8266 ser.println("AT+RST"); // Resetting ESP8266 char inv ='"'; //command to join accesse point String cmd = "AT+CWJAP"; cmd+= "="; cmd+= inv; cmd+= Host_Name; cmd+= inv; cmd+= ","; cmd+= inv; cmd+= Password; cmd+= inv; // sending command to esp module; ser.println(cmd); // Connecting ESP8266 to your WiFi Router } // the loop void loop() { int temperature = 15; // Reading Temperature Value temperature=random(100); // generating random value Converting them to string String state2=String(temperature); // as to send it through URL Serial.println("temperature="+state2); //print value on serial terminal on pc String cmd = "AT+CIPSTART=\"TCP\",\""; // Establishing TCP connection,,Generating AT command for tcp connection cmd += "184.106.153.149"; // api.thingspeak.com cmd += "\",80"; // port 80 ser.println(cmd); //sending command to esp8266 Serial.println(cmd); if(ser.find("Error")){ Serial.println("AT+CIPSTART error"); return; } String getStr = "GET /update?api_key="; // prepare GET string to send to espmodule getStr += apiKey; getStr +="&field1="; getStr += String(state2); // Temperature Data getStr += "\r\n\r\n"; cmd = "AT+CIPSEND="; // AT command to send data length cmd += String(getStr.length()); // Total Length of data ser.println(cmd); //sending the AT command to the esp8266 Serial.println(cmd); if(ser.find(">")){ ser.print(getStr); // sending get string to esp8266 Serial.print(getStr); //diplaying on terminal } else{ ser.println("AT+CIPCLOSE"); // closing connection // alert user Serial.println("AT+CIPCLOSE"); } delay(15000); // Update after every 15 seconds }
This is the code I used to upload data to the thingspeak site using arduino and esp8266. SoftwareSerial.h is an header file inbuilt in arduino.
Can you also show us your code running on the nRF52?
Can you also show us your code running on the nRF52?
I have not written a code on nrf52, i could not send data to the esp8266 using the uart of nrf52.
Can you give an equivalent code to the arduino used above.I am programming using segger studio.I am not fluent with nrf52 hence i test it on the arduino first.But since the board has an rx and tx i assume the same thing can be done on the nrf board.
Unfortunately I don't have time to port your Arduino code for you, but if you show me your work on the nRF52 I might be able to spot your errors. We can make this case private if you don't want to post it publically.
Ok but how can i define a rx and tx to send data to the esp8266
My understanding is that you have had a look at the UART Example? I don't have any other advice than to base your project on that example and make sure to format your AT command strings correctly.