DIY Smart Home

Meet the Arduino Killer: ESP8266

James Bruce 16-11-2015

Wi-Fi is an essential bit of kit for any Internet of Things (IoT) DIY projects, but our favorite Arduino doesn’t come with Wi-Fi, and adding in a Wi-Fi shield can bring the total cost to around $40. What if I told you a there’s an Arduino-compatible dev board with built-in Wi-Fi for less than $10? Well, there is.


Meet the Arduino Killer: ESP8266. It was only a matter of time before the crown was stolen from the shiny head of our dear Arduino development board. Is it possible to fall in love with a circuit board?

Catchy names aside, the ESP8266 (also known as NodeMCU) was originally marketed as a low cost Wi-Fi add-on for Arduino boards, until the hacker community realized you could cut the Arduino out of the equation entirely.

In less than a year, the ESP8266 has rocketed in popularity, and is now so well supported and developed that if you’re currently using Arduino, you need to stand up and take note. Buy one now, then follow along with this guide to get started programming your ESP8266 – all from within the familiar Arduino IDE.

You’re not limited to using the Arduino IDE of course – they’re compatible with Lua too (which looks like a slimmed down Python to my novice eyes), but since we’re tackling this from the perspective of those us who have learnt on Arduino, that’s what’ll we cover exclusively today.

There’s quite a few models of ESP8266 around now, but I’m going to go ahead and recommend this one: ESP-12E (also known as NodeMCU 1.0, or it’s newest sibling NodeMCU 2.0).


It’s a little more expensive than the others ($6.50 compared to $4!), but includes the serial driver needed to program the chip, and has a built-in power regulator, as well as lots of IO pins. It’s widely supported and really doesn’t need anything apart from a USB connection for programming or power, so it’s the easiest to work with. If you buy any other kind of ESP8266 board, you may need a separate 3.3v power regulator, and a suitable FTDI connection for programming.

Getting Started with ESP8266-12E and Arduino

First, install the serial drivers [Broken URL Removed] for this board. You may need to disable KEXT signing if you’re running El Capitan due to new security systems.

Next, we need to enable support for ESP8266 from the Arduino IDE’s board manager. Open up Preferences, and enter the following URL where it says Additional Board Manager URLs:

arduino board manager URLS


Hit Ok, then open the Boards Manager from Tools -> Board menu, search for esp8266 and install the platform. You should now see a choice for NodeMCU 1.0.

select board

Leave the CPU and upload speed as is, and select your newly install serial port. On Mac, this appears as cu.SLAB_USBtoUART.

As a first program, I’d suggest the simple Wi-Fi scanner – find it from File -> Examples -> ESP8266WiFi -> WifiScan. Note that it’s quite slow to upload, but eventually it’ll say “done uploading” and at that point (not before, or you’ll break the upload process), you can open the Serial monitor. You should see something similar to this:


wifi scan test esp8266
Success! Now, let’s try connecting to one.

Here’s an absolutely simple barebones code for connecting to a Wi-Fi network. It doesn’t do anything other than just connect, but it’s something you can add too later. Just remember to change the YOUR_SSID and YOUR_PASSWORD to your Wi-Fi details. Upload, open the Serial console and you should see it connecting.

const char* ssid = "YOUR_SSID";
const char* password = "YOUR_PASSWORD";   

WiFiClient wifiClient;

