Quantcast
Channel: ThingSpeak IoT Community - All Forums
Viewing all 1833 articles
Browse latest View live

tamairon on Get total entries collected.

$
0
0

Hello,

I'm sending samples about power and current from my energy monitor (based on ESP8266) to thingspeak. I would like to write a Matlab script in order to get all power entries to calculate the total energy comsuption.

How can I get all data collected from thingspeak to calculate energy? How can I know how much entries has got thingspeak about field variable (what's the last item) ?

Thanks.

Best regards.


cstapels on Get total entries collected.

$
0
0

You can definitely make a MATLAB analysis to calculate the energy.  Consider using the thingSpeakRead() function to get the data from your channels.

https://www.mathworks.com/help/thingspeak/thingspeakread.html

You can tailor thingSpeakRead() read just the last entry, or several entries (up to 8000).

You can also use the react app to trigger the analysis to run whenever new data is entered.

https://www.mathworks.com/help/thingspeak/react-app.html

I would also suggest looking at the 'Analyze Your Data' part of the 'Getting Started'  page in the help.

https://www.mathworks.com/help/thingspeak/getting-started-with-thingspeak.html 

 

Feel free to share your energy calculation methods on the ThingSpeak community site.  A lot of people are interested in using the ESP8266 with MATLAB.

piajola on String format to update channel

$
0
0

Hi Pedro,

Is it a Texas Launchpad (newer?)

My picohelp would be search:

 - e2e.ti.com/support (a forum with subforums)
 - forum.43oh.com (search forums for ENERGIA the red IDE imitating arduino)

 - https://training.ti.com/simplelink-cc1350-sub-1-ghz-and-ble-launchpad-development-kit-software-example

 - https://github.com/mik4el/testing-cc1350 (found by accident)

and of course old uncle Google he knows a lot of blogs search for TI "SimpleLink" approach

But all my experience is Launchpads with Energia with the mspxxx microcontroller ages ago

Good luck Smile

piajola on Upload two values to ThingSpeak with a Arduino GSM Module?

$
0
0

Hi ICar,

Glad to know your status ... Cool

Welcome to the exclusive club of Iot(ers) I hope for a long membership

And help someone you know you can help

Smile

piajola on Get total entries collected.

$
0
0

Hi tamairon,

In addition to the above

Prefered method use Matlab in https://thingspeak.com/apps (sign up or login)
Use MATLAB Analysis (maybe other apps) worth the try

I also try sometimes the quick/dirty/cheating next "method"

In a browser type: (or copy/paste)

- http://api.thingspeak.com/channels/0000/feeds.csv?results=xxx

- http://api.thingspeak.com/channels/0000/feeds.csv?start=2017-01-01 00:00:00&end=2017-01-03 23:59:59&offset=-05.00

replace 0000 with your public channel number, xxx with how many results backwards (1 the last, 5 the 5 latest, and so on). In the case with dates bear in mind the maximum of 8000 records, so for 10000 records 2 downloads one with 8000 the another with older start and end dates for the other 2000

In both cases thingspeak ask you to save a .CSV file that can be worked with a spreadsheet in your PC (or other personal computer)

created_at,entry_id,field1,field2
2017-01-01 00:00:16 -0500,17160,1.96,1.926
2017-01-01 00:00:50 -0500,17161,1.52,1.94
2017-01-01 00:01:21 -0500,17162,1.62,1.954
2017-01-01 00:02:16 -0500,17163,0.26,1.958
2017-01-01 00:03:37 -0500,17164,0.08,1.96
2017-01-01 00:04:35 -0500,17165,0.12,1.962
2017-01-01 00:05:57 -0500,17166,0.08,1.964
2017-01-01 00:06:52 -0500,17167,0.13,1.966
2017-01-01 00:07:48 -0500,17168,0.13,1.968
                                         ^          ^         ^   ^
-----------------------------offset--rec#--2 values recorded

your download look like this (or whatever you sent)

then in your spreadsheet you + - * / at your pleasure Laugh

Hans on NEW FEATURE: Bulk-Update a Channel Feed

$
0
0

We just released a new feature that allows you to bulk-update a channel feed with one request.

You can use the bulk-update API in certain scenarios when you want to conserve your device power. When using the bulk-update API, you can collect data over a period of time and then upload the data to ThingSpeak. Bulk-update API takes JSON or CSV encoded data and updates the channel.

Documentation: https://www.mathworks.com/help/thingspeak/bulk-update-a-channel-feed-1.html

Examples:

Let us know what you make with this capability.

Thanks,
Hans

AlanWooler on Public plugin

$
0
0

Is there any way to get plugins to work externally? Surly everybody seems to want it, so why can't it me adapted to make it happen? I need to view plugins on my mobile phone but can't as each time I try it logs me out and it is causing me much pain. Why can't this be an option???

embdev on Uploading data from RPi SenseHat to Thingspeak via python script

$
0
0

Dear fellow coders, i'm trying to upload temperature data from my RPi sensehat -> Thingspeak channel. I copied the scripts from the internet and tried to integrate them together. I executed the Python script on Putty terminal, the printed temperature looks ok, hovering between 29-30 degrees C but when displayed on thingspeak, it shows up as werid numbers like 4 or 6 degrees C.

Greatly appreciate your advice! Thank you!

 

#!/usr/bin/env python

 

import httplib, urllib

import time

sleep = 3

key = '0HERL1VYW2S0KOXE'

 

def thermometer():

 

from sense_hat import SenseHat

 

sense = SenseHat()

sense.clear()

 

tmax = 40

tmin = tmax - 8

 

while True:

temp = sense.get_temperature()

#-----rd off temp to 2 d.p.-----

temp = round(temp,2)

print(temp)

temp = int(temp) - tmin

for x in range(0, 8):

for y in range(0, temp):

sense.set_pixel(x, y, 255, 0, 0)

for y in range(temp, 8):

sense.set_pixel(x, y, 0, 0, 0)

 

params = urllib.urlencode({'field1': temp, 'key':key })

headers = {"Content-typZZe": "application/x-www-form-urlencoded","Accept": "text/plain"}

conn = httplib.HTTPConnection("api.thingspeak.com:80")

 

try:

conn.request("POST", "/update", params, headers)

response = conn.getresponse()

print temp

print response.status, response.reason

data = response.read()

conn.close()

except:

print "connection failed"

#break

 

#sleep for desired amount of time

if __name__ == "__main__":

while True:

thermometer()

time.sleep(sleep)

 

 


tina.mir on Update multiple fields with one write

$
0
0

Hello Everyone,

 

I am pretty new in arduino and thingSpeak. The project that I am currently working on is to collect Temperature and Humidity using Arduino Uno and DH11 and transfer both values into a channel at ThingSpeak using SIM900 (GPRS communication).

I was able to transfer one parameter (either Temperature or Humidity) . Could anyone help and show me how is this possible to update multiple fields with one write using the following command:

String str2="GET https://api.thingspeak.com/update?api_key=Write API KEY &field2=0" + String(humi);

I have search a lot but all examples are either for Ethernet Shield or not working properly.

 

Thanks, 

salim on 1440 Averaging Inaccuracy

$
0
0

I am new to the ThingSpeak platform and I am trying to display the 1440 average of my data I am sending from an Arduino Uno. I am sending data from 5 different detectors to be plotted into 5 different fields on my ThingSpeak channel. The live data plotted is quite accurate but when I chose to plot the average I get values significantly lower than it should be. I am suspecting it to have something to do with the bunch of Null values I have here for example maybe: https://thingspeak.com/channels/126439/field/4.json

Hans on 1440 Averaging Inaccuracy

$
0
0

You are correct. The average is using null's and lowering the expected average.

If you have two devices, you might want to update two different ThingSpeak channels.

If that is not possible, then MATLAB can help here. You can use MATLAB Analysis app to read in the field data, ignore the nulls, and then calculate the average. You can even use MATLAB to write the averaged data to a new processed channel and have it calculate the daily average each day by scheduling it with TimeControl.

tina.mir on Update multiple fields with one write

$
0
0

Never mind, I found the solution:Cool

In the function you have to define all parameters you are willing to send:

int temperature = dht.readTemperature();
int humidity = dht.readHumidity();

And then use the following command:

String str="GET https://api.thingspeak.com/update?api_key=writeAPIkey&field1=" + String(temperature)+"&field2=" +String(humidity);

(substitute "writeAPIkey" with your channel's)

cstapels on Uploading data from RPi SenseHat to Thingspeak via python script

$
0
0

I think I see part of the problem.

Following these lines in your code:

tmax = 40

tmin = tmax - 8

Then tmin = 32.

temp = int(temp) - tmin #.....or temp=30 - 32

For temps such as 29-30, you would get a temp of -2 to -3 when you post to ThingSpeak.  This doesn't explain the values of 4 or 6, except if your variable type for temp is unsigned, but it explains some of the difference (rounding could explain more).  Generally ThingSpeak is pretty literal about what it does with your data, so I wouldn't usually look there if I see a wrong format of my data, as long as you get a success response after your post.

Good luck with your project!

rw950431 on Uploading data from RPi SenseHat to Thingspeak via python script

$
0
0

I suspect the previous poster is correct- you are messing up the value of temp before you send it to thingspeak. Either save a copy of the variable or move the section where you send to thingspeak before you update the pixels.

 

If that doesnt work you could also try printing out the value of params to make sure you are sending what you think you are sending

 

print temp

print params

print response.status, response.reason

tomski on ThingSpeak Does not logs data from sensor to server

$
0
0

Hi. I have similar problem. My data does not log to server, when I switch to different Wifi access point (of course SSID and PASSWORD are changed in the code before switching).

Here is my code:

#include
#include
#include
#include

#define ONE_WIRE_BUS 2

char ssid[] = "MY_SSID";
char pass[] = "MY_PASSWORD";

WiFiClient client;

OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature DS18B20(&oneWire);

unsigned long myChannelNumber = MY_CHANNEL_NUMBER;
const char * myWriteAPIKey = "MY_API_KEY";

void setup() {
WiFi.begin(ssid, pass);
ThingSpeak.begin(client);
pinMode(LED_BUILTIN, OUTPUT);
}

void loop() {
digitalWrite(LED_BUILTIN, HIGH);
DS18B20.requestTemperatures();
float temp = DS18B20.getTempCByIndex(0);
ThingSpeak.writeField(myChannelNumber, 1, temp, myWriteAPIKey);
delay(1000);
digitalWrite(LED_BUILTIN, LOW);
delay(19000);
}


cstapels on ThingSpeak Does not logs data from sensor to server

$
0
0

Some networks may need more time to connect, I would suggest adding some delay and a loop to trying connection repeatedly.  You could add it to your main loop in case the device looses connection after start up. The antenna on an ESP8266 is pretty small...

Have a look at the methods for connecting to wifi in here.

ArbitraryUserN01 on MQTT optimization

$
0
0

The publish url for MQTT is unnecessarily long for a protocol designed to be efficient.

"channels/123456/publish/fields/field1/APIKEY"

Could be shortened to, for example:

"c/123456/1/APIKEY"

This saves 27 characters.

jaysha4 on ThingSpeak Does not logs data from sensor to server

$
0
0

I also built my first Thingspeak project for monitoring temperature using DHT11, but I always send values through URL using POST function like below

sprintf(postUrl, "update?api_key=%s&field1=%s&field2=%s",api_key,humidStr,tempStr);
httpGet("api.thingspeak.com", postUrl, 80);

I followed this Arduino temperature monitoring article, and it worked for me as it is.
I will try to use ThingSpeak.writeField function next time, till then you can also try to send values to server using POST URL, read the referred article for detailed instruction.

melanogaster on Unable to clear a channel via Arduino

$
0
0

Hello,

i am desperatly trying to clear a Channel with an Arduino Uno.

Can someone help me to Change the Code i am using for updateing the channel into a Code for Clearing the channel?

 

if (client.connect(server,80)) { // "184.106.153.149" or api.thingspeak.com
   String postStr = apiKeyChannel;
   postStr +="&field1=";
   postStr += str_sensor;
   client.println("POST /update HTTP/1.1");
   client.println("Host: api.thingspeak.com");
   client.println("Connection: close");
   client.println("X-THINGSPEAKAPIKEY: "+apiKeyChannel);
   client.println("Content-Type: application/x-www-form-urlencoded");
   client.print("Content-Length: ");
   client.println(postStr.length());
   client.println();
   client.print(postStr);
   }

I found this Code on the Internet and works fine for updating my channel.

 

I have read the Documentation to clear a channel (which can be found here: https://de.mathworks.com/help/thingspeak/clear-a-channel.html)  and thougt all i have to do is enter my User API Key, Change the adress, enter channel ID, etc...

But nothing worked.

Also I am new to this IOT Thing.

Please, can somebody help me?

Hans on Unable to clear a channel via Arduino

$
0
0

Sounds like you are going in the right direction. Have you tried changing the HTTP method? 

client.print("POST... 

Change to

client.print("DELETE... 

Viewing all 1833 articles
Browse latest View live