loading
5Comments

Tell us about yourself!

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

    no.i didnt get connected to thingspeak ,not even to wifi.only sensor data is displayed in serial monitor.****please check my connections above post and tell me whether right or wrong.because iam not using Tx and Rx of arduino instead iam using 2,3 pins for that purpose.***clarift this first please i.e what senddebug() function is doing and when command AT is given the output is OK .the return path for OK is present in code or not(in your code).the code is almost similar to yours.just instead of LIGHT, TEMPERATURE,HUMIDITY i have cons1, cons2 , pole.and in void loop just i printed values of cons1 and cons2 ,pole and compared values.nothing more than this.iam little worried as time is running out since the deadline is approaching.the hardware part is completed.just transmission is left.p...see more »no.i didnt get connected to thingspeak ,not even to wifi.only sensor data is displayed in serial monitor.****please check my connections above post and tell me whether right or wrong.because iam not using Tx and Rx of arduino instead iam using 2,3 pins for that purpose.***clarift this first please i.e what senddebug() function is doing and when command AT is given the output is OK .the return path for OK is present in code or not(in your code).the code is almost similar to yours.just instead of LIGHT, TEMPERATURE,HUMIDITY i have cons1, cons2 , pole.and in void loop just i printed values of cons1 and cons2 ,pole and compared values.nothing more than this.iam little worried as time is running out since the deadline is approaching.the hardware part is completed.just transmission is left.please help me.thank you once again.

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

    thank u for your patiencebelow is my code.i am using current sensors, so i included one function for it . and my esp baud rate is 115200 , so i changed it in the code .rest remains the same.my output when i run this code is follows :-----------------------------------------------------------------------------ATcons1= 2.8 cons2=5.2 pole=6.7power thefted at location no.123AT+CIPSTART="TCP",184.106.153.149",80AT+CIPSEND=70 (sometimes 72)AT+CIPCLOSE.(and it contiues).----------------------------------------------------------------------------------the values that i got from sensors are correct and it is functioning good.only transmission is not happening.my connections are :ARDUINO : A0,A1,A2 are connected from sensors. the power for current sensors i.e...see more »thank u for your patiencebelow is my code.i am using current sensors, so i included one function for it . and my esp baud rate is 115200 , so i changed it in the code .rest remains the same.my output when i run this code is follows :-----------------------------------------------------------------------------ATcons1= 2.8 cons2=5.2 pole=6.7power thefted at location no.123AT+CIPSTART="TCP",184.106.153.149",80AT+CIPSEND=70 (sometimes 72)AT+CIPCLOSE.(and it contiues).----------------------------------------------------------------------------------the values that i got from sensors are correct and it is functioning good.only transmission is not happening.my connections are :ARDUINO : A0,A1,A2 are connected from sensors. the power for current sensors i.e 5v is also taken from arduino 5v.ESP8266 : VCC,CHIP_SET,RST to 3.3v supply(RPS). GND OF esp to GND(-ve) of supply.arduino esp8266pin 2 tx of esppin 3 rx of esp.** can i check without connecting to sensors as it takes random values and so they can be updated.ANALYSIS FROM OUTPUT :after sending command AT , it checks for OK but iam not getting OK in serial monitor , so it is skipping CONNECTWIFI() function.because if it is into this function it should show AT+CWMODE=1 in output as you have given that.but my doubt is did we write code for printing output of esp8266 after sending command AT. if we write then we should get OK right.moreover MY esp8266 is connecting automatically to wifi as i can see from my mobile connected devices.MY arduino version is 1.6.7i think problem is there in receiving part from esp.CODE BEGINS HERE :#include <SoftwareSerial.h>float value_cons1=0;float value_cons2=0;float value_pole=0;//current sensor information `float current=0;const unsigned long sampleTime = 100000UL; const unsigned long numSamples = 250UL; const unsigned long sampleInterval = sampleTime/numSamples; const int adc_zero = 510; int x;// function for the calculation of currentfloat CurrentSense(int x){ unsigned long currentAcc = 0; unsigned int count = 0; unsigned long prevMicros = micros() - sampleInterval ; while (count < numSamples) { if (micros() - prevMicros >= sampleInterval) { int adc_raw = analogRead(x) - adc_zero; currentAcc += (unsigned long)(adc_raw * adc_raw); ++count; prevMicros += sampleInterval; } } float rms = sqrt((float)currentAcc/(float)numSamples) * (50 / 1024.0);rms=rms-0.10;if (rms<0.20){rms=0;}current=rms;}#define DEBUG FALSE //comment out to remove debug msgs//*-- Hardware Serial#define _baudrate 9600//*-- Software Serial//#define _rxpin 2#define _txpin 3SoftwareSerial debug( _rxpin, _txpin ); // RX, TX//*-- IoT Information#define SSID "kaduluri"#define PASS "balamurali"#define IP "184.106.153.149" // ThingSpeak IP Address: 184.106.153.149// GET /update?key=[THINGSPEAK_KEY]&field1=[data 1]&field2=[data 2]...;String GET = "GET /update?key=CMBIAUZGMHMC4S9U";void setup() { Serial.begin( _baudrate ); debug.begin( _baudrate ); sendDebug("AT"); delay(5000); if(Serial.find("OK")) { debug.println("RECEIVED: OK\nData ready to sent!"); connectWiFi(); }}void loop() { CurrentSense(0); value_cons1 = current; delay(100); CurrentSense(1); value_cons2 = current; delay(100); CurrentSense(2); value_pole = current; Serial.print("cons1 :"); Serial.print(value_cons1); Serial.print("\t\t"); Serial.print("cons2 :"); Serial.print(value_cons2); Serial.print("\t\t"); Serial.print("pole :"); Serial.print(value_pole); Serial.print("\n"); if((value_cons1+value_cons2)-value_pole>=0.3) Serial.println("power thefted at locaton no.123"); else Serial.println("good on distribution lines"); String cons1 =String(value_cons1);// turn integer to string String cons2= String(value_cons2);// turn integer to string String pole=String(value_pole);// turn integer to string updateTS(cons1,cons2, pole); delay(16000); //}//----- update the Thingspeak string with 3 valuesvoid updateTS( String T, String L , String H){ // ESP8266 Client String cmd = "AT+CIPSTART=\"TCP\",\"";// Setup TCP connection cmd += IP; cmd += "\",80"; sendDebug(cmd); delay(2000); if(Serial.find("Error")) { debug.print( "RECEIVED: Error\nExit1" ); return; } cmd = GET + "&field1=" + T +"&field2="+ L + "&field3=" + H +"\r\n"; Serial.print( "AT+CIPSEND=" ); Serial.println( cmd.length() ); if(Serial.find( ">" ) ) { debug.print(">"); debug.print(cmd); Serial.print(cmd); } else { sendDebug( "AT+CIPCLOSE" );//close TCP connection } if( Serial.find("OK") ) { debug.println( "RECEIVED: OK" ); } else { debug.println( "RECEIVED: Error\nExit2" ); }}void sendDebug(String cmd){ debug.print("SEND: "); debug.println(cmd); Serial.println(cmd);}boolean connectWiFi(){ Serial.println("AT+CWMODE=1");//WiFi STA mode - if '3' it is both client and AP delay(2000); //Connect to Router with AT+CWJAP="SSID","Password"; // Check if connected with AT+CWJAP? String cmd="AT+CWJAP=\""; // Join accespoint cmd+=SSID; cmd+="\",\""; cmd+=PASS; cmd+="\""; sendDebug(cmd); delay(5000); if(Serial.find("OK")) { debug.println("RECEIVED: OK"); return true; } else { debug.println("RECEIVED: Error"); return false; } cmd = "AT+CIPMUX=0";// Set Single connection sendDebug( cmd ); if( Serial.find( "Error") ) { debug.print( "RECEIVED: Error" ); return false; }}

    i got confused with your answer.we are declaring 2,3 in code. so accordingly rx-2,tx-3 of uc.but you said we should connect real tx and rx of uc.then what is the use of declaring 2,3 ??????????

    thank you for the reply.i have one code to test the esp8266 and it is running fine i.e iam able to connect to wifi etc.so there is no problem with esp8266.1.when iam running your code . i got the following error.but it compiled.please clarify about this.------------------------------------------------------------------------------------------------C:\Users\MURALI\Desktop\Arduino\bala_bala\bala_bala.ino: In function 'void setup()':C:\Users\MURALI\Desktop\Arduino\bala_bala\bala_bala.ino:68:22: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings] if(Serial.find("OK")) ^C:\Users\MURALI\Desktop\Arduino\bala_bala\bala_bala.ino: In function 'void updateTS(String, String, String)':C:\Users\MURALI\Desktop\Arduino\bala_bala\bala_bala.i...see more »thank you for the reply.i have one code to test the esp8266 and it is running fine i.e iam able to connect to wifi etc.so there is no problem with esp8266.1.when iam running your code . i got the following error.but it compiled.please clarify about this.------------------------------------------------------------------------------------------------C:\Users\MURALI\Desktop\Arduino\bala_bala\bala_bala.ino: In function 'void setup()':C:\Users\MURALI\Desktop\Arduino\bala_bala\bala_bala.ino:68:22: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings] if(Serial.find("OK")) ^C:\Users\MURALI\Desktop\Arduino\bala_bala\bala_bala.ino: In function 'void updateTS(String, String, String)':C:\Users\MURALI\Desktop\Arduino\bala_bala\bala_bala.ino:115:25: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings] if(Serial.find("Error")) ^C:\Users\MURALI\Desktop\Arduino\bala_bala\bala_bala.ino:124:23: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings] if(Serial.find( ">" ) ) ^C:\Users\MURALI\Desktop\Arduino\bala_bala\bala_bala.ino:134:23: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings] if( Serial.find("OK") ) ^C:\Users\MURALI\Desktop\Arduino\bala_bala\bala_bala.ino: In function 'boolean connectWiFi()':C:\Users\MURALI\Desktop\Arduino\bala_bala\bala_bala.ino:164:22: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings] if(Serial.find("OK")) ^C:\Users\MURALI\Desktop\Arduino\bala_bala\bala_bala.ino:177:27: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings] if( Serial.find( "Error") ) ^Sketch uses 11,986 bytes (37%) of program storage space. Maximum is 32,256 bytes.Global variables use 719 bytes (35%) of dynamic memory, leaving 1,329 bytes for local variables. Maximum is 2,048 bytes.-------------------------------------------------------------------------------------------------2.here in your code AT command initially written doesnt gave any responsse so it jumped directly to loop without connecting to wifi.but i said that when i run another testing code , when I typed this AT COMMAND ,the is reply of OK.but iam not getting in your code.3 .for esp,when i took power from outside source nothing is worked either your or my testing code.but when i took power from arduino i.e vcc(3.3v)and gnd, it is working fine.please please clarify the above mentioned doubts.iam new to esp8266 and iam from eee too.this is my final year project which is about to finish in 10 days.so kindly clarify it.thank you.

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

    Thank you for the code.iam working with different sensors,but the process is same.I have few doubts in the code.please reply to the questions as soon as possible.1.where to write the CHANNELS API KEY in the code.i think here in this line String GET = "GET /update?key=[ThingSpeak_(Write)API_KEY]"; IS IT RIGHT ? 2. my esp8266 is of 115200 baud rate which i found. so both arduino and esp8266 are of different baud rates.so for this do i need to change the baud rates in code or shall i change the baud rate of esp8266 with new firmware.

    View Instructable »