Jonas Meier in MATLAB Answers
최근 활동: 2024년 3월 26일

Dear all, is there a way to use the Fronius push service to send data directly to thingspeak? I want to collect the solar PV production data. Below you can see a screenshot of the push service. Most important is "server:port:" and "upload filename". I can choose between "FTP upload" or "HTTP Post". Does thinspeak have a "server:port:"? Thank you!
Tobias Wagner in MATLAB Answers
최근 활동: 2022년 11월 10일

Hi everybody, I have successfully created a thinghttp that returns a number. It's running with time control. How can I write the number to a thingspeak channel?
Christopher Stapels in Discussions
최근 활동: 2022년 8월 4일

The ThingSpeak certificate was updated recently. If you are using secure communication for your devices, you may need to update the certificate or certificate fingerprint on your devices. Secure ThingSpeak communications and security certificate If anyone find a working with ThingSpeak root certificat for Arduino ESP32 programmation, I'd be interrested, something like : const char* rootCACertificate = "-----BEGIN CERTIFICATE-----\n" ... here should be what I need ... "-----END CERTIFICATE-----"; for Arduino code: WiFiClientSecure client; client.setCACert(rootCACertificate); Thanks, TC This post might help. Hi, Thanks, but I already tried the one exported and download from ThingSpeak.com, still not working. I try also the one from Digicert and two others, none are working. I am hoping somehting from the other post... TT Use firefox Got to thingspeak.com. Click on the lock icon Click on Connection secure -> More information Click on view certificate Click on "DigiCert Global Root CA" in the tab Click on PEM(cert) under Miscellaneous Right click on the downloaded file. Open with any editor. In Chrome, I think its similar, but you want to save it with base64 encoding. I was able to use the thingspeak library secure connection with esp32 with this cert, but you need to add the line you mentioned. in secrets.h: client.setCACert(SECRET_TS_ROOT_CA); #define SECRET_TS_ROOT_CA "-----BEGIN CERTIFICATE-----\n" \ ... "-----END CERTIFICATE-----\n" in main file: const char* certificate = SECRET_TS_ROOT_CA; % in setup fucntion client.setCACert(certificate); // Set Root Certificate for authenticity check http mqtt secure certificat
NAGUBATHULA SATYA SRIRAM in MATLAB Answers
최근 활동: 2022년 5월 26일

