Martinov in Discussions
最後のアクティビティ: 2025 年 11 月 21 日 22:27

Hello, I have Arduino DIY Geiger Counter, that uploads data to my channel here in ThingSpeak (3171809), using ESP8266 WiFi board. It sends CPM values (counts per minute), Dose, VCC and Max CPM for 24h. They are assignet to Field from 1 to 4 respectively. How can I duplicate Field 1, so I could create different time chart for the same measured unit? Or should I duplicate Field 1 chart, and how? I tried to find the answer here in the blog, but I couldn't. I have to say that I'm not an engineer or coder, just can simply load some Arduino sketches and few more things, so I'll be very thankfull if someone could explain like for non-IT users. Regards, Emo How to duplicate field chart? Can you cliarify what you mean my "Duplicate Field 1"? Do you mean the settings on the field plot, like number of points and axis scale and so forth? If I understand your question correctly, I think the easiest way to do what you want is to use a custom visualization. Then you can copy the code for another custom visualization, but change the field you read data from. psuedo code: %Read data from channel field x myData=thingSpeakRead(...); %plot data plot(myData.timestamps,myData.xvals...); %adjust settings ylabel("dose"); You can use the MATLAB AI chat playground to help you generate the code for the custom visualization. I can also give you more description here if that is what you are interested in. You might also just be asking how to add a field plot. That you can do in the "add visualizations" button on the channel view page. Thanks for putting up the radiation levels. I built scintillation based dosimeters in a previous engagement, so I think it would be cool to have rad monitors on ThingSpeak from all over the world, kind of like all the weather stations. Yeah, you said it better - just wanted to add a field plot that uses the same field 1 data (red rectangle on the picture above). Currently, the plot set to use that field is showing readings for an one hour back. I want to make another plot, that uses the same field 1, but this time will set it to show reading for a week, or month etc. I hope I managed to explain it understandable. If not, sorry, I'm a physician, not a coder (if that's an excuse at all hahah). Yeah, lets make a custom visualization. Instructions are here. in general, click the green button that says MATLAB visualizations and click "create a 2d line plot". Then fill in the data and muck with the thingspeakread line to get the data you want [data, time] = thingSpeakRead(readChannelID, 'Field', fieldID1, 'NumPoints', 30, 'ReadKey', readAPIKey); In that line, you can change numpoints to numdays or numminutes to get the data range you want. You can then perform infinite customization on the plot. You can look in the documentation or use the AI chat playground i liked above to use natural language to describe what you want. Like "Give me a thicker line plot with red axis labels and a title of 'radiation plot' ". They the AI will show you the code you can copy into your visualization to get the plot you want (blue marker points, black background, inset close up etc.). When you are done, save and run, then it should show on your channel view. You can add multiple visualizations. They wont have the live update features of the thingspeak plots but you get way more options. If you definitely need the thingspeak plot, you can write code to copy the data to multiple fields in another channel and configure each field view how you like it. Lemme know if you need help with that. Many thanks for your answer! I'll try to figure out what's needed and how to work with the info you provided. AI is a good suggestion, since the coding needed here isn't sounds like rocket science. Yeah, it's still beyond my knowledge, but it looks very doable with some ai help. Will definitely give you a feedback. field chart duplicate
University of the Incarnate Word in MATLAB Answers
最後のアクティビティ: 2023 年 2 月 7 日

I have two seperate temperature sensors connected to arduino and I would like for them to read data on the same field in Thingspeak. For example, have one graph showing two lines on it in different colors, each representing one of the temperature sensor data. Is this possible? If so, how can it be done? Thank you
Lorenzo Scavarda in Discussions
最後のアクティビティ: 2022 年 6 月 8 日

Good morning, I'm working with an Arduino MKR 1010 which takes information about weather from the website "api.openweathermap.org". On a ThingSpeak dashboard I displayed the main numbers (float) information like: temperature, wind speed, humidity, etc. Moreover, from the openweathermap I can also get string sentence (e.g. "light rain" or "broken clouds" etc.). I'm wondering if there is a way to display on the ThingSpeak dashboard string fields. Indeed, in the ThingSpeak Channel Settings I added an extra Field in order to store these string words but I don't know how to print them in the dashboard. Someone can help me? Thanks in advance, Lorenzo Display message on ThingSpeak Are you trying to display the text on your ThingSpeak channel? If so, you can use a MATLAB visualization, and use the text or annotate functions to put the text on a figure. Then add the visualization to your channel. When I've done this, i occasionally have to experiment with scaling the figure and text, but with a little work, you can definitely get what you want. Maybe you can use the Status field of the channel to display the text? Thanks Christopher for the answer. Yes, I though it but I have a doubt: what is the right function to retrieve the string (that I want to display) and put it in the annotate function? Because my problem is that the String is one of the Fields of my Channel. For example I found: data = thingSpeakRead(readChannelID,'Fields',field_number,NumPoints=3) but I don't how to handle a string variable. Is it enough use: data = thingSpeakRead(readChannelID,'Fields',field_number) Do you have some hints? Thanks a lot in advance, Cheers, Lorenzo Hi Vinod, yes, I'm using the Status Field indeed. However, it is not the best way because the layout and format of the text is very fixed, for example I can't use the "new line" but the text is in just one line. If I want to display a sort of weather report for the next hours of the day (i.e. not just one word but several sentences) is not very suitable. Either option you show above will work fine. dashboard string arduino api field
Hamidi Ismail in Discussions
最後のアクティビティ: 2021 年 6 月 14 日

Currently i am able to send the 2 decimal data to thingspeak field. But i stuck on how to write 3 decimal places data to that field. Hope u guys can help.Here is my coding. #include <PubSubClient.h> // library used to publish the data through mqtt broker #include <WiFiEsp.h> // library for ESP8266 wifi #include <EEPROM.h> // library that GravityTds use #include <GravityTDS.h> // library that GravityTds use #include <OneWire.h> // Include the libraries for temperature #include <DallasTemperature.h> // Include the libraries for temperature #include <SoftwareSerial.h> // library for software serial to display output on the serial monitor #define TdsSensorPin A1 // set TdsSensorPin at pin A1 #define temperaturePin 2 // temperature sensor is connected into pin 2 on the Arduino OneWire oneWire(temperaturePin); // Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs) DallasTemperature tempsensor(&oneWire); // Pass our oneWire reference to Dallas Temperature. GravityTDS gravityTds; // define the gravityTds SoftwareSerial Esp8266(5, 6); // Rx, Tx set communication pin for esp8266 to uno WiFiEspClient Esp8266wifi; // set the esp8266 for the mqtt broker connnection PubSubClient client(Esp8266wifi); // set the esp8266 for the mqtt broker connnection unsigned long previousMillis1 = 0; // used to delay without delay the system for sensor data unsigned long previousMillis2 = 0; // used to delay without delay the system for the send data to thingspeak float temperature; // variable to store temperature value int tdsValue; // variable to store tds value float EC; // variable to store EC value char ssid[] = ""; // your network SSID (name) char pass[] = ""; // your network password int status = WL_IDLE_STATUS; // the Wifi radio's status String clientName="ESP-Thingspeak"; //char* topic="channels/<channelID/publish/<channelAPI> char* topic = "channels/1244171/publish/FOZYSFXXS4P6DE5N"; // topic to be published to the thingspeak with channel id and api code char* mqtt_server = "mqtt.thingspeak.com"; // set the server for the mqtt of thingspeak void setup() { Serial.begin(9600); // 9600 is the baud rate for the data to display to the serial monitor Esp8266.begin(9600); //9600 is the baud rate for the srial data connection of esp8266 WiFi.init(&Esp8266); client.setServer(mqtt_server, 1883); // set mqtt broker server and port tempsensor.begin(); // begin temperature sensor library gravityTds.setPin(TdsSensorPin); // set pin tds at declared variable TdsSensorPin gravityTds.setAref(5.0); //reference voltage on ADC, default 5.0V on Arduino UNO gravityTds.setAdcRange(1024); //1024 for 10bit ADC;4096 for 12bit ADC // arduino uno adc level is a 10-bit ADC gravityTds.begin(); //initialization InitWiFi(); //call function to intialize wifi Serial.print("Connecting to "); // display on serial monitor Serial.print(mqtt_server); Serial.print(" as "); Serial.println(clientName); if (client.connect((char*) clientName.c_str())) // connect to the thingspeak with the client name { Serial.println("Connected to MQTT broker"); if (client.publish(topic, "Test send data")) // Test send data to the thingspeak { Serial.println("Testing send data succes"); } else { Serial.println("Testing send data failed"); } } else { Serial.println("MQTT connect failed"); Serial.println("Will reset and try again..."); abort(); } } //this function is only for the initialization of the esp8266 to connect to the network & mqtt and initialize the sensor void loop(){ unsigned long currentMillis = millis(); //timer start checkconnection(); // calling function to check the connection if (currentMillis - previousMillis1 >= 2000) //delay without causing system delay { previousMillis1 = currentMillis; sensordata(); // calling fucntion of the sensor data } if (currentMillis - previousMillis2 >= 2000) //delay without causing system delay { previousMillis2 = currentMillis; senddata(); // calling fucntion to send data // send one set of data in 2 seconds } } void sensordata() { tempsensor.requestTemperatures(); // get temperatures temperature = tempsensor.getTempCByIndex(0); // set variable to the temperature sensor output gravityTds.setTemperature(temperature); // set the temperature and execute temperature compensation gravityTds.update(); //sample and calculate tdsValue = gravityTds.getTdsValue(); // then get the value of TDS EC = gravityTds.getEcValue()/1000; // get EC value Serial.println(temperature); // display sent data Serial.println(tdsValue); Serial.println(EC,3); Serial.println("Data Sent"); } void senddata() { String payload="field1="; // payload to send to thingspeak using mqtt broker payload+=temperature; // field1=temperature&field2=tdsValue&field3=EC&status=MQTTPUBLISH payload+="&field2="; //// field1=26.9&field2=120&field3=0.2&status=MQTTPUBLISH payload+=tdsValue; payload+="&field3="; //// field1=26.9&field2=120&field3=0.2&status=MQTTPUBLISH payload+=EC,3; payload+="&status=MQTTPUBLISH"; if (client.connected()) // if client connected { Serial.println("Sending data "); if (client.publish(topic, (char*) payload.c_str())) // send data to the thingspeak, topic (the channel id and channel api) -- payload is the data from sensor that will be sent to the thingspeak { Serial.println(temperature); // display sent data Serial.println(tdsValue); Serial.println(EC,3); Serial.println("Data Sent"); } else { Serial.println("Publish failed"); } } } void checkconnection() /// check connection if disconnected try to reconnect wifi and mqtt broker { if ( status != WL_CONNECTED) Serial.println("Wifi Disconnected"); { while ( status != WL_CONNECTED) { InitWiFi(); // call function to start wifi // reconnect wifi } } if (!client.connected()) // if mqtt broker disconnected from thingspeak { Serial.println("MQTT Disconnected"); while (!client.connected()) // while mqtt broker disconnected from thingspeak { if (client.connect((char*) clientName.c_str())) // reconnect to the server { Serial.println("MQTT connected"); } else { Serial.println("MQTT connect failed"); Serial.println("Will reset and try again..."); } } } } void InitWiFi() { // check for the presence of the module if (WiFi.status() == WL_NO_SHIELD) { Serial.println("WiFi module not present"); // don't continue // don't continue while (true); //keep looping until it detect esp8266 module } // attempt to connect to WiFi network while ( status != WL_CONNECTED) { Serial.print("Attempting to connect to WPA SSID: "); Serial.println(ssid); // Connect to WPA/WPA2 network status = WiFi.begin(ssid, pass); } // print your WiFi ESP8266 IP address IPAddress ip = WiFi.localIP(); Serial.print("IP Address: "); Serial.println(ip); // print the SSID of the network you're attached to Serial.print("SSID: "); Serial.println(WiFi.SSID()); // print the received signal strength long rssi = WiFi.RSSI(); Serial.print("Signal strength (RSSI): "); Serial.println(rssi); delay (5000); } How to write 3 decimal places data in Thingspeak field Here is an example feed from your channel: "created_at": "2021-06-11T23:09:43-04:00", "entry_id": 96, "field1": "30.56", "field2": "313", "field3": "0.586" There are three decimal places in the last measurement. If that is not sufficient, can you explain in more detail about the measurement that you are concerned about? Share only the parts of the code that relate to that measurement. Then describe what you have tried and what you have observed, and what the desired result is. Then I think we will be able to help you get the result you need. field 3decimal thingspeak
Dayne Gilleland in MATLAB Answers
最後のアクティビティ: 2020 年 2 月 3 日

Is it possible to set up Matlab to compare thing speak field values. Field 4 = 1 and Field 5 = 1 and Field 1 > 4 then delay 30 secounds Alert message " xxxxxxxxx"
Owen Medeiros in MATLAB Answers
最後のアクティビティ: 2019 年 11 月 5 日

Hello, I am trying to write instrument data to a ThingSpeak channel using python. I have installed the urllib package and I am using using the urlopen command to write data. I am able to write data for multiple fields (I have shown t1 as an example but I also have t2, t3), however the rate is inconsistent. More explicitly, the time in between data points varies. I have tried different length delays between events, still inconsistent. Is this because of Thingspeak, or my python script? c1 = 'https://api.thingspeak.com/update?api_key=__________&field4=' t1 = urllib.urlopen(c1+str(temp4)) t1.close() sleep(30)

ThingSpeak について

The community for students, researchers, and engineers looking to use MATLAB, Simulink, and ThingSpeak for Internet of Things applications. You can find the latest ThingSpeak news, tutorials to jump-start your next IoT project, and a forum to engage in a discussion on your latest cloud-based project. You can see answers to problems other users have solved and share how you solved a problem.

上位コントリビューター

モデレーター