Results for
Hello! I have been working on an app for viewing thingspeak numerical data as graphs and I'm planning to publish it on playstore soon. If anybody is interested to test the beta version I would appreciate it. Here is the link https://play.google.com/apps/testing/com.mlundell.theThingV
ThankYou !
Magnus
I have both of my account profile and channel export time zones set to "(GMT+8000)Beijing". The datetime from the exported feeds.csv looks like:
'2021-09-06 11:16:28 CST'
I want to import data, but MATLAB do not directly understand its datetime format. I assume "CST" to be "China Standard Time", but when I try to convert it to datetime, MATLAB throws an error:
>> datetime(s,'InputFormat',"yyyy-MM-dd HH:mm:ss z","TimeZone","Asia/Shanghai","Locale","zh_CN") Error using datetime (line 651) Unable to convert '2021-09-06 11:16:28 JST' to datetime using the format 'yyyy-MM-dd HH:mm:ss z' and locale 'zh_CN'.
However if I change the "Locale" to US instead:
>>datetime(s,'InputFormat',"yyyy-MM-dd HH:mm:ss z","TimeZone","Asia/Shanghai","Locale","en_US")
ans =
datetime
07-Sep-2021 01:16:28
There is no error, but the time is wrong and is 14 hours ahead. So I guess that MATLAB sees this "CST" as "Central Standard Time".
My point is:
- It's pretty strange that the datetime exported by ThingSpeak could not be directly understood by MATLAB. MATLAB is supposed to work with ThingSpeak data seamlessly, but now I have to find a detour to import ThingSpeak data to MATLAB.
- It seems that the datetime function needs improvement to understand this "CST" timezone, or that ThingSpeak could improve its datetime output format.
What amazing images can be created with no more than 280 characters of MATLAB code? Check out the GALLERY of 700+ entries from the MATLAB Mini Hack contest.
VOTE on your favorite images and help fight the global pandemic! For every vote an entry gets, MathWorks will donate $1 to Direct Relief *.
How can I vote?
1) You need to log in with your MathWorks Account. If you do not have a MathWorks Account, you can create one at MathWorks sign in .
2) You can vote for an entry by clicking on the heart icon on an entry card or the vote button on the entry detail page.
*Maximum amount of $20 donated per entry; maximum of $20,000 donated based on the combined totals raised from the Treasure Hunt contest and the MATLAB Mini Hack contest.
I'm not a programmer but I'm loving Thingspeak!
by way of background: i have been having mysterious PM 2.5 spikes on my PurpleAir several times a day (usually from ~12 ug/m3 to 100 ug/m3!!). i recently figured out what is causing it: i live by a charcoal burger place that sends smoke throughout my neighborhood when they relight their grill at peak hours. it is what it is unfortunately, until these restaurants get properly regulated.
that being said, i like to work in my yard, and id love to be able to just put on an N95 when a charcoal smoke event is happening. so i'm trying to use thingspeak to build a little notification system for me.
the PurpleAir Thingspeak channels are private (by default I believe), so I'm using a Matlab analysis to copy the raw data from the PurpleAir Thingspeak channel over to a channel I can administer.
next i set up TimeControls to run the data update Matlab analysis at 5 minute intervals, and staggered them apart from each other (the channel seems to be updating just about every minute now).
next i set up a React that, upon data insertion of a PM 2.5 value above 35 mg/um3, triggers a ThingHTTP which sends a request to Pushover's API --> so I get text messages and Chrome notifications when there are air events.
this seems to be working great so far -- the air in LA right now is pretty good, so it just captures the transient charcoal smoke events and notifies me of them.
but my concern is --> the air in LA can often get worse for extended periods. Some days, the average will be 40 ug/m3. so when those days inevitably come, will my system just be constantly chirping at me all day about the air values?
if so, is there anything i can do about this? is there a way to tell react to notify me, but then only retest again after an hour, for instance?
thanks for your help, thingspeak community!
Hi everyone,
I need your help. As of 10-4-2021 the option of &headers=false stopped working?
It worked beautifully for about 2 years (circa early 2020) and suddenly on 10-4 the headers are being returned despite this option in the URL (no testing with Chrome isn't a credible test, it internally suppresses them regardless)
Need your help, if there's a way to suppress headers and just return the value of interest as it worked prior to Monday 10-4-2021
Thank you Boyan
How do I code my arduino sketch in order to get the HTTP response from an arduino post?
Hello,
I am working on a project which measures the water level in a well and the temperature of the water. Currently, we have a few of these units deployed in the field and they are working well, but our environmental engineer does not like the water level graphs because they are not "intuitive" enough. The water levels displayed on our graphs are simply the distance between the surface of the water and our distance sensor, so when the water in the well rises, the y-axis value drops, which bothers the environmental guy. Is there a way to flip the y-axis without driving back out to these rural locations and flashing revised code to the mcu? I have been looking around the channel and graph settings and I do not see anything. Google has taken me to some matlab forum links which suggest changing values in objects, which I do not think is any help right now.
Any help is appreciated.
Hi,
my first time to use thingspeak. I have a graph where from time to time there is a peak with 4000, ussualy the data ist arround 50. When I insert the "hampel(my_variable)" I get a message that the toolbox is requierd.
Is there a different way to get rid of these spikes?
greetings
As part of MATLAB Central’s 20 year anniversary celebration, we created the MATLAB Mini Hack . The contest starts today on Oct. 4th!
What to do?
Generate an interesting image using up to 280 characters of MATLAB code.
Who can play?
Participants across all skill levels are welcome. Create original entries of your own code, remix others’ entries and make them your own, or simply vote on ENTRIES you love!
How to win prizes?
Those at the top of the leaderboard at the end of the contest will win up to $300 Amazon gift cards, 5 customized T-shirts, or special badges. Visit the prizes section on the contest page for more information.
To add more fun, we will award RANDOM PRIZES that every participant has a chance to win.
- Each week, we will pick 5 players who participate in both the Treasure Hunt and MATLAB Mini Hack .
- Each week, we will have different surprise giveaways.
Important Notes
- The first week (Oct. 4th, 2021 ~ Oct. 10th 2021) is for creating entries only. Voting starts on Week 2.
- Make sure you follow the contests (click the ‘follow the contests’ button on the top) to get notified when prizes are awarded and of other important announcements.
We hope you are the winner!
Title pretty much explains it. I can control a TMC2209 Stepper Motor controller or a BMP280 Barometric Pressure device, but when I hook both up to one MEGA if fails. Help would be greatly appreciated. The goal is to sample the barometric pressure, run a vacuum pump to bring the pressure down inside a vessel, then bring the pressure back to the sampled value and then run stepper motors with the TMC2209.
#include "SparkFunBME280.h"
//Stepper driver pin definitions #define PIN_STEP_ENABLE 14 #define PIN_STEP1_DIRECTION 13 #define PIN_STEP1_STEP 12
BME280 mySensorA; //Uses default I2C address 0x77 BME280 mySensorB; //Uses I2C address 0x76 (jumper closed)
void setup() { //Configuer stepper driver pins as OUTPUTs pinMode(PIN_STEP1_DIRECTION, OUTPUT); pinMode(PIN_STEP1_STEP, OUTPUT); pinMode(PIN_STEP_ENABLE, OUTPUT);
//ENABLE pin has to be pulled LOW for TMC2209 digitalWrite(PIN_STEP_ENABLE, LOW);
//Serial.begin(115200);
//Wire.begin();
mySensorA.setI2CAddress(0x76); //The default for the SparkFun Environmental Combo board is 0x77 (jumper open). //If you close the jumper it is 0x76 //The I2C address must be set before .begin() otherwise the cal values will fail to load.
if(mySensorA.beginI2C() == false) Serial.println("Sensor A connect failed"); //if I remark out his line and the line //like it for SensorB ( 2 lines down ) the stepper will run but I get no pressure readings, I stopped getting pressure //readings as soon as I added the code to operate the TMC2209
mySensorB.setI2CAddress(0x76); //Connect to a second sensor if(mySensorB.beginI2C() == false) Serial.println("Sensor B connect failed");
Wire.begin(); Serial.begin(115200);
}
void loop() { //determine starting direction of Stepper digitalWrite(PIN_STEP1_DIRECTION,HIGH);
// Makes 200 pulses for making one full cycle rotation for(int x = 0; x < 2000; x++) { Serial.println(" Forword "); digitalWrite(PIN_STEP1_STEP,HIGH); delayMicroseconds(50); digitalWrite(PIN_STEP1_STEP,LOW); delayMicroseconds(50); } delay(1000); // One second delay
digitalWrite(PIN_STEP1_DIRECTION,LOW); //Changes the rotations direction // Makes 400 pulses for making two full cycle rotation for(int x = 0; x < 2000; x++) { Serial.println(" Reverse "); digitalWrite(PIN_STEP1_STEP,HIGH); delayMicroseconds(50); digitalWrite(PIN_STEP1_STEP,LOW); delayMicroseconds(50); } delay(1000);
Serial.print(" PressureA: "); Serial.println(mySensorA.readFloatPressure(), 0);
//Serial.print(" PressureB: "); //Serial.println(mySensorB.readFloatPressure(), 0);
Serial.println();
delay(500); }
When I browse thingspeak,It loading so slow and can't read data from my project
I am trying to migrate a project that used to post from an Arduino with a Tinysine Wifly shield (from Roving networks) to a php form/mysql db using this code snippet:
void reportToCloud() {
data = "";
Serial.println("Reporting to cloud...");
if (wifly.available() > 0) {
char ch = wifly.read();
Serial.write(ch);
if (ch == '\n') {
/* add a carriage return */
Serial.write('\r');
}
}
if (wifly.open(site, 80)) {
Serial.print("Connected to ");
Serial.println(site); // Set data to send
static char outstr1[15];
static char outstr2[15];
static char outstr3[15];
static char outstr4[15]; String dataString1 = dtostrf(uvindex, 8, 2, outstr1);
String dataString2 = dtostrf(mq2ratio, 8, 2, outstr2);
String dataString3 = dtostrf(CO2PPM, 8, 2, outstr3);
String dataString4 = dtostrf(temperature, 8, 2, outstr4);
data = String("uvindex=" + dataString1 + "&mq2=" + dataString2 + "&age=" + dataString3 + "&name=" + dataString4);
Serial.print(data); //name = temp && age = co2
//Reset all values
uvindex = 0;
mq2ratio = 0;
CO2PPM = 0;
temperature = 0; /* Send the request */
wifly.println("POST /arduino/data_post.php HTTP/1.0");
wifly.println("Host: www.santiapps.com"); // SERVER ADDRESS HERE TOO
wifly.println("Content-Type: application/x-www-form-urlencoded" );
wifly.print("Content-Length: ");
wifly.println(data.length());
wifly.println();
wifly.print(data);
Serial.println("Posted successfully");
} else {
Serial.println(">>Failed to connect");
} if (Serial.available() > 0) {
wifly.write(Serial.read());
} //Added Sat 14 Nov @820am
wifly.close();
}Now Im trying to make it post to thingspeak for improved analysis capabilities and what not. I get a post successful but I get no data in my thingspeak channel. I've checked the string used and its fine:
void reportToCloud() {
data = "";
Serial.println("Reporting to cloud...");
if (wifly.available() > 0) {
char ch = wifly.read();
Serial.write(ch);
if (ch == '\n') {
/* add a carriage return */
Serial.write('\r');
}
}
if (wifly.open(site, 80)) {
Serial.print("Connected to ");
Serial.println(site); // Set data to send
static char outstr3[15];
static char outstr4[15];
String dataString3 = "33.33";//dtostrf(33.33, 8, 2, outstr3);//dtostrf(CO2PPM, 8, 2, outstr3);
String dataString4 = "44.44";//dtostrf(44.44, 8, 2, outstr4);//dtostrf(temperature, 8, 2, outstr4);
data = String("field3=" + dataString3 + "&field4=" + dataString4);
//Serial.print(data); //for debugging //Reset all individual values
CO2PPM = 0;
temperature = 0; /* Send the request */
String postData = "POST /update?api_key=mykey&"+data+" HTTP/1.0";
//Serial.println(postData);
wifly.println("Host: api.thingspeak.com"); // SERVER ADDRESS HERE TOO
wifly.println("Content-Type: application/x-www-form-urlencoded" );
wifly.print("Content-Length: ");
wifly.println(postData.length());
wifly.println();
wifly.print(postData);
Serial.println("Posted successfully");
} else {
Serial.println(">>Failed to connect");
} if (Serial.available() > 0) {
wifly.write(Serial.read());
} //Added Sat 14 Nov @820am
wifly.close();
}postData is printed with this result:
printing co2... 87 105 102 108 121 45 87 101 98 false returned Free memory: 670 setPrompt hasnt been called Already joined network DeviceID: Wifly-WebClient2 Reporting to cloud... open santiapps.com 80 Connected to santiapps.com POST /update?api_key=mykey&field3=33.33&field4=44.44 HTTP/1.0 Posted successfully close: failed, no *CLOS* Reporting to cloud...
open santiapps.com 80 Connected to santiapps.com POST /update?api_key=mykey=33.33&field4=44.44 HTTP/1.0 Posted successfully close: failed, no *CLOS*
So basically the first snippet works fine and posts to the db via my php form and i can then read it off the db. The second snippet returns what seems to be a successful post but the data is not posted to thingspeak.
R2021b is live! There are two new products, five major updates, and hundreds of other feature updates in this latest release. Download or access MATLAB Online to discover what’s new.
New Products
- RF PCB Toolbox - Perform electromagnetic analysis of printed circuit boards
- Signal Integrity Toolbox - Simulate and analyze high-speed serial and parallel links
Major Updates
- Lidar Toolbox - Use Lidar Viewer app to visualize, analyze, and preprocess lidar point clouds interactively
- Simulink Code Inspector - Use Code Inspector contextual tab to check compatibility, inspect code and view results directly in the model
- Simulink Control Design - Design Model Reference Adaptive Controllers
- Symbolic Math Toolbox - Get guidance for symbolic workflows with next-step suggestions in MATLAB Live Editor
- Wavelet Toolbox - Use wavelet analysis to process and extract features for signals and images for AI workflows
Check out our release highlight page for details.
Share your experience with the community
Are there any new features you find particularly useful? Are you trying the new product to solve a particular problem? Share your story with us no matter it’s big or small. We plan to publish those stories in the highlight channel so that community users can get more out of the new release. A good example is an article written by Adam Danz . If you are interested, contact me via email on my profile card.
what happen to thingspeak? it also loading so slow. it happen for almost a week, until now it has not been like normal
I am using a Microsoft surface laptop (running on Microsoft RT) and using a Explorer browser (which unfortunately cannot be upgraded to Microsoft Edge, or replaced by Chrome or Firefox). Until end of August 2021 I could log into ThingSpeak, with the login (email) entry fields in page https/:thingspeak.com (after clicking "Get started for free"). However since end of August this email entry item does not appear anymore on the webpage of thingspeak.com on my Surface. So I can't login anymore and thus can't use Thingspeak anymore on my Surface RT laptop. This is rather frustrating. Is there a possibility of provide arguments to the URL so that I can login directly (e.g. https://thingspeak.com/login?email?password, or something similar) or do you know another way to login. Your help is greatly appreciated.
My goal is to get the data from two DHT22 sensors, with a single sensor I had no problem but with two sensors I get only a few data and then it interrupts reporting "Read DHT22 failed." I share my code, any suggestions I appreciate
#include <SimpleDHT.h>
#include <ESP8266WiFi.h> String apiKey = "xxxxx";
const char* ssid = "xxxxx";
const char* password = "xxxxx";
const char* server = "api.thingspeak.com";
int pinDHT22 = D0;
int pinDHT221 = D1; SimpleDHT22 dht22(pinDHT22);
SimpleDHT22 dht221(pinDHT221); WiFiClient client;
void setup() {
Serial.begin(115200);
delay(10);
WiFi.begin(ssid, password);
Serial.println();
Serial.println();
Serial.print("Connecting to ");
Serial.println(ssid);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("");
Serial.println("WiFi connected");
}
void loop() {
byte temperatura = 0;
byte humedad = 0;
byte temperatura1 = 0;
byte humedad1 = 0; if (dht22.read(pinDHT22, &temperatura, &humedad, NULL)) {
Serial.print("Read DHT22 failed.");
return;
} if (dht221.read(pinDHT221, &temperatura1, &humedad1, NULL)) {
Serial.print("Read DHT221 failed.");
return;
} if (client.connect(server,80)) {
String postStr = apiKey;
postStr +="&field1=";
postStr += String((int)temperatura);
postStr +="&field2=";
postStr += String((int)humedad);
postStr +="&field3=";
postStr += String((int)temperatura1);
postStr +="&field4=";
postStr += String((int)humedad1); postStr += "\r\n\r\n";
client.print("POST /update HTTP/1.1\n");
client.print("Host: api.thingspeak.com\n");
client.print("Connection: close\n");
client.print("X-THINGSPEAKAPIKEY: "+apiKey+"\n");
client.print("Content-Type: application/x-www-form-urlencoded\n");
client.print("Content-Length: ");
client.print(postStr.length());
client.print("\n\n");
client.print(postStr);
Serial.println("% send to Thingspeak");
}
client.stop();
Serial.println("Waiting…");
delay(120000);
}Hi,
I have this code posting data. It used to work a couple of years back but now it shows no new data being posted and I want to see what the error is:
#include <Bridge.h> #include <BridgeServer.h> #include <BridgeClient.h> #include <DHT.h>
#define DHTPIN 4 #define DHTTYPE DHT22 DHT dht(DHTPIN, DHTTYPE);
//********************
#define ARRAY_SIZE 2 String API = "13xxxxxxxxxxxxx";
unsigned long previousMillis = 0; // will store last time LED was updated const long interval = 900000; // interval at which to blink (milliseconds)
void setup() {
Bridge.begin();
Console.begin();
dht.begin();
Serial.begin(9600);
Serial.println("set up");
}
//********************
void postToThingSpeak(String key, float value[]) {
Process p;
String cmd = "curl -d \'key="+key;
for (int i=0;i<ARRAY_SIZE;i++) {
cmd = cmd + "&field"+ (i+1) + "=" + value[i];
}
cmd = cmd + "\' http://api.thingspeak.com/update";
p.runShellCommand(cmd);
Console.println(cmd);
p.close();
Serial.println("posted");
}
void loop() {
unsigned long currentMillis = millis();
if (currentMillis - previousMillis >= interval) {
// save the last time you blinked the LED
previousMillis = currentMillis; float temperature = dht.readTemperature();
//float temperature = 33.33;
Console.println(temperature);
float humidity = dht.readHumidity();
//float humidity = 44.44;
Console.println(humidity);
float vol[ARRAY_SIZE];
vol[1] = temperature;
vol[0] = humidity;
postToThingSpeak(API, vol); //ACCOUNT
}
//delay(120000); // ThingSpeak will only accept updates every 15 seconds.
}Hi, I've been using ThingSpeak now for a number of years capturing temperature data from a Pi zero and Python. I currently use the Unsecured TCP option, but the recent email about moving to mqtt3 server suggests websockets. I've looked at the example and understand username, password and channel ID, but not what the Client ID is. Can someone tell me what this is please.
Many thanks Alastair
Afternoon Everyone, Looking for some help with my Arduino/Thingspeak sketch.
To give you an idea I have a Lora Sensor sending data to a Lora/Uno receiver, the data I receive is two strings, one for DO and one for Temp, in the parsepacket section below I convert the string to floats and use these as my fields for Thingspeak.
Currently the code allows a connection to Thingspeak, it also correctly associates the DO and Temp float variables with corresponding graphs on the channel.
However after the initial WiFi connection all that happens is zero is written to both graphs and only once, another write will not happen untill I reboot the Arduino.
I'm pretty certain that the order of my Loop is wrong.
My expected results are to write Temp and DO to Thingspeak every 30 seconds, with actual values, not 0. Currently a write happens once and Temp and DO are Zero, despite the packets being received correctly with actual values.
If I can clarify anything or better explain then please feel free to ask, I'm fairly new to this.
TIA. AC
if true
#include <ESP8266WiFi.h>
#include <ThingSpeak.h>
#include <LoRa.h>
#include <SoftwareSerial.h>
#define nss D10
#define rst D14
#define dio0 D2
//
WiFiClient client;
//
const char* ssid = "myssid";
const char* password = "mypassword";
//
char thingSpeakAddress[] = "api.thingspeak.com";
unsigned long channelID = mychannelid;
char* readAPIKey = "myapi";
char* writeAPIKey = "myapi";
unsigned long lastTime = 0;
unsigned long timerDelay = 30000;
unsigned int dataFieldOne = 1;
unsigned int dataFieldTwo = 2;
//
float DO;
float temp;
//
void setup() {
WiFi.mode(WIFI_STA);
ThingSpeak.begin(client);
LoRa.setPins(nss, rst, dio0);
Serial.begin(115200);
while (!Serial);
if (!LoRa.begin(868E6)) {//914E6
Serial.println("Starting LoRa failed!");
while (1);
}
}
//
void loop() {
int packetSize = LoRa.parsePacket();
if (WiFi.status() != WL_CONNECTED) {
Serial.print("Attempting to connect");
while (WiFi.status() != WL_CONNECTED) {
WiFi.begin(ssid, password);
delay(5000);
if (packetSize)
{
Serial.print("packetSize = ");
Serial.println(packetSize);
parseLoRaPacket();
}
ThingSpeak.setField(1, DO);
ThingSpeak.setField(2, temp);
int x = ThingSpeak.writeFields(channelID, writeAPIKey);
//
if (x == 200) {
Serial.println("channel update succesful.");
}
else {
Serial.println("Problem updating channel.");
}
}
}
}
//
void parseLoRaPacket() {
String lora_data; // String as local variable
//
while (LoRa.available())
{
lora_data = LoRa.readString();
Serial.print(lora_data);
//
int strIndex = lora_data.indexOf("TEMP: ");
if (strIndex > -1)
{
int startPos = strIndex + strlen("TEMP: ");
temp = lora_data.substring(startPos).toFloat();
Serial.println(temp);
}
strIndex = lora_data.indexOf("DO: ");
if (strIndex > -1)
{
int startPos = strIndex + strlen("DO: ");
DO = lora_data.substring(startPos).toFloat();
Serial.println(DO);
}
}
}
end