{"id":9057,"date":"2020-10-20T15:39:44","date_gmt":"2020-10-20T15:39:44","guid":{"rendered":"https:\/\/wolles-elektronikkiste.de\/esp8266-esp-01-module"},"modified":"2025-02-24T17:55:18","modified_gmt":"2025-02-24T17:55:18","slug":"esp8266-esp-01-module","status":"publish","type":"post","link":"https:\/\/wolles-elektronikkiste.de\/en\/esp8266-esp-01-module","title":{"rendered":"ESP8266 ESP-01 module"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">About the post<\/h2>\n\n<p>A lot has already been published about the ESP8266 ESP-01 module. So why <em>another<\/em> post about this topic? Until I was able to do everything I had planned to do with my ESP-01 module, it took a lot of time, despite the wealth of information available, because the required details were spread over many sources. Therefore, here is the attempt to introduce the basic functions step-by-step and not too long but comprehensible. I focus on programming with the Arduino IDE. Im Einzelnen behandele ich die folgenden Themen:<\/p>\r\n<ul>\r\n\t<li>Integration of the ESP8266 product family into the Arduino IDE<\/li>\r\n\t<li>Circuit for programming with an Arduino<\/li>\r\n\t<li>Circuit for programming with a USB-to-TTL adapter<\/li>\r\n\t<li>Control of the GPIOs via WLAN<\/li>\r\n\t<li>Displaying measured values on a website and updating them regularly\u00a0<\/li>\r\n\t<li>Updating\/restoring the firmware<\/li>\r\n\t<li>Control of the ESP8266 ESP-01 module via AT commands (set up a server \/ switching GPIOs)<\/li>\r\n\t<li>LUA programming (only as reference)<\/li>\r\n<\/ul>\n\n<h2 class=\"wp-block-heading\">Basics<\/h2>\n\n<p>An ESP8266 ESP-01 module or, in short, ESP-01 module is based on the ESP8266 chip from Espressif. This chip is used on various modules, whereby the ESP-01 module is the simplest variant. It is basically a fairly powerful microcontroller with integrated Wi-Fi.\u00a0<\/p>\r\n<p>The original firmware allows programming via the somewhat cryptic &#8220;AT commands&#8221;, which you may know from Bluetooth modules such as the HC-05 and HC-06. I have described these components <a href=\"https:\/\/wolles-elektronikkiste.de\/en\/hc-05-and-hc-06-bluetooth-modules\" target=\"_blank\" rel=\"noopener noreferrer\">here.<\/a> Smart people have made it possible to program the ESP8266 modules with the Arduino platform, which is the main topic of this article. Later, however, I will also briefly mention the AT commands.<\/p>\r\n<p><em>Note: Once you have uploaded an Arduino Sketch, the firmware is overwritten and the module no longer understands AT commands. Then you have to flash it again with the original firmware. This is not a big deal, but it requires a few steps. More on that below.<\/em><\/p>\n\n<h2 class=\"wp-block-heading\">Pinout of the module<\/h2>\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/05\/ESP01_mit_Programmer-1.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"789\" height=\"600\" src=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/05\/ESP01_mit_Programmer-1.jpg\" alt=\"ES8266 ESP-01 Module with a breadboard adapter\" class=\"wp-image-1285\" srcset=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/05\/ESP01_mit_Programmer-1.jpg 789w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/05\/ESP01_mit_Programmer-1-300x228.jpg 300w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/05\/ESP01_mit_Programmer-1-768x584.jpg 768w\" sizes=\"auto, (max-width: 789px) 100vw, 789px\" \/><\/a><figcaption class=\"wp-element-caption\">ES8266 ESP-01 Module with a breadboard adapter<\/figcaption><\/figure>\n\n<p>The ESP-01 module has 8 pins arranged in such a way that you cannot connect it directly with a breadboard. Because of this and because it is easy to mix up the pins due to the missing label, I recommend buying a small adapter (see photo). You get the module including the adapter e.g. at <a href=\"https:\/\/smile.amazon.de\/\" target=\"_blank\" rel=\"noopener noreferrer\">Amazon<\/a> for 5 &#8211; 10 Euro.<\/p>\r\n<p>The module is powered via VCC\/GND. The voltage should be between 2.5 and 3.6 volts. For serial communication the module uses TX and RX. If you program via an Arduino, strictly speaking, a voltage divider or logic level converter must be set in front of RX, so that the 3.6 volts are not exceeded. The CH-PD is the enable-pin and is connected to the power supply. The RST pin triggers a reset if it is set for short time to &#8220;LOW&#8221;. GPIO0 and GPIO2 (General Purpose Input Output) are the two programmable I\/O pins. GPIO0 is also required to set the ESP8266 ESP-01 module into programming mode. For this purpose, this pin is connected to GND when the power supply is switched on or during a reset. After that, the connection to GND can be disconnected. The module remains in programming mode until a sketch is uploaded.<\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><a href=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/05\/ESP8266.png\"><img loading=\"lazy\" decoding=\"async\" width=\"300\" height=\"194\" src=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/05\/ESP8266-300x194.png\" alt=\"Pin assignment of the ESP8266 ESP-01 module\" class=\"wp-image-1286\" srcset=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/05\/ESP8266-300x194.png 300w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/05\/ESP8266-768x496.png 768w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/05\/ESP8266-1024x661.png 1024w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/05\/ESP8266-1320x852.png 1320w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/05\/ESP8266.png 1453w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><figcaption class=\"wp-element-caption\">Pinout of the module<\/figcaption><\/figure>\n<\/div>\n<p>You can use TX as GPIO1 and RX as GPIO3 and thus you have four I\/O Pins. Nevertheless, the ESP8266 ESP-01 module is of course a little limited in its possibilities due to the small number of GPIOs. Those who need more can rely on the larger representatives of the ESP8266 module family, in particular the ESP-12. In a further post I will also show how to make port expansion with GPIO0 and GPIO2.\u00a0<\/p>\n\n<h2 class=\"wp-block-heading\">ESP-01 vs. ESP-01S<\/h2>\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/05\/esp01_esp01s-1024x561.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"561\" src=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/05\/esp01_esp01s-1024x561.jpg\" alt=\"\" class=\"wp-image-23293\" srcset=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/05\/esp01_esp01s-1024x561.jpg 1024w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/05\/esp01_esp01s-300x164.jpg 300w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/05\/esp01_esp01s-768x421.jpg 768w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/05\/esp01_esp01s-1320x723.jpg 1320w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/05\/esp01_esp01s.jpg 1500w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption class=\"wp-element-caption\">Links: ESP-01S, rechts: ESP-01<\/figcaption><\/figure>\n\n<p>In addition to the ESP-01, there is also the newer ESP-01S variant. It is still based on the same ESP8266EX microcontroller, but the board has a few advantages:<\/p>\r\n<ul>\r\n<li>4 MB vs. 1 MB Flash-Speicher<\/li>\r\n<li>12 k\u03a9 pull-up resistors on RST, GPIO0 and CH_PD<\/li>\r\n<li>On-Board LED on GPIO2<\/li>\r\n<\/ul>\r\n\n<p>The pull-up resistors can simplify programming and make the booting process more reliable. <\/p>\r\n\n<h2 class=\"wp-block-heading\">Preparing the Arduino IDE<\/h2>\n\n<p>It takes less than two minutes to extend the Arduino IDE to include the ESP8266 modules. In the first step, you have to enter the appropriate board manager URL. To do this, you need to go to File &#8211; &gt; Preferences and click on the icon marked in red:<\/p>\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/05\/Boardverwalter.png\"><img loading=\"lazy\" decoding=\"async\" width=\"717\" height=\"41\" src=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/05\/Boardverwalter.png\" alt=\"Entering the Board Manager URL\" class=\"wp-image-1288\" srcset=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/05\/Boardverwalter.png 717w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/05\/Boardverwalter-300x17.png 300w\" sizes=\"auto, (max-width: 717px) 100vw, 717px\" \/><\/a><\/figure>\n\n<p>Then enter the address: &#8220;http:\/\/arduino.esp8266.com\/stable\/package_esp8266com_index.json&#8221; as a separate line and confirm with &#8220;OK&#8221;:<\/p>\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/10\/Boardverwalter_Eintrag_engl.png\"><img decoding=\"async\" src=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/10\/Boardverwalter_Eintrag_engl.png\" alt=\"Entering board administrators URL II\" class=\"wp-image-1289\"\/><\/a><\/figure>\n\n<p>The next step is to go to Boards Manager, search for &#8220;esp8266&#8221; and install the package:<\/p>\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/10\/Anleitung_engl.png\"><img decoding=\"async\" src=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/10\/Anleitung_engl.png\" alt=\"\" class=\"wp-image-1290\"\/><\/a><figcaption class=\"wp-element-caption\">Choose &#8220;Board Manager&#8221;<\/figcaption><\/figure>\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/10\/AnleitungII_engl-2.png\"><img decoding=\"async\" src=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/10\/AnleitungII_engl-2.png\" alt=\"\" class=\"wp-image-1324\"\/><\/a><figcaption class=\"wp-element-caption\">&#8230;.then install the  &#8220;esp8266&#8221; package<\/figcaption><\/figure>\n\n<p>Finally, you have to restart the Arduino IDE and that&#8217;s it.\u00a0<\/p>\n\n<h2 class=\"wp-block-heading\">Upload sketches<\/h2>\n\n<h3 class=\"wp-block-heading\">Uploading via Arduino-Boards<\/h3>\n\n<p>You can program the ESP-01(S) with an Arduino board (e.g.: UNO\/ Nano Classic). Be aware: it is <em>much<\/em> easier using a programmer which I show later.<\/p>\r\n<ul>\r\n\t<li>TX is attached to TX and RX to RX; Vmax of the RX pin of the ESP01 is 3.6V.\u00a0\r\n\r\n<ul>\r\n\t<li>therefore use a voltage divider (if you don&#8217;t have the resistors shown, you can also use two 10 k\u03a9 resistors).<\/li>\r\n<\/ul>\r\n<\/li>\r\n\t<li>Attach the reset pin of the Arduino to GND or upload the bare minimum sketch to the Arduino.<\/li>\r\n\t<li>VCC (ESP-01): The ESP-01 consumes more current at peak times than the 3.3 V pin of the Arduino can supply. An external 3.0 &#8211; 3.6 V power source is recommended.<\/li>\r\n\t<li>GND to GND<\/li>\r\n\t<li>CH_PD to 3.3V (<strong>obsolete for the ESP-01S<\/strong>).<\/li>\r\n\t<li>GPIO0 to GND (to enter programming mode), indicated here by the switch. In normal mode, connect GPIO0 via a pullup resistor to HIGH (<strong>obsolete for ESP-01S<\/strong>).<\/li>\r\n\t<li>Connect RST (ESP-01) with a pull-up resistor to HIGH (<strong>obsolete for ESP-01S<\/strong>). For a reset, connect RST to GND, e.g. via a pushbutton.<\/li>\r\n<\/ul>\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/05\/esp01_program_with_nano-1-1024x425.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"425\" src=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/05\/esp01_program_with_nano-1-1024x425.png\" alt=\"Circuit for flashing the ESP-01 via Aurduino board\" class=\"wp-image-23299\" srcset=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/05\/esp01_program_with_nano-1-1024x425.png 1024w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/05\/esp01_program_with_nano-1-300x125.png 300w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/05\/esp01_program_with_nano-1-768x319.png 768w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/05\/esp01_program_with_nano-1-1320x548.png 1320w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/05\/esp01_program_with_nano-1.png 1454w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption class=\"wp-element-caption\">Circuit for flashing the ESP-01 via Aurduino board<\/figcaption><\/figure>\n\n<p>Choose &#8220;Generic ESP8266 Module&#8221; in the Arduino IDE as board. Apart from the port, you leave the other settings as they are.\u00a0<\/p>\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/10\/Anleitung_engl-1.png\" alt=\"Choosing the right board in the Arduino IDE\" class=\"wp-image-1296\"\/><\/figure>\n\n<p>A simple blink sketch is a good test:<\/p>\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-group=\"ESP8266_ESP01_Blink.ino\" data-enlighter-title=\"ESP8266_ESP01_Blink.ino\">int\u00a0LEDPin\u00a0=\u00a02;\u00a0\/\/\u00a0GPIO2\r\n\r\nvoid\u00a0setup()\u00a0{\r\n\u00a0\u00a0pinMode(LEDPin,\u00a0OUTPUT);\u00a0\u00a0\u00a0\u00a0\u00a0\r\n}\r\n\r\nvoid\u00a0loop()\u00a0{\r\n\u00a0\u00a0digitalWrite(LEDPin,\u00a0LOW);\u00a0\r\n\u00a0\u00a0delay(500);\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\r\n\u00a0\u00a0digitalWrite(LEDPin,\u00a0HIGH);\u00a0\u00a0\r\n\u00a0\u00a0delay(500);\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\r\n}<\/pre>\n\n<p>If you then connect an LED to GPIO2, it should work. If not, perform another reset or briefly disconnect the power supply.<\/p>\r\n\n<p>Confused? Here is the upload process in short (thanks to Christian!):<\/p>\r\n<ol>\r\n<li>Set up the circuit as described (GPIO0 connected to GND).<\/li>\r\n<li>Connect the circuit to power.<\/li>\r\n<li>Briefly press the pushbutton.<\/li>\r\n<li>Disconnect GPIO0 from GND.<\/li>\r\n<li>Upload your sketch.<\/li>\r\n<li>Briefly press the pushbutton.<\/li>\r\n<\/ol>\r\n\n<h3 class=\"wp-block-heading\">Upload via USB-to-TTL adapter<\/h3>\n\n<p>If you take a USB-to-TTL adapter instead of an Arduino, it is best to choose a model where you can set 3.3 V. Here is an example:<\/p>\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/05\/USB_zu_TTL.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"938\" height=\"399\" src=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/05\/USB_zu_TTL.jpg\" alt=\"USB-to-TTL adapter with adjustable voltage\" class=\"wp-image-1298\" srcset=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/05\/USB_zu_TTL.jpg 938w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/05\/USB_zu_TTL-300x128.jpg 300w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/05\/USB_zu_TTL-768x327.jpg 768w\" sizes=\"auto, (max-width: 938px) 100vw, 938px\" \/><\/a><figcaption class=\"wp-element-caption\">USB-to-TTL adapter with jumper for setting 3.3 or 5 volts<\/figcaption><\/figure>\n\n<p>It is important that you connect now RX to TX and TX to RX. A voltage divider for RX is omitted if you can set your adapter to 3.3 volts.\u00a0<\/p>\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/05\/esp01_program_with_ftdi-1024x461.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"461\" src=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/05\/esp01_program_with_ftdi-1024x461.png\" alt=\"Circuit: Upload to the ESP-01 via USB-to-TTL Adapter\" class=\"wp-image-23297\" srcset=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/05\/esp01_program_with_ftdi-1024x461.png 1024w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/05\/esp01_program_with_ftdi-300x135.png 300w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/05\/esp01_program_with_ftdi-768x346.png 768w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/05\/esp01_program_with_ftdi-1536x692.png 1536w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/05\/esp01_program_with_ftdi-1320x595.png 1320w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/05\/esp01_program_with_ftdi.png 1538w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption class=\"wp-element-caption\">Upload to the ESP-01 via USB-to-TTL Adapter<\/figcaption><\/figure>\n\n<p>Again, the pull-up resistors on GPIO0 and Reset and the connection of CH_PD to HIGH are obsolete if you use an ESP-01S. <\/p>\r\n\n<h2 class=\"wp-block-heading\">Programmer<\/h2>\n\n<p>As previously mentioned, flashing the ESP01 modules using a programmer is much easier. All you have to do is attaching the ESP-01, plug the programmer into the USB socket, set the port in the Arduino IDE and upload your sketches. Such programmers are available for 10 euros or less. Here are two examples:<\/p>\r\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/05\/esp01_programmer-1024x254.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"254\" src=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/05\/esp01_programmer-1024x254.jpg\" alt=\"ESP-01 Programmer, model 1\" class=\"wp-image-23301\" srcset=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/05\/esp01_programmer-1024x254.jpg 1024w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/05\/esp01_programmer-300x75.jpg 300w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/05\/esp01_programmer-768x191.jpg 768w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/05\/esp01_programmer-1536x381.jpg 1536w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/05\/esp01_programmer-1320x328.jpg 1320w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/05\/esp01_programmer.jpg 1800w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption class=\"wp-element-caption\">ESP01-Programmer 1<\/figcaption><\/figure>\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/05\/esp01_programmer_2-2-1024x238.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"238\" src=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/05\/esp01_programmer_2-2-1024x238.jpg\" alt=\"\" class=\"wp-image-23322\" srcset=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/05\/esp01_programmer_2-2-1024x238.jpg 1024w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/05\/esp01_programmer_2-2-300x70.jpg 300w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/05\/esp01_programmer_2-2-768x178.jpg 768w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/05\/esp01_programmer_2-2-1320x306.jpg 1320w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/05\/esp01_programmer_2-2.jpg 1500w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption class=\"wp-element-caption\">ESP01-Programmer 2<\/figcaption><\/figure>\n\n<p>The lower model has an additional pin header so that you do not have to reconnect the ESP-01 from the programmer to your project circuit. <\/p>\r\n\n<p>In addition to the programmers, there are also ESP-01 adapters. These can not automatically pull the GPIO0 to GND or perform a reset. The parts are OK for normal operation (or for programming via AT commands), but are not recommendable for flashing sketches.<\/p>\r\n<p>Here are two examples:<\/p>\r\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/05\/esp01_adapters-1024x263.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"263\" src=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/05\/esp01_adapters-1024x263.jpg\" alt=\"ESP01 Adapter\" class=\"wp-image-23305\" srcset=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/05\/esp01_adapters-1024x263.jpg 1024w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/05\/esp01_adapters-300x77.jpg 300w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/05\/esp01_adapters-768x197.jpg 768w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/05\/esp01_adapters-1536x395.jpg 1536w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/05\/esp01_adapters-1320x339.jpg 1320w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/05\/esp01_adapters.jpg 2000w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption class=\"wp-element-caption\">Adapter for the ESP-01 (not recommended for flashing sketches!)<\/figcaption><\/figure>\n\n<h2 class=\"wp-block-heading\">Control of the GPIOs via WiFi<\/h2>\n\n<h3 class=\"wp-block-heading\">To &#8220;warm up&#8221;: send a message to the browser<\/h3>\n\n<p>Controlling the ESP8266 by WiFi is quite an extensive topic, which I have covered in a separate article (<a href=\"https:\/\/wolles-elektronikkiste.de\/en\/using-wifi-with-the-esp8266-and-esp32\" target=\"_blank\" rel=\"noopener\">link<\/a>). There you can delve deeper into this matter. Perhaps the following examples will whet your appetite.\u00a0<\/p>\r\n<p>You only have to adjust the following sketch slightly. At the beginning of the sketch, a server is defined: <code>ESP8266WebServer Server(80);<\/code>. 80 is the default port, so you can access the website without specifying the port in the browser. In this, as well as the following sketches, you only find the following in the main loop: <code>server.handleClient();<\/code> What is actually interesting is defined by <code><span style=\"display: inline !important; float: none; background-color: #ffffff; color: #191e23; cursor: text; font-family: 'Noto Serif'; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;\"><code>server.on(\"\/\",handleRoot);<\/code><\/span><\/code> in the setup. Translated, this means that when the main web page (&#8220;\/&#8221;) is called, the function &#8220;handleRoot&#8221; is performed. In this simple sketch, handleRoot only sends text with a little HTML formatting. The &#8220;200&#8221; is the HTTP status code (200 = OK), see also <a href=\"https:\/\/de.wikipedia.org\/wiki\/HTTP-Statuscode\" target=\"_blank\" rel=\"noopener noreferrer\">here<\/a>.\u00a0<\/p>\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-group=\"esp8266_Minimum_Server.ino\" data-enlighter-title=\"esp8266_Minimum_Server.ino\">#include\u00a0\"ESP8266WiFi.h\"\r\n#include\u00a0\"ESP8266WebServer.h\"\r\n\r\nconst\u00a0char*\u00a0ssid\u00a0=\u00a0\"Eure\u00a0SSID\";\r\nconst\u00a0char*\u00a0pass\u00a0=\u00a0\"Euer\u00a0WLan\u00a0Passwort\";\r\nIPAddress\u00a0ip(192,168,178,xxx);\u00a0\/\/\u00a0192.168.178.xxx\u00a0=\u00a0freie\u00a0IP\u00a0Adresse,\u00a0ggf.\u00a0m\u00fcsst\u00a0ihr\u00a0auch\u00a0die\u00a0anderen\u00a0Zahlen\u00a0anpassen;\u00a0schaut\u00a0am\u00a0besten\u00a0in\u00a0euren\u00a0Router\r\nIPAddress\u00a0gateway(192,168,178,1);\r\nIPAddress\u00a0subnet(255,255,255,0);\r\n\r\nESP8266WebServer\u00a0server(80);\r\n\u00a0\r\nvoid\u00a0handleRoot()\u00a0{\r\n\u00a0String\u00a0message=\"&lt;h1&gt;Minimalprogramm\u00a0ESP8266&lt;\/h1&gt;\";\r\n\u00a0message\u00a0+=\u00a0\"Hallo\u00a0...\u00a0!!!!\u00a0Dieses\u00a0ist\u00a0ein\u00a0netter\u00a0Gru&amp;szlig\u00a0vom\u00a0ESP8266\u00a0Server\";\r\n\u00a0server.send(200,\u00a0\"text\/html\",\u00a0message);\r\n}\r\n\r\nvoid\u00a0setup(){\r\n\u00a0\u00a0WiFi.begin(ssid,\u00a0pass);\r\n\u00a0\u00a0WiFi.config(ip,\u00a0gateway,\u00a0subnet);\u00a0\r\n\u00a0\u00a0server.on(\"\/\",handleRoot);\r\n\u00a0\u00a0server.begin();\r\n}\u00a0\r\n\u00a0\u00a0\r\nvoid\u00a0loop(){\r\n\u00a0\u00a0server.handleClient();\u00a0\r\n}<\/pre>\n\n<p>After you have uploaded the sketch, you chose your favorite browser and navigate to the IP address, in this case &#8220;192.168.178.xxx&#8221;. I had no problems with Firefox and Chrome, Edge was sometimes a bit tricky. So if you have problems, you might change your browser and don&#8217;t immediately doubt your code.\u00a0<\/p>\n\n<h3 class=\"wp-block-heading\">Switching via Wi-Fi<\/h3>\n\n<p>In this example, an LED attached to GPIO0 is switched via Wi-Fi and browser. The sketch is similar to the one above. Here, however, two subpages have been added, which are called by links (&#8221; &lt; a href=&#8230;&#8230; &gt; &#8221; and that triggers the execution of the corresponding functions (ledan(), ledaus() ). Some German lessons: an = on, aus = off!\u00a0<\/p>\r\n<p>If you uncomment the commented lines, you can track the connection on the serial monitor. For me, however, this has led to difficulties in accessing the web pages. So I would only do that for testing purposes.\u00a0<\/p>\n\n<div class=\"scroll-paragraph-long\">\r\n<pre class=\"EnlighterJSRAW\" data-enlighter-group=\"Eine_LED_per_WLAN_schalten.ino\" data-enlighter-title=\"Eine_LED_per_WLAN_schalten.ino\">#include \"ESP8266WiFi.h\"\r\n#include \"ESP8266WebServer.h\"\r\n#define LEDPIN 0\r\n\r\nconst char* ssid = \"Eure SSID\";\r\nconst char* pass = \"Euer WLAN Passwort\";\r\nIPAddress ip(192,168,178,xxx); \/\/ Individuell anzupassen\r\nIPAddress gateway(192,168,178,1);\r\nIPAddress subnet(255,255,255,0);\r\n\r\nESP8266WebServer server(80);\r\n \r\nString led1= \"&lt;a href=\\\"\/led_an\\\"&gt;LED An&lt;\/a&gt;\";\r\nString led0= \"&lt;a href=\\\"\/led_aus\\\"&gt;LED Aus&lt;\/a&gt;\";\r\n\r\nvoid handleRoot() {\r\n  String message=\"&lt;h1&gt;Testprogramm - Minimalprogramm ESP8266&lt;\/h1&gt;\";\r\n  message += \"Hallo ..., das ist ein Gru&amp;szlig vom ESP8266 Server&lt;\/BR&gt;&lt;\/BR&gt;\";\r\n  message += led1;\r\n  server.send(200, \"text\/html\", message);\r\n}\r\n\r\nvoid ledan(){\r\n  digitalWrite(LEDPIN, HIGH);\r\n  server.send(200, \"text\/html\", led0);\r\n}\r\n\r\nvoid ledaus(){\r\n  digitalWrite(LEDPIN, LOW);\r\n  server.send(200, \"text\/html\", led1);\r\n}\r\n\r\nvoid setup(){\r\n  pinMode(LEDPIN, OUTPUT);\r\n  digitalWrite(LEDPIN, LOW);\r\n\/\/  Serial.begin(9600); \r\n\/\/  Serial.println(\"Testprogramm - Minimalprogramm ESP8266\");\r\n\/\/  Serial.print(\"Verbinde mich mit Netz: \");\r\n\/\/  Serial.println(ssid);\r\n  WiFi.begin(ssid, pass);\r\n  WiFi.config(ip, gateway, subnet); \r\n  \r\n\/\/  while(WiFi.status() != WL_CONNECTED){\r\n\/\/  delay(500); Serial.print(\".\");\r\n\/\/  }\r\n\/\/  Serial.println(\"\");\r\n\/\/  Serial.println(\"WiFi Verbindung aufgebaut\");\r\n\/\/  Serial.print(\"Eigene IP des ESP-Modul: \");\r\n\/\/  Serial.println(WiFi.localIP());\r\n\r\n  server.on(\"\/\",handleRoot);\r\n  server.on(\"\/led_an\", ledan);\r\n  server.on(\"\/led_aus\", ledaus);\r\n  server.begin();\r\n\/\/  Serial.println(\"HTTP Server wurde gestartet!\");\r\n} \r\n  \r\nvoid loop(){\r\n  server.handleClient(); \r\n}<\/pre>\r\n<\/div>\r\n<p>&nbsp;<\/p>\n\n<h4 class=\"wp-block-heading\">Switching two LEDs<\/h4>\n\n<p>The switching of two LEDs can also be done with this methodology:<\/p>\n\n<div class=\"scroll-paragraph-long\">\r\n<pre class=\"EnlighterJSRAW\" data-enlighter-group=\"Zwei_LEDs_per_WLAN_schalten.ino\" data-enlighter-title=\"Zwei_LEDs_per_WLAN_schalten.ino\">#include \"ESP8266WiFi.h\"\r\n#include \"ESP8266WebServer.h\"\r\nint led[2] = {0,2};\r\nbool led_status[2] = {false};\r\nString message = \"\";\r\nString title = \"&lt;h1&gt;Testprogramm - Minimalprogramm ESP8266&lt;\/h1&gt;\"\r\n               \"Hallo Wolle, das ist ein Gru&amp;szlig vom ESP8266 Server&lt;\/BR&gt;&lt;\/BR&gt;\";\r\n\r\nconst char* ssid = \"Eure SSID\";\r\nconst char* pass = \"Euer WLAN Passwort\";\r\nIPAddress ip(192,168,178,xxx);\r\nIPAddress gateway(192,168,178,1);\r\nIPAddress subnet(255,255,255,0);\r\n\r\nESP8266WebServer server(80);\r\n \r\nString led0_1= \"&lt;a href=\\\"\/led0_an\\\"&gt;LED0 An&lt;\/a&gt;\";\r\nString led0_0= \"&lt;a href=\\\"\/led0_aus\\\"&gt;LED0 Aus&lt;\/a&gt;\";\r\nString led1_1= \"&lt;\/BR&gt;&lt;a href=\\\"\/led1_an\\\"&gt;LED1 An&lt;\/a&gt;\";\r\nString led1_0= \"&lt;\/BR&gt;&lt;a href=\\\"\/led1_aus\\\"&gt;LED1 Aus&lt;\/a&gt;\";\r\n\r\n\r\nvoid setup(){\r\n  pinMode(led[0], OUTPUT);\r\n  digitalWrite(led[0], LOW);\r\n  pinMode(led[1], OUTPUT);\r\n  digitalWrite(led[1], LOW);\r\n  WiFi.begin(ssid, pass);\r\n  WiFi.config(ip, gateway, subnet); \r\n  server.on(\"\/\",handleRoot);\r\n  server.on(\"\/led0_an\", led0an);\r\n  server.on(\"\/led0_aus\", led0aus);\r\n  server.on(\"\/led1_an\", led1an);\r\n  server.on(\"\/led1_aus\", led1aus);\r\n  server.begin();\r\n}\r\n  \r\nvoid loop(){\r\n  server.handleClient(); \r\n}\r\n\r\nvoid handleRoot() {\r\n  message = \"\";\r\n  message += title; \r\n  message += led0_1;\r\n  message += led1_1;\r\n  server.send(200, \"text\/html\", message);\r\n}\r\n\r\nvoid led0an(){\r\n  led_status[0] = true;\r\n  switchLED(0,1);\r\n}\r\n\r\nvoid led0aus(){\r\n  led_status[0] = false;\r\n  switchLED(0,0);\r\n}\r\n\r\nvoid led1an(){\r\n  led_status[1] = true;\r\n  switchLED(1,1);\r\n}\r\n\r\nvoid led1aus(){\r\n  led_status[1] = false;\r\n  switchLED(1,0);\r\n}\r\n\r\n\r\nvoid switchLED(int num, bool state){\r\n  message = \"\";\r\n  message += title; \r\n  digitalWrite(led[num], state);\r\n  (led_status[0]==true)?(message += led0_0):(message += led0_1);\r\n  (led_status[1]==true)?(message += led1_0):(message += led1_1);\r\n  server.send(200, \"text\/html\", message);\r\n}<\/pre>\r\n<\/div>\r\n<p>&nbsp;<\/p>\n\n<h2 class=\"wp-block-heading\">Displaying measured values and updating them automatically<\/h2>\n\n<p>With two GPIOs, of course, you have limited options. This is probably why almost everyone who writes an introduction about the ESP8266 ESP-01 module uses temperature measurement via a DS18B20 sensor as an application example. Because this works with the One Wire technology. Where I2C and SPI need two or three communication lines, One Wire &#8211; as the name suggests &#8211; can do with a single one.<\/p>\r\n<p>Since this is a post about the ESP-01 module and not about the DS18B20 sensor, I will not go into the details and refer to the many tutorials available on the net. But at least few words about the sensor: the DS18B20 is available both as a TO-92 (&#8220;three-legged&#8221;) and as a waterproof version. I use the latter:\u00a0<\/p>\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"711\" src=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/05\/WNFF2982-1024x711.jpg\" alt=\"\" class=\"wp-image-1308\" srcset=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/05\/WNFF2982-1024x711.jpg 1024w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/05\/WNFF2982-300x208.jpg 300w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/05\/WNFF2982-768x533.jpg 768w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/05\/WNFF2982.jpg 1198w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n<p>The part is supplied with the bare connection cables. I made a breadboard adapter with a piece of PCB prtotyping board.\u00a0 Black (GND) is connected to GND, red (VCC) to 3.3 volts (5 volts also goes) and yellow (DATA) to GPIO0 or GPIO2, depending on the programming. It should also be noted that the data line requires a pullup resistor of 4.7 kOhm.\u00a0<\/p>\n\n<h3 class=\"wp-block-heading\">The sketch<\/h3>\n\n<div class=\"scroll-paragraph-long\">\r\n<pre class=\"EnlighterJSRAW\" data-enlighter-group=\"ESP8266_DS18B20.ino\" data-enlighter-title=\"ESP8266_DS18B20.ino\">#include &lt;OneWire.h&gt; \r\n#include \"ESP8266WiFi.h\"\r\n#include \"ESP8266WebServer.h\"\r\n\r\nint DS18B20_Pin = 2; \r\nOneWire ds(DS18B20_Pin);\r\n\r\nconst char* ssid = \"Eure SSID\";\r\nconst char* pass = \"Euer WLAN Passwort\";\r\nIPAddress ip(192,168,178,xxx); \/\/Anzupassen\r\nIPAddress gateway(192,168,178,1);\r\nIPAddress subnet(255,255,255,0);\r\nESP8266WebServer server(80);\r\n \r\nvoid setup() {\r\n  WiFi.begin(ssid, pass);\r\n  WiFi.config(ip, gateway, subnet); \r\n  \r\n  server.on(\"\/\",handleRoot);\r\n  server.begin();\r\n}\r\n \r\nvoid loop() {\r\n   server.handleClient(); \r\n}\r\n\r\nvoid handleRoot() {\r\n  String message= \"&lt;head&gt;&lt;meta http-equiv=\\\"refresh\\\" content=\\\"10\\\"&gt;&lt;\/head&gt;\"\r\n                  \"&lt;h1&gt;Temperaturprogramm ESP8266&lt;\/h1&gt;&lt;BR&gt;&lt;BR&gt;\"\r\n                  \"Die Temperatur betr&amp;aumlgt: \";\r\n  static String tString = \"\";\r\n  static unsigned long lastMeasure = 0; \r\n  \r\n  if((millis()-lastMeasure) &gt; 5000){\r\n    float temperature = getTemp();\r\n    tString = String(temperature);\r\n    lastMeasure = millis();\r\n  }\r\n  \r\n  message += tString;\r\n  server.send(200, \"text\/html\", message);\r\n}\r\n \r\nfloat getTemp(){\r\n  byte data[12];\r\n  byte addr[8];\r\n  if ( !ds.search(addr)) {\r\n      \/\/no more sensors on chain, reset search\r\n      ds.reset_search();\r\n      return -1000;\r\n  }\r\n\r\n  ds.reset();\r\n  ds.select(addr);\r\n  ds.write(0x44,1); \/\/ start conversion\r\n \r\n  ds.reset();\r\n  ds.select(addr);    \r\n  ds.write(0xBE); \/\/ read Scratchpad\r\n \r\n    for (int i = 0; i &lt; 9; i++) { \/\/ we need 9 bytes\r\n    data[i] = ds.read();\r\n  }\r\n  \r\n  ds.reset_search();\r\n  \r\n  byte MSB = data[1];\r\n  byte LSB = data[0];\r\n \r\n  float tempRead = ((MSB &lt;&lt; 8) | LSB); \/\/using two's compliment\r\n  float TemperatureSum = tempRead \/ 16;\r\n  \r\n  return TemperatureSum;\r\n}<\/pre>\r\n<\/div>\r\n<p>&nbsp;<\/p>\n\n<p>I do not go into the DS18B20 related part in more detail. At this point, simply take as a given fact that the getTemp() function returns the temperature as a float. If you compare the code with other sketches for the DS18B20, it might seem a little more complicated here. You can simplify it theoretically by including the &#8220;DallasTemperature&#8221; library, but then I had problems with the web page connection &#8211; for whatever reason.\u00a0<\/p>\r\n<p>The rest should be relatively clear. The temperature is measured every five seconds. To update the website regularly, the HTML code <code>&lt;head&gt;&lt;meta http-equiv=\\\"refresh\\\" content=\\\"10\\\"&gt;&lt;\/head&gt;<\/code> was inserted. The &#8220;10&#8221; means that a refresh is performed every 10 seconds.\u00a0<\/p>\r\n<p><em>And another note: quotation marks need an additional backslash so that they are not interpreted as Arduino code. \u00a0<\/em><\/p>\n\n<h2 class=\"wp-block-heading\">Reinstalling the firmware<\/h2>\n\n<p>As mentioned above, uploading the Arduino sketches will overwrite the original firmware, so that control via AT commands is no longer possible. However, you can restore the AT software or choose a newer version. This is a little laborious, because you have to install a small tool. A good instruction can be found <a href=\"https:\/\/www.electronicshub.org\/update-flash-esp8266-firmware\/\" target=\"_blank\" rel=\"noopener noreferrer\">here.<\/a> If you stick to it (exactly!), it works.\u00a0<\/p>\n\n<h2 class=\"wp-block-heading\">Control via AT commands<\/h2>\n\n<p>This will not be a detailed introduction to the AT commands. I would just like to use two examples to give an impression of how AT commands work. A list of AT commands can be found <a href=\"https:\/\/www.espressif.com\/sites\/default\/files\/documentation\/4a-esp8266_at_instruction_set_en.pdf\" target=\"_blank\" rel=\"noopener noreferrer\">here<\/a>.<\/p>\r\n<p><em>Note: Not all AT commands work with every firmware version.\u00a0<\/em><\/p>\n\n<h3 class=\"wp-block-heading\">The setup<\/h3>\n\n<p>The circuit for transmitting the AT commands to the ESP8266 ESP-01 module is fundamentally different from the circuit for uploading sketches and firmware. RX is hooked up to TX (via SoftwareSerial), TX to RX. A voltage divider is applied between the Arduino TX and the RX of the ESP-01. GPIO0 is not connected to GND because you don&#8217;t go into programming mode. Of course, the transmission of the AT commands is also a kind of programming, but it&#8217;s not a whole program that is transferred. In addition, the reset pin remains unconnected.\u00a0<\/p>\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2021\/01\/AT_Progr_mit_Ard_2-1024x553.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"553\" src=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2021\/01\/AT_Progr_mit_Ard_2-1024x553.png\" alt=\"Circuit for transmitting AT commands to the ESP8266 ESP-01 module\" class=\"wp-image-10820\" srcset=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2021\/01\/AT_Progr_mit_Ard_2-1024x553.png 1024w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2021\/01\/AT_Progr_mit_Ard_2-300x162.png 300w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2021\/01\/AT_Progr_mit_Ard_2-768x415.png 768w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2021\/01\/AT_Progr_mit_Ard_2-1536x830.png 1536w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2021\/01\/AT_Progr_mit_Ard_2-1320x713.png 1320w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2021\/01\/AT_Progr_mit_Ard_2.png 1544w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n<p>To enable communication, a SoftwareSerial is set up. When uploading, you now have to choose the Arduino as the board.\u00a0<\/p>\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-group=\"SoftwareSerial.ino\" data-enlighter-title=\"SoftwareSerial.ino\">#include &lt;SoftwareSerial.h&gt;\r\nSoftwareSerial mySerial(10, 11);\r\n\r\nvoid setup() {\r\n  Serial.begin(9600);\r\n  Serial.println(\"Los geht's\");\r\n  mySerial.begin(115200);\r\n}\r\n\r\nvoid loop() { \/\/ run over and over\r\n  if (mySerial.available()) {\r\n    Serial.write(mySerial.read());\r\n  }\r\n  if (Serial.available()) {\r\n    mySerial.write(Serial.read());\r\n  }\r\n}<\/pre>\r\n<p>&nbsp;<\/p>\n\n<h3 class=\"wp-block-heading\">Setting up a server with AT commands<\/h3>\n\n<p>After the softwareSerial Sketch has been uploaded, you open the serial monitor, set the baud rate to 9600 and select the option &#8220;Both NL and CR&#8221;. Sending &#8220;AT&#8221; should be answered by the module with &#8220;OK&#8221;. If it doesn&#8217;t, you&#8217;ll have to check all settings and flash the module again with the firmware if necessary (see above).\u00a0<\/p>\r\n<p>If everything works, &#8220;AT+GMR&#8221; \u00a0 will provide the version of the firmware. To display a message in your browser, enter the following AT commands:<\/p>\r\n<p><code>AT+CWMODE=1<\/code>\u00a0 &#8211;&gt; Station Wi-Fi Mode<\/p>\r\n<p><code>AT+CWJAP=\u201ceure SSID\u201c,\u201cWiFi-Zugangspasswort\u201c<\/code>\u00a0 &#8212; &gt; connect to Wi-Fi; enter this including quotation marks<\/p>\r\n<p><code>AT+CIFSR<\/code> &#8212; &gt; here you can see your IP address<\/p>\r\n<p><code>AT+CIPMUX=1<\/code> &#8212; &gt; connection mode (Multiple)<\/p>\r\n<p><code>AT+CIPSERVER=1,80<\/code> &#8211;&gt; 1: create server, 80: Port<\/p>\r\n<p>At this point you can start your browser and enter the IP address. As you see, you don&#8217;t see anything yet.<\/p>\r\n<p><code>AT+CIPSEND=0,5<\/code>\u00a0 &#8212; &gt; channel and number of characters<\/p>\r\n<p>A &#8221; &gt; &#8221; appears. You enter &#8220;Hello&#8221; without quotation marks, then press enter<\/p>\r\n<p><code>AT+CIPCLOSE=0<\/code>\u00a0 &#8212; &gt; Only now a friendly &#8220;Hello&#8221; appears in the browser.<\/p>\n\n<h3 class=\"wp-block-heading\">Controlling GPIOs with AT commands<\/h3>\n\n<p>First of all: controlling the GPIOs did not work with my ESP8266 ESP-01 modules until I updated the firmware according to the instructions above.\u00a0<\/p>\r\n<p>To switch GPIO2, enter:<\/p>\r\n<p><code>AT+SYSIOSETCFG=2,0,0<\/code> &#8212; &gt; 2: pin, 0: mode, 0: no pullup<\/p>\r\n<p><code>AT+SYSGPIODIR=2,1<\/code> &#8211;&gt; 2: pin, 1: output<\/p>\r\n<p><code>AT+SYSGPIOWRITE=2,1<\/code> &#8211;&gt; 2: pin, 1: HIGH<\/p>\r\n<p><code>AT+SYSGPIOWRITE=2,0<\/code> &#8211;&gt; 2: pin, 0: LOW\u00a0<\/p>\n\n<h2 class=\"wp-block-heading\">Programming with LUA<\/h2>\n\n<p>In addition to programming with Arduino and AT commands, there is a third variant, namely programming with the rather simple programming language LUA. To do this, you must first flash your module with the nodeMCU firmware. The procedure is described very well <a href=\"https:\/\/randomnerdtutorials.com\/flashing-nodemcu-firmware-on-the-esp8266-using-windows\/\">here.<\/a> I&#8217;m not going into it.\u00a0<\/p>\n\n<h2 class=\"wp-block-heading\">Getting deeper<\/h2>\n\n<p>If you want to get even deeper, you can try the <a href=\"https:\/\/www.espressif.com\/sites\/default\/files\/documentation\/2a-esp8266-sdk_getting_started_guide_en.pdf\">Manufacturer&#8217;s Getting Started Guide.<\/a> A very good site that explains the basics well is <a href=\"http:\/\/stefanfrings.de\/esp8266\/index.html\">this<\/a> one. I also recommend browsing the various example sketches you will find after installing the ESP8266 board family in the Arduino IDE.<\/p>\r\n<p>At a later stage, I will make a post about the big brother of the ESP-01, the ESP-12. I also have in mind to do introduce ways to expand the ESP-01 port. Stay tuned!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Controlling ESP-01 modules with the Arduino IDE is explained step by step. I provide example sketches with circuits. Also: AT commands.<\/p>\n","protected":false},"author":1,"featured_media":7951,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[543,548,570],"tags":[2672,556,658,601,657,660,2671,655,735,656,659],"class_list":["post-9057","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-boards-and-microcontrollers","category-wireless","category-wlan-en","tag-adapter-en","tag-arduino-en-2","tag-arduino-ide-en","tag-at-commands-en-2","tag-control-of-gpios","tag-ds18b20-en","tag-esp-01-vs-esp01s-en","tag-esp8266-en","tag-programmer-en-2","tag-programming-mode","tag-uploading-via-arduino"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>ESP8266 ESP-01 module &#8226; Wolles Elektronikkiste<\/title>\n<meta name=\"description\" content=\"Control the ESP8266 ESP-01 module with the Arduino IDE. Step by step guide. Example sketches with circuits. And: AT commands.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/wolles-elektronikkiste.de\/en\/esp8266-esp-01-module\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"ESP8266 ESP-01 module &#8226; Wolles Elektronikkiste\" \/>\n<meta property=\"og:description\" content=\"Control the ESP8266 ESP-01 module with the Arduino IDE. Step by step guide. Example sketches with circuits. And: AT commands.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/wolles-elektronikkiste.de\/en\/esp8266-esp-01-module\" \/>\n<meta property=\"og:site_name\" content=\"Wolles Elektronikkiste\" \/>\n<meta property=\"article:published_time\" content=\"2020-10-20T15:39:44+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-02-24T17:55:18+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/05\/esp8266_beitrag.png\" \/>\n\t<meta property=\"og:image:width\" content=\"960\" \/>\n\t<meta property=\"og:image:height\" content=\"960\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Wolfgang Ewald\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Wolfgang Ewald\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"17 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en\\\/esp8266-esp-01-module#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en\\\/esp8266-esp-01-module\"},\"author\":{\"name\":\"Wolfgang Ewald\",\"@id\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en#\\\/schema\\\/person\\\/b774e4d64b4766889a2f7c6e5ec85b46\"},\"headline\":\"ESP8266 ESP-01 module\",\"datePublished\":\"2020-10-20T15:39:44+00:00\",\"dateModified\":\"2025-02-24T17:55:18+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en\\\/esp8266-esp-01-module\"},\"wordCount\":2530,\"commentCount\":2,\"publisher\":{\"@id\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en#\\\/schema\\\/person\\\/b774e4d64b4766889a2f7c6e5ec85b46\"},\"image\":{\"@id\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en\\\/esp8266-esp-01-module#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/wp-content\\\/uploads\\\/2019\\\/05\\\/esp8266_beitrag.png\",\"keywords\":[\"Adapter\",\"Arduino\",\"Arduino IDE\",\"AT commands\",\"Control of GPIOs\",\"DS18B20\",\"ESP-01 vs. ESP01S\",\"ESP8266\",\"programmer\",\"Programming mode\",\"Uploading via Arduino\"],\"articleSection\":[\"Boards and Microcontrollers\",\"Wireless\",\"WLAN\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en\\\/esp8266-esp-01-module#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en\\\/esp8266-esp-01-module\",\"url\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en\\\/esp8266-esp-01-module\",\"name\":\"ESP8266 ESP-01 module &#8226; Wolles Elektronikkiste\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en\\\/esp8266-esp-01-module#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en\\\/esp8266-esp-01-module#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/wp-content\\\/uploads\\\/2019\\\/05\\\/esp8266_beitrag.png\",\"datePublished\":\"2020-10-20T15:39:44+00:00\",\"dateModified\":\"2025-02-24T17:55:18+00:00\",\"description\":\"Control the ESP8266 ESP-01 module with the Arduino IDE. Step by step guide. Example sketches with circuits. And: AT commands.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en\\\/esp8266-esp-01-module#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en\\\/esp8266-esp-01-module\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en\\\/esp8266-esp-01-module#primaryimage\",\"url\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/wp-content\\\/uploads\\\/2019\\\/05\\\/esp8266_beitrag.png\",\"contentUrl\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/wp-content\\\/uploads\\\/2019\\\/05\\\/esp8266_beitrag.png\",\"width\":960,\"height\":960},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en\\\/esp8266-esp-01-module#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Startseite\",\"item\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"ESP8266 ESP-01 module\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en#website\",\"url\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en\",\"name\":\"Wolles Elektronikkiste\",\"description\":\"Die wunderbare Welt der Elektronik\",\"publisher\":{\"@id\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en#\\\/schema\\\/person\\\/b774e4d64b4766889a2f7c6e5ec85b46\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en#\\\/schema\\\/person\\\/b774e4d64b4766889a2f7c6e5ec85b46\",\"name\":\"Wolfgang Ewald\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/wp-content\\\/uploads\\\/2019\\\/03\\\/cropped-Logo-1.png\",\"url\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/wp-content\\\/uploads\\\/2019\\\/03\\\/cropped-Logo-1.png\",\"contentUrl\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/wp-content\\\/uploads\\\/2019\\\/03\\\/cropped-Logo-1.png\",\"width\":512,\"height\":512,\"caption\":\"Wolfgang Ewald\"},\"logo\":{\"@id\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/wp-content\\\/uploads\\\/2019\\\/03\\\/cropped-Logo-1.png\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"ESP8266 ESP-01 module &#8226; Wolles Elektronikkiste","description":"Control the ESP8266 ESP-01 module with the Arduino IDE. Step by step guide. Example sketches with circuits. And: AT commands.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/wolles-elektronikkiste.de\/en\/esp8266-esp-01-module","og_locale":"en_US","og_type":"article","og_title":"ESP8266 ESP-01 module &#8226; Wolles Elektronikkiste","og_description":"Control the ESP8266 ESP-01 module with the Arduino IDE. Step by step guide. Example sketches with circuits. And: AT commands.","og_url":"https:\/\/wolles-elektronikkiste.de\/en\/esp8266-esp-01-module","og_site_name":"Wolles Elektronikkiste","article_published_time":"2020-10-20T15:39:44+00:00","article_modified_time":"2025-02-24T17:55:18+00:00","og_image":[{"width":960,"height":960,"url":"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/05\/esp8266_beitrag.png","type":"image\/png"}],"author":"Wolfgang Ewald","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Wolfgang Ewald","Est. reading time":"17 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/wolles-elektronikkiste.de\/en\/esp8266-esp-01-module#article","isPartOf":{"@id":"https:\/\/wolles-elektronikkiste.de\/en\/esp8266-esp-01-module"},"author":{"name":"Wolfgang Ewald","@id":"https:\/\/wolles-elektronikkiste.de\/en#\/schema\/person\/b774e4d64b4766889a2f7c6e5ec85b46"},"headline":"ESP8266 ESP-01 module","datePublished":"2020-10-20T15:39:44+00:00","dateModified":"2025-02-24T17:55:18+00:00","mainEntityOfPage":{"@id":"https:\/\/wolles-elektronikkiste.de\/en\/esp8266-esp-01-module"},"wordCount":2530,"commentCount":2,"publisher":{"@id":"https:\/\/wolles-elektronikkiste.de\/en#\/schema\/person\/b774e4d64b4766889a2f7c6e5ec85b46"},"image":{"@id":"https:\/\/wolles-elektronikkiste.de\/en\/esp8266-esp-01-module#primaryimage"},"thumbnailUrl":"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/05\/esp8266_beitrag.png","keywords":["Adapter","Arduino","Arduino IDE","AT commands","Control of GPIOs","DS18B20","ESP-01 vs. ESP01S","ESP8266","programmer","Programming mode","Uploading via Arduino"],"articleSection":["Boards and Microcontrollers","Wireless","WLAN"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/wolles-elektronikkiste.de\/en\/esp8266-esp-01-module#respond"]}]},{"@type":"WebPage","@id":"https:\/\/wolles-elektronikkiste.de\/en\/esp8266-esp-01-module","url":"https:\/\/wolles-elektronikkiste.de\/en\/esp8266-esp-01-module","name":"ESP8266 ESP-01 module &#8226; Wolles Elektronikkiste","isPartOf":{"@id":"https:\/\/wolles-elektronikkiste.de\/en#website"},"primaryImageOfPage":{"@id":"https:\/\/wolles-elektronikkiste.de\/en\/esp8266-esp-01-module#primaryimage"},"image":{"@id":"https:\/\/wolles-elektronikkiste.de\/en\/esp8266-esp-01-module#primaryimage"},"thumbnailUrl":"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/05\/esp8266_beitrag.png","datePublished":"2020-10-20T15:39:44+00:00","dateModified":"2025-02-24T17:55:18+00:00","description":"Control the ESP8266 ESP-01 module with the Arduino IDE. Step by step guide. Example sketches with circuits. And: AT commands.","breadcrumb":{"@id":"https:\/\/wolles-elektronikkiste.de\/en\/esp8266-esp-01-module#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/wolles-elektronikkiste.de\/en\/esp8266-esp-01-module"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/wolles-elektronikkiste.de\/en\/esp8266-esp-01-module#primaryimage","url":"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/05\/esp8266_beitrag.png","contentUrl":"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/05\/esp8266_beitrag.png","width":960,"height":960},{"@type":"BreadcrumbList","@id":"https:\/\/wolles-elektronikkiste.de\/en\/esp8266-esp-01-module#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Startseite","item":"https:\/\/wolles-elektronikkiste.de\/en"},{"@type":"ListItem","position":2,"name":"ESP8266 ESP-01 module"}]},{"@type":"WebSite","@id":"https:\/\/wolles-elektronikkiste.de\/en#website","url":"https:\/\/wolles-elektronikkiste.de\/en","name":"Wolles Elektronikkiste","description":"Die wunderbare Welt der Elektronik","publisher":{"@id":"https:\/\/wolles-elektronikkiste.de\/en#\/schema\/person\/b774e4d64b4766889a2f7c6e5ec85b46"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/wolles-elektronikkiste.de\/en?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/wolles-elektronikkiste.de\/en#\/schema\/person\/b774e4d64b4766889a2f7c6e5ec85b46","name":"Wolfgang Ewald","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/03\/cropped-Logo-1.png","url":"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/03\/cropped-Logo-1.png","contentUrl":"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/03\/cropped-Logo-1.png","width":512,"height":512,"caption":"Wolfgang Ewald"},"logo":{"@id":"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/03\/cropped-Logo-1.png"}}]}},"_links":{"self":[{"href":"https:\/\/wolles-elektronikkiste.de\/en\/wp-json\/wp\/v2\/posts\/9057","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wolles-elektronikkiste.de\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wolles-elektronikkiste.de\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wolles-elektronikkiste.de\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wolles-elektronikkiste.de\/en\/wp-json\/wp\/v2\/comments?post=9057"}],"version-history":[{"count":6,"href":"https:\/\/wolles-elektronikkiste.de\/en\/wp-json\/wp\/v2\/posts\/9057\/revisions"}],"predecessor-version":[{"id":23326,"href":"https:\/\/wolles-elektronikkiste.de\/en\/wp-json\/wp\/v2\/posts\/9057\/revisions\/23326"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/wolles-elektronikkiste.de\/en\/wp-json\/wp\/v2\/media\/7951"}],"wp:attachment":[{"href":"https:\/\/wolles-elektronikkiste.de\/en\/wp-json\/wp\/v2\/media?parent=9057"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wolles-elektronikkiste.de\/en\/wp-json\/wp\/v2\/categories?post=9057"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wolles-elektronikkiste.de\/en\/wp-json\/wp\/v2\/tags?post=9057"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}