Measure Wi-Fi Signal Levels with the ESP8266 and ThingSpeak

Oh, my. I am sure you have been hearing about the Internet of Things… The IoT! You might be wondering how to get started with i(o)t. There are many places to start. You might be interested in the data that devices collect and analyzing it or you might be interested in how to deploy thousands of sensors around a factory floor to better understand how efficient things are. You might just want to tinker. Be the cool person at the party talking about Arduino, Raspberry Pi, and Maroon 5. If you want to try out a “thing”—a small, connected device—that can measure data, I will help you get started with a quick tutorial using the ESP8266 “thing”.


First, you need to go buy a thing on Amazon. I recommend for this project an ESP8266-compatible device like the NodeMCU. Don’t be scared. Add it to your Amazon shopping list or ask Alexa to buy you one. It’s $8.

ESP8266 NodeMCU

Other parts that you will need:

  • Laptop
  • Micro USB cable


While you are waiting for your Amazon stuff to arrive, you can learn about ThingSpeak.

ThingSpeak IoT Platform

ThingSpeak is where we are going to store the data collected by our thing and where we can see the data that we collected. Visit and Sign Up for an account. This will just take a minute, and the user accounts are free. Once you have a user account, you need to create a channel. ThingSpeak channels are where data gets stored. Create a new channel by selecting Channels, My Channels, and then New Channel. Name the channel “ESP8266 Signal Strength” and name Field 1 “RSSI”. Click “Save Channel” at the bottom to finish the process.


Arduino Setup

Once the ESP8266 comes in the mail in a couple of days, you need to gather a few more things to be able to program this thing. You will need a laptop and a micro USB cable (like the one that you charge a phone with). On the laptop, we need to install some software to be able to program the ESP8266. Visit and install the Arduino IDE.

Arduino IDE

Once the Arduino IDE is installed, open the program so we can do a couple of setup steps to get it ready to program ESP8266 devices. Under File, Preferences, and Additional Boards Manager URLs, add this link: – this will allow the Arduino IDE to manage ESP8266-compatible boards.

Arduino Preferences for ESP8266 programming

Close and reopen Arduino. Click on Tools, Board, and Boards Manager…. to open the board manager. The Arduino IDE will load the Additional Boards URL that you entered in the preferences.

ThingSpeak Library

Arduino needs to have a library installed in order for your thing to know how to send data to ThingSpeak. In the Arduino IDE, choose Sketch, Include Library, and Manage Libraries. Search for “thingspeak” and click Install.

The thing that you bought from Amazon uses the CP2102 USB driver. You might have to install a USB driver from Silicon Labs for this to work with your computer. Connect the ESP8266 to your laptop with the micro USB cable.

USB Driver for the ESP8266 CP2102

Back on the Arduino IDE, under tools, configure the following settings:

Arduino Board Settings for NodeMCU

Whew. We got through the setup. Now we can program this device or any ESP8266-compatible device and shouldn’t have to do that again.


The code that the Arduino IDE uses is called a “sketch” – this is just a short program that the device runs over and over. In our project, we are going to have the code measure the signal strength of the Wi-Fi connection and upload the data to ThingSpeak, wait, and repeat. Over time, we can see the signal strength of our Wi-Fi connection. Copy the example code to your Arduino IDE and change some of the defaults to match your Wi-Fi network and ThingSpeak settings.

Once everything is set, click Sketch and then Upload. This will take the code and program the ESP8266 with it. It takes a minute, so be patient. If anything goes wrong, make sure that you have the right board settings and that your “Port” matches what your laptop thinks the port is.

Back on ThingSpeak, you should see data start to come in. You are looking for the Private View of your channel and a chart that is updating. As new data comes in, the chart shows the latest value. If you carry the ESP8266 around the house, you might notice the signal strength changing.


Next Steps

To take the project further, you can use MATLAB on ThingSpeak to do some data analysis. I will post about IoT data analytics on another day. The ESP8266 source code for sending data to ThingSpeak is available on GitHub.

Welcome to the Internet of Things. Let me know if you try this out, and let me know if you take this project further and build something cool.


  1. Hi Hans. I am working on a project that aims to rescue people trapped under rubble in case of natural calamities like earthquakes. We intend to use the ESP8266 and use the RSSI signals obtained from it to triangulate the position of the victim. However, we haven’t been able to co-relate the distance and the RSSI signals so far. Hence, I would like to obtain your suggestions for the same.
    Also, would the use of bluetooth beacons suffice for the aforementioned problem statement.
    Thanking you in anticipation.

    1. This is a bold project and wish it success. What you are describing is possible but will require some real engineering and signal processing. If I am able to think of anything more, I will share it with you.

    2. Hi Jay
      google subpos – it is an indoor wifi positioning system. might give you a good starting point.



    3. I have no deep understanding in programming, but I would go for ping measurments from \ to each client and then do the math. A digital compass module or better gps module could give additional and very useful data.

  2. Hello everyone! I was wondering how I could alter the example code to let me update multiple fields on the same channel, would anyone know how?

    1. After some trial and error, we altered the code like this (starting at // Construct API request body )

      // Construct API request body
      String body = “field1=”;
      body += String(temperature);
      body += “&”;
      body += “field2=”;
      body += String(humidity);

      The rest of the code after that stays the same…the & seems to work as the field delimiter 🙂

      1. I copied and pasted your code and had problems until i retyped the quotation marks for myself and somehow the change of font allowed the code to be compiled. All works thanks

  3. Hans, I want to thank you for this tutorial and the GitHub code. This is the FIRST sketch I’ve ran across that actually works for posting data to ThingSpeak over the NodeMCU ESP8266 ESP12E. I’ve hunted and ran sketches for a week now, and finally one that works. Thank you!!!

  4. Hans, I made a similar sensor to measure temperature, input voltage and RSSI. I used the Thingspeak library, which makes the logging to Thingspeak even easier.
    However, my first RSSI measurement is 30, while the next measurement are in the rigth range (-60 to -80). Do you have a suggestion what the cause of this is?

  5. Hello, I want to ask about changing a value in the script, through IoT. For example, I have a room where temperature is being observe all the time, I also have a user based temperature that will become the pivot which will control servo motor that control the amount of air flow. Meaning, the servo motor will regulate the air flow automatically based on the temperature that the user desired. My question is, can I do through IoT, an option where the user can update his/her desired temperature online, without needing to change the data in the script?
    Thank You 😀

  6. I can see the signal strenght on serial monitor and a number of entries on thingspeak is increasing after every 20 seconds, but the graph and signal strenght in exported data is still empty. Does anyone know how to solve this?

    1. sorry, didn’t respond to your comment (I’m new to this website). See below post. The body.length() is returning an int, and is causing the content length to be incorrectly reported. just turn it into a string. Correct line should be:
      Serial.println(“Content-Length: ” + String(body.length()));
      I’ve submitted a pull request for the code on git. Hopefully this isn’t an issue in the future.

      1. Thank you so much! This helped and everything is now working. They have corrected the code on the GitHub, so it’s not an issue in future.

  7. @JOONAS I struggled with this for a few hours and the correct below worked for me. The issues is very small. The body.length() is returning an int, and is causing the content length to be incorrectly reported. just turn it into a string. There are no error messages generated so it was difficult to debug.

    correct line should be:
    Serial.println(“Content-Length: ” + String(body.length()));

    I’ve submitted a pull request for the code on git. Hopefully this isn’t an issue in the future.

  8. Hi Hans, i am using your code as base to get info from production about runing machines. Do you have idea how to collect and display data so that employees can see this? We need 5 sec interval. Reason for monitoring is because company is quite huge and there is only few people operating production.

  9. Hi Hans, I’m trying to implement this code in order to learn more about ESP8266 and sending data to the cloud, but this message “secrets.h: no files such or directory” always appears. I’ve downloaded all the libraries but I don’t understand what I’m doing wrong. Can you help me? Thank you.

    1. Make sure you have a file in the same path as the Arduino file that is called “secrets.h”. You can also comment out at the top of the Arduino sketch that includes the “secrets.h”.

  10. I tried this code but the challenge is i cannot see updates on thingspeak can you help me to know all possible reasons so that I can try

    1. Try the API links in your browser or POSTMAN to see if you got the API Keys entered in your code correctly. I would also check the serial monitor in the Arduino IDE to make sure that you are connected to Wi-Fi.

  11. Muchas gracias Hans, probe el codigo y funciono muy bien, me tope con el error de secrets.h y lo que hize fue volarlo y coloque lo valores de ID y API Key manualmente.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.