Quantcast
Channel: ThingSpeak IoT Community - Forum: Arduino
Viewing all 172 articles
Browse latest View live

Tonibco6 on Wrong Value ThingSpeak

$
0
0

Still '0' values as result. Well, I got some peaks as I added a random values to each field, but unfortunately then, it keeps coming down to '0'.

This is what my LoRa provider (Sodaq) has messaged me;

You are sending your data correctly to the LoRa gateway (as operated by KPN).

They are forwarding your data on to the specified link you provide. It appears that they use POST and encode the data as JSON. However, this is not in the format that ThingSpeak requires.

You will either have to request that KPN translates the data and forwards in on directly to ThingSpeak, in the correct format. Or setup a some system for doing that yourself. i.e. KPN forwards it in their format to your service, you then translate it and then forward it on to ThingSpeak.

 Does not ThingSpeak allow JASON format, then?

Thanks


cstapels on Wrong Value ThingSpeak

$
0
0

Data for updating a field or a feed is not generally formatted as a JSON object when you use the REST API.

You can use JSON format is certain situations, and ThingSpeak will optionally return some output in JSON.  One exception is for a bulk post, which you can provide as a JSON object as shown here.  For your application, I wouldn't necessarily suggest the use of a bulk post.

What do you do to get 'some peaks'?  If you are still using the code above, I would suggest looking at the output of the function (LoRaBee.send(1, (uint8_t*)packet.c_str(), packet.length()) and see how it packages your data.  Then see if that format matches the requirements listed in Update a channel feed .  Since you are getting data to post, but the values aren't going where you want, it must be a format issue.  

mac on Limits with the length of "uri" when using Ciao

$
0
0

What limits apply to the length of "uri" when using Ciao to send a URL to ThingSpeak (free account)?

CiaoData data = Ciao.write(CONNECTOR, SERVER_ADDR, uri); // to send the URL to ThingSpeak?

I am using a Arduino Uno with ESP8266 WiFi built in (not a WiFi Shield) to send Temperature/Humidity data from DHTxx sensors.

My code works with 2 sensors (4 data fields) but fails with 3 sensors.

#define CONNECTOR "rest"
#define SERVER_ADDR "api.thingspeak.com"

#define APIKEY_THINGSPEAK   "my key"

 

String uri = "/update?api_key=";
uri += APIKEY_THINGSPEAK;
uri += "&field1=";
uri += String(h1);
uri += "&field2=";
uri += String(t1);
uri += "&field3=";
uri += String(h2);
uri += "&field4=";
uri += String(t2);

CiaoData data = Ciao.write(CONNECTOR, SERVER_ADDR, uri);

Would it better to use

ThingSpeak.writeField(myChannelNumber,1,t1, myWriteAPIKey);

ThingSpeak.writeField(myChannelNumber,2,t2, myWriteAPIKey);

etc

Tonibco6 on Wrong Value ThingSpeak

$
0
0

The peaks made sense because they were coming from the GET request I made several times...however, I was not aware about it at that moment.

So, I have been consulting with my LoRa provider and we believe that KPN is posting a JSON or XML to the destination URL.
ThingSpeak is expecting a GET request.

We believe the only way to solve this is to have a server in the middle what will handle to incoming data from KPN, decode the HEX data and create a GET for ThingSpeak with the correct payload.

wjpavalko on Arduino Zero with WiFi101 Shield Only Sends Two Updates

$
0
0

I have an Arduino Zero with WiFi 101 Shield.  Connected to WiFi and successfully sent data to my channel.  Problem is it only sends two updates, then stops updating. If I reset the Zero, it will send another two (with delay set in sketch).  WiFi light is on and network light glows periodically, so I know the Zero is trying to send the updates, but they don't show up in the channel.

Any ideas?

cstapels on Arduino Zero with WiFi101 Shield Only Sends Two Updates

$
0
0

Can you connect the serial monitor and see what responses are being returned by ThingSpeak when you send the data?

wjpavalko on Arduino Zero with WiFi101 Shield Only Sends Two Updates

$
0
0

I'm an admitted amateur at this, but can you advise how to print out communications between the Arduino and Thingspeak?  The example WriteVoltage code has no Serial connection. I assume I need to do more than just initialize a serial connection, e.g. add Serial.begin(9600). 

wjpavalko on Arduino Zero with WiFi101 Shield Only Sends Two Updates

$
0
0

Any help from anyone else out there?  I tried an MKR1000 board and the same problem occurs.  I get two (not one, not three) updates each time the Arduino is rebooted, and then nothing.  Can't find out how to show communications with either of these boards.


cstapels on Arduino Zero with WiFi101 Shield Only Sends Two Updates

$
0
0

Your ISP connection may be bad.  Try adding a connectWiFi() function and calling it each main loop if there is no connection: 

<put this in loop>

if(WiFi.status() != WL_CONNECTED)
{ connectWifi(); } // Make sure we have an internet connection

 

<put this after the end of your program>

int connectWifi()
{
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(2500);
Serial.println("Connecting to WiFi"); // Inform the serial output
}
Serial.println("Connected");
ThingSpeak.begin(client);
}

 

You will need Serial.begin(9600) in your setup().

For the thingspeak commands, you can at least test for success:

int success=ThingSpeak.writeField(myChannelNumber, 1, voltage, myWriteAPIKey);

Serial.println("success "+String(success));

You can see the serial monitor by pressing ctrl shift m or hitting the plus/curcle icon on the right top of the IDE window.

 

Do you see the number of entries in your channel growing - even if you see no data in your plot?

wjpavalko on Arduino Zero with WiFi101 Shield Only Sends Two Updates

$
0
0

Thanks.  I out in the code to reconnect the wifi, but it is not executed, so WiFi is connected.

Still, after two updates, I get:

Error code is: -301:ERR_CONNECT_FAILED

AugustoEst on Arduino Zero with WiFi101 Shield Only Sends Two Updates

$
0
0

I solved this issue by disconnecting from the WiFi after updating my ThingSpeak channel:

 

void loop()
{
   WiFi.begin(ssid, pass);
   delay(10000); // Waits 10 seconds to confirm connection
   
   // Updates x fields in ThingSpeak

   // Disconnects from the WiFi
   WiFi.disconnect();
 
   // ThingSpeak will only accept updates every 15 seconds
   delay(20000);
}

beekeeper on Arduino Zero with WiFi101 Shield Only Sends Two Updates

$
0
0

Hi there,

I have the same toppic but using a MKR 1000 with a TMP36.

For trying I took the example "write voltage" by Thingspeak-library in its newest version 1.3.

My Arduino-IDE-version is 1.8.4

Here is the sketch, a little bit modified after the last entry by AugustoEst:

/*
WriteVoltage

Reads an analog voltage from pin 0, and writes it to a channel on ThingSpeak every 20 seconds.

ThingSpeak ( https://www.thingspeak.com ) is an analytic IoT platform service that allows you to aggregate, visualize and
analyze live data streams in the cloud.

Copyright 2017, The MathWorks, Inc.

Documentation for the ThingSpeak Communication Library for Arduino is in the extras/documentation folder where the library was installed.
See the accompaning licence file for licensing information.
*/

#include "ThingSpeak.h"

// ***********************************************************************************************************
// This example selects the correct library to use based on the board selected under the Tools menu in the IDE.
// Yun, Ethernet shield, WiFi101 shield, esp8266, and MXR1000 are all supported.
// With Yun, the default is that you're using the Ethernet connection.
// If you're using a wi-fi 101 or ethernet shield (http://www.arduino.cc/en/Main/ArduinoWiFiShield), uncomment the corresponding line below
// ***********************************************************************************************************

#define USE_WIFI101_SHIELD
//#define USE_ETHERNET_SHIELD

#if defined(ARDUINO_AVR_YUN)
#include "YunClient.h"
YunClient client;
#else
#if defined(USE_WIFI101_SHIELD) || defined(ARDUINO_SAMD_MKR1000) || defined(ARDUINO_ARCH_ESP8266)
// Use WiFi
#ifdef ARDUINO_ARCH_ESP8266
#include <ESP8266WiFi.h>
#else
#include <SPI.h>
#include <WiFi101.h>
#endif
char ssid[] = "***"; // your network SSID (name)
char pass[] = "***"; // your network password
int status = WL_IDLE_STATUS;
WiFiClient client;
#elif defined(USE_ETHERNET_SHIELD)
// Use wired ethernet shield
#include <SPI.h>
#include <Ethernet.h>
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};
EthernetClient client;
#endif
#endif

#ifdef ARDUINO_ARCH_AVR
// On Arduino: 0 - 1023 maps to 0 - 5 volts
#define VOLTAGE_MAX 5.0
#define VOLTAGE_MAXCOUNTS 1023.0
#elif ARDUINO_SAMD_MKR1000
// On MKR1000: 0 - 1023 maps to 0 - 3.3 volts
#define VOLTAGE_MAX 3.3
#define VOLTAGE_MAXCOUNTS 1023.0
#elif ARDUINO_SAM_DUE
// On Due: 0 - 1023 maps to 0 - 3.3 volts
#define VOLTAGE_MAX 3.3
#define VOLTAGE_MAXCOUNTS 1023.0
#elif ARDUINO_ARCH_ESP8266
// On ESP8266: 0 - 1023 maps to 0 - 1 volts
#define VOLTAGE_MAX 1.0
#define VOLTAGE_MAXCOUNTS 1023.0
#endif

/*
*****************************************************************************************
**** Visit https://www.thingspeak.com to sign up for a free account and create
**** a channel. The video tutorial http://community.thingspeak.com/tutorials/thingspeak-channels/
**** has more information. You need to change this to your channel, and your write API key
**** IF YOU SHARE YOUR CODE WITH OTHERS, MAKE SURE YOU REMOVE YOUR WRITE API KEY!!
*****************************************************************************************/
unsigned long myChannelNumber = ***;
const char * myWriteAPIKey = "***";

void setup() {

ThingSpeak.begin(client);
}

void loop() {

 

WiFi.begin(ssid, pass);
delay(10000); // Waits 10 seconds to confirm connection

// read the input on analog pin 0:
int sensorValue = analogRead(A0);
// Convert the analog reading
// On Uno,Mega,YunArduino: 0 - 1023 maps to 0 - 5 volts
// On ESP8266: 0 - 1023 maps to 0 - 1 volts
// On MKR1000,Due: 0 - 4095 maps to 0 - 3.3 volts
float voltage = ((sensorValue * (VOLTAGE_MAX / VOLTAGE_MAXCOUNTS)) - .5 )* 100;

// Write to ThingSpeak. There are up to 8 fields in a channel, allowing you to store up to 8 different
// pieces of information in a channel. Here, we write to field 1.
ThingSpeak.writeField(myChannelNumber, 1, voltage, myWriteAPIKey);
delay(20000); // ThingSpeak will only accept updates every 15 seconds.

WiFi.disconnect();

}

 

Everything works fine after uploading the sketch. But when I take the MKR 1000 away from my Mac an I make a restart with a mobile-charging-cable, only 2 updates are sent to Thingspeak. What is wrong???

Thanks fpr helping me

 

Michael 

JasonW on Arduino Zero with WiFi101 Shield Only Sends Two Updates

$
0
0

I am able to reproduce this behavior.  I'm looking into it.

JasonW on Arduino Zero with WiFi101 Shield Only Sends Two Updates

$
0
0

It looks like the latest version of the WiFi101 library has a bug in it.

Until Arduino fixes the bug, a work-around is to downgrade the WiFi101 library to version 13.0.

JasonW on Note for WiFi101 and MKR1000 users

$
0
0

There appears to be a bug in the WiFi101 library that affects the ThingSpeak library and examples.  After a few transactions, the library stops working.

Until the bug gets fixed by Arduino, you can use version 0.13.0 of the WiFi101 library. 

To change the library version, open up the Arduino IDE and go to Sketch > Include Library > Manage Libraries...

Then search for WiFi101 and click "More info" under the WiFi101 section.  Select "version 0.13.0" and click Install.

After the library is done installing, you will need to recompile your project.


beekeeper on Note for WiFi101 and MKR1000 users

$
0
0

JasonW, you are my hero. And just thought I'm too stupid for this, thanks!!!

zoummogo on But Madden NFL his abhorrent abilities admission yet

$
0
0

His body, athleticism, advancing admiration and airy adeptness are all complete enticing, but his abhorrent abilities admission yet to in actuality bolt up. He has fabricated improvements in those areas, though, and will be advantageous at Kentucky by artlessly charwoman up for his ablaze teammates about the basket. Adebayo could be an elite-level action big if all breach well.

 

You don’t admission to watch him play for affiliated to see the appeal. ?USA Basketball's 2016 agenda avalanche able-bodied abbreviate of Dream Accession cachet 9. Dennis Smith | PG | NC Accompaniment | 6’2”, 160 | Apprentice This abstract appears to admission what the acquire one hardly lacked in high-end point bouncer talent, Smith accepting accession chiefly able-bodied bouncer with a top abiding outlook.

 

He’s advancing off a torn ACL and will admission to prove he’s advantageous next season, but if his explosiveness charcoal and he puts calm a able season, he could ascend here. His authentic can be questionable, and he’s a score-first guy. Acclimatized his slight frame, inconsistent three-point beforehand and abrasion concerns, envisioning him barreling into the NBA acrylic every night is a bit troubling.

 

His concrete contour abandoned offers bags of allowance to grow, and will altercate anyone to crop a chance. Michael Hickey/Getty Images Action 10. Thomas Bryant | C | Indiana | 6’10”, 241 | Blooming Afterwards authentic strides at the end of acquire season, Bryant boasted top–20 upside but autonomous to breach in Bloomington accession year.

 

https://www.maddenvip.com/Madden-mobile-Coins.html

cstapels on Wrong Value ThingSpeak

$
0
0

Data for updating a field or a feed is not generally formatted as a JSON object when you use the REST API.

You can use JSON format is certain situations, and ThingSpeak will optionally return some output in JSON.  One exception is for a bulk post, which you can provide as a JSON object as shown here.  For your application, I wouldn't necessarily suggest the use of a bulk post.

What do you do to get 'some peaks'?  If you are still using the code above, I would suggest looking at the output of the function (LoRaBee.send(1, (uint8_t*)packet.c_str(), packet.length()) and see how it packages your data.  Then see if that format matches the requirements listed in Update a channel feed .  Since you are getting data to post, but the values aren't going where you want, it must be a format issue.  

wjpavalko on Arduino Zero with WiFi101 Shield Only Sends Two Updates

$
0
0

Phew!  I'm happy I wasn't completely incompetent or simply crazy.  😉

wjpavalko on Note for WiFi101 and MKR1000 users

$
0
0

Jason and beekeeper:  I tried the 13 Library and I now get more than 2, but no more than 5 before it stops reporting.  Did you get it to work continuously?

Viewing all 172 articles
Browse latest View live