While i have written a code and transmitted the values to thing speak and now iam trying to use message alerts with twilio and included HTTP and while using it iam getting an error. the code is as follows and iam highlighting the error and the error [ is exit status 1 'HTTPClient' was not declared in this scope] /* WriteMultipleFields Description: Writes values to fields 1,2,3,4 and status in a single ThingSpeak update every 20 seconds. Hardware: Arduino Uno WiFi Rev2 !!! IMPORTANT - Modify the secrets.h file for this project with your network connection and ThingSpeak channel details. !!! Note: - Requires WiFiNINA library. - This example is written for a network using WPA encryption. For WEP or WPA, change the WiFi.begin() call accordingly. ThingSpeak ( https://www.thingspeak.com ) is an analytic IoT platform service that allows you to aggregate, visualize, and analyze live data streams in the cloud. Visit https://www.thingspeak.com to sign up for a free account and create a channel. Documentation for the ThingSpeak Communication Library for Arduino is in the README.md folder where the library was installed. See https://www.mathworks.com/help/thingspeak/index.html for the full ThingSpeak documentation. For licensing information, see the accompanying license file. Copyright 2020, The MathWorks, Inc. */ #include <WiFiNINA.h> #include "secrets.h" #include "ThingSpeak.h" // always include thingspeak header file after other header files and custom macros #include <ArduinoHttpClient.h> // the libraries of the ph sensor and varibles defined #include <Wire.h> float calibration_value = 21.34-5.5; int phval = 0; unsigned long int avgval; int buffer_arr[10],temp; // the libraries of tds sensor and varibles are declared here #include <EEPROM.h> #include "GravityTDS.h" #define TdsSensorPin A1 GravityTDS gravityTds; float temperature = 25,tdsValue = 0; //the libraries of dissolved oxygen meter are declared here #include <Arduino.h> #define DO_PIN A2 #define VREF 5000 //VREF (mv) #define ADC_RES 1024 //ADC Resolution //Single-point calibration Mode=0 //Two-point calibration Mode=1 #define TWO_POINT_CALIBRATION 0 #define READ_TEMP (25) //Current water temperature ℃, Or temperature sensor function //Single point calibration needs to be filled CAL1_V and CAL1_T #define CAL1_V (1831) //mv #define CAL1_T (25) //℃ //Two-point calibration needs to be filled CAL2_V and CAL2_T //CAL1 High temperature point, CAL2 Low temperature point #define CAL2_V (1300) //mv #define CAL2_T (15) //℃ const uint16_t DO_Table[41] = { 14460, 14220, 13820, 13440, 13090, 12740, 12420, 12110, 11810, 11530, 11260, 11010, 10770, 10530, 10300, 10080, 9860, 9660, 9460, 9270, 9080, 8900, 8730, 8570, 8410, 8250, 8110, 7960, 7820, 7690, 7560, 7430, 7300, 7180, 7070, 6950, 6840, 6730, 6630, 6530, 6410}; uint8_t Temperaturet; uint16_t ADC_Raw; uint16_t ADC_Voltage; uint16_t DO; uint16_t dissolved; int16_t readDO(uint32_t voltage_mv, uint8_t temperature_c) { #if TWO_POINT_CALIBRATION == 0 uint16_t V_saturation = (uint32_t)CAL1_V + (uint32_t)35 * temperature_c - (uint32_t)CAL1_T * 35; return (voltage_mv * DO_Table[temperature_c] / V_saturation); #else uint16_t V_saturation = (int16_t)((int8_t)temperature_c - CAL2_T) * ((uint16_t)CAL1_V - CAL2_V) / ((uint8_t)CAL1_T - CAL2_T) + CAL2_V; return (voltage_mv * DO_Table[temperature_c] / V_saturation); #endif } //wifi and api keys are declared here char ssid[] = SECRET_SSID; // your network SSID (name) char pass[] = SECRET_PASS; // your network password int keyIndex = 0; // your network key Index number (needed only for WEP) WiFiClient client; boolean checkpoint= true; boolean checkpoint1= true; unsigned long myChannelNumber = SECRET_CH_ID; const char * myWriteAPIKey = SECRET_WRITE_APIKEY; // Initialize our values int number1 = 0; int number2 = random(0,100); int number3 = random(0,100); int number4 = random(0,100); String myStatus = ""; void setup() { Serial.begin(9600); // Initialize serial gravityTds.setPin(TdsSensorPin); gravityTds.setAref(5.0); //reference voltage on ADC, default 5.0V on Arduino UNO gravityTds.setAdcRange(1024); //1024 for 10bit ADC;4096 for 12bit ADC gravityTds.begin(); //initialization while (!Serial) { ; // wait for serial port to connect. Needed for Leonardo native USB port only } // check for the WiFi module: if (WiFi.status() == WL_NO_MODULE) { Serial.println("Communication with WiFi module failed!"); // don't continue while (true); } String fv = WiFi.firmwareVersion(); if (fv != "1.0.0") { Serial.println("Please upgrade the firmware"); } ThingSpeak.begin(client); //Initialize ThingSpeak } void loop() { // Connect or reconnect to WiFi if(WiFi.status() != WL_CONNECTED){ Serial.print("Attempting to connect to SSID: "); Serial.println(SECRET_SSID); while(WiFi.status() != WL_CONNECTED){ WiFi.begin(ssid, pass); // Connect to WPA/WPA2 network. Change this line if using open or WEP network Serial.print("."); delay(5000); } Serial.println("\nConnected."); } // TDS sensor values starts from here gravityTds.setTemperature(temperature); // set the temperature and execute temperature compensation gravityTds.update(); //sample and calculate tdsValue = gravityTds.getTdsValue(); // then get the value Serial.print(tdsValue,0); Serial.println("ppm"); delay(1000); // ph meter values and code here for(int i=0;i<10;i++) { buffer_arr[i]=analogRead(A0); delay(30); } for(int i=0;i<9;i++) { for(int j=i+1;j<10;j++) { if(buffer_arr[i]>buffer_arr[j]) { temp=buffer_arr[i]; buffer_arr[i]=buffer_arr[j]; buffer_arr[j]=temp; } } } avgval=0; for(int i=2;i<8;i++) avgval+=buffer_arr[i]; float volt=(float)avgval*5.0/1024/6; float ph_act = -5.70 * volt + calibration_value; Serial.println(ph_act); delay(1000); // dissolved oxygen meter starts from here Temperaturet = (uint8_t)READ_TEMP; ADC_Raw = analogRead(DO_PIN); ADC_Voltage = uint32_t(VREF) * ADC_Raw / ADC_RES; Serial.print("Temperaturet:\t" + String(Temperaturet) + "\t"); Serial.print("ADC RAW:\t" + String(ADC_Raw) + "\t"); Serial.print("ADC Voltage:\t" + String(ADC_Voltage) + "\t"); Serial.println("DO:\t" + String(readDO(ADC_Voltage, Temperaturet)) + "\t"); delay(1000); if (ph_act < 4) { if(checkpoint) { HTTPClient http; [errror] Serial.println("[HTTP] begin...\n"); String str= String(h)+"pH has reached "; http.begin("https://api.thingspeak.com/apps/thinghttp/send_request?api_key=GCA8S03FIUORHJJM0&message="+str); Serial.print("[HTTP] begin...\n"); int httpcode= http.GET(); if(httpcode >0) { Serial.printf("[HTTP] GET...code :%d\n",httpcode); if(httpcode=HTTP_CODE_OK) { String payload=http.GETString(); Serial.println(payload); checkpoint= false; } } } } else { checkpoint=true; } } // set the fields with the values ThingSpeak.setField(1, ph_act); ThingSpeak.setField(2, tdsValue); ThingSpeak.setField(3, float(ADC_Voltage)); ThingSpeak.setField(4, Temperaturet); // figure out the status message if(number1 > number2){ myStatus = String("field1 is greater than field2"); } else if(number1 < number2){ myStatus = String("field1 is less than field2"); } else{ myStatus = String("field1 equals field2"); } // set the status ThingSpeak.setStatus(myStatus); // write to the ThingSpeak channel int x = ThingSpeak.writeFields(myChannelNumber, myWriteAPIKey); if(x == 200){ Serial.println("Channel update successful."); } else{ Serial.println("Problem updating channel. HTTP error code " + String(x)); } // change the values number1++; if(number1 > 99){ number1 = 0; } number2 = random(0,100); number3 = random(0,100); number4 = random(0,100); delay(15000); // Wait 20 seconds to update the channel again }
Donald Duck in Discussions
최근 활동: 2022년 4월 16일

I've had a Thingspeak channel since 2017. It's updated by a RPi running Raspbian Lite (the Raspberry Pi version of Debian Linux). The "Lite" means there's not much GUI stuff in there, and the RPi is run "headless" using SSH. To update my channel I use the linux utility curl to send http GET commands. curl is run at intervals from a bash script which loops indefinitely. This has worked fine for nearly 5 years until suddenly between 14:00 and 14:20 UTC on 13/4/22 (UK format) it stopped working, and I started getting HTTP error 400 responses. I haven't changed anything; I haven't updated the RPi OS for over a year, and the timestamp the bash script file is 2020. Status is enabled on the channel, and a little trial and error showed that the problem was caused by including a status update string which contained a space character. So the workaround is simple, just amend the status string to not have a space character, and all is well again. I can still send status updates with a string including a space character directly from a web browser, so what has happened to break curl after all this time? Channel status update strings including space chars I think it may be related to some updates on our end which tightened the rules around query parameters. For example, the browser automatically does some things like convert spaces to %20 - the ASCII value for space. In curl that is not automatic. So, you may have to update your curl string to include double quotes around the query parameters or manually convert the spaces to %20. Do either of those solutions resolve the issue for your device? Vinod, Thanks for your reply. No, your suggested fixes don't work. I had already tried single and double quoting the string when I was messing about earlier. I've just tried %20 and that doesn't work either. Maybe I should go back and read the curl documentation again, but not knowing what your end will accept now means that may not help resolve things much. A slightly more helpful error message rather than just a 400 failure and the the message "invalid constant string" would be good too. Maybe if you share your exact curl request with a placeholder for the api_key, I can suggest what the change needs to be. Vinod, I've just retried replacing spaces with %20 in the status string, and it's working now. So probably I had finger trouble before when I tried it, or possibly you've changed something else your end. Whatever, it's an easy fix for me to change the software that generates the string. Thanks for your help. I would suggest your documentation could do with an update or note. In Write Data the value type for the status parameter is defined as string. I can't find anywhere string is further defined, but in most contexts space characters are valid components of strings. Glad to hear you got it working. I appreciate the suggestion to improve the documentation to say status updates need to be URL encoded strings. Thanks! http 400 space characters
Peter Reiter in MATLAB Answers
최근 활동: 2021년 11월 5일

Dear all, I have created an HTTP post with the corresponding REACT to send various measurement data of a bee hive to beep.nl. Unfortunately, the data does not arrive there although I was able to successfully transmit data with Postman which was then also written to the database (JSON an also with X-WWW-FORM). I can't explain what content error I have in the body? Unfortunately, my knowledge of MATHLAB is not sufficient to create a post from this. Thanks a lot in advance regards Peter -------------------------------------------------- Name:Beute 2 API Key:52G8X93X1UTSHH6K URL:https://api.beep.nl/api/sensors?key=kptnnz7wrz3qy90c HTTP Auth Username: HTTP Auth Password: Method:POST Content Type:application/json HTTP Version:1.1 Host:api.beep.nl Headers: Body:{"weight_kg"=%%channel_1293353_field_6%%, "h"=%%channel_1293353_field_3%%, "t"=%%channel_1293353_field_1%%, "p"=%%channel_1293353_field_4%%, "t"=%%channel_1293353_field_2%%, t_i=%%channel_1293353_field_5%%} Parse String: Created:2021-10-16 4:50 am --------------------------------------------------------
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
joem in MATLAB Answers
최근 활동: 2019년 10월 21일

I build an arduino based device and connect a GSM900 module to it which can establish GPRS connection and visit website. Also I have created an account in thingspeak. I tested sending data to the field with the browser in my PC by visiting https://api.thingspeak.com/update?api_key=XXXXXXXXXXXXX&field1=0, and it does upload data and shows a number. But when I try to do the same thing with the arduino based device, after softSerial.println("GET https://api.thingspeak.com/update?api_key=XXXXXXXXXXXXX&field1=0"); It dosn't repond nor shows the number. Is there anything missing? The following is the arduino sketch and all the at command before the line above shows "ok" result. Also, is there a way to test this GSM900 module is able to get http? #include <SoftwareSerial.h> SoftwareSerial softSerial(51, 52);// void setup() { Serial.begin(9600); softSerial.begin(9600); Serial.println("Initing...please wait."); softSerial.println("AT+CPIN?"); delay(500); printLine(); softSerial.println("AT+CGATT?"); delay(500); printLine(); softSerial.println("AT+CIPSHUT"); delay(500); printLine(); softSerial.println("AT+CIPSTATUS"); delay(500); printLine(); softSerial.println("AT+CIPMUX=0"); delay(500); printLine(); softSerial.println("AT+CSTT=\"ZENNET\""); delay(500); printLine(); softSerial.println("AT+CIICR"); delay(3000); printLine(); softSerial.println("AT+CIFSR"); delay(1000); printLine(); //softSerial.println("AT+CIPSPRT=0"); // delay(1000); // printLine(); softSerial.println("AT+CIPSTART=\"TCP\",\"api.thingspeak.com\",\"80\""); //AT+CIPSTART="TCP","api.thingspeak.com","80" delay(3000); printLine(); softSerial.println("AT+CIPSEND"); delay(13000); printLine(); softSerial.println("GET https://api.thingspeak.com/update?api_key=XXXXXXXXXXXXX&field1=0"); delay(20000); printLine(); softSerial.println("\#026"); delay(3000); printLine(); softSerial.println("AT+CIPSHUT"); delay(500); printLine(); } void loop() { } void printLine() { String data; while (softSerial.available() > 0) { char c = softSerial.read(); data += c; } Serial.println(data); }
MathWorks Support Team in MATLAB Answers
최근 활동: 2018년 1월 2일

What ports need to be opened in a firewall in order to communicate with the ThingSpeak server? kA00Z000000oUUDSA2 000093410

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.