Results for
#include <WiFi.h>
#include <Wire.h>
#include <WireSlave.h>
#include "ThingSpeak.h"
const char* ssid = ; // your network SSID (name)
const char* password = ; // your network password
WiFiClient client;
unsigned long myChannelNumber = ; // Channel ID:
const char* myWriteAPIKey = ; // API kluc
#define SDA_PIN 13
#define SCL_PIN 14
#define I2C_SLAVE_ADDR 0x04
int hodnota;
int MenoVahy;
// Timer variables
unsigned long lastTime = 0;
unsigned long timerDelay = 30000;
void receiveEvent(int howMany);
void setup() {
Serial.begin(115200); //Initialize serial
WiFi.mode(WIFI_STA);
ThingSpeak.begin(client); // Initialize ThingSpeak
bool success = WireSlave.begin(SDA_PIN, SCL_PIN, I2C_SLAVE_ADDR);
if (!success) {
Serial.println("I2C slave init failed");
while (1)
delay(30000);
}
WireSlave.onReceive(receiveEvent);
}
void loop()
{
if ((millis() - lastTime) > timerDelay) {
if (WiFi.status() != WL_CONNECTED) {
Serial.print("Pripájam sa k sieti...");
while (WiFi.status() != WL_CONNECTED) {
WiFi.begin(ssid, password);
delay(5000);
}
Serial.println("\nPripojené.");
}
sendDataToThingSpeak();
lastTime = millis();
}
// the slave response time is directly related to how often
// this update() method is called, so avoid using long delays
// inside loop(), and be careful with time-consuming tasks
WireSlave.update();
if (MenoVahy == 2) {
Serial.println(hodnota); // print the integer
}
// let I2C and other ESP32 peripherals interrupts work
delay(1);
}
void receiveEvent(int howMany)
{
while (1 < WireSlave.available()) // loop through all but the last byte
{
MenoVahy = WireSlave.read(); // receive byte as a character
}
hodnota = WireSlave.read(); // receive byte as an integer
}
void sendDataToThingSpeak() {
// Nastavte polia s hodnotami
ThingSpeak.setField(1, 10);
ThingSpeak.setField(2, 20);
ThingSpeak.setField(3, 30);
ThingSpeak.setField(4, 40);
ThingSpeak.setField(5, 50);
ThingSpeak.setField(6, 60);
ThingSpeak.setField(7, 70);
ThingSpeak.setField(8, 80);
int x = ThingSpeak.writeFields(myChannelNumber, myWriteAPIKey);
if (x == 200) {
Serial.println("Úspešne aktualizovaný kanál.");
}
else {
Serial.println("Problém s aktualizáciou kanála. HTTP chybový kód: " + String(x));
}
}
I have carefully followed the instructions to load data into my channel without success.
1 how do I check if I have a wifi connection?
2 the following lines are my thingspeak commands
char thingSpeakAddress[] = "api.thingspeak.com";
unsigned long myChannelNumber = 2202392;
const char * myWriteAPIKey = "xxxxxxxxxxxxxxxx";
String myStatus = "";
ThingSpeak.begin( client );
ThingSpeak.setField(1, volts2);
ThingSpeak.setField(2, adc2);
I can seed the data on arduino serial monitor. I am using an ESO8266 connected to a win 10 PC
Any help will be much appreciated as I have spent a lot of time trying to solve the problem
Using mqtt3.thingspeak.com, initially everything works well. but it appears the connection is disconnected after a period of inactivity. Is this expected? Is there a workaround? is some kind of keepalive expected?
Traceback (most recent call last):
File "microdot_asyncio.py", line 368, in dispatch_request
File "microdot_asyncio.py", line 432, in _invoke_handler
File "main.py", line 39, in toggle_led
File "umqtt/simple.py", line 134, in publish
OSError: [Errno 128] ENOTCONN
I have developed an MATLAB application for using as standalone or web based application which also includes trained datasets in it's code. Now i download the package having code, readme file and trained datasets. It takes online data and user input after installing its standalone function but it never shows output which it has to take from trained datasets. Kindly help what is the procedure to upload trained datasets in MATLAB standalone application.
Hello all....
I have used MATLAB code to convert .bmp file to hex format. This converted hex file shows zero for all values.
Why such result?What is the posibility?
Please guide...
Wie füge ich einen Zeilenumbruch mit ThingSpeak.setStatus(Text mit Zeilenumbruch)ein?
0D 0A funktioniert nicht.
Hi,
I am using ThingSpeak with Raspberry Pi Pico W, by using python langage.
I am sending some pressure data from the raspberry with this method :
request = urequests.post('http://api.thingspeak.com/update?api_key=' + THINGSPEAK_WRITE_API_KEY, json=dht_readings, headers=HTTP_HEADERS)
And it works pretty good, i have fields with the new data every 15sec.
But now i am trying send a CLEAR request by using the following method :
url = 'http://api.thingspeak.com/channels/{}/fields/{}.json?api_key={}&days={}'.format(CHANNEL_ID, FIELD_NUMBER , THINGSPEAK_WRITE_API_KEY, NUM_DAYS )
clear_request = urequests.delete(url)
Nothing to be done.
I also tried to clean or delete directly all info in the channel and not only the fields' data by this method :
delete_url = 'https://api.thingspeak.com/channels/{}/feeds?api_key={}'.format(CHANNEL_ID,THINGSPEAK_WRITE_API_KEY)
clear_request = urequests.delete(delete_url)
Still not working.
I tired several ways, clearing the channel, deleting the channel, sending some empty update... none of them works.
Clear Channel is working only from the website when clicking on the button, i would like to do it with a request.
So to make a little summary of what i am looking for : I want to automatically send a clear request from my microcontroller to thingspeak channel 1 each X times.
Is there any way to make it possible ?
Thank you for your answer.
Sincerly Arthur
Hi all,
I am so far on a free account.
I have setup 1 channel. I am sending 3 values from a bitShake SmartMeterReader every 20 seconds to this channel.
When trying to send additional data from my solar inverter every 5min! and calculate some data coming from my bitShake (e.g. once per hour) and send it back to the channel I receive the following error:
Requests are too frequent. For further information, see Limitations in the documentation.
Now I understand that my messages (write orperations) to my channel are limited to 3 Mio / year or 8200/day. With my current setup I am at little more than 4K messages per day and since I just recently started my account I have still 2.840.531 messages left.
How come I get that error even if I switch even if my message limit is far from reached?
Thanks in advance for your time! Much appreciated!
btw. The link "Limitations" where it is supposed to be explained is not working (for me)
Hello!
Im trying to split my Data into 6 different values but the system wont work
I thought this should work, but im not sure how my data is being sent as,
its being sent as a a table, but thats about it. Anyone have any idea what ive done wrong?