void setup() {
  Serial.print("Connecting to ");
  WiFi.begin(ssid, password);
  while (WiFi.status() != WL_CONNECTED) {
  Serial.println("WiFi connected");  
  Serial.println("IP address: ");


void loop() {

Isn’t it great how ridiculously simple that was?

Before we carry on, here’s the pinout diagram – it might come in handy later. Note that the pin numbers referred to in code are the GPIO numbers, not the D0-16 probably written on your board PCB. If you absolutely, positively cannot figure out why a sensor isn’t working, you’ve probably mixed the pin numbers up.



Quick Smart Home Sensor with MQTT and DHT11

Here’s a practical example you can put to use straight away to monitor your home. We’ll be adding a DHT11 temperature and humidity sensor, then reporting the values using the MQTT protocol over the Wi-Fi network, in my case to an OpenHAB DIY home automation system (if not, you might want to read our beginners guide to getting OpenHAB up and running on a Raspberry Pi Getting Started with OpenHAB Home Automation on Raspberry Pi OpenHAB is a mature, open source home automation platform that runs on a variety of hardware and is protocol agnostic, meaning it can connect to nearly any home automation hardware on the market today. Read More , and part 2, which deals specifically with installing an MQTT server OpenHAB Beginner's Guide Part 2: ZWave, MQTT, Rules and Charting OpenHAB, the open source home automation software, far exceeds the capabilities of other home automation systems on the market – but it's not easy to get set up. In fact, it can be downright frustrating. Read More ).

On the wiring side, connect the DHT sensor to GND, 3.3v, and ~D4 (or GPIO 2). That’s all we need for now.

Download these MQTT and DHT libraries. Even if you already have them, download these ones anyway, backup what you have, and overwrite with these. The latest DHT11 library from Adafruit uses an automatic algorithm for determining the speed at which data is read from the sensor, but it’s buggy on ESP8266 and 90% of the time results in failed readings.

With the old version 1.0 of the library I’ve included in the download, you can manually change the timing: 11 works best for these ESP2866 boards. I also went through many copies of the MQTT library trying to find one a good callback function, finally landing on the one included. You’ll need to restart the Arduino IDE after replacing these.

Here’s the complete code for the project. At the top are all the variables you need to change, including Wi-Fi details, MQTT server (a URL can be used instead if using a cloud server, though there’s no authentication in place), and channels to publish data on.

Here’s how it works and a few notes:

  • First we connect to the Wi-Fi, then to the MQTT server, then begin the main loop().
  • In the loop, we poll the DHT sensor every 60 seconds and publish readings to the relevant MQTT channels. Again, if you find most of the readings results in a failure message, you have the wrong version of the DHT library – downgrade to v1.0.
  • client.loop() passes control to the MQTT library, allowing it to react to incoming messages.
  • There’s a messageReceived() function where we handle incoming messages – just do a simple if statement to compare the payload with the message you’re expecting. You could use this to activate a relay, for instance.
  • After running these for a few days, I found they would randomly stop working – I assume this is some kind of memory leak, but given I don’t have the coding skill to deal with that and it might be with the core libraries, I’ve opted for a simple soft reset every day. Exactly one day after the sensors nodes are first activated, they will restart themselves.
  • When powering these cheap DHT11 modules from 3.3v, the humidity values are far lower than they should be. I’ve solved this with a simple multiplication, and calibrated against a commercial sensor. I’d advise you to confirm against your own known source too, before relying on the readings. Alternatively, power them with 5V – but you must place a 5v-3.3v logic level shifter between the data pin and the ESP8266, or you will damage it.

If everything went well, you should now be receiving sensor readings in your MQTT broker, and can go ahead with connecting these to OpenHAB as detailed in part 2 of our beginner’s guide OpenHAB Beginner's Guide Part 2: ZWave, MQTT, Rules and Charting OpenHAB, the open source home automation software, far exceeds the capabilities of other home automation systems on the market – but it's not easy to get set up. In fact, it can be downright frustrating. Read More , where I also showed you how to graph the data.

humdity graph from openhab

Farewell Arduino, we loved thee so. Just kidding: not everywhere in my house can even get Wi-Fi, so for those spots I’ll still need a mesh network with Arduino and RF receivers.

For a fun project, check out how to make a Wi-Fi button with the ESP8266 How to Make Your Own Wi-Fi Connected Button With ESP8266 In this tutorial, you'll learn how to create a Wi-Fi-enabled button using NodeMCU and IFTTT. Read More .

But what will you make with ESP8266? Any projects using ESP8266 you’d like to see written up at MakeUseOf? Let us know in the comments!

Related topics: Arduino, Electronics, Internet of Things, Smart Sensor.

Affiliate Disclosure: By buying the products we recommend, you help keep the site alive. Read more.

Whatsapp Pinterest

Leave a Reply

Your email address will not be published. Required fields are marked *

  1. JM
    January 27, 2020 at 11:41 pm

    2015: Meet Arduino Killer
    2020: Arduino is alive and kicking

    How many iPhone Killers, RPi Killers, Arduino Killers have to fail to kill until we stop advertising products as "other-product-killer"?

    • James
      January 28, 2020 at 8:43 am

      Well, you clicked on it, so it did its intended job.

  2. Phil Jones
    August 10, 2018 at 7:01 pm

    Great article, thanks. However, I experienced an issue with the URL that is listed for Additional Board Manager URLs:

    However it does work if you change it to the address in the screenshot:

    Please can you update this in the article?

  3. russell broomhall
    January 28, 2018 at 2:54 pm

    i want to monitor the temp of hot water in a building and use my iphone to see the temp and be notified if the temp drops below a certain limit.

  4. Bill Purta
    June 18, 2017 at 5:57 pm

    I am trying to learn how to use a wifi connected microcontroller to log multiple analog and digital sensors to a file on my local wifi network for an MS Access database to churn thru.
    Adafruit has the HUZZAH32 that looks enticing for my project with plenty of GPIO's and Analog pins , USB to serial converter and LiPo battery charger ( I purchased one but am stuck. The problem is there is no code that I can find that will to do what you have made in your excellent data logging tutorial. It seems everyone is focused on the Internet of Things route which I can not do in a secured LAN environment, plus it adds another layer of things that can stop working. Would you consider making the same project above using the newer HUZZAH32? I would be happy to purchase one or two for try.

    • James Bruce
      June 22, 2017 at 9:46 am

      Unfortunately, the ESP32 doesnt yet have a simple Arduino board manager install available, so thats not a simple thing to do. I'd recommend buying a $5 NodeMCU board from China instead, and waiting for better support to come for these ESP32 things. Do you really need an on-board charger circuit? It's easy enough to just use a high capacity mobile battery pack to power the NoeMCU over USB...

      • bill purta
        June 24, 2017 at 9:39 pm

        Good point on staying with something that is well known and well supported. Also, I really don’t NEED the onboard battery charger either. I just thought it was cool to have just in case but it is not worth the added cost. I do have a Adafruit Feather HUZZAH with ESP8266 WiFi but again, it has the LiPo charger and costs 2-3X standard ESP modules.
        So I could better follow your tutorial, I shelved the HUZZAH and ordered a ESP8266 Module ESP-12E & DHT22 sensor from It came in a couple of days ago. I am having difficulty in getting your code to compile without errors.
        The first error encountered was easy to find and fix. Line one of the barebones code is missing the next to #include. Once added the code worked perfect.
        The error I am encountering is related to the MQTTClient.h library I downloaded from your tutorial.
        I receive this error…
        “WARNING: Category '' in library MQTT is not valid. Setting to 'Uncategorized'
        C:\ArduinoPrograms\ESP8266-MQTT\ESP8266-MQTT.ino:8:24: fatal error: mqttClient.h: No such file or directory
        compilation terminated.
        exit status 1
        Error compiling for board NodeMCU 1.0 (ESP-12E Module).”

        I believe it then treats the library file as bad and looks for another one. I believe this is the case because if I remove the library from my library directory I only receive the following error message…
        “C:\ArduinoPrograms\ESP8266-MQTT\ESP8266-MQTT.ino:8:24: fatal error: mqttClient.h: No such file or directory
        compilation terminated.
        exit status 1
        Error compiling for board NodeMCU 1.0 (ESP-12E Module).”

        If you like, you can email me directly using my Gmail address while we work this thru and then post the final answer to the forum. This will also allow me to elaborate on my projects that I need to use the ESP8266 in a secured LAN environment.
        Thank you for taking the time to help myself and others- this is very fun stuff.

        • James Bruce
          June 27, 2017 at 8:13 am

          Hi Bill. Since you're getting this error in both cases:

          “C:\ArduinoPrograms\ESP8266-MQTT\ESP8266-MQTT.ino:8:24: fatal error: mqttClient.h: No such file or directory

          the library hasnt been installed correctly (or your Arduino software version doesn't like it). Start by downgrading to version 1.6.5 if you're on something higher - that's what I've used, and they usually break something every new version. Then please ensure you've downloaded the ones linked in this article, deleting any similar ones already in the libraries folder, and use only the ones linked. You probably need to rename the folder too, as when you unzip it from Github it'll has the wrong name. Get rid of the "-master" bit at the end of the folder name, and rename it to all lowercase, no spaces - that sort of thing.

          The error just means it cant find the library file, so nothing will work until it can.

  5. Dario
    June 2, 2017 at 2:02 pm

    Thank you very much for this tutorial!

    I was wondering, how many sensors can be connected simultaneously to the same ESP8266-12E ?

  6. Ashwini
    May 21, 2017 at 10:57 am

    I am using nodemcu v2 . I got error after uploading code. I am posting error below:
    Fatal exception (0): epc1=0x4021a4dc, epc2=0x00000000, epc3=0x00000000, excvaddr=0x00000000, depc=0x00000000?

    I searched on net but I didn't get solution.would you tell me what is the problem?

  7. mbob
    November 12, 2016 at 8:28 pm

    Thank you! Read your article, bought a ESP8266-12E dev board for a few bucks, downloaded the Arduino IDE and followed the instructions in your article. No previous Arduino experience. So far, everything works.

    Question: (I'll search online, but perhaps you'll be faster and clearer.) Right now the ESP8266 is powered through a USB connection to my Mac, which also allows communication. Once I've uploaded the code, is it possible to disconnect the Mac, power the chip through the USB using a USB wall-power supply, and have the uploaded code run? (I'd then communicate with the chip by other means, either purely wi-fi or through a serial, FTDI, connection.) Also, need I be concerned about power supply voltage if I provide power via USB?

    Again, thank you so much! And please forgive my ignorance. This is new to me, but it's fun.

  8. Tyn
    October 21, 2016 at 2:05 am

    How can I turn off the status LED that blinks every time data is published?
    I'm getting insane because it's blinking all night in my sleeping room and robbes me my sleep.
    It drives me crazy.

    • James Bruce
      October 21, 2016 at 8:00 am

      I've searched around but can't find a way to do this - your best bet is a small bit of electrical tape.

      • Tyn
        October 21, 2016 at 3:15 pm

        Ok thanks. Thought there would be a more elegant solution than this. :(
        Anyway thanks for the great tutorial works perfectly. I love the esp12-e bought a lot of them already.

  9. musthtc
    May 16, 2016 at 5:07 pm

    Dear James:
    It's nice to see your post, but I have a question in the first program(WifiScan),beside the AP's name(SSID),it's there anyway to show their MAC address? thx.

    • James Bruce
      May 18, 2016 at 8:53 am

      Copied from a similar question on the Github page: "WiFi.getNetworkInfo() to get all at once or MAC only WiFi.BSSID()"

  10. Bob Adler
    April 1, 2016 at 6:55 pm

    cant seem to get mqtt_dht library into arduino

    • James Bruce
      April 2, 2016 at 7:04 am

      It's not a library, just copy paste it into a new project. You'll need the other libraries for it though. Post with any specific errors if you get them.

  11. Tresspasser
    March 13, 2016 at 8:26 pm

    "There’s quite a few models of ESP8266 around now, but I’m going to go ahead and recommend this one: ESP-12E (also known as NodeMCU 1.0, or it’s newest sibling NodeMCU 2.0)."

    I think calling this model "ESP-12E" is misleading. ESP8266-12E still requires a separate 3.3v power regulator, and a suitable FTDI connection for programming. It is not easier to use than the other versions. It can be found here:

    [Broken Link Removed]

    The board you are suggesting is a "ESP8266 12E Development Kit".

    • Terry Thomas / Atlanta, Georgia USA
      October 29, 2017 at 11:55 am

      404 ERROR:

      Sorry, the page you have requested can not be found.

  12. Joe
    March 10, 2016 at 2:33 pm

    FYI, the Arduino IDE now has built-in defines that map GPIO# to D#. Just reference D1, D2,... Dn in your code and it will automatically substitute the right GPIO number. For example:

    wire.begin(0x3c, D2, D3);

    It just works! No need to keep referencing the schematic, just use the silkscreen D number.

    • James Bruce
      March 10, 2016 at 2:40 pm

      Awesome tip.

      I screw up the pin numbers. Every. Single. Time.

  13. dbabits
    February 25, 2016 at 10:50 pm

    Wrt "you must place a 5v-3.3v logic level shifter between the data pin and the ESP8266, or you will damage it" - could you show an example, or elaborate a bit more - I just don't know what logic level shifter is, and don't want to burn my new shiny ESP8266.
    I intend to power it from 5v phone charger, I have many of those.

    What parts are needed and how to fit them together, if you could.

    Thank you!

    • James Bruce
      February 26, 2016 at 10:00 am

      Here's a good guide: [Broken Link Removed]

  14. dbabits
    February 23, 2016 at 7:40 pm

    Is it possible to connect Aeotec Z-Stick to this board and code a rule to have one sensor trigger another?
    I know I could do it with Raspberry Pi + OpenHab + MQTT, like your other tutorial shows, but I want to avoid having Rpi alltogether.

    one reason why: Linux OSs such as the ones in Rpi may not survive abrupt power shutdown, they require graceful shutdown, which makes RPi unsuitable for my purpose.

    My goal is to connect an actuated Z-Wave water valve to a Z-Wave water sensor and have it shut down water in the house when water leak is sensed.

    The setup works with Samsung SmartThings hub, but I'm unhappy that code runs in the cloud, I want local execution, independent of Internet, preferably using ESP8266 or Arduino.

    Any pointers appreciated!

    • James Bruce
      February 24, 2016 at 9:13 am

      No. You need drivers for the Z-Wave controller, if you you need to use Z-Wave that is. Otherwise, consider skipping Z-Wave entirely and using custom components directly. You would still have remote control over them with a simple MQTT or web interface.

      • Anonymous
        February 24, 2016 at 3:03 pm

        Unfortunately, the actuator is not so easy to DIY.
        And the one I'm using, talks Z-Wave.

        Is it not possible to code the driver for Z-Wave controller (Aeotec Z-Stick) in C, inline with the other code and upload it to this ESP8266 board?

  15. sandeep
    February 22, 2016 at 7:43 pm

    Excellent tutorial, followed to the letter and got it to work.

    However you might wanna add the MQTT windows git url for us poor windows users. :). [] <- this one worked for me.

    + usage of char* is throwing a deprecation warning on latest arduino IDE, though we can just ignore that.

    And finally i had to move the f2s() function somewhere above loop()/setup() for it to stop breaking the code.

    and with that I'd like to thank you again for pointing me towards learning something really cool. Cheers.

  16. yuvraj upadhyay
    February 17, 2016 at 5:19 am

    can u just provide the circuit diagram of the same (whole project )

  17. PY
    February 7, 2016 at 8:05 pm

    I cannot get the drivers to work with the module! This has been 4 days and I am not getting anywhere..

    • James
      February 7, 2016 at 8:20 pm

      Do you actually have a NodeMCU module, or are you trying with a raw ESP8266 chip? Can you see it listed in ports? If not, you have to install CH430 drivers, the USB chip on them.

      • PY
        February 7, 2016 at 9:55 pm

        I bought the exact model (ESP12E) you recommend from AliExpress. I also installed the drivers from Silicon Labs. When I connect the ESP, there is just no recognition with the computer. I cannot select a Port in the Arduino IDE..

        • James
          February 7, 2016 at 10:04 pm

          Some are fitted with CH430 driver chips, not UART bridge from Silicon Labs.

        • PY
          February 7, 2016 at 10:10 pm

          I see, do you have a link for that driver? Thanks so much, looking forward to start coding...

  18. Hans
    February 7, 2016 at 1:53 pm

    Hi James,

    Thanks for your tutorial, after searching the Internet I've found yours and it was the best to get started. Although demo's like WiFiScan and WiFiWebserver work perfect I discover a problem.

    The NTP Client sketch generates a compilation error: "exit status 1'sendNTPpacket' was not declared in this scope".

    Do you have any idea what causes this problem?

    And a second, more common, question. I'm looking for a sketch for this board like the POP3 Notifier from Martin Coolen. I can't find one :-( Do you have any suggestion?

    Regards, Hans.

  19. Tommy
    January 29, 2016 at 9:13 pm

    Hi James,

    I'm really interested in using one of these boards to try do "pulse counting" on my power meter outside and then feed it into OpenHAB using MQTT.

    I've found a few articles but they don't use MQTT.

    It might be something you'd be interested in looking into and writing up?

    • James Bruce
      January 30, 2016 at 9:40 am

      Hi Tommy. I'm afraid I have no idea what pulse counting is, but I'm about to submit a tutorial that involves NodeMCU/ESP8622 with MQTT for Siri control, perhaps something in that will help. I'm hesitant to work with anything involves the consumer power board, as I'm pretty sure that's illegal here in the UK!

      • Tommy Sharp
        February 9, 2016 at 3:53 am

        Hey James, most "smart" power meters that get installed by the power companies now have an LED that pulses normally 1000 times per KwH of energy used. So what I'm talking about is using a light sensor that simply gets taped to the meter over the led and sends an MQTT signal to openHAB every time it detects a pulse.

        So no playing with electrical wires at all :-)

  20. Loral
    January 16, 2016 at 7:25 pm

    Hi James,

    Thanks for another awesome tutorial. I really do appreciate how detailed and easy to follow your tutorials are! I was able to get my esp8266 setup in the Arduino ide and sending and receiving mqtt messages in no time following your guide.

    One side note I think your memory leak issue could be due to lines 110 and 111 in your program. You are declaring the tPayload and hPayload variables inside the main loop of your program so you are creating new ones every time it loops. If you declare tPayload and hPayload outside of the loop where you declare the rest of your MQTT variables and then just updated their value inside the loop that might solve your problem.


    • James Bruce
      January 28, 2016 at 10:14 am

      Hi Loral - excellent advice, thank you!

  21. akash
    January 14, 2016 at 5:09 pm

    hi james,

    i am a hobbyist and i am working on nodemcu 12e, but i am facing a problem with it.
    how to connect it with relay board and make GPIo pins high or low through server. please help me out with this

    thanking you,

  22. jonas
    January 4, 2016 at 5:34 pm

    'f2s' was not declared in this scope...

    • Chrisvs1
      January 6, 2016 at 10:42 am

      I Got the same error

  23. John
    December 30, 2015 at 12:54 pm

    Hi James,

    Thanks for the awesome tutorial. I have been following your tutorials for some weeks now. It seems like esp8266 is capable of many home automation projects. I tried ir remote controlled home automation using Arduino yun and it works fine. Is similar project also possible with esp8266? Also, can I use esp8266 to control my television set using mobile app? If yes, I would really appreciate if you have your next tutorial on that.


    • James Bruce
      December 30, 2015 at 2:16 pm

      Thanks for the kind words John, I'll see what I can do about a web-controlled IR thing - seems like a great way to add cheap IR control nodes for OpenHAB.

  24. Syed
    December 16, 2015 at 6:18 am

    Thanks for the tutorial, I finally got DHT22 sensor with Rpi and ESP-12 setup. I am very new to all this, so trying to figure out how I do all this with board not connected to my PC where I was running arduino IDE to send commands. I read something on flashing the code to the chip and restarting so everything runs standalone. Any simple step-by-step tutorials such as this somewhere?

    Also, in the code above I did not understand why humidity and temperature are adjusted like this: h = h*1.23; t = t*1.1;
    And I had to move the float to string code further up because char* f2p was not declared yet when it was used. Not sure if I made some mistake but it worked after moving that part up.


    • Syed
      December 16, 2015 at 7:18 am

      Never mind, I found out that it works without any flashing and arduino IDE takes care of that. This is amazing! :)
      But I'd still like to know if h=h*1.23 is for some reason in the code.
      Thanks James, I am setting up lots of sensors using your tutorials! And backing the Pine too!

      • James Bruce
        December 16, 2015 at 10:31 am

        This was my attempt at fixing the numbers because they were just too low. In retrospect, this doesn't work - you really need a level converter on the signal.

        • Syed
          December 16, 2015 at 2:59 pm

          I see. Mine was showing values that were little high so removed those conversions, now I get 75F and 50%, which are reasonable i think. Forgot to mention that I have 4.5K resistor pull up on DHT22 Pin2.
          So you think the 5V from my phone charger is making the ESP-12E erratic? I'll try buying the level converter and report my findings. Thanks!

        • James Bruce
          December 16, 2015 at 3:26 pm

          Your phone charger 5v is fine, I think it's the 3.3v being supplied to the DHT sensor that's the problem, at least on mine. I might try powering from the VIN pin instead..

        • James Bruce
          December 16, 2015 at 3:27 pm

          Actually, yeh, might be no need for a level converter at all if I just supply it with the right voltage ;)

        • Syed
          December 16, 2015 at 3:52 pm

          Great thanks! Awesome tutorials, please keep them coming. ESP-12E is so easy to deal with.
          Also, something trivial, I needed #include in the barebones wifi code above for it to work.

        • Syed
          December 16, 2015 at 4:35 pm

          Sorry, in the above comment I meant #include followed by ESP8266WiFi.h inside the angle brackets. The html format does not allow me to add angle bracket.

  25. pj jones
    December 11, 2015 at 10:11 am

    Hi Brian - First of all THANK YOU for introducing me to this little gem! What a great product and great instructions too - thanx.
    I am running Arduino on Linux and it keeps saying it cant find the com port. What do I need to do to fix this

    Thanx Matey :¬)


    • pj jones
      December 11, 2015 at 1:42 pm

      Hi All - just in case anyone is following this thread - I will update where I have got to. There was a linux issue with port authority. So I had to update that. Then I have fiddled with the arduino ide settings back and forth clicking this and clicking that and trying all the option and i have somehow got it to produce something via the serial monitor. Unfortunately I can tell you guys what I did to get it to work as I tried all sorts of tinkering. I am getting a name of a wifi hub - so some success - I am gonna try some other progs now. pj

      • pj jones
        December 11, 2015 at 2:03 pm

        read "serial port permissions" when i say "port authority".
        I was getting a lot of rubbish being displayed on the serial monitor screen until i changed it to 115200 baud - then - kerching a whole load of wifi signal names flashed infront of my eyes.
        This certainly looks like a great chip but it needs a lot of configuring/working out first. For all those questioning this chip - It is acheivable.
        I am no means a techie persay but it takes a little bit of nowse.

  26. Joe Q.
    December 9, 2015 at 7:18 pm

    Thanks for posting this. I have a very similar setup going right now, with an ESP8266 dev board (almost identical to the one in your picture) connected to a DHT22. Temperature is read every minute and uploaded to Thingspeak. I find that once you've arranged the pin-out properly, the ESP8266 dev board seems about as easy to use as a typical Arduino.

    Thingspeak itself is a very handy service, but I'm thinking of moving to MQTT as it seems to be something of a standard, and better suited to integrating a lot of sensor data (Thingspeak has limitations on how often one can add data to its channels).

    • Joe Q.
      December 9, 2015 at 7:21 pm

      I should add that I'm almost a total novice (not an engineer, I have no background in C, minimal background in Python, and only learned how to write sketches for Arduino by tutorials and copy-paste). And even I was able to get the ESP8266 to work. Having it on the dev board really helps.

  27. Andres Porras
    November 25, 2015 at 3:49 pm

    Can I have the same functionality with the NodeMCUv2?, program it using Arduino IDE? I'm trying to upload MinIMU-9v3 data to ThingSpeak servers using an ArduinoProMini and ESP8266-01. I think I can simplify it using only NMCU2 and IMU9.

    • James Bruce
      November 26, 2015 at 9:11 am

      I'm not familiar with that sensor, but I bvelieve support for i2c is fine on NodeMCU, so you shouldnt have any issues.

  28. Fik of borg
    November 17, 2015 at 2:09 pm

    Self-settings wifi NIST clocks came to mind, if the modules have enough I/O pins to multiplex four LED digits (which they seem to have).
    We have at least one blackout per week where I live, so there are always several clocks blinking 12:00

  29. Anonymous
    November 16, 2015 at 7:02 pm

    here are pinouts for the nodemcu board

    I use one for a MQTT messenger for open door status in my garage so I just plug mine into a USB wall wart since I have an outlet near where I have the board mounted

    This is the board I am using for sensing if my garage door is open and then publishing an MQTT message:

    if you don't mind spending a few more dollars, you can buy the sparkfun ESPThing (which has a built in battery charger)

    handy to solar charge during the day and run off of battery at night. I use one of these in my garden for water sensing, etc.

  30. Steve
    November 16, 2015 at 5:17 pm

    It's an informative article. During development the ESP8266-12E is powered through the USB connection. How are you powering your board when you deploy it power source, input pins, etc.)?

    • Anonymous
      November 16, 2015 at 6:53 pm

      Hi Steve,

      I am using a nodemcu board for a monitoring device to determine if my garage is open or closed. you can power it from usb if you want (I just have mine plugged into a USB cable that is tied to a usb wall wart). there is a Vin (5 volts) that you might be able to use, but I am not sure if it is regulated.

      If you don't mind spending a few more bucks (around $16 for the board), the sparkfun ESPThing is worth it. It has a built in battery charging circuit. so, if you want to put a lithium battery along with a little solar panel, you could charge the battery during the day and use battery at night. the sparkfun board is here:

      This is also handy if you are looking for the pinouts for the nodeMCU:

      you can buy these things off of ebay for $6 - 10 ( )

    • James
      November 17, 2015 at 10:27 am

      I'm using some of the many old USB chargers I have lying around. I prefer mains power for everything, though I assume you can make 3.3v with batteries. I just generally hate batteries ;)

  31. Vferg
    November 16, 2015 at 2:33 pm

    Thanks for the write up! This is the most informative article I have seen on here in a while. I haven't dealt with any ESP8266 boards as of now but after this article I am seriously considering getting 1 to try out.


    • Anonymous
      November 17, 2015 at 3:29 pm

      for the price, you just cant beat it.

  32. Gavin
    November 16, 2015 at 1:38 pm

    Looks Very interesting. Easier security cams I hope?

    • Gavin
      November 20, 2015 at 10:01 am

      Is it possible to attach a camera to this?

      • James Bruce
        November 20, 2015 at 7:08 pm