Main Content

Results for

Hi,
I have been using ThingSpeak upload on several CO2 detectors based on ESP32 Arduino board, for six mounth.
Some are using direct API HTTPS requests to write values on ThingSpeak channels. Those are still working (through a proxy)
Others with similar programmetion but using ThingSpeak secure Communication Library for Arduino, have stopped uploading values since 19/07/2022 around 16h.
Was there any non publiched modification on the library at this time ?
Did any body notice something similar ?
I have not investigateg the error yet...
Thanks for feed back,
TC
Hi Everyone,
I'm a novice when it comes to programming and i'm trying to figure out why my weather data is not loading into my channel. I've had the code working previously before thingspeak went from MQTT to MQTT3. I'm having issues around the publish.single().
import subprocess
import paho.mqtt.publish as publish
import psutil
import string
import json
from statistics import median
from pms5003 import PMS5003
#weather_iot
import requests
import time
from datetime import datetime
from csv import writer
import math
import paho.mqtt.publish as publish
#Thingspeak channel and MQQT protocol
mqtt_client_ID = "detail removed"
mqtt_username = "detail removed"
mqtt_password = "detail removed"
channelID = "detail removed"
apiKey = "detail removed"
topic = "channels/" + channelID + "/publish/"
mqttHost = "mqtt3.thingspeak.com"
tTransport = "websockets"
useSSLWebsockets = False
tTLS = None
tPort = 80
def csv():
List=[now, Temperature1, IAQ1, Pressure1, Humidity1, PM1_0, PM2_5, PM10]
with open('Weather.csv', 'a') as f_object:
writer_object = writer(f_object)
writer_object.writerow(List)
f_object.close()
return
#PM sensor configuration
pms5003 = PMS5003(
device='/dev/ttyAMA0',
baudrate=9600,
pin_enable=22,
pin_reset=27
)
#Open C File
proc = subprocess.Popen(['./bsec_bme680'], stdout=subprocess.PIPE)
listIAQ_Accuracy = [ ]
listPressure = [ ]
listGas = [ ]
listTemperature = [ ]
listIAQ = [ ]
listHumidity = [ ]
listStatus = [ ]
for line in iter(proc.stdout.readline, ''):
lineJSON = json.loads(line.decode("utf-8")) # process line-by-line
lineDict = dict(lineJSON)
listIAQ_Accuracy.append(int(lineDict['IAQ_Accuracy']))
listPressure.append(float(lineDict['Pressure']))
listGas.append(int(lineDict['Gas']))
listTemperature.append(float(lineDict['Temperature']))
listIAQ.append(float(lineDict['IAQ']))
listHumidity.append(float(lineDict['Humidity']))
listStatus.append(int(lineDict['Status']))
if len(listIAQ_Accuracy) == 20:
#generate the median for each value
IAQ_Accuracy = median(listIAQ_Accuracy)
Pressure = median(listPressure)
Gas = median(listGas)
Temperature = median(listTemperature)
IAQ = median(listIAQ)
Humidity = median(listHumidity)
Status = median(listStatus)
#clear lists
listIAQ_Accuracy.clear()
listPressure.clear()
listGas.clear()
listTemperature.clear()
listIAQ.clear()
listHumidity.clear()
listStatus.clear()
#Temperature Offset
Temperature = Temperature + 2
IAQ1 = round(IAQ,1)
Temperature1 = round(Temperature, 1)
Humidity1 = round(Humidity, 1)
Pressure1 = round(Pressure, 1)
data = pms5003.read()
if Humidity1 < 80:
CF = 1
else:
CF = (Humidity1/100)*1.3
PM1_0 = format(data.pm_ug_per_m3(1.0))
PM2_5 = format(data.pm_ug_per_m3(2.5))
PM10 = format(data.pm_ug_per_m3(10))
PM1_0 = round(int(PM1_0) / CF,)
PM2_5 = round((int(PM2_5)/CF/25) * 100,)
PM10 = round((int(PM10)/CF/50) * 100,)
now = datetime.now()
tPayload = "field1=" + str(Temperature1)+ "&field2=" + str(IAQ1)+ "&field3=" + str(Pressure1)+ "&field4=" + str(Humidity1)+ "&field5=" + str(PM1_0)+ "&field6=" + str(PM2_5)+ "&field7=" + str(PM10)
try:
print ("[INFO] Data prepared to be uploaded")
publish.single(topic, payload=tPayload, hostname=mqttHost, transport=tTransport, port=tPort, tls=tTLS, client_id=mqtt_client_ID, auth={'username':mqtt_username,'password':mqtt_password})
print ("[INFO] Data sent for 7 fields: ", Temperature1, IAQ1, Pressure1, Humidity1, PM1_0, PM2_5, PM10)
except (KeyboardInterrupt):
break
except:
print ("[INFO] Failure in sending data")
csv()
clear
clc
%----------Deklarasi Data Aktual atau Data Mentah (x^(0))----------
%----------Berdasarkan Urutan Periode Waktunya----------
X_1 = [85983, 70017, 42320, 26565, 21439, 113409, 271185, 35930, 7182, 3775, 2407, 1350, 48058, 261484, 62897, 9998, 2982];
X_2 = [408, 454, 941, 17162, 35687, 19932, 61510, 81608, 122599, 199153, 156101, 120015, 473173, 528996, 296969, 191202, 185226];
X_3 = [124171, 190032, 219189, 152435, 130347, 191144, 133795, 53560, 31457, 26162, 15893, 20052, 19478, 48404, 9502, 3737, 2332];
X_4 = [70409, 207282, 1494766, 1433620, 1110495, 2224241, 2359721, 2913705, 2800503, 912552, 600338, 297624, 232018, 94727, 1963767, 957424, 189150];
X_5 = [204975, 190683, 122735, 60850, 46974, 33007, 65187, 79223, 53214, 48594, 26030, 29108, 38010, 54320, 32069, 24323, 27081];
X_6 = [67018, 38201, 19335, 11657, 12855, 6542, 6611, 4101, 2953, 2723, 1313, 1393, 1866, 2354, 2157, 1740, 1231];
X_7 = [190988, 182134, 120311, 60621, 44094, 31392, 53312, 71792, 50007, 44888, 24092, 27284, 36540, 52766, 30289, 23357, 26715];
X_8 = [72365, 46900, 21759, 11886, 15735, 8157, 18336, 11826, 6160, 5761, 3251, 3537, 4068, 3788, 3937, 2706, 1797];
n = length(X_1); % panjang data
%----------Plotting Data Awal Covid-19----------
figure('Name','Data Awal');
sbx = 1:n;
plot(sbx,X_1,'k-o');
%hold on
%plot(sbx, X_2, '-*', sbx, X_3, '-*', sbx, X_4, '-*', sbx, X_5, '-*', sbx, X_6, '-*', sbx, X_7, '-*', sbx, X_8, '-*')
%hold off
title('Data Awal Penjangkitan Covid-19 ');
%legend('Kasus Positif', 'Pelaku Perjalanan', 'Pelaku Kontak Erat', 'Realisasi Vaksinasi Keseluruhan', 'Perilaku Memakai Masker', 'Perilaku TIDAK Memakai Masker', 'Perilaku Menjaga Jarak dan Menghindari Kerumunan', 'Perilaku TIDAK Menjaga Jarak dan Menghindari Kerumunan');
ylabel('Jumlah (Data)');
xlabel('Periode Waktu (k)');
grid on;
grid minor;
%----------Nilai Akumulasi AGO----------
Ago_1 = cumsum(X_1);
Ago_2 = cumsum(X_2);
Ago_3 = cumsum(X_3);
Ago_4 = cumsum(X_4);
Ago_5 = cumsum(X_5);
Ago_6 = cumsum(X_6);
Ago_7 = cumsum(X_7);
Ago_8 = cumsum(X_8);
%----------Nilai Pembangkit Rata-rata dari Dua Data yang Berdekatan----------
for k = 2:n
Z(k) = 0.5*(Ago_1(k) + Ago_1(k-1)); %Z(k) generates a sequence for the immediate mean of xi(1)
end
%----------Mencari Nilai Parameter a dan b----------
% 1) The constant (-a) is known as the system's development coefficient
% 2) b(i)x(i)(k) the driving term
% 3) b(i) the driving coefficient
% 4) a=[a,b(i),b(2)] the sequence of parameters.
syms a b;
c = [a,b]';% Constitutes a matrix
Yn_1 = X_1; %Yn is a constant term vector
Yn_1(1)= [];
Z(1) = [];
Ago_2(1) = [];Ago_3(1) = [];Ago_4(1) = [];Ago_5(1) = [];Ago_6(1) = [];Ago_7(1) = [];Ago_8(1) = [];
B = [-Z;Ago_2;Ago_3;Ago_4;Ago_5;Ago_6;Ago_7;Ago_8]';
c = inv(B'*B)*(B'.*Yn_1);
c = c';
a = c(:,1);% parameter a
b2 = c(2); %parameter b
b3 = c(3);
b4 = c(4);
b5 = c(5);
b6 = c(6);
b7 = c(7);
b8 = c(8);
jml_b2Ago2 = b2*Ago_2;
jml_b3Ago3 = b3*Ago_3;
jml_b4Ago4 = b4*Ago_4;
jml_b5Ago5 = b5*Ago_5;
jml_b6Ago6 = b6*Ago_6;
jml_b7Ago7 = b7*Ago_7;
jml_b8Ago8 = b8*Ago_8;
total_biAgoi = jml_b2Ago2 + jml_b3Ago3 + jml_b4Ago4 + jml_b5Ago5 + jml_b6Ago6 + jml_b7Ago7 + jml_b8Ago8;
%----------Proses Whitening----------
F = [];
F(1) = X_1(1);
for k = 1:n
%F(k+1) = exp(-a.*k)*(X_1(1)- k.*total_biAgoi(0) + integral(total_biAgoi(k))*exp^(a.*k));% Find the GM(1,1) model formula
end
Hi,
The template code provided for the visualisation of a '2D line plot with y axis on both left & right side' does not work with my public channel 1789024 and Field 1 and Field 2 data. The axes are drawn and automatically adjust to the number of points which are chosen and the range of data values. But no points are actually plotted ( visible ). I have a free license and two channels in total. Are there license restrictions or can anyone see why the code doesn't work ?
regards,
SpacerLabs
How to implement IoT nodes based on processing power, memory size, power consumption, etc in Matlab.
please
provide such kind of implemenation in matlab code.
Hi,
response
{"created_at":"2022-07-08T01:17:08Z","entry_id":16662856,"status":null}
it's normal, solution?
thanks
We are using thingspeak for collect data from sensor and we are using that data from thingspeak to website using thingspeak API but sensor real time data is missing in API, can you please help to resolve it. is it a Sensor issue or need to update anythings in thingspeak. https://api.thingspeak.com/channels.json?api_key=xxxxxxxxxxxxxxxx In this API we need to know mow much Garbage is empty we are using hc-sr04 ultrasonic sensor for it
Simple app created using Simulink support package for Android device. App created but data is not getting logged on thingspeak channel the error msg on app log is as attached.
Hi,
I'm trying to connect my Sierra Wireless GL7600 4G modem with ThingSpeak.
To do so I send:
AT+KCNXCFG=1,"GPRS","TM" (APN)
AT+KHTTPSCFG=1,"api.thingspeak.com",443 (configure https session and connect)
When I try to send data
AT+KHTTPGET=1,"api.thingspeak.com/update?api_key=9**********J&field1=2"
I always get a NO CARRIER error.
I have installed the root certificate from thingspeak.com in the modem.
Do I need anything else?
Regards
Jan
Hi, the status of "Updated" on my channel page show the correct updated time but when we enter the single channel, the last entry did not show the latest update time, and the data did not uploaded for all my channel. Anyone facing this problem?
Hi, I'm trying to plot some real-time data recieved from an Arduino Uno R3 in matlab R2020b but I'm not sure what baudrate should I set for data transfer. In my case the higher the baudrate is better but if I cant graph it properly it would be of no value. I want to know if I set the baudrate to max (which is 2000000) and since every sample I recieve from arduino would be 10 bits long (it's a number between 0 to 1.1) will I be able to plot them in real time efficiently? is Matlab able to do that?
CPU: intel core i3 1005G1
I work with an Arduino device. I have subscribed separately two thingspeak devices that works properly. Every device has a channel and I would like to publish on both channel using an only device.
I have added the second channel to the first device(see image).
Althougt this device can publish on both channel separately, I can't publish at the same time (after a few seconds, obviously). When I try to publish both of then, no one works.
I'm trying to access the ThingSpeak channel from Unity using MQTTnet.
I tried the following, but the access failed.
options = new MqttClientOptionsBuilder()
.WithClientId(clientId)
.WithTcpServer("mqtt3.thingspeak.com", 1833)
.WithCredentials(username, password)
.WithTls()
.Build();
try
{
await mqttClient.ConnectAsync(options);
}
How do I access the channel to send and receive values?
Die
Die
Last activity on 27 Jun 2022

Hi there,
i prefere to develop my stuff in my windows-enviromet with VS-code. bur how to import the thingspeak-lib or module into vs-code so thate the code is running?
Hi everyone,
is it possible to see when a channel has been switched from a private to public view, a sort of timeline of activities?

The code is based on recording and sending data of heartbeat and temperature to the thingspeak channels but nothing displays

Hey, so I have a simple air quality measurement IoT system but the values are not arriving in my ThingSpeak channel. I use basic tutorials for it and tried some kind of variation but the code is so simple, I don't see any problem code-wise. Maybe someone here can help me?
I am working with a Raspberry Pi 3 and the following code for a SDS011 sensor:
import time
from datetime import datetime
import paho.mqtt.publish as publish
import paho.mqtt.client as mqtt
import psutil
from sds011 import *
import aqi
sensor = SDS011("/dev/ttyUSB0", use_query_mode=True)
def get_data(n=3):
sensor.sleep(sleep=False)
pmt_2_5 = 0
pmt_10 = 0
time.sleep(10)
for i in range (n):
x = sensor.query()
pmt_2_5 = pmt_2_5 + x[0]
pmt_10 = pmt_10 + x[1]
time.sleep(2)
pmt_2_5 = round(pmt_2_5/n, 1)
pmt_10 = round(pmt_10/n, 1)
sensor.sleep(sleep=True)
time.sleep(2)
return pmt_2_5, pmt_10
def conv_aqi(pmt_2_5, pmt_10):
aqi_2_5 = aqi.to_iaqi(aqi.POLLUTANT_PM25, str(pmt_2_5))
aqi_10 = aqi.to_iaqi(aqi.POLLUTANT_PM10, str(pmt_10))
return aqi_2_5, aqi_10
def save_log():
with open("/YOUR PATH/air_quality.csv", "a") as log:
dt = datetime.now()
log.write("{},{},{},{},{}\n".format(dt, pmt_2_5, aqi_2_5, pmt_10, aqi_10))
log.close()
channelID = "YOUR CHANNEL ID"
apiKey = "YOUR WRITE KEY"
clientID = "YOUR CLIENT ID"
tUsername = "YOUR USERNAME"
tPassword = "YOUR PASSWORD"
topic = "channels/" + channelID + "/publish/" + apiKey
mqttHost = "mqtt3.thingspeak.com"
tTransport = "tcp"
tPort = 1883
tTLS = None
tProtocol = mqtt.MQTTv311
while True:
pmt_2_5, pmt_10 = get_data()
aqi_2_5, aqi_10 = conv_aqi(pmt_2_5, pmt_10)
print ("AQI2.5 =", aqi_2_5," AQI10 =", aqi_10)
tPayload = "field1=" + str(pmt_2_5)+ "&field2=" + str(aqi_2_5)+ "&field3=" + str(pmt_10)+ "&field4=" + str(aqi_10)
try:
publish.single(topic, payload=tPayload, hostname=mqttHost, port=tPort, client_id=clientID, auth={'username':tUsername, 'password':tPassword}, tls=tTLS, transport=tTransport, protocol=tProtocol)
print ("[INFO] Published data")
save_log()
time.sleep(60)
except Exception as e:
print ("[INFO] Failure in sending data")
print (e)
time.sleep(60)
We operate roughly 600 data loggers on Think Speak where there are roughly 150 gateways and each gateway communicates with a node. Our channels are labeled node# - gateway number and each number is 16 diigits. We have not found a wildcard search function so must have each number exactly right or we cannot find our channel. In some cases we wish to query a gateway and see which nodes are successfully communicating with it.