Tag Archives: esp8266

How to set up Arduino IDE for esp8266 programming

The Arduino (or in some cases also Genuino) is a physical hard and software development plattform. During the recent years its developing environment grow to a useful and library rich developing platform. Because of that the esp8266 team created an conversion tool to its internal programming language lua.

Setting up the Arduino IDE for esp8266 programming is really easy. Just follow this small guide.

Step 1: Download the arduino IDE software

Go to the most recent version download page of the Arduino IDE. Please keep in mind that you’ll need at least version 1.6.x. In some cases it is not available at the packet repositories of your beloved Debian Distribution.

screenshot-from-2016-12-28-15-22-44Click on Windows, Linux or Mac Version of your choice. We are going to use the Linux 64bit for further pictures.

screenshot-from-2016-12-28-15-24-53Extract the provided tar.gz. For windows or Mac please use a extraction software like 7zip, Winrar etc accordingly.

screenshot-from-2016-12-28-15-28-32Please make sure the arduino.sh file in your directory is excecutable.


screenshot-from-2016-12-28-15-29-01You also can use the terminal command:

chmod +x -/arduino.sh

After that double click the application…

screenshot-from-2016-12-28-15-33-03or use the terminal to start the IDE. This is also very useful to see possible errors after they occure while flashing the esp8266 from time to time.



Et voila, your IDE should look somehow like this:


Step 2: Setting up the IDE to work with ESP8266 by board manager.

We need to add an additional url to the boards manager sources list. For that open File > Preferences


And add http://arduino.esp8266.com/stable/package_esp8266com_index.json  to the Additional Boards Manager URLs.

screenshot-from-2016-12-28-15-38-25After that open Tools > Boards > Boards Manager and search for esp8266.


install the latest version:


After that you should be able to select the Generic ESP Module board in Tools > Board


screenshot-from-2016-12-28-15-42-15Congratulations! You are now able to compile esp8266 code from the arduino IDE.

Step 3: Use the Examples to learn to code

This step is easy. Open File > Examples > ESP8266Wifi > WifiWebServer as a good starting point.


In the next post we will have a look at how to wire the ESP8266 up for an easy flashing.

esp8266 ws2812b hostname triggered wifi light

Today I built a small wifi light which rotates in case a certain hostname (my smartphone) is in the local wifi. As these devices tend not to answer to ping or arp requests, and bonjour or mDNS where to slow, I crawl my dhcp server every five to ten seconds. Additionally i decreased the lease time of the dhcp to  improve the switch off response time. As my smartphone usually logs into my wifi instantly when I enter the house it’s usually switches on before the main door has been opened.

The interior of the lamp consists of seventeen ws2812b rgb leds which I controlled in an intermediate stage with the esp2866 opc code on github. As this would have required a constant network packages flow and a device delivering the UDP packages, I later on switched over to control the led animation by the esp8266.

Something I discovered today is that soldering the 2mm grid esp8266 upside down onto a 2.54 grid prototyping circuit board improves handling and speed, as well as the size of the final circuit.  You also can see the pin map information on the final product, which is nice.

After putting some hot glue on the board to prevent shorts and improve lifetime, I took some measurements regarding current consumption: about 0,1Amps at 5V, which should result to 0.5W with a constant rotating light and wifi crawling. This makes the device capable to be run on most USB power providers. The final result looks like this in action:


As the code is very specific and dependent on my local setup, I will not post it on github this time. Just one thing I would have found really helpful to find in the internet while I was struggling with a constantly without information resetting esp8266 would have been this:

Howto grab and parse a HTTP.Auth protected website with the esp8266 as a client:

bool getPage() {
  bool foundHost = false;

  WiFiClient client; //initialising the client globally leads to crashes

  if (client.connect(http_site, 80)) { //the more common version !client.connect() crashes 

    // We now create a URI for the request
    String url = "/dhcp";
    // This will send the request to the server
    client.print(String("GET ") + url + " HTTP/1.1\r\n" +
                 "Host: " + http_site + "\r\n" +
                 "Authorization: Basic YWRTeW4kYWRmaW4=\r\n" + //this is Http.Auth as a Client (Base 64)
                 "Connection: close\r\n\r\n");
    delay(500); // you'll need to wait until repsonse
    String line = "";
    // Read all the lines of the reply from server and print them to Serial
    while (client.available()) {
      line = client.readStringUntil('\r');
      if (line.indexOf(hostname) != -1) {
        foundHost = true;
  } else {
    Serial.println("connection failed");

In conclusion, this was a nice little project I really enjoyed doing in a sleepless night 🙂 And with about 10€ plus the lamp I got as a gift a long time ago, not that expensive.

DIY WLAN sauna thermometer for 10 EUR with ESP8266 and DS18B20

I recently built an WLAN Thermometer which needed to be partly whaterproof and support temperatures under 0 and over 85 degrees celsius. Therefore the usual temperature measurement chips like DHT11 or LM35 couldn’t be used, especially as the surrounding circuits might be damaged by the steam of the sauna environment. After a while I found the DS18B20, which has an metalic and whaterproof end and perfectly matches the requirements. In china the one-wire-supporting chip currently costs around 2 USD and comes with a 1m whaterproof cable.

The ESP8266 works with 3,3 Volts which isn’t very common among my old power adapters which is why I soldered a chinese version of the AMS1117 (an Lm2596 step down controller) on the board, which enables the setup also to be run by USB cable as you can see on the pictures.

Screenshot_2015-12-30_16-26-31For the webinterface I wrote a small external javascript file, which gets called by the esp8266 on most web requests. It fetches the temperature by json and visulizes it with d3.js in real time. The scales fit to the measured temperature and time automagically. It further is possible to display the site on multiple clients without loosing data or performance.

That was my useful christmas holiday project 🙂

Code on github.com