I've noticed a few times that a bulk update can take a while to appear. Normally a few minutes at most but at the moment it seems to be much longer, hours maybe. I know the message I sent had been received as I get an RC = 202 as normal. I sent a non bulk update via the browser and it appeared imediately.
Is this something I have to get used to ? It's a problem when I first set up a device and look at Thingspeak to check it's sending messages correctly (I send a bulk update with 1 message when it first connets). Even a single data point sent in batch form is not appearing.
Update: the data has started appearing but it's still hours behind.
I can't get my dynamic position data to display.My JASON body looks like this:
{ "api_key": "XXXXXXXXXXXXXXX", "created_at": "2023-05-15T23:17:54.000Z", "field1": 50.71875, "field2": 20.375, "field3": 4.1132812, "field4": 91.625, "field5": 1523985, "lat": -25.8152875, "long": 152.58867187500002, "status": "Bauple" }
Fields 1-4 display fine, as does the Status field. However the position map always shows a balloon at (0,0). I've tried "lat" and "latitude", "long" and "longitude", but no luck. Any ideas?
This is weird to me.
I have an IP address., I am connected to the MQTT server.
I see the number of entries increasing in my channel. However, no data visible in the graph.
This is the AT command to the SIM7080 module : AT+SMPUB="channels/**********/publish",37,1,1
And then I send the payload : field1=1&field2=2&field3=3&field4=400
As said, each time a send a request I see the number of entries increasing, but no real data.
The export shows me this :
created_at,entry_id,field1,field2,field3,field4
2023-05-15 17:33:40 UTC,1,,,,
2023-05-15 17:34:59 UTC,2,,,,
2023-05-15 17:36:16 UTC,3,,,,
2023-05-15 17:37:31 UTC,4,,,,
2023-05-15 17:38:48 UTC,5,,,,
Any idea why the content of the field is empty?
Thanks
I have a channel where I upload measurements from a BME280 sensor, but on the Pi Pico I calculate the min/avg/max temperature every 10 minutes.
I never have created a visualisation from scratch before. Usually, I can continue from a working example, but I know nothing (yet) about the mathlab language...
Can someone show me how to create a diagram of my temperatures, were the average temp is a (thick) solid line, and the min/max temperatures are a filled out area above and below?
Is it possible to change the color (Background and the Meter itself) of the Gauge Widget ?

The Widget Edit Menu will only offers Colors for the range Indicators, but not for the Gauge itself.
The background in black would be ideal.
I have created a mqtt device in thingspeak, allocated a channel for pub and sub. I noted down the credentials for connection when the device was created. I tried to connect using the host mqtt3.thingspeak.com port 1883 and the supplied credentials(user name and password). I tried with node red (mqtt node) and also mqtt lense but still cannot connect. Would appreciate advice some advise. Thanks
Up until yesterday (May 6, 2023), time controls were working fine in regards to running my Analysis code recurring at specified intervals. Now they will no run more than once? I’ve tried creating new time controls but no luck. I have to manually run the code to get updated results.
How can I display a string value using thingspeak visualization ? for example name, gender, bloodgroup,etc.
Hello - I have a new account and when I click My Channels, I don't get a drop down menu with choices like My Channels, My Image Channels, ect. I only get Public Channels when I click the Channels tab. I can't select My Channels. Could someone please help me?
Thank you
We need to do IoT work for our university project. I want to open a channel without any profit motive so that I can see the statistics. New Channel option does not appear.
