loading

They day I read at hackaday (http://hackaday.com/tag/esp8266/) that a new $5 wifi module was available, I order a few of them to test. Now, a few weeks later I want to share my experience.

This is a very simple demo using the ESP8266 and Arduino to update a remote server (https://thingspeak.com/) using a digital temperature sensor.

These are really exciting times for the Internet of Things (r)evolution. Prices are coming down and the Maker community is eager to develop the next generation of all things connected.

The following setup could be done under $20. This is using off the shelf "pricey" components (like Arduino), but you could program your own MCU with UART support and make it cheaper.

Step 1: Materials

<p>awsome sketch ... I have to learn to use the WiFi module ESP8266 ... thanks al lot ! Bruno</p>
<p>https://www.youtube.com/watch?v=_A8iyLPsGAw</p>
<p>https://www.youtube.com/watch?v=_A8iyLPsGAw</p>
<p>wait a minute, you can just use ESP8266 module for that? It has GPIOs to which you can connect the temp probe and has even more memory than arduino to put your soft there, am I right?</p>
<p>yes. That's how I've got it running... no arduino of any sort. Just used the arduino IDE to upload the sketch on an ESP 8266 running nodemcu v2</p>
wow thats awesome
<p>Well I gave it a go WITHOUT schematic and it does not post to thingspeak.</p><p>I have two other devices that post just fine for multiple sensors so I know its not in my personal settings.</p><p>As far as the connection and from the way it is described above </p><p>(18B20-DQ)&gt;&gt;&gt;&gt;(4.7K)&gt;&gt;&gt;&gt;(3.3V) simply does not make sense. This means I am feeding the output from the DSB with a voltage reduced by the resistor. whereas the 18B20 will also be putting out a small voltage by way of a signal which means that I have two converging voltages (18B20)&gt;&gt;&gt;&gt;(4.7K)&lt;&lt;&lt;&lt;(3.3V) which is only going to result in heat In the resistor until something breaks down. I know I am missing something here that a schematic would show clearly.</p>
<p>It's a pull-up resistor to ensure the data line doesn't 'float' between 1 and 0. There's more of an explanation here:</p><p><a href="https://en.wikipedia.org/wiki/Pull-up_resistor" rel="nofollow">https://en.wikipedia.org/wiki/Pull-up_resistor</a> </p><p>:)</p>
<p>Great article, but I would not call Arduino Mini Pro pricey - it just ~$1.4 on eBay (technically it is a clone but I purchased many of them and never had a problem). The same is true for other components. ESP8266 module currently costs about $2.07. And temperature sensor $0.99. Assuming you already have power supply and 4.7K resistor, everything else can be purchased under $4.5 including international shipping. I thought I mention this because some people may not know that these components are available at much better prices than mentioned in the article.</p>
<p>wait a minute, you can just use ESP8266 module for that? It has GPIOs to which you can connect the temp probe and has even more memory than arduino to put your soft there, am I right?</p>
<p>There is an error in this piece of code:</p><p>if(Serial.find(&quot;&gt;&quot;))</p><p>{ </p><p> Serial.print(cmd);</p><p><br> }</p><p>else</p><p>{</p><p><br> Serial.println(&quot;AT+CIPCLOSE&quot;);</p><p><br> }</p><p>It should be like this:</p><p>Serial.println(cmd);</p>
<p>you can try:</p><p>if(Serial.find((char *) &quot;&gt;&quot;) ){</p><p>Serial.print(cmd);</p><p>}</p>
<p>Hi,<br><br>My string length is 52 to send values between 0 to 9 on thingspeak. </p><p>Serial.print(&quot;AT+CIPSEND=&quot;);</p><p> Serial.println(cmd.length()); // here length is 46</p><p>i want length to be 52, how can i change it in program. <br><br>I am able to upload using USB TTL and ESP8266 on teraterm. <br><br>Need help with arduino ... Thank you , please reply asap !</p>
<p>I've been trying two days now to get this to work and I'm tearing my hair here!</p><p>I've followed the guide but instead of powering the ESP from the arduino 3.3v I got a separate powerbar that gives me both 5V and 3.3 so I'm getting all the juice from there. Like some others here in the comments I just keep getting:</p><p>AT<br>AT+CIPSTART=&quot;TCP&quot;,&quot;184.106.153.149&quot;,80<br>AT+CIPSEND=49<br>AT+CIPCLOSE<br>AT+CIPSTART=&quot;TCP&quot;,&quot;184.106.153.149&quot;,80<br>AT+CIPSEND=49<br>AT+CIPCLOSE<br>AT+CIPSTART=&quot;TCP&quot;,&quot;184.106.153.149&quot;,80<br>AT+CIPSEND=49<br>AT+CIPCLOSE</p><p>etc. etc. when I try and run it and monitor it in the IDE, I followed <a href="http://www.instructables.com/member/RidhwanA" rel="nofollow">RidhwanA</a>'s suggestion to connect the reset of the ESP to the 3.3V to and I read that somewhere else to that it's needed for the thing to work.</p><p><a href="http://www.instructables.com/member/chrisrust" rel="nofollow">chrisrust</a> drawings made it a bit clearer to since I'm a noob and thought that the part of the code that says &quot;SoftwareSerial monitor(10, 11); // RX, TX&quot; ment that I should connect the RX from the ESP to 10 and the TX to 11 but still no go!</p><p>Is there anyway to check if the ESP really is getting a connection since my thingspeak refuses to upload!</p><p>If anyone want to see my version of the code it's here: <a href="https://github.com/Naesstrom/Arduino_temp_pcv/blob/master/arduino_temp_2/arduino_temp_2.ino" rel="nofollow">https://github.com/Naesstrom/Arduino_temp_pcv/blob...</a></p>
<p>Hi<br>Thank you for this amazing Instructable..<br>just a simple question..Why you used ConnectWiFi function as Boolean datatype and can we use it without Boolean??</p>
<p>Thank you for your code! I made some changes to log temperature and humidity from a DHT22 sensor. It works like a charm!</p>
<p>Ok.</p><p>I found a bug, i think it's the conversion fault....</p><p>Getting no value when temperature is less than 10.0... Anyone?</p>
<p>Found out what was the problem:</p><p>String tempF = dtostrf(tempC, 4, 1, buffer); -&gt;This doesn't work for values less than 10.</p><p>String tempF = dtostrf(tempC, 3, 1, buffer); -&gt;Use it for values less than 10</p>
<p>I would have loved to build this one but noticed there is no real schematic apart from a scratching in one of the replies</p><p>I was a little confuzed by the description of the connections above too.</p><p>Pretty good starting point tho if there is ever a schematic.</p>
<p>No need schematic. Just follow the connections.</p><p>Cheers</p>
<p>when I run this sketch, i show as below</p><p>AT<br>AT+CIPSTART=&quot;TCP&quot;,&quot;184.106.153.149&quot;,80<br>AT+CIPSEND=54<br>AT+CIPCLOSE<br>AT+CIPSTART=&quot;TCP&quot;,&quot;184.106.153.149&quot;,80<br>AT+CIPSEND=54<br>AT+CIPCLOSE<br>AT+CIPSTART=&quot;TCP&quot;,&quot;184.106.153.149&quot;,80<br>AT+CIPSEND=54<br>AT+CIPCLOSE<br>AT+CIPSTART=&quot;TCP&quot;,&quot;184.106.153.149&quot;,80<br>AT+CIPSEND=54<br>AT+CIPCLOSE<br>AT+CIPSTART=&quot;TCP&quot;,&quot;184.106.153.149&quot;,80<br>AT+CIPSEND=54<br>AT+CIPCLOSE<br>AT+CIPSTART=&quot;TCP&quot;,&quot;184.106.153.149&quot;,80<br>AT+CIPSEND=54<br>I cant upload to thingspeak. the 2 led on esp still on, I connect nothing to Uno. here is my code</p><p>#include &lt;SoftwareSerial.h&gt;<br> <br>#define SSID &quot; &quot; // I delete it when post here<br>#define PASS &quot; &quot; <br> // I delete it when post here <br><br>#define IP &quot;184.106.153.149&quot; // thingspeak.com<br>String GET = &quot;GET /update?key=EDPAJHIWQLX2A8VB&amp;field1=&quot;;<br>SoftwareSerial monitor(10, 11); // RX, TX<br><br>void setup()<br>{<br> monitor.begin(9600);<br> Serial.begin(9600);<br> <br> sendDebug(&quot;AT&quot;);<br> delay(1000);<br> if(Serial.find(&quot;OK&quot;)){<br> monitor.println(&quot;RECEIVED: OK&quot;);<br> connectWiFi();<br> }<br>}<br><br>void loop(){<br> <br> String tempF = String(5.4,DEC);<br> updateTemp(tempF);<br> delay(1000);<br>}<br><br>void updateTemp(String tenmpF){<br> String cmd = &quot;AT+CIPSTART=\&quot;TCP\&quot;,\&quot;&quot;;<br> cmd += IP;<br> cmd += &quot;\&quot;,80&quot;;<br> sendDebug(cmd);<br> delay(1000);<br> if(Serial.find(&quot;Error&quot;)){<br> monitor.print(&quot;RECEIVED: Error&quot;);<br> return;<br> }<br> cmd = GET;<br> cmd += tenmpF;<br> cmd += &quot;\r\n&quot;;<br> Serial.print(&quot;AT+CIPSEND=&quot;);<br> Serial.println(cmd.length());<br> if(Serial.find(&quot;&gt;&quot;)){<br> monitor.print(&quot;&gt;&quot;);<br> monitor.print(cmd);<br> Serial.print(cmd);<br> }else{<br> sendDebug(&quot;AT+CIPCLOSE&quot;);<br> }<br> if(Serial.find(&quot;OK&quot;)){<br> monitor.println(&quot;RECEIVED: OK&quot;);<br> }else{<br> monitor.println(&quot;RECEIVED: Error&quot;);<br> }<br>}<br>void sendDebug(String cmd){<br> monitor.print(&quot;SEND: &quot;);<br> monitor.println(cmd);<br> Serial.println(cmd);<br>} <br> <br>boolean connectWiFi(){<br> Serial.println(&quot;AT+CWMODE=1&quot;);<br> delay(1000);<br> String cmd=&quot;AT+CWJAP=\&quot;&quot;;<br> cmd+=SSID;<br> cmd+=&quot;\&quot;,\&quot;&quot;;<br> cmd+=PASS;<br> cmd+=&quot;\&quot;&quot;;<br> sendDebug(cmd);<br> delay(1000);<br> if(Serial.find(&quot;OK&quot;)){<br> monitor.println(&quot;RECEIVED: OK&quot;);<br> return true;<br> }else{<br> monitor.println(&quot;RECEIVED: Error&quot;);<br> return false;<br> }<br>}</p>
<p>did your problem solved? i am having same error...i am using esp8266_03 module</p>
<p>Please read my comment above. Hope this helps.</p>
<p>Hello,</p><p>I tried to connect a Mega Arduino , a sensor DS18B20 and esp8266 to send data from my sensor on the Internet.</p><p>After configuration, I sed https://codebender.cc/sketch:98754#thingspeak%20ds18b20%20esp8266.ino this code</p><p>but the data does not reach the server, why?</p><p>AT</p><p>AT + CIPSTART = &quot; TCP &quot;, &quot; 184106153149 &quot; 80</p><p>AT + CIPSEND = 47</p><p>AT + CIPCLOSE</p><p>AT + CIPSTART = &quot; TCP &quot;, &quot; 184106153149 &quot; 80</p><p>AT + CIPSEND = 47</p><p>AT + CIPCLOSE</p><p>AT + CIPSTART = &quot; TCP &quot;, &quot; 184106153149 &quot; 80</p><p>AT + CIPSEND = 47</p><p>AT + CIPCLOSE</p><p>Can anyone help me please ?</p><p>Thank you in advance</p>
<p>did your problem solved? i am having same error...i am using esp8266_03 module</p>
<p>Please read my comment above. Hope this helps.</p>
<p>i made this! part of my huge solar inverter controller project. Works like a charm. I even didnt bother to update the firmware, i just instructed the arduino to tell the esp to change port speed to 9600 at start up, and then change the arduino seriel port to 9600 also, and carry on. (too lazy to learn how to update firmware unless i really needed it lol)</p><p>anyway, i have a question. I need to have more than one feed (actually about 30)</p><p>How do i go about this?</p>
<p>can you please share your code?</p>
<p>Hi why mi in serial ports arduino duemilanove writing?:</p><p>AT</p><p>AT + CIPSTART = &quot; TCP &quot;, &quot; 184106153149 &quot; 80</p><p>AT + CIPSEND = 47</p><p>AT + CIPCLOSE</p><p>and temp no send to thingspeak.com ....</p>
<p>I got the same problem. To solve I connected RESET to VCC 3.3V. Hope this helps.</p>
<p>I have same problem, did you solve? if yes, please send me instructions, thank you !</p>
<p>Cool!</p>
<p>i couldn't understand how to upload new firmware to esp2866 can you explain it clearly? What do u use to upload the firmware to esp2866? thank you for sharing the new idea.</p>
<p>try with this: (follow step by step)</p><p><a href="http://www.xess.com/blog/esp8266-reflash/" rel="nofollow">http://www.xess.com/blog/esp8266-reflash/</a></p><p>you can find a good firmware here:</p><p><a href="http://www.instructables.com/id/Intro-Esp-8266-firmware-update/" rel="nofollow">http://www.instructables.com/id/Intro-Esp-8266-fir...</a></p>
<p>thank u </p>
<p>After some tinkering, It works! Thanks. I used DHT22 for temp and humidity.</p><p><a href="https://thingspeak.com/channels/43907" rel="nofollow">https://thingspeak.com/channels/43907</a></p>
<p>inorder to post data to the website POST has to be used . Why GET method is used here ? Could you please explain in detail </p>
<p>Both can be used at thingspeak with same effect.</p><p>https://thingspeak.com/docs/channels#update_feed</p>
<p>I want to thank noelportugal for the great instructable. My project is working now but I was unable to get it to work initially so I thought I would post a schematic and the code that is working for me. My ESP8266 is running the 0018000902 firmware. Also thanks to the other posters for your help. </p>
<p>that circuit diagram is very helpful (I almost said sketch, but that terminology might be confusing in this context!) but a couple of questions:</p><p>1) why 3.3v into raw? shouldn't that be vcc? if raw is regulated wouldnt 3.3v be too low?</p><p>2) shouldnt GPIO0 and GPIO2 be tied high in normal operation to avoid erratic behaviour rather than left floating? </p>
<p>Very amazing project. Wifi is suitable for the indoor monitor. For the outdoor monitoring, i recommend the Sub_G solution based on 433MHz. Only one module with 18b20 sensor. Pls check as below:</p><p><a href="http://www.appconwireless.com/NEWS/shownews.php?lang=en&id=13" rel="nofollow">http://www.appconwireless.com/NEWS/shownews.php?lang=en&amp;id=13</a></p><p><a href="http://www.appconwireless.com/PRODUCTS/showproduct.php?lang=en&id=10" rel="nofollow">http://www.appconwireless.com/PRODUCTS/showproduct.php?lang=en&amp;id=10</a></p>
<p>I have used several 433mhz devices and the ESP8266 is so much more versatile and easy to use that IMHO I can't imagine many cirumstances where it wouldn't be the better choice - the range is easily comparable to the 433mhz devices.</p>
<p>I agree. The LoRa module RF1276 based on Sub-GHz is more amazing solution since I have seen. The range is up to 56Km long. There is a link for this information.</p><p>http://www.appconwireless.com/NEWS/shownews.php?lang=en&amp;id=23</p>
<p>thanks a ton..</p>
<p>I'm working on incorporating the ESP8266 into my Automated Garden Controller project thanks to the fine work you've shared here.</p>
<p>thank you instructable, i did many projects according to your advise and instructions, but know i have a project using ESP8266, i tried this code but its gives error wile compiling </p><p>OneWire oneWire(ONE_WIRE_BUS); </p><p>DallasTemperature sensors(&amp;oneWire); </p><p>so please any advise</p>
<p>The code seems to be missing:</p><p>#include &lt;OneWire.h&gt;<br>#include &lt;DallasTemperature.h&gt;</p>