Results for
Hi, Its my day 1... and just thought i should confirm something for sake of clarity. I found this table on the site...
But I want to know does Number of Messages include Reads & Writes... or only Writes because the other parameter is Message update interval limit ... and usually the word update is a part of the operation where there is a WRITE being committed. And thats what confused me...
So is that interval only for updating data... or is it even if you are reading data?
Thanks
Hello,
can someone please help me to understand, how average works? I send data from temperature sensor to Thingspeak roughly every 5 min(DIFF column in seconds). If i dont use average, i can see temperature in more less 5min slots around 20 degrees. See DATUM and TEPLOTA field on first image(Vlhkost is humidity).
I supposed, if i use parameter average=60, it will calculate average temperature in time slot 60min and extract it. But if you check second image with same data, only parameter average=60 added, results are crazy. I can see rows per hour, but values are crazy, around 7 degrees. I really dont understand what system calculate. I get exactly same result on thingspeak page in channel setup, so problem is not with my page.
Thingspeak screenshots 1day without average
1day with average 60
settings i changed
Dears Good day. I am new in IoT and I need help I am looking for a code that I can run to transmit real-time data from Revolution Pi based on Raspberry Pi to Thingspeak. I have code I used before to transmit data from Revolution Pi based on Raspberry Pi to Wolkabout ( cloud platform). Nevertheless, due to license issues. I had to change to Thingspeak. Can you please help me to adjust the code so that I can use it with Thingspeak instead of Wolkabout. Here is the code .............Code start...............
import os import random import sys import time from urllib.request import urlopen import wolk import revpimodio2 from pymodbus.client.sync import ModbusSerialClient as ModbusClient from pymodbus.register_read_message import ReadInputRegistersResponse
- Sensors Keys device = wolk.Device(key="KDD", password="FDV7F12TSW")
wolk_device = wolk.WolkConnect(device, host="54.72.159.61", port=8883, ca_cert="ca_local_wolkabout.crt") # Establish a connection to the WolkAbout IoT Platform print("Connecting to WolkAbout IoT Platform") wolk_device.connect() rpi = revpimodio2.RevPiModIO(autorefresh=True)
- For Modbus RTU Connection #client = ModbusClient(method = 'rtu', port='/dev/ttyRS485', stopbits=1, bytesize=8, parity='E',baudrate=19200,timeout=1,strict=False) #connection = client.connect() #print(connection)
def main(): """Connect to WolkAbout IoT Platform and send a random sensor reading."""
publish_period_seconds = 5
# LS1 Level sensor 1 LS2 Level sensor 2 VS1 Velocity sensor 1 VS2 Velocity sensor 2 while True:
try:
#first set of the sensors
LS1 = rpi.io.InputValue_1.value*0.059056-205.825
LS2 = rpi.io.InputValue_2.value*0.059056-205.825
VS1 = rpi.io.InputValue_3.value*0.0025-10
VS2 = rpi.io.InputValue_4.value*0.0025-10 #sensors from RTU1
#Temp1= (client.read_input_registers(58, 1, unit=1))
#Temp2 = Temp1.registers
#Temp = float(Temp2[0])/100
Temp1 = rpi.io.Temperature.value/100
Temp2 = rpi.io.Temperature2.value/100
#mu1= (client.read_input_registers(66, 1, unit=1))
#mu2 = mu1.registers
#mu = float(mu2[0])/100
mu1 = rpi.io.Viscosity.value/100
mu2 = rpi.io.Viscosity2.value/100
#rho1= (client.read_input_registers(74, 1, unit=1))
#rho2 = rho1.registers
#rho = float(rho2[0])/100
rho1 = rpi.io.Density.value/100
rho2 = rpi.io.Density2.value/100
#publshing data
#wolk_device.add_sensor_readings({"LS1": LS1,"LS2": LS2,"VS1": VS1,"VS2": VS2,"Temp1": Temp1,"rho1": rho1,"mu1": mu1,"Temp2": Temp2,"rho2": rho2,"mu2": mu2}) print('Publishing "Level Sensor 1": ' + str(LS1))
print('Publishing "Level Sensor 2": ' + str(LS2))
print('Publishing "Velocity Sensor 1": ' + str(VS1))
print('Publishing "Velocity Sensor 2": ' + str(VS2))
print('Publishing "Temperature_RTU1": ' + str(Temp1))
print('Publishing "Viscosity_RTU1": ' + str(mu1))
print('Publishing "Density_RTU1": ' + str(rho1))
print('Publishing "Temperature_RTU2": ' + str(Temp2))
print('Publishing "Viscosity_RTU2": ' + str(mu2))
print('Publishing "Density_RTU2": ' + str(rho2))
#wolk_device.publish()
time.sleep(publish_period_seconds) except KeyboardInterrupt:
print("\tReceived KeyboardInterrupt. Exiting script")
wolk_device.disconnect()
sys.exit()if _name_ == "__main__": main() ...............Code End................... Hope that you can help me. I have a fee account in Thingspeak, only 1 channel with 8 fields which is enough for my current project for time being. Wish you a nice day
I have developed an acoustic sensor that can pick up water leaks at a substantial separation distance. The leaks must originate from pressurized plumbing, which causes the emission of broadband acoustics. The sensor is on a small PCB that communicates with the host controller via I2C. I have connected to an ESP8266 WiFi module and uploaded data to ThingSpeak. The entire project is open-source; you can view the documentation, design files, and firmware on github:
https://github.com/microphonon/acoustic-leak-detector
Let me know if you have any questions. Mike
Hi, I am a newcomer to ThingSpeak, and have created a channel for my soil-moisture sensor. I have checked "show status" of my channel. 'Channel Status Updates' widget appears, but no data are displayed. It is not responding. The widget is always blank despite new sensor data every hour. I would like to display default status messages. Why doesn't it work and what should I do ? I have searched all documentation but find no help there. br SpacerLabs Team
I am trying to extract the value of a couple of variables from a very basic web page. Although I can see the variable's values changing when I Inspect the page in Chrome Browser and Xcopy, I only get the variable name, not its value, when I select the option to "send your ThingHTTP request and view the response using the following URL:" Can anybody point this rookie in the right direction please?
Hi all, I currently have a forecasting of a variable based on the data that I collected. But is there a way to calculate what is the accuracy for the forecast? Thanks.
Hi everyone. I updated my IoT Debugger project on GitHub. You can use the debugger to view channel data from ThingSpeak.
Please Reply soon, its argent...
Currently i am using lora from my end node to my dragino gateway and from my gateway, i push the sensor data up to thingspeak. i want to check that when my temperature graph hits above 30 it will send down a 1 or a command to my gateway and my gateway will transmit it to my end node to take action. i research and saw that react is one of the solution for on top but i do not know which action and how to use that specific action for this scenario.
Hi all, don't upload data to Thingspeak (sorry my english) I'm build this counter geiger https://www.electronics-lab.com/project/new-improved-geiger-counter-now-wifi/ but not upload data, only appear this to my channel:
29T23:17:58Z","entry_id":112,"field1":null},{"created_at":"2022-03-29T23:22:58Z","entry_id":113,"field1":null},{"created_at":"2022-03-29T23:27:58Z","entry_id":114,"field1":null},{"created_at":"2022-03-29T23:32:58Z","entry_id":115,"field1":null},{"created_at":"2022-03-30T18:43:09Z","entry_id":116,"field1":null},{"created_at":"2022-03-30T19:00:19Z","entry_id":117,"field1":null},{"created_at":"2022-03-30T19:05:19Z","entry_id":118,"field1":null},{"created_at":"2022-03-30T19:10:19Z","entry_id":119,"field1":null}]}
The code I'm use is there https://www.electronics-lab.com/project/new-improved-geiger-counter-now-wifi/ sorry it does not allow me to upload it because it is long
Assignments, quizzes, midterms, finals, grades, joys of success, the anxiety of low grades. Sounds like a typical cycle that students go through, right? Sometimes, all that hustle and bustle makes students forget that coding could be fun! Dr. Amin Rahman teaches AMATH 301 at the University of Washington. Many engineering students take this course and learn MATLAB in the course. He was looking for ways to keep students engaged and remind them that coding is fun. To achieve this goal Dr. Rahman and I set up a small competition in MATLAB Grader. Dr. Rahman selected several problems from MATLAB Grader problem collections. Students competed in this optional competition without the pressure of grades. They submitted their solutions; their submissions were automatically graded using MATLAB Grader and they got instant feedback. Green checkmarks for the correct answers empowered students and gamified coding. With the feedback they got, they continuously improved their code.
Prizes? Aside from the joys of coding in MATLAB, students won MathWorks-branded items like t-shirts, hats, and bags and proudly wore them as you can see in Dr. Rahman’s tweet.
Interested in using MATLAB Grader? Interested in accessing MATLAB Grader problem collections? Like to brainstorm ideas to make coding more fun? Reach out to us! We are here to help. Any creative ideas to make courses more engaging? Please share your ideas with this community!
I have a google gauge that shows my PM2.5 sensor values but I would like to make 3 gauges appear side by side that show the value of different sensors. How can I do that? Thanks
Hello everyone, I am new to ThingSpeak and ESP32, I would like to send IMU sensor acceleration data from my ESP32 to ThingSpeak so that I can use this data for further analysis. I have tried the example code provided in this link: Bulk-Update and this works perfectly fine for me with the default update interval and post interval. I also attached the code here.
#include <Wire.h> #include <Arduino.h> #include <Adafruit_MCP4725.h> #include <Adafruit_Sensor.h> #include <Adafruit_BNO055.h> #include <utility/imumaths.h> #include <WiFi.h> #include "ThingSpeak.h"
// Define multiplexer address #define TCAADDR 0x70
// Define imu and dac objects Adafruit_BNO055 bno = Adafruit_BNO055(55, 0x28);
char jsonBuffer[500] = "[";
char ssid[] = "my ssid"; char pass[] = "my password"; WiFiClient client;
char server[] = "api.thingspeak.com";
unsigned long lastConnectionTime = 0; unsigned long lastUpdateTime = 0; const unsigned long postingInterval = 15L * 1000L; const unsigned long updateInterval = 3L * 100L;
// To choose the multiplexer specific channel (between 0 and 7)
void tcaselect(uint8_t i){
if (i > 7) return;
Wire.beginTransmission(TCAADDR); Wire.write(1 << i); Wire.endTransmission(); }
void setup() {
// put your setup code here, to run once:
Wire.begin();
Serial.begin(9600);
while(!Serial);
delay(1000);
Serial.println("Serial communication set up");// set up bno055
tcaselect(2);
if (!bno.begin()){
Serial.println("Failed to connect to BNO055");
while (1);
}
while(WiFi.status() != WL_CONNECTED){
Serial.print("Attempting to connect to wifi");
WiFi.begin(ssid, pass);
delay(5000);
}
Serial.println("Connected to WiFi");
printWiFiStatus();
}
void loop() {
// put your main code here, to run repeatedly.
if (millis() - lastUpdateTime >= updateInterval){
updatesJson(jsonBuffer);
}
}
void updatesJson(char* jsonBuffer){
/* JSON format for updates paramter in the API
* This examples uses the relative timestamp as it uses the "delta_t". You can
also provide the absolute timestamp using the "created_at" parameter
* instead of "delta_t".
* "[{\"delta_t\":0,\"field1\":-70},{\"delta_t\":3,\"field1\":-66}]"
*/
// Format the jsonBuffer as noted above
strcat(jsonBuffer,"{\"delta_t\":");
unsigned long deltaT = (millis() - lastUpdateTime)/1000;
size_t lengthT = String(deltaT).length();
char temp[4];
String(deltaT).toCharArray(temp,lengthT+1);
strcat(jsonBuffer,temp);
strcat(jsonBuffer,",");
tcaselect(2); sensors_event_t orientationData , angVelocityData , linearAccelData, magnetometerData, accelerometerData, gravityData;
bno.getEvent(&orientationData, Adafruit_BNO055::VECTOR_EULER); bno.getEvent(&angVelocityData, Adafruit_BNO055::VECTOR_GYROSCOPE); bno.getEvent(&linearAccelData, Adafruit_BNO055::VECTOR_LINEARACCEL);
float rssi = linearAccelData.acceleration.x;
strcat(jsonBuffer, "\"field1\":");
lengthT = String(rssi).length();
String(rssi).toCharArray(temp,lengthT+1);
strcat(jsonBuffer,temp);
strcat(jsonBuffer,"},");
// If posting interval time has reached 15s, update the ThingSpeak channel with your
data
if (millis() - lastConnectionTime >= postingInterval) {
size_t len = strlen(jsonBuffer);
jsonBuffer[len-1] = ']';
httpRequest(jsonBuffer);
}
lastUpdateTime = millis(); // Update the last update time
}
// Updates the ThingSpeakchannel with data
void httpRequest(char* jsonBuffer) {
/* JSON format for data buffer in the API
* This examples uses the relative timestamp as it uses the "delta_t". You can also
provide the absolute timestamp using the "created_at" parameter
* instead of "delta_t".
* "{\"write_api_key\":\"YOUR-CHANNEL-WRITEAPIKEY\",\"updates\":
[{\"delta_t\":0,\"field1\":-60},{\"delta_t\":15,\"field1\":200},
{\"delta_t\":15,\"field1\":-66}]
*/
// Format the data buffer as noted above
char data[500] = "{\"write_api_key\":\"59IISQVOXV5GGH0D\",\"updates\":"; // Replace
YOUR-CHANNEL-WRITEAPIKEY with your ThingSpeak channel write API key
strcat(data,jsonBuffer);
strcat(data,"}");
// Close any connection before sending a new request
client.stop();
String data_length = String(strlen(data)+1); //Compute the data buffer length
Serial.println(data);
// POST data to ThingSpeak
if (client.connect(server, 80)) {
client.println("POST /channels/1683708/bulk_update.json HTTP/1.1"); // Replace
YOUR-CHANNEL-ID with your ThingSpeak channel ID
client.println("Host: api.thingspeak.com");
client.println("User-Agent: mw.doc.bulk-update (Arduino ESP8266)");
client.println("Connection: close");
client.println("Content-Type: application/json");
client.println("Content-Length: "+data_length);
client.println();
client.println(data);
}
else {
Serial.println("Failure: Failed to connect to ThingSpeak");
}
delay(250); //Wait to receive the response
client.parseFloat();
String resp = String(client.parseInt());
Serial.println("Response code:"+resp); // Print the response code. 202 indicates that
the server has accepted the response
jsonBuffer[0] = '['; //Reinitialize the jsonBuffer for next batch of data
jsonBuffer[1] = '\0';
lastConnectionTime = millis(); //Update the last conenction time
}
void printWiFiStatus() {
// Print the SSID of the network you're attached to:
Serial.print("SSID: ");
Serial.println(WiFi.SSID());
// Print your device IP address:
IPAddress ip = WiFi.localIP();
Serial.print("IP Address: ");
Serial.println(ip);
// Print the received signal strength:
long rssi = WiFi.RSSI();
Serial.print("signal strength (RSSI):");
Serial.print(rssi);
Serial.println(" dBm");
}
However, when I tried to change the update interval to 0.3s (30Hz), the following error massage was given in the Arduino monitor: Guru Meditation Error: Core 1 panic'ed (LoadProhibited). Exception was unhandled.
Could someone please help me with this issue. If anything else is needed, I will update immediately.
Many thanks
I want to scale A and B (shown in a picture below) from a known dimension (base of tail light) from an image of an assembled car. The purpose is to get factory dimensions prior to welding my car together because I replaced both quarters, trunk pan, and trunk drop-offs. I replaced the frame rails. I made tubular ones in an effort to make them stronger. The installation of the tail panel will tie everything together. I want to make sure it's right.
Hello!
I`ve got problems with reading last input of a channel field using AT commands, here follows the sketch I'm currently using:
/* String tx_data_r = "GET https://api.thingspeak.com/channels/CHANNEL/fields/4/last.txt?api_key=API_READ_KEY&results=1"; */
String tx_data_r = "GET https://api.thingspeak.com/channels/"; tx_data_r += "CHANNEL"; tx_data_r += "/"; tx_data_r += "fields"; tx_data_r += "/4/"; tx_data_r += "last.txt?api_key="; tx_data_r += "API_READ_KEY"; tx_data_r += "&results=1"; tx_data_r += "\r\n";
Serial.print("AT+CIPSEND=");
delay(1000);
Serial.println(tx_data_r.length()); delay(1000);
Serial.println(tx_data_r); delay(1000);
This piece of code doesn`t return a valid response, however if I copy/paste https://api.thingspeak.com/channels/CHANNEL/fields/4/last.txt?api_key=API_READ_KEY&results=1" using a browser I get the right data.
One more thing, if instead of using a microcontroller I use an USB serial PC interface program directly connected to my RF module, with GET https://api.thingspeak.com/channels/CHANNEL/fields/4/last.txt?api_key=API_READ_KEY&results=1 along with other commands I get the right data too!
Can anybody tell me what's going on?
There are no problems with any read related commands.
If a working sketch is available it will be most welcome!
Tks in advance for any help!
Hello guys:
I am having a problem with something I'm doing, I don't know whether it is something related to thingspeak or to my program. I am using Curl library in c to make Get requests to send data to my channel, those data are are measurments of my Analog Discovery 2 device and they are instantaneous, (using the AD2 SDK library which was uploaded recently, and in it they use thingspeak to send the measurments too) . However, the updating to my channel is happenning very slowly (every new sample update happens each 15 seconds). What do you think is causing the problem? is the updating to the channels is usually slow and you can't do thing kind of fast uploading? or is it something that my code fails to communicate with the channel properly. I attached a photo to my program which shows the status of the Curl Get requests (which demonstrates the connectivity problem). Appreciating any help.
Hello, I see a difference in the number of elements returned by: https://api.thingspeak.com/channels/1389063/status.json?offset=0&results=2500&api_key=XXXXXXXXXXXXXX and https://api.thingspeak.com/channels/1389063/feeds.json?offset=0&results=2500&status=true&api_key=XXXXXXXX The first returns only 271 elements, the second 2500 as requested. Why is that?
I am working with an Arduino nodemcu board and a Tmp36 sensor. My channel updates fine if I use my browser with the following: https://api.thingspeak.com/update?api_key=xxxxxxxxx&field1=71, but does not update with the following sketch, although the serial monitor shows the commands are executed:
//Source code to the Temperature Sensor and ThingSPeak Server Blog String ssid = "XXX"; // SSID to connect to String password = "XXX"; // Our virtual wifi has no password (so dont do your banking stuff on this network) String host = "api.thingspeak.com"; // Open Weather Map API const int httpPort = 443; String uri = "/update?api_key=XXXX&field1=";
int setupESP8266(void) {
// Start our ESP8266 Serial Communication
Serial.begin(115200); // Serial connection over USB to computer
Serial.println("AT"); // Serial connection on Tx / Rx port to ESP8266
delay(10); // Wait a little for the ESP to respond
if (!Serial.find("OK")) return 1;
// Connect to 123D Circuits Simulator Wifi
Serial.println("AT+CWJAP=\"" + ssid + "\",\"" + password + "\"");
delay(10); // Wait a little for the ESP to respond
if (!Serial.find("OK")) return 2; // Open TCP connection to the host:
Serial.println("AT+CIPSTART=\"TCP\",\"" + host + "\"," + httpPort);
delay(50); // Wait a little for the ESP to respond
if (!Serial.find("OK")) return 3;return 0; }
void anydata(void) {
int temp = map(analogRead(A0),20,358,-40,125);
// Construct our HTTP call
String httpPacket = "GET " + uri + String(temp) + " HTTP/1.1\r\nHost: " + host + "\r\n\r\n";
int length = httpPacket.length(); // Send our message length
Serial.print("AT+CIPSEND=");
Serial.println(length);
delay(10); // Wait a little for the ESP to respond if (!Serial.find(">")) return -1; // Send our http request
Serial.print(httpPacket);
delay(1000); // Wait a little for the ESP to respond
if (!Serial.find("SEND OK\r\n")) return;}
void setup() {
setupESP8266();
}
void loop() {
anydata();
delay(10000); }