Results for
I get the following error message when using a DELETE command.
I am using the correct api_key and channel ID Error Response: { "status": "401", "error": { "error_code": "error_auth_required", "message": "Authorization Required", "details": "Please provide proper authentication details." } }
I just cannot find out what I'm doing wrong. I've used Postman and Curl apps.
Can anyone help?

how can I do to get those informations?
Ich erinnere mich, dass die Visualisierungsfenster verschoben werden konnten. Das geht nicht mehr? Wer kennt den Trick?
I can't or it's not working anymore to change the position of the widgets on the channel panel.
I tested on Chrome and Firefox.
Expected:

I noticed a couple new replies show up on the recent poll a day or so ago, but since then, the page can't be loaded anymore in any browser I've tried.

Is MathWorks going to spend 5 years starting in 2024 making Python the #1 supported language?
I'm not sure it's authentic information, and am looking forward to a high level of integration with python.
Reference:
I wanted to say that I am thoroughly enjoying my ThingSpeak channels and I often discuss with friends and associates the technical and documentative aspects of the MathWorks/MatLab/ThingSpeak platform and all the possible benefits for engineers, researchers, scientists and students across the globe.
My pubic channel demonstrates to them how useful it is to see simple data in a visually intereresting way. I hope my efforts will bring ThingSpeak more subscribers in the new year.
If there are any questions, let me know. (I owe Christopher a story here about my Alaska system. Soon......)
https://thingspeak.com/channels/2016936 Alaska Boiler System
Opie
edited update, only one channel used publically now in 2025. I still owe CS a story...
Hello Everyone,
I want to model an electric vehicle in simscape electrical, I have few quiries regarding it.
- I have modelled an 3-Phase inverter, and used ee_getPowerLossSumary to get switching losses, and the results are okay as i was expecting, but now is there any other function to calculate conduction losses?
- I want to connect a BLDC motor, I have few parameters from manufacturers datasheet, but not all the parameters, so what would the best way according to your understanding, to model motor losses (Copper + Core).
I'm trying to calculate major fundamental losses of an EV. Looking for your inputs on this.
Thank you!
I am sending data to Thingspeak chanels from an ESP8266. I am saving data on the ESP memory which is collected at 5 minute intervals . I have created a trigger function which sends the data on demand in batches from the memory, which means there could be varying number of Data points from say 10 to 50.However I have notice recently whilst my code tells me the data points have been transmitted not all get recorded in thingspeak, are there restrictions which cause this problem and if so what is the solution please?
Hi, while I can download data from the thingspeak page as csv older than 5 months, I can't read history data older than one month.
The data exists on the database.
This are my requests:
https://api.thingspeak.com/channels/667773/fields/1.json?start=2023-11-23T01:01:10.000Z
The same results. Every day the older value date is higher by one day.
Today the older value day is: 2023-11-25T02:13:46Z
Why? Is there a limit to history data loading?
Explore all the capabilities for Modeling Dynamic Systems while keeping them handy with this Cheat Sheet - Download Now.

