loading
12 Comments

Tell us about yourself!

Complete Your Profile
  • Send sensor data (DHT11 & BMP180) to ThingSpeak with an Arduino, using cable or WiFi (ESP8266)

    hi DIY_BLOKEby now i am running the post sequence, with a sketch that i belive emulateetehrnet library sketch these are the fellows:- <WiFiEsp.h> <WiFiEspClient.h> <WiFiEspServer.h>it lets me define the serial1 as the hw serial for the esp8266 communication,(since other ethernet shields commnicate i believe over spi not like our esp8266-01)and "speak" to the server in a client stuff vocabulary.i found it extremely hard to figure out.Actually here it is , stripped of all sensor data collection dht etc.if it helps getting others to get themselves through POST or even GET usingethernet shields vocabulary .and maybe i contribute here something after all help i got from you.CHEERS:)---------------------just comm. without dht sensor library--------------...see more »hi DIY_BLOKEby now i am running the post sequence, with a sketch that i belive emulateetehrnet library sketch these are the fellows:- <WiFiEsp.h> <WiFiEspClient.h> <WiFiEspServer.h>it lets me define the serial1 as the hw serial for the esp8266 communication,(since other ethernet shields commnicate i believe over spi not like our esp8266-01)and "speak" to the server in a client stuff vocabulary.i found it extremely hard to figure out.Actually here it is , stripped of all sensor data collection dht etc.if it helps getting others to get themselves through POST or even GET usingethernet shields vocabulary .and maybe i contribute here something after all help i got from you.CHEERS:)---------------------just comm. without dht sensor library--------------------------------------------------------------------#include <WiFiEsp.h>#include <WiFiEspClient.h>#include <WiFiEspServer.h>#include <WiFiEspUdp.h>String apiKey ="QR74QZBRXADXPC3C"; // api from tschar MY_SSID[] = "******************";char MY_PWD[] = "*******************";#define WEBSITE "api.thingspeak.com"//or const char* WEBSITE = "api.thingspeak.com"; if you prefervoid setup(){ Serial.begin(9600); Serial1.begin(115200);WiFi.init(&Serial1);//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<Serial.print("Connecting to ");Serial.println(MY_SSID);WiFi.begin(MY_SSID, MY_PWD); while (WiFi.status() != WL_CONNECTED) //not connected, ...waiting to connect { delay(1000); Serial.print("."); } Serial.println(""); Serial.println("Credentials accepted! Connected to wifi\n "); Serial.println("");}void loop(){ // HERE I ASSIGN SOME FAKE DATA TO 3 FIELDS delay(2000); // float h = dht.readHumidity(); float h =400; // Read temperature as Celsius (the default) //float t = dht.readTemperature(); float t = 400; // Read temperature as Fahrenheit (isFahrenheit = true) //float f = dht.readTemperature(true); float f = 400; // Check if any reads failed and exit early (to try again). if (isnan(h) || isnan(t) || isnan(f)) { Serial.println("Failed to read from DHT sensor!"); return; }//// // Compute heat index in Fahrenheit (the default)// float hif = dht.computeHeatIndex(f, h);// // Compute heat index in Celsius (isFahreheit = false)// float hic = dht.computeHeatIndex(t, h, false); Serial.print("Humidity: "); Serial.print(h); Serial.print(" %\t"); Serial.print("Temperature: "); Serial.print(t); Serial.print(" *C "); Serial.print(f); Serial.print(" *F\t");//WiFiClient client;WiFiEspClient client; if (client.connect(WEBSITE, 80)) { Serial.println("WiFi Client connected ");//// client.print(F("POST "));// client.print("/update?key=apiKey&field1=" // + (String) h// +"&field2=" +(String) t// +"&field3=" +(String) f// ); //need the length of our data string to give to ThingSpeak String tsData = "&field1="+(String)h+"&field2=" +(String)t+"&field3="+(String)f; client.print("POST /update HTTP/1.1\n"); //alternate sans 'update'client.print(F(" HTTP/1.1\r\n")); client.print("Host: api.thingspeak.com\n"); client.print("Connection: close\n"); client.print("X-THINGSPEAKAPIKEY: " + apiKey + "\n"); client.print("Content-Type: application/x-www-form-urlencoded\n"); client.print("Content-Length: "); client.print(tsData.length()); //send out data string legth to ts client.print("\n\n"); client.print(tsData); delay(1000); } //end client connect else Serial.print("couldnt connect to ThingSpeak\n"); //if client connect failed client.stop();}-------------------------------------------------------------------------------------

    View Instructable »
  • Send sensor data (DHT11 & BMP180) to ThingSpeak with an Arduino, using cable or WiFi (ESP8266)

    Diy_bloke hi again and thanks for your fenomenal output!.First the remarks regarding " /n/r " s is one thing I needed.SecondWhat is the client.print class you suggests and why cant i see To which port in my arduino i am tx rx toI assum the client object encapsulates whithin the wifi,and connection to server.(thingspeak)This is confusing.ThanksOded:)

    View Instructable »
  • Send sensor data (DHT11 & BMP180) to ThingSpeak with an Arduino, using cable or WiFi (ESP8266)

    diy_bloke hello again :)i am looking for the right sequence of posting to thingspeak , same project as above but using "post" methode rather then "get" method.i am confused on the right sequence and syntax just afteropenning the tcp ip and cipsend = length etc.there is a chunk of http coding which comes line after the other with or without cr/lf'slike so which i copied from some other blog:- --------------------------------------------POST /update HTTP/1.1\nHost: api.thingspeak.com\nConnection: close\nX-THINGSPEAKAPIKEY:[my api key here]\nContent-Type: application/x-www-form-urlencoded\nContent-Length: 32\nfield1=200&field2=300&field2=400\n--------------------------------------------------------------------closest i got was bad request from th...see more »diy_bloke hello again :)i am looking for the right sequence of posting to thingspeak , same project as above but using "post" methode rather then "get" method.i am confused on the right sequence and syntax just afteropenning the tcp ip and cipsend = length etc.there is a chunk of http coding which comes line after the other with or without cr/lf'slike so which i copied from some other blog:- --------------------------------------------POST /update HTTP/1.1\nHost: api.thingspeak.com\nConnection: close\nX-THINGSPEAKAPIKEY:[my api key here]\nContent-Type: application/x-www-form-urlencoded\nContent-Length: 32\nfield1=200&field2=300&field2=400\n--------------------------------------------------------------------closest i got was bad request from the ts server. while trying it on the SERIAL console.do you have ready made working example for that ? ()thanksOded.

    View Instructable »
  • Send sensor data (DHT11 & BMP180) to ThingSpeak with an Arduino, using cable or WiFi (ESP8266)

    diy_bloke hi.yes.i must go further to understand the "print" fuctionallity.i believe i missed something there.thanks anyway :)oded.\

    View Instructable »
  • Send sensor data (DHT11 & BMP180) to ThingSpeak with an Arduino, using cable or WiFi (ESP8266)

    hi again :)!if i had not succeeded 99 pct on tries ,manually (ie step bt step serial console), to reach right responses ">" and bytes received etc , i would not battle with this and look for other database.i am going now to try and "play " the datatype char over the ">" issue to see.thanksgood w/eoded.

    Hi diy_bloke.Ofcourse i went through many scripts,ending modifying your original.this is for learnning purpose.ButI am not sure about println converting int to string.I am not a pro. But , it looks like serial console and AT commands are submitted ad strings.When it comes to running the sketch, not applying string convertion over an int result, confuses the cipsend data .I will look at the original script tomorrow, to verify i am not talking nonesense.;).i am glad to have found such cooperative and helpfull "bloke"Diy...Speak tomorrow.Oded.I

    S O L V E D !!:))hi diybloke!look at thatcmd = "AT+CIPSEND="; cmd += String(getStr.length());Serial1.println(cmd);do you see the String definition on the getstr?not having this messed the length value sent with the CIPSEND command.the CIPSEND i sent was a combination of string and int , I do recommend that you update the script on this instructable , to smoothen integration on this nice feature.thanks a lot for being there.Oded,

    diy_bloke hi.its a bit i a mess to be shown presented here. i did eliminate all the sensor stuf etc. for purpose of pinpointing the problem. but thank you,i still dont get how you concateneate 2 types without the string thing , since i tried that originally.i even submitted "cipsend=54" just a plain number as a full string , and it did not respond ">".over runtime. (it did on the console.)there is a lot to be learned regarding data types and the way they r presented, and converted. its a subject people tend to bypassuntill they fall in the ditch......ha ha...anyway.this was kind of good schooling to me and i am very satisfied. it helps for future tasks.thanks again.Oded

    View Instructable »
  • Send sensor data (DHT11 & BMP180) to ThingSpeak with an Arduino, using cable or WiFi (ESP8266)

    hi diy_bloke.thanks for your thoughts so far:)!So i went through software serial ,and even tried the altsoftware serialusing ports 46 and 48 to write data to 3 fields over thinhspeak.i must say , the software serial looks more edgy, and not clean relative to data sent over the hardware serials.one thing i did was to ignore the ">" confirmation as well as "ok" supposed to return from the thingspeak just after the "--AT+CIPSEND="+cmd.length()--\and i just pushed the data "get "string through the serial (soft or hard) port.RESULT ?well not stable.sometime it wrote the data , somtimes it wrote some of the data and most of times it just did go through.i now believe entire other method should be adopted , and i wonder :do you have a...see more »hi diy_bloke.thanks for your thoughts so far:)!So i went through software serial ,and even tried the altsoftware serialusing ports 46 and 48 to write data to 3 fields over thinhspeak.i must say , the software serial looks more edgy, and not clean relative to data sent over the hardware serials.one thing i did was to ignore the ">" confirmation as well as "ok" supposed to return from the thingspeak just after the "--AT+CIPSEND="+cmd.length()--\and i just pushed the data "get "string through the serial (soft or hard) port.RESULT ?well not stable.sometime it wrote the data , somtimes it wrote some of the data and most of times it just did go through.i now believe entire other method should be adopted , and i wonder :do you have any other way to dialog the thingspeak via esp8266 wifi?i wonder if the hardware i use - esp or arduino are not faulty somehowand unstable over serial com.could be that the logigal shift 5>3.3 is doing this mess?could be that the data type i am sending is not recognized by thingspeak ?thanks for comments SO fr.Good night (here)

    View Instructable »
  • Send sensor data (DHT11 & BMP180) to ThingSpeak with an Arduino, using cable or WiFi (ESP8266)

    Hi diy_bloke.ok ! so i went through softwareserial ports 10,11 on my mega,avoiding the hardware serial2.worse.even the simple at commands over the console , although respond properly , it returns garbelled half correct half messed strings.i read the software serial is a bit nervous methode and sensitive to background noise.odd that i had to use 115200 baude for th software serial and console to work at all.I managed to reach the point (over the console) of getting the message "62 char received ok" from thingspeak but - data was not added to the table over there.i have no clue how to continue from here.i cant get the send ok ">" through running script , if you recall, only when i am on the step by step on console and best result with hardware s...see more »Hi diy_bloke.ok ! so i went through softwareserial ports 10,11 on my mega,avoiding the hardware serial2.worse.even the simple at commands over the console , although respond properly , it returns garbelled half correct half messed strings.i read the software serial is a bit nervous methode and sensitive to background noise.odd that i had to use 115200 baude for th software serial and console to work at all.I managed to reach the point (over the console) of getting the message "62 char received ok" from thingspeak but - data was not added to the table over there.i have no clue how to continue from here.i cant get the send ok ">" through running script , if you recall, only when i am on the step by step on console and best result with hardware serial.thanks for your insights!great day!

    View Instructable »
  • Send sensor data (DHT11 & BMP180) to ThingSpeak with an Arduino, using cable or WiFi (ESP8266)

    hi diy_bloke thanks. well... first i have 2 hardware serials thats why i use serial2 on the mega to tx_rx esp. it seems that on the point of "AT+CIPSEND=62"  for example , the serial does not come back with ">"  waiting for the whole 62 char string .   from there  , it takes it to  try closing tcp )(AT+CIPCLOSE)>>>>not having ok on that >>>>returnning  error   thats it. the strange thing is ....when i run the whole process step by step  with the serial console  screen of the arduino , each step runs perfrctly to the point of planting data in the thingspeak db. i wonder if it has to do with cr/lf mode , or stray chars the sketch spreads over , or proper delay needed inbetween  steps (whi...see more »hi diy_bloke thanks. well... first i have 2 hardware serials thats why i use serial2 on the mega to tx_rx esp. it seems that on the point of "AT+CIPSEND=62"  for example , the serial does not come back with ">"  waiting for the whole 62 char string .   from there  , it takes it to  try closing tcp )(AT+CIPCLOSE)>>>>not having ok on that >>>>returnning  error   thats it. the strange thing is ....when i run the whole process step by step  with the serial console  screen of the arduino , each step runs perfrctly to the point of planting data in the thingspeak db. i wonder if it has to do with cr/lf mode , or stray chars the sketch spreads over , or proper delay needed inbetween  steps (which i tried without success). in one blog i noticed a remark the using NODEMCU is the solution (flashing) here the stuff gets stuck ---------------------------------- if(Serial2.find( ">" ) ) { Serial2.println(cmd); } else { Serial2.println( "AT+CIPCLOSE" );//close TCP connection } i appreciate your commitment and help over this  best regards oded.

    Hello diy_bloke.i have reached the point where i manage to add data to thingspeak using esp8266 01but ! only while feeding the AT commands over the hardware serial console of my arduino mega step by step .when i run the code as a sketch , generally all goes fine , wifi connects , tcp ip approved.butreaching the Serial2.println( "AT+CIPSEND="+cmd.length() ); and the " >" sign with ok to send the right amount of data get the whole thing stuck,i am now 5 hours of combatting this issue , and i just hope i dont have to flash the esp and move to new firmware,i can see from other posts that this issue of CIPSEND makes problems not only for me,can you elaborate a bit about this.?i thank you for your post , i followed it , and actually went into the esp world...see more »Hello diy_bloke.i have reached the point where i manage to add data to thingspeak using esp8266 01but ! only while feeding the AT commands over the hardware serial console of my arduino mega step by step .when i run the code as a sketch , generally all goes fine , wifi connects , tcp ip approved.butreaching the Serial2.println( "AT+CIPSEND="+cmd.length() ); and the " >" sign with ok to send the right amount of data get the whole thing stuck,i am now 5 hours of combatting this issue , and i just hope i dont have to flash the esp and move to new firmware,i can see from other posts that this issue of CIPSEND makes problems not only for me,can you elaborate a bit about this.?i thank you for your post , i followed it , and actually went into the esp world through it fully.oded.

    View Instructable »