7:51 am

August 9, 2016

Hello everyone,
I want to read Noise&CO values using Arduino UNO and then send this to Thingspeak. I am coding it using the Arduino IDE 1.6.7 with the Ethernet add-in module.
I have managed to write some code that reads and displays my data, and I have written some code that reads the data and sends it to Web Server,But in case of things speak my data not going to "Things Speak" .Which I want use for analysis...please help me..
Any suggestions?
12:05 am


Top
January 29, 2014

Did you check out the Arduino examples on the thingspeak website (under Support).
I think there are some examples in https://github.com/mathworks/thingspeak-arduino
5:09 am

August 9, 2016

10:02 pm


Top
January 29, 2014

5:54 am

August 9, 2016

Hai....
Thank you ......@rw950431
code: which i'm using
....................................................................................................................................................................................................................................................................................................................................................................
#ifdef SPARK
#include "ThingSpeak/ThingSpeak.h"
#else
#include "ThingSpeak.h"
#endif
#ifdef ARDUINO_ARCH_AVR
#ifdef ARDUINO_AVR_YUN
#include "YunClient.h"
YunClient client;
#else
#ifdef USE_WIFI_SHIELD
#include <SPI.h>
#include <WiFi.h>
char ssid[] = "<YOURNETWORK>";
char pass[] = "<YOURPASSWORD>";
int status = WL_IDLE_STATUS;
WiFiClient client;
#else
#include <SPI.h>
#include <Ethernet.h>
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};
EthernetClient client;
#endif
#endif
#define VOLTAGE_MAX 5.0
#define VOLTAGE_MAXCOUNTS 1023.0
#endif
#ifdef ARDUINO_ARCH_ESP8266
#include <ESP8266WiFi.h>
char ssid[] = "<YOURNETWORK>";
char pass[] = "<YOURPASSWORD>";
int status = WL_IDLE_STATUS;
WiFiClient client;
#define VOLTAGE_MAX 1.0
#define VOLTAGE_MAXCOUNTS 1023.0
#endif
#ifdef SPARK
TCPClient client;
#define VOLTAGE_MAX 3.3
#define VOLTAGE_MAXCOUNTS 4095.0
#endif
unsigned long myChannelNumber = XXXXX;
const char * myWriteAPIKey = "XXXXXXXXXXX";
void setup() {
#if defined(ARDUINO_ARCH_AVR) || defined(ARDUINO_ARCH_ESP8266)
#ifdef ARDUINO_AVR_YUN
Bridge.begin();
#else
#if defined(USE_WIFI_SHIELD) || defined(ARDUINO_ARCH_ESP8266)
WiFi.begin(ssid, pass);
#else
Ethernet.begin(mac);
#endif
#endif
#endif
ThingSpeak.begin(client);
}
void loop()
{
float pinVoltage = analogRead(A0) * (VOLTAGE_MAX / VOLTAGE_MAXCOUNTS);
ThingSpeak.setField(1,pinVoltage);
#ifndef ARDUINO_ARCH_ESP8266
pinVoltage = analogRead(A1) * (VOLTAGE_MAX / VOLTAGE_MAXCOUNTS);
ThingSpeak.setField(2,pinVoltage);
pinVoltage = analogRead(A2) * (VOLTAGE_MAX / VOLTAGE_MAXCOUNTS);
ThingSpeak.setField(3,pinVoltage);
pinVoltage = analogRead(A3) * (VOLTAGE_MAX / VOLTAGE_MAXCOUNTS);
ThingSpeak.setField(4,pinVoltage);
pinVoltage = analogRead(A4) * (VOLTAGE_MAX / VOLTAGE_MAXCOUNTS);
ThingSpeak.setField(5,pinVoltage);
pinVoltage = analogRead(A5) * (VOLTAGE_MAX / VOLTAGE_MAXCOUNTS);
ThingSpeak.setField(6,pinVoltage);
pinVoltage = analogRead(A6) * (VOLTAGE_MAX / VOLTAGE_MAXCOUNTS);
ThingSpeak.setField(7,pinVoltage);
pinVoltage = analogRead(A7) * (VOLTAGE_MAX / VOLTAGE_MAXCOUNTS);
ThingSpeak.setField(8,pinVoltage);
#endif
ThingSpeak.writeFields(myChannelNumber, myWriteAPIKey);
delay(15000);
}
10:26 pm


Top
January 29, 2014

What happens if you only try and upload 2 or 3 voltages instead of 8? I seem to recall reading that someone else had strange troubles when attempting to upload 8 fields at once.
If its the case it must be a bug in the thingspeak arduino library since its definitely possible to upload all 8 fields.
11:29 am

August 9, 2016

1:52 pm


MathWorks
April 29, 2016

Hi,
I don't see that you are updating the channel status field. You are only updating the fields in your channel. To update the status field you have to send a HTTP POST request to ThingSpeak (I am not sure if the ThingSpeak Arduino library support updating the channel status). For more details on how to format your POST request you can see here.
Most Users Ever Online: 166
Currently Online:
29 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
rw950431: 272
Vinod: 240
piajola: 95
turgo: 70
vespapierre: 63
Adarsh_Murthy: 62
Member Stats:
Guest Posters: 1
Members: 8665
Moderators: 1
Admins: 2
Forum Stats:
Groups: 3
Forums: 14
Topics: 1600
Posts: 5760
Newest Members:
Advantagetreeexperts, laundrydaddyuk, techhhelp5, ken, tran, huldacormierModerators: cstapels: 460
Administrators: Hans: 405, lee: 457