I have encountered a problem. I want to study the direction of PHEVP2 configuration energy control strategy, but the whole vehicle model has stumped me. I don't know how to proceed, and every time I run, an error message will be reported. I don't understand where the problem lies?
Hello, I have followed the tutorial from https://www.halvorsen.blog/documents/technology/iot/arduino/resources/Arduino%20UNO%20R4%20WiFi%20and%20ThingSpeak.pdf to use an arduino Uno R4 wifi board to write sensor data to thingspeak, and the field 1 of random data is updating properly, but when I try to send data from analog pin A0 it will not update to field 2. I've been speaking with ChatGPT to try to resolve this issue, and it has offered several solutions that have simplified the code dramatically but the same problem persists. I wonder if this could be an error with the channel settings in my thingspeak channel? I cannot find any errors myself. ChatGPT suggested looking for the http responses to trouble shoot and both fields return -210, which it says means the API key is missing, but I have stored this key in the seperate arduino_secrets.h tab in the code, so both fields must be using the same API key, and since field 1 is working properly I don't think this is the issue. This is why I suspect there might be a deeper issue with my channel. I set it up about a year ago with a different experimental project, so maybe it has been corrupted over time. Any help is much appreciated! My current loop code reads as follows:
void loop() {
// Update field 1
float temperature = random(2000, 3000) / 100.0;
Serial.println(temperature);
ThingSpeak.setField(1, temperature);
ThingSpeak.writeFields(SECRET_CH_ID, SECRET_WRITE_APIKEY);
int response = ThingSpeak.writeFields(SECRET_CH_ID, SECRET_WRITE_APIKEY);
Serial.print("ThingSpeak write response code: ");
Serial.println(response);
delay(1000); // Add a delay to separate updates
// Update field 2
float button = analogRead(A0);
int buttonInt = static_cast<int>(button);
Serial.println(buttonInt);
ThingSpeak.setField(2, buttonInt);
ThingSpeak.writeFields(SECRET_CH_ID, SECRET_WRITE_APIKEY);
int response2 = ThingSpeak.writeFields(SECRET_CH_ID, SECRET_WRITE_APIKEY);
Serial.print("ThingSpeak write response code: ");
Serial.println(response2);
delay(19000); // Adjust the delay to maintain the total delay period
}
I have two public channels and this happens in both: when I change the chart type from Line to Column (or any other type), the chart type does not change, the datapoints keep being displayed as a line.
I have cleared both channels but this did not fix the issue. Also, my devices keep uploading the values to Thingspeak normally, it just seems Chart Options isnt working.
Dear all,
in the Matlab Analysis I use twice the fuinction thingSpeakRead to read data from a channel, from two different fields.
The problem is that so far, only one of the values is read properly and the other one delivers NaN.
What could be the reason?
Thank you!
Here's my code:
% TODO - Replace the [] with channel ID to read data from:
readChannelID = [xxx];
% TODO - Enter the Read API Key between the '' below:
readAPIKey = 'xxxxxxxx';
% TODO - Replace the [] with channel ID to write data to:
writeChannelID = [xxx];
% TODO - Enter the Write API Key between the '' below:
writeAPIKey = 'xxxxxx';
%% Read Data %%
%data = thingSpeakRead(readChannelID, 'ReadKey', readAPIKey);
temperature = thingSpeakRead(xxx,Fields=[1])
humidity = thingSpeakRead(xxx,Fields=[8])
Hello I want to upload a single value from a raspberry and I can't find a way. Can somebody help me?
Lot of Thanks¡¡
TimeControl Ran, but it didn't appiied it to channel (chart has not been updated in the right time and in the end, it did not ran, had to manually run the script by myself). And I would like to request to MathWorks to fix (modify) my chart to right time and value and investigate this problem.


I want to control the level my water tank with a esp8266 and Thingspeak.
I can see the level in Thingspeak. This is working.
Now I want to send 2 emails :
- One daily email with the actual level
- Alarm email when level is below a setpoint.
How can I incorporate the value from a channel in the email ?
What I have now for the daily email , but with errors :
alert_body = 'huidig peil regenput';
channelID = ..........;
% Provide the ThingSpeak alerts API key. All alerts API keys start with TAK.
alertApiKey = 'TAK...............';
% Set the address for the HTTTP call
alertUrl="https://api.thingspeak.com/alerts/send";
% webwrite uses weboptions to add required headers. Alerts needs a ThingSpeak-Alerts-API-Key header.
options = weboptions("HeaderFields", ["ThingSpeak-Alerts-API-Key", alertApiKey ]);
% Set the email subject.
alertSubject = sprintf("Niveau regenput " );
% Read the recent data.
peil = thingSpeakRead(channelID,'Fields',1);
% Check to make sure the data was read correctly from the channel.
% Set the outgoing message
webwrite(alertUrl , "body", alertBody, "subject", alertSubject,'Fields',peil);
% Catch errors so the MATLAB code does not disable a TimeControl if it fails
try
webwrite(alertUrl , "body", alert_body, "subject", alertSubject, options);
catch someException
fprintf("Failed to send alert: %s\n", someException.message);
end
The errors I receive :
Unrecognized function or variable 'alert_Body'.
Error in Read Channel to Trigger Email 1 (line 24)
webwrite(alertUrl , "body", alert_Body, "subject", alertSubject,"Fields",peil);
Manny thanks in advance
Hallo,
ich Neuling hier, und habe das Beispiel WriteMultipleFields benutzt um die Funktionsweise zu verstehen.
So weit so gut, hat auch alles grklappt. Jetzt nach 2 Tagen bekomme ich immer eine Fehlermeldung.
Problem updating channel. HTTP error code -401 abwechselnd mit
Channel update successful.
Es ist immernoch die gleiche Software, Board ist WiFi LoRa 32 V3.
Buongiorno, non mi è possibile connetermi al canale di thingspeak che ho creato, per passare i dati tramite MQTT. Il codice segue la libreria PubSubClient su arduino ide, l'errore restituito dal serial monitor dell'ide é: -4 : MQTT_CONNECTION_TIMEOUT - the server didn't respond within the keepalive time.
Allego il codice per eventuali verifiche:
Grazie per a disponibilità
#include "PubSubClient.h"
#include <ESP8266WiFi.h>
#include "secrets.h"
bool DEBUG = false; // true=serial message of debug enabled
char* server = "mqtt.thingspeak.com";
WiFiClient wifiClient;
PubSubClient client(server, 1883, wifiClient);
String payload;
// BME280 Setting
#include <Wire.h>
#include <Adafruit_BME280.h>
//#define SEALEVELPRESSURE_HPA (1013.25)
Adafruit_BME280 bme; // I2C
bool BMEStatus;
ADC_MODE(ADC_VCC); // Set ADC for read Vcc
// Update time in seconds. Min with Thingspeak is ~20 seconds
const int UPDATE_INTERVAL_SECONDS = 3600; //il clock interno ha un errore del 5% questo valore va tarato sperimentalmente
//const int UPDATE_INTERVAL_SECONDS = 60; // caricamento ogni minuto solo per test
void setup()
{
// Connect BME280 GND TO pin14 OR board's GND
pinMode(14, OUTPUT);
digitalWrite(14, LOW);
Serial.begin(115200);
delay(10);
// BME280 Initialise I2C communication as MASTER
Wire.begin(13, 12); //Wire.begin([SDA], [SCL])
BMEStatus = bme.begin();
if (!BMEStatus)
{
if (DEBUG) { Serial.println("Could not find BME280!"); }
//while (1);
}
// Weather monitoring See chapter 3.5 Recommended modes of operation
bme.setSampling(Adafruit_BME280::MODE_FORCED,
Adafruit_BME280::SAMPLING_X1, // temperature
Adafruit_BME280::SAMPLING_X1, // pressure
Adafruit_BME280::SAMPLING_X1, // humidity
Adafruit_BME280::FILTER_OFF );
// read values from the sensor
float temperature, humidity, pressure;
if (BMEStatus)
{
temperature = bme.readTemperature();
humidity = bme.readHumidity();
pressure = bme.readPressure() / 100.0F;
}
else
{
if (DEBUG) Serial.println("Could not find BME280!");
temperature=0;
humidity=0;
pressure=0;
}
float voltage = ESP.getVcc();
voltage = voltage/1024.0; //volt
if (DEBUG)
{
Serial.println("T= " + String(temperature) + "°C H= " + String(humidity) + "% P=" + String(pressure) + "hPa V=" + voltage + "V");
}
// Construct MQTT payload
payload="field1=";
payload+=temperature;
payload+="&field2=";
payload+=humidity;
payload+="&field3=";
payload+=pressure;
payload+="&field4=";
payload+=voltage;
payload+="&status=MQTTPUBLISH";
//Connect to Wifi
if (DEBUG)
{
Serial.println();
Serial.print("\nConnecting to WiFi SSID ");
Serial.print(SECRET_SSID);
}
WiFi.begin(SECRET_SSID, SECRET_PASS);
int timeOut=10; // Time out to connect is 10 seconds
while ((WiFi.status() != WL_CONNECTED) && timeOut>0)
{
delay(1000);
if (DEBUG) { Serial.print("."); }
timeOut--;
}
if (timeOut==0) //No WiFi!
{
if (DEBUG) Serial.println("\nTimeOut Connection, go to sleep!\n\n");
ESP.deepSleep(1E6 * UPDATE_INTERVAL_SECONDS);
}
if (DEBUG) // Yes WiFi
{
Serial.print("\nWiFi connected with IP address: ");
Serial.println(WiFi.localIP());
}
// Reconnect if MQTT client is not connected.
if (!client.connected())
{
reconnect();
}
mqttpublish();
delay(200); // Waiting for transmission to complete!!! (ci vuole)
WiFi.disconnect( true );
delay( 1 );
if (DEBUG) { Serial.println("Go to sleep!\n\n"); }
// Sleep ESP and disable wifi at wakeup
ESP.deepSleep( 1E6 * UPDATE_INTERVAL_SECONDS, WAKE_RF_DISABLED );
}
void loop()
{
//there's nothing to do
}
void mqttpublish()
{
// read values from the sensor
float temperature, humidity, pressure;
if (DEBUG)
{
Serial.print("Sending payload: ");
Serial.println(payload);
}
// Create a topic string and publish data to ThingSpeak channel feed.
String topicString ="channels/" + String( channelID ) + "/publish/"+String(writeAPIKey);
unsigned int length=topicString.length();
char topicBuffer[length];
topicString.toCharArray(topicBuffer,length+1);
if (client.publish(topicBuffer, (char*) payload.c_str()))
{
if (DEBUG) Serial.println("Publish ok");
}
else
{
if (DEBUG) Serial.println("Publish failed");
}
}
void reconnect()
{
String clientName="MY-ESP";
// Loop until we're reconnected
while (!client.connected())
{
if (DEBUG) Serial.println("Attempting MQTT connection...");
// Try to connect to the MQTT broker
if (client.connect((char*) clientName.c_str()))
{
if (DEBUG) Serial.println("Connected");
}
else
{
if (DEBUG)
{
Serial.print("failed, try again");
// Print to know why the connection failed.
// See http://pubsubclient.knolleary.net/api.html#state for the failure code explanation.
Serial.print(client.state());
Serial.println(" try again in 2 seconds");
}
delay(2000);
}
}
}