Cécilia Facca in MATLAB Answers
上次活动时间: 2024-7-29

Hello :) This is my first big project using Arduino components, so I don't really understand everything, that's why I encounter so many difficulties. My goal is to send data from my ultrasonic sensor (HC-SR04) to Thingspeak using an Arduino UNO and a GSM SIM800c. Material : Arduino UNO ; GSM SIM 800c shield (https://www.eagle-robotics.com/accueil/257-shield-sim800c-arduino.html) ; Ultrasonic sensor (HC-SR04) ; Cables for my ultrasonic sensor ; Cable to connect my Arduino to my computer. I want to send data to Thinspeak from everywhere, so I can't use Wifi. I found a solution on google : https://github.com/707amitkumar/Send-Data-on-cloud-using-gsm-800c/blob/main/gsmangthingspeak.txt In order to send data to my channel on thingspeak, I did use the code mentionned on the link and I just changed the part concerning the data to send (because I want to send data from my ultrasonic sensor) : #include <SoftwareSerial.h> SoftwareSerial gprsSerial(7,8); #include <String.h> #include <HCSR04.h> const int trigPin = 2 ; const int echoPin = 3 ; UltraSonicDistanceSensor distanceSensor(trigPin, echoPin) ; void setup() { gprsSerial.begin(9600); // the GPRS baud rate Serial.begin(9600); // the GPRS baud rate delay(1000); } void loop() { float distance = distanceSensor.measureDistanceCm(); Serial.print("Distance = "); Serial.print(distance); Serial.println(" cm"); if (gprsSerial.available()) Serial.write(gprsSerial.read()); gprsSerial.println("AT"); delay(1000); gprsSerial.println("AT+CPIN?"); delay(1000); gprsSerial.println("AT+CREG?"); delay(1000); gprsSerial.println("AT+CGATT?"); delay(1000); gprsSerial.println("AT+CIPSHUT"); delay(1000); gprsSerial.println("AT+CIPSTATUS"); delay(2000); gprsSerial.println("AT+CIPMUX=0"); delay(2000); ShowSerialData(); gprsSerial.println("AT+CSTT=\"tango.lu\"");//start task and setting the APN, delay(1000); ShowSerialData(); gprsSerial.println("AT+CIICR");//bring up wireless connection delay(3000); ShowSerialData(); gprsSerial.println("AT+CIFSR");//get local IP adress delay(2000); ShowSerialData(); gprsSerial.println("AT+CIPSPRT=0"); delay(3000); ShowSerialData(); gprsSerial.println("AT+CIPSTART=\"TCP\",\"api.thingspeak.com\",\"80\"");//start up the connection delay(6000); ShowSerialData(); gprsSerial.println("AT+CIPSEND");//begin send data to remote server delay(4000); ShowSerialData(); String str="GET https://api.thingspeak.com/update?api_key=F2WFEAUL58M062LM&field1=0" + String(distance) ; Serial.println(str); gprsSerial.println(str);//begin send data to remote server delay(4000); ShowSerialData(); gprsSerial.println((char)26);//sending delay(5000); //waitting for reply, important the time is base on the condition of internet gprsSerial.println(); ShowSerialData(); gprsSerial.println("AT+CIPSHUT"); //close the connection delay(100); ShowSerialData(); } void ShowSerialData() { while(gprsSerial.available()!=0) Serial.write(gprsSerial.read()); delay(5000); } When I run this code to my Arduino, I notice 2 problems : The piece of information is "sent" to my Thingspeak Channel but it doesn't match with the data sent from my sensors (It always show "0" on Thingspeak while the sensor sends a positive value : 2. I can notice that my code doesn't run as well as expected because the Serial Monitor dislay this : I really don't kow what to do... And I thank you in advance for any help you may give me. I hope my english is not so bad and you cand understand me :) I wish you a good day, Cécilia.
Alx Grm in MATLAB Answers
上次活动时间: 2021-5-21

Hello i would like some help with my channel 1313074. I have a remote beescale which sends me data every 12 hours through gprs. Everything was working fine until today. The gsm shows me that today it has send data at 6:46pm but on my channel's graphics there is nothing showed. Is there any problem with the server or what can cause this? Please help me.
Labo SMRA in MATLAB Answers
上次活动时间: 2021-1-29

Hello, I can't post data on thingspeak with my yoctopuce probes anymore. The probes post the data via a GSM 3 router that doesn't assume the https protocol. I was able to transfer data very well before, are the Thingspeak API keys configured in https? Thank you in advance

关于 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.