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

avoletta on mDNS Alternative

$
0
0

Hi all,

 

Need help! The problem is:

The user needs to access a webserver web page installed on esp8266 and connected as a client.

For this it is necessary to know the IP assigned by the DHCP of the network router.

I'm trying to use the mDNS library to access the device as "mydevice.local".

This is not working. (Even using Bonjour on Win 10, and also does not work on Android 6.0)

Does anyone suggest another technique or method to achieve for the same purpose?

 

Tks!


cstapels on ThingHTTP is not calling on meeting certain condition in React

$
0
0

You could test your react by using your thingHTTP to write to a ThingSpeak channel.  Use the instructions https://www.mathworks.com/help/thingspeak/update-channel-feed.html to set your thingHTTP to publish to your channel (be careful with the two different API keys).  Have the thingHTTP post a unique value to your channel:

URL https://api.thingspeak.com/update

Method: POST

Headers:
Name: Content-Type
Value: application/x-www-form-urlencoded

Body: api_key=THE_WRITE_API_KEY&field1=12345 Be sure to include the ampersand.

Then use your browser to trigger it:

https://api.thingspeak.com/apps/thinghttp/send_request?api_key=THING_HTTP_API_KEY

Once you see it worked, change the value 12345, and see if it gets triggered from the react. (you might have to wait ten minutes)

mun on Inactivity alert

$
0
0

Mine still refuses to make the HTTP request, so I'm not sure what's happening.

irproject on Sending Data to Twilio SMS via ThingHTTP

$
0
0

raghunow said
Hi Guys,

 

I am facing a similar issue.

I am able to send an SMS from Thingspeak to a US number but not to an Indian number.

However, I am able to send an SMS from Twilio to the Indian number. This confirms that this number is verified and also that I am using the correct format in Thingspeak.

 

I also tried using &ForceDelivery=True" but it still doesnt work and I get this message.

{"code": 21211, "message": "The 'To' number ' 9198XXXXXX49' is not a valid phone number.", "more_info": "https://www.twilio.com/docs/errors/21211", "status": 400}  

Hi raghunow!

I'm having the same problem.

Did you figure out a way how to solve it?

Does anyone else knows how to solve it?

I'm frustrated.

Thnaks!

cstapels on Inactivity alert

$
0
0

Hi Mun,

Are you able to trigger the thingHTTP from a browser or POSTMAN?

The syntax is 

GET https://api.thingspeak.com/apps/thinghttp/send_request?api_key=THINGHTTP_APIKEY


The react settings look appropriate, you could try increasing the test frequency, or decreasing the update time just to see if it goes.

JK on Problem with Arduino Thingspeak.writeFields() not updating fields correctly

$
0
0

Thanks for the tip. I am running low on RAM. Are there any good libs (or tricks) out there that provide memory resource tracking?

mun on Inactivity alert

$
0
0

cstapels said
Hi Mun,

Are you able to trigger the thingHTTP from a browser or POSTMAN?

The syntax is 

GET https://api.thingspeak.com/apps/thinghttp/send_request?api_key=THINGHTTP_APIKEY

The react settings look appropriate, you could try increasing the test frequency, or decreasing the update time just to see if it goes.

  

Hi

 

Yes, I can trigger the thingHTTP perfectly. I've tried various test frequencies already though. Is REACT meant to be stable?

cstapels on Inactivity alert

$
0
0

Mun,

I was able to reproduce the problem and the team is looking into it.  Thanks.


cstapels on Inactivity alert

$
0
0

The problem with react on no data has been fixed. I have tested the condition, and it now works again for me. Can you go ahead and test it and let me know if your thingHTTP is called by the react when there is no data?  

loli72 on Need help posting data using RN171 wifi shield and wifly library

$
0
0

Hello, could you please post your entire code. At least the code to connect this wifi schield to Thingspeak as a client. I manage to connect whit a ethernet schield but I'm lost with this one.

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

$
0
0

Halo everyone,

I want to upload 2 values to ThingSpeak in feld1 and feld2. I use an Arduino uno and a GSM module for that. I have already work out some code that work but not as good as I want. I am working with the ThingSpeak.h but I don’t think the library good for the use with the GSM Module. The problem with the code below is that die code stops working after the two values are sended to ThingSpeak. So the loop function just stop there. I don’t know why.  Even when after the function writeFields() some more function came. The getLastReadStatus () doesn’t work also. Do you have any idea how to fix this problem? The loop function and the values should send some values over and over again.

Or do you know other methods to upload more very values to ThingSpeak with the GSM module from Arduino?

thank you in advance.

 

//------------------------------------Bibliotheken--------------------------------------------------------------------------------------------------------------
#include <SPI.h>
#include <GSM.h>
#include "ThingSpeak.h"

//------------------------------------Definitionen für SIM-Karte------------------------------------------------------------------------------------------------
#define PINNUMBER "XXX"
#define GPRS_APN "internet.t-mobile"
#define GPRS_LOGIN "t-mobile"
#define GPRS_PASSWORD "XXX"

//------------------------------------Variablen für SIM-Karte---------------------------------------------------------------------------------------------------
GSMClient client;
GPRS gprs;
GSM gsmAccess;

uint16_t reset = 0;
int Wert1 = 80; /
int Wertalt;
boolean neuerWert = true;
int Wert2 =5;

long lastConnectionTime = 0;
boolean lastConnected = false;
int failedCounter = 0;
//------------------------------------Variablen für Datencloud--------------------------------------------------------------------------------------------------

const char * myWriteAPIKey = "XXX";
unsigned long myChannelNumber = 000;

//Zählervariablen für neunstart
int seconds =0;

//CanAktiv erkennen
boolean CANschlaf=false;
boolean GSMaus=true;

 

void setup() {
Serial.begin(9600); // Initialiesiere Serial port (Baudrate:9600)
ThingSpeak.begin(client);
pinMode(5, INPUT); //die Pins 9,6 und 3 sind durch die ThingSpeak lib schon beleckt und werden zum ansteuern einer RGB genutzt. Solten nicht verwendet werden.
digitalWrite(5,HIGH);
pinMode(2, INPUT);
CANschlaf=digitalRead(5);

startGSM();
GSMaus=false;

}

 

void loop() {

// Update ThingSpeak

if(neuerWert== true && Wert1 > 0)
{
if(GSMaus==true)
{
startGSM();
GSMaus=false;
}
ThingSpeak.setField(1,Wert1);
ThingSpeak.setField(2,Wert2);
ThingSpeak.writeFields(myChannelNumber, myWriteAPIKey);
int resultCode = ThingSpeak.getLastReadStatus();
if(resultCode == 200)
{
Serial.print("OK");
}
else
{
Serial.print("Error reading message. Status was: ");
Serial.println(resultCode);
}

neuerWert == false;
delay(15000);
Wert1--;

}

// Check if Arduino Ethernet needs to be restarted
if (failedCounter > 3 )
{
startGSM();
GSMaus=false;
}

lastConnected = client.connected();

}

void startGSM() {
boolean notConnected = true;
Serial.println("try to connect to GSM...");
while(notConnected) {
if ((gsmAccess.begin(PINNUMBER) == GSM_READY) & (gprs.attachGPRS(GPRS_APN, GPRS_LOGIN, GPRS_PASSWORD) == GPRS_READY))
notConnected = false;
else {
Serial.println("Not connected");
delay(1000);
}
}
Serial.println("Connected");
}

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

$
0
0

Does startGSM() claim to succeed?  - Do you get the "connected" message printed out..

Perhaps you can try calling Thingspeak.begin()  only after you connect to GSM rather than before?

If that doesnt work you can avoid the thingspeak library altogether and just construct the URL yourself (its possible that the thingspeak library isnt tested for GSM since the source only refers to WiFi and Ethernet)

Sample code for a web client is https://www.arduino.cc/en/Tutorial/GSMExamplesWebClient

The URL you need can be found on the "Data Import/Export" tab of your channel page on the thingspeak website.

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

$
0
0

Thang you for your tip. Yes the startGSM() works fine and I get the Massage connected. I try your idea to change the position of Thingspeak.begin() after the startGSM() but the code still stops working after uploading the two values, like bevor. I think your right I should avoid the ThingSpeak.h library. I already working on come code for that. Down below is my code. With this code I am able to upload one value to feld1 on ThingSpeak but not two values. It looks easier than it is. When I call the function updateThingSpeak("field1="+analogValue) again for the fild2 I get a Bad request error.

Any ideas?

//------------------------------------Bibliotheken--------------------------------------------------------------------------------------------------------------           
#include <SPI.h>                           
#include <GSM.h>
//------------------------------------Definitionen für SIM-Karte------------------------------------------------------------------------------------------------           
#define PINNUMBER "XXX"                   
#define GPRS_APN "internet.t-mobile"
#define GPRS_LOGIN "t-mobile"
#define GPRS_PASSWORD "XX"

//------------------------------------Variablen für SIM-Karte---------------------------------------------------------------------------------------------------           
GSMClient client;
GPRS gprs;
GSM gsmAccess;

uint16_t reset = 0;     
int Wert1 = 0;                          //Startwert auf 0 gesetzt
int WEert1_alt;
boolean neuWert = true;

long lastConnectionTime = 0;
boolean lastConnected = false;
int failedCounter = 0;
//------------------------------------Variablen für Datencloud--------------------------------------------------------------------------------------------------         

char thingSpeakAddress[] = "api.thingspeak.com";
String writeAPIKey = "XXX";
const int updateThingSpeakInterval = 16 * 1000;

void setup() {

  Serial.begin(9600);                  // Initialiesiere Serial port (Baudrate:9600)                         
  pinMode(9, OUTPUT);
  pinMode(2, INPUT);
  startGSM();
 
}

void loop() {
 
  String analogValue = String(Wert1, DEC);   
 
  if (client.available())
  {
    char c = client.read();
    Serial.print(c);
   
  }
 
  // Disconnect from ThingSpeak
  if (!client.connected() && lastConnected)
  {
    Serial.print(Wert1);
    Serial.println("...disconnected");
    Serial.println();
    client.stop();
    neuWert = false;
  }
 
  // Update ThingSpeak
  if(!client.connected() && (millis() - lastConnectionTime > updateThingSpeakInterval) && neuWert == true && Wert1 > 0)
  {
    updateThingSpeak("field1="+analogValue);
  }
 
  // Check if Arduino Ethernet needs to be restarted
  if (failedCounter > 3 )
  {
    startGSM();
    }
 
  lastConnected = client.connected();
}                         

void startGSM() {
    boolean notConnected = true;
    Serial.println("try to connect to GSM...");
    while(notConnected) {
        if ((gsmAccess.begin(PINNUMBER) == GSM_READY) & (gprs.attachGPRS(GPRS_APN, GPRS_LOGIN, GPRS_PASSWORD) == GPRS_READY))
            notConnected = false;
        else {
            Serial.println("Not connected");
            delay(1000);
        }
    }
    Serial.println("Connected");
}

void updateThingSpeak(String tsData)
{
  if (client.connect(thingSpeakAddress, 80))
  {         
    client.print("POST /update HTTP/1.1
");
    client.print("Host: api.thingspeak.com
");
    client.print("Connection: close
");
    client.print("X-THINGSPEAKAPIKEY: "+writeAPIKey+"
");
    client.print("Content-Type: application/x-www-form-urlencoded
");
    client.print("Content-Length: ");
    client.print(tsData.length());
    client.print("

");

    client.print(tsData);
   
    lastConnectionTime = millis();
   
    if (client.connected())
    {
      Serial.println("Connecting to ThingSpeak...");
      Serial.println();
      failedCounter = 0;
    }
    else
    {
      failedCounter++;
      Serial.println("Connection to ThingSpeak failed ("+String(failedCounter, DEC)+")");   
      Serial.println();
    }
  }
  else
  {
    failedCounter++;
    Serial.println("Connection to ThingSpeak Failed ("+String(failedCounter, DEC)+")");   
    Serial.println();
    lastConnectionTime = millis();
  }
}

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

$
0
0

Hi ICar,

You say

int Wert1 = 0; //Startwert auf 0 gesetzt

google helped me saying you say start with value=0
but you never made it greater than 0
and you check

if (!client.connected() && (millis() - lastConnectionTime > updateThingSpeakInterval) && neuWert == true && Wert1 > 0){

to run your routine void updateThingSpeak(String tsData) that will never run

 

Also you can do (semi pseudo-code)

analogValue = "field1=" + str(Wert1) + "field2=" + str(Wert2)
...
...
updateThingSpeak(analogValue);

 

Hope this is some helpWink

Good luck (&& | ask again)

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

$
0
0

Hi piajola,

You are absolutely right with the “int Wert1=0”. That was a volatile mistake from me.

I am still working on the problem to upload two variables to ThingSpeak. The code example you give me (analogValue = "field1=" + str(Wert1) + "field2=" + str(Wert2) )looks good but how is the right implementation for that. I try a lot variation of that but still no idea. What did you mean with str?

Thank you very much for your help.


vondes on Mobile and web developer

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

$
0
0

Hi ICar,

str is "string" the idea is concatenate one string from 2 strings plus 2 numbers. (convert the number to string)

It depends in the "type" of number int, float, etc.

My particular case is I have 2 numbers from my sensor

      float valHumidity;
      float valTemperature;

and thingspeak wants to receive one string that my "internet device" must compose. So my string is

    altSer.print(F("GET /update?api_key=")); // 20 chars
    altSer.print(apiKey);                            // 16 chars
    altSer.print(F("&field1="));                   // 8 chars
    altSer.print(String(valTemperature));      // 5 chars
    altSer.print(F("&field2="));                   // 8 chars
    altSer.print(String(valHumidity));            // 5 chars
    altSer.print(F("

"));                    // 4 chars

because also I must say how many characters I am sending. Capital F so arduino put the fixed strings in flash and use less RAM

      "&field1="+String(valTemperature))+"&field2="+String(valHumidity))

is the same string, but as I did is cleaner to see 2 years after to repeat

My device get the string and do whatever needed to send "really to Internet"

I do not know how to use your device but I think it is "more or less" the same thing

 

Hope still making sense Wink

josephlowry on Mobile and web developer

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

$
0
0

Hi piajola,

Thank you very much for your help. It works now! Great idea to put both variables in one string. The solution is:

   String analogValue = String(Wert1, DEC);

   String analogValue2 = String(Wert2, DEC); 

senden="&field1="+analogValue+"&field2="+ analogValue2; 

and after this you can just call the “updateThingSpeak(senden);” function.

I am really happy now. Thank you again and great job.

pedro.henrique on String format to update channel

$
0
0

Hi there,

I am trying to use a CC1350 to update my thingspeak channel through a GSM modem. Since CC1350 does not have a proper api to "build" the string to be sent, I am trying to do it myself. The problem is I did not find how to properly create this string. I would like to know how do I format a string just to send one or 2 fileds of data.

Thanks in advance.

Viewing all 1833 articles
Browse latest View live