emmanuel jallas in MATLAB Answers
上次活动时间: 2022-6-2

Hello to everyone. I will be very gratefull for support and knowledge sharing with AT commands and troubleshooting knowledge with hardware setup and software. Hardware context : Arduino Uno, SIM800F GSM shield , USB connection and power, Rx -Tx GSM connection strapped on Software Serial Concerning SIM card. Inserted on a mobile phone, can send and receive SMS and phone communications. Data plan available. Software context : I'm using Serial monitor to send AT commands and receive answers. Aim : to follow manually the proper AT sequence to send one piece of data to one field of one channel. Code : [code] // Sending AT commands via Serial Monitor interface #include<SoftwareSerial.h> SoftwareSerial mySerial(2,3); // setting up GSM serial communication void setup() { digitalWrite(8, HIGH); // Switching on GSM shield delay(1100); digitalWrite(8,LOW); mySerial.begin(9600); Serial.begin(9600); Serial.println("Type AT command :"); } void loop() { if (mySerial.available()) Serial.write(mySerial.read()); if (Serial.available()) mySerial.write(Serial.read()); } [/code] Setup : AT returns OK, SMS ready, CALL ready AT+CPIN? returns ready As far I understand the proper sequence of AT commands to connect device to thingspeak server and send data should be this : AT // is SIM800F ready ? good return is : OK AT+CGREG? // is SIM800F registered on GPRS provider network ? good return is : +CGREG: 0,1 (edited) AT+CGATT? // is GPRS attached or not ? good return is : +CGATT: 1 AT+CIPSHUT // resets previous IP session if any. good return is : SHUT OK AT+CIPSTATUS // Check if IP stack is intitalized. good return is : STATE: IP INITIAL AT+CIPMUX=0 // Sets single connection mode. good return is : OK AT+CSTT="APN","","" // Starts task. good return is : OK AT+CIPSTATUS // Not needed but for troubleshooting Check IP status. good return is : STATE: IP START AT+CIICR // Brings up wireless connection. good return is : OK and quick flashing led (edited) AT+CIPSTATUS // Not needed but for troubleshooting Check IP status. good return is : STATE: IP GPRSACT (edited) AT+CIFSR // Gets local IP adress. good return is : anything else than "0.0.0.0" AT+CIPSTART="TCP", "api.thingspeak....","80" // Starts connection with TCP protocol, TCP, domain name, port. good return is : CONNECT OK AT+CIPSEND // Data sending request. good return is : > > data string // Sends data to the proper field and channel >#026 // Ctrl+Z input to indicate the end of data AT+CIPSHUT // Shuts down UDP context. good return is : SHUT OK At this time : AT+CGREG? is returning : +CGREG: 1,0 which states : network registration is enabled, device is not registered and searching for operator's network (edited) AT+CGATT? is returning : 0, which states GPRS is detached AT+CIICR is returning +PDP: DEACT, ERROR Question : What may prevent network registration and getting a +CGREG: 0,1 return ? (edited) How can I troubleshoot and assess actual situation ? Thank you for your insights.
IOT4ALL in Discussions
上次活动时间: 2022-3-21

Hello! I`ve got problems with reading last input of a channel field using AT commands, here follows the sketch I'm currently using: /* String tx_data_r = "GET https://api.thingspeak.com/channels/CHANNEL/fields/4/last.txt?api_key=API_READ_KEY&results=1"; */ String tx_data_r = "GET https://api.thingspeak.com/channels/"; tx_data_r += "CHANNEL"; tx_data_r += "/"; tx_data_r += "fields"; tx_data_r += "/4/"; tx_data_r += "last.txt?api_key="; tx_data_r += "API_READ_KEY"; tx_data_r += "&results=1"; tx_data_r += "\r\n"; Serial.print("AT+CIPSEND="); delay(1000); Serial.println(tx_data_r.length()); delay(1000); Serial.println(tx_data_r); delay(1000); This piece of code doesn`t return a valid response, however if I copy/paste https://api.thingspeak.com/channels/CHANNEL/fields/4/last.txt?api_key=API_READ_KEY&results=1" using a browser I get the right data. One more thing, if instead of using a microcontroller I use an USB serial PC interface program directly connected to my RF module, with GET https://api.thingspeak.com/channels/CHANNEL/fields/4/last.txt?api_key=API_READ_KEY&results=1 along with other commands I get the right data too! Can anybody tell me what's going on? There are no problems with any read related commands. If a working sketch is available it will be most welcome! Tks in advance for any help! Issues using AT commands to read a channel field Sorry: There are no problems with any write related commands. I've seen some advice not to include the https:\\, or to connect to the server separately from sending the command to read data to the server as in <https://arduino.stackexchange.com/questions/32567/get-data-from-website-with-esp8266-using-at-commands this post> . M y advice is generally not to use the AT command set. What is your hardware and why do you need to use AT commands? atcommands read
Richard Stallard in MATLAB Answers
上次活动时间: 2022-3-21

I am working towards sending data from a Picaxe using AT commands via ESP8266, based on an example from 2015 here: https://www.allaboutcircuits.com/projects/connect-a-picaxe-to-the-internet-of-things/ At this stage, I am sending the AT commands to the ESP8266 from a terminal program (Termite), so the Picaxe board is not playing an active part other than providing 3.3V for the ESP-01S module. However, the GET command is not working and there are no updates to ThingSpeak. I can send the same update string from a browser and the data does appear in ThingSpeak, so the key and field number are correct. This is the update URL which works: https://api.thingspeak.com/update?key=XXXXXXXXXXXXXXXX&field2=123 I understand there is a ThingSpeak library for Arduino which would simplify the process but, for various reasons, I prefer Picaxe at the moment. Are updates via GET still supported? Have there been any recent changes to the format which affect the data string? I assume the byte count requires addition of 2 to account for the CR+LF sent from the terminal program but I have also tried with byte count reduced by 2 with no change in the result. Here is the log from Termite: AT OK AT+CIPSTART="TCP","thingspeak.com",80 AT+CIPSTART="TCP","thingspeak.com",80 CONNECT OK AT+CIPSEND=45 AT+CIPSEND=45 OK > GET /update?key=XXXXXXXXXXXXXXXX&field1=123 Recv 45 bytes SEND OK +IPD,69:HTTP/1.1 408 REQUEST_TIMEOUT Content-Length:0 Connection: Close CLOSED
Jakob Jackson in MATLAB Answers
上次活动时间: 2019-12-6

I am very new to this area. My small project is as follows: MCU: NXP ESP8266 module C programming language with AT Commands for ESP8266 IDE: Online Mbed Complier ThingSpeak Cloud Server My goal is simply to simply read data (measurement) from a sensor and push it to ThingSpeak cloud. Part of my code with AT commands for ESP8266 module is as follows: //Sending Data to the Cloud Server via ESP8266 WiFi Module strcpy(snd,"AT+CIPMUX=0\n\r"); //AT+CIPMUX: Enabling Single Channel Mode wifi.SendCMD(snd); wait(1); wifi.RcvReply(rcv, 1000); wait(1); sprintf(snd,"AT+CIPSTART=4,\"TCP\",\"%s\",80\n",CloudIP); //Establish TCP connection w/ Cloud Server wait(1); wifi.RcvReply(rcv, 1000); wait(1); strcpy(snd,"AT+CIPSEND=100\n\r"); //Set length of the data that will be sent wifi.SendCMD(snd); pc.printf("%s\r", rcv); wait(1); wifi.RcvReply(rcv, 1000); pc.printf("%s\r", rcv); wait(1); //Pushing the data acquired from HC-SR04 Ultrasonic Sensor to Cloud Server via API sprintf(snd,"GET https://api.thingspeak.com/update?api_key=3LV9GHWHJYDZNWEH&field1=%f \r\n\r\n", dist_percent); pc.printf("%s\r",snd); wifi.SendCMD(snd); wait(1); wifi.RcvReply(rcv, 1000); pc.printf("%s\r", rcv); Before this, I do initialization part for connecting my ESP module to my Wifi router. That works fine. No issues. Problem: I need to click on the GET link as shown in the screenshot below, in order to update my ThingSpeak cloud server. I have tried many AT commands but none seems to automatically update cloud. Everytime, I have to open terminal (TeraTerm) and then double click on the link, which then opens a new web page with just a single digit. Then after I go back to my ThingSpeak Channel dashboard, I see the new value. Else, channel does not automatically update itself. Please note that I am only updating (writing the channel), not reading from it or anything. (Screenshot with the GET link. When I double click on it, only then does my ThingSpeak Channel gets updated). Is there a way to automate this? Am I missing any AT command or anything else? I apologize, I am new to programming ESP module and ThingSpeak server. So, your help will be much appreciated. Thank you for your time.

关于 ThingSpeak

The community for students, researchers, and engineers looking to use MATLAB, Simulink, and ThingSpeak for Internet of Things applications. You can find the latest ThingSpeak news, tutorials to jump-start your next IoT project, and a forum to engage in a discussion on your latest cloud-based project. You can see answers to problems other users have solved and share how you solved a problem.