We will learn how to make a simple protected web server to control some 5VDC relay modules and show the temperature from thermistor.
Tag: Project 110b ESP8266 ESP-12E module, thermistor and 5VDC relay module – Protected Web server. Acoptex.lt
Project resources
- Sketch: sketch
- Libraries: None;
- Other attachements: None.
Parts required
In this project, you needed these parts (Dear visitors. You can support our project buy clicking on the links of parts and buying them or donate us to keep this website alive. Thank you):
1. ESP8266 ESP-12E module and Micro USB cable 1pc

2.Arduino IDE (you can download it here)
3. Breadboard 1 pc

4. Thermistor 1 pc

5. Resistor 10 KOhm 1 pc

6. Jumper wires F-M, M-M

7. 5VDC relay module with 2 ch 1 pc

Understanding the thermistor
A thermistor is a type of resistor whose resistance is dependent on temperature, more so than in standard resistors. The word is a combination of thermal and resistor. Thermistors are widely used as inrush current limiters, temperature sensors (negative temperature coefficient or NTC type typically), self-resetting overcurrent protectors, and self-regulating heating elements (positive temperature coefficient or PTC type typically).
Thermistors are of two opposite fundamental types:
- With NTC thermistors, resistance decreases as temperature rises. An NTC is commonly used as a temperature sensor, or in series with a circuit as an inrush current limiter.
- With PTC thermistors, resistance increases as temperature rises. PTC thermistors are commonly installed in series with a circuit, and used to protect against overcurrent conditions, as resettable fuses.
Undestanding the relay module
You can read more about it here.
Understanding the ESP8266 ESP-12E WI FI module (LoLin NODEMCU V3)
You can read more about it here.
Signals and connections of the ESP8266 ESP-12E WI FI module (LoLin NODEMCU V3)

- TX – transmit pin. GPIO pin
- RX – receive pin. GPIO pin
- 3V3 (or 3V or 3.3V)- power supply pin (3-3.6V).
- GND ( or G) – ground pin.
- RST – reset pin. Keep it on high (3.3V) for normal operation. Put it on 0V to reset the chip.
- EN – Chip enable. Keep it on high (3.3V) for normal operation.
- Vin – External power supply 5VDC.
- D0-D8 – GPIO (General Purpose Input Output) pins
- D5-D8 – SPI interface
- D1-D2– I²C/TWI Interface
- SC (or CMD) – (Chip Select) – the pin that the master can use to enable and disable specific devices. GPIO pin
- SO (or SDO) – Master In Slave Out (MISO) – SPI communication. The Slave line for sending data to the master. GPIO pin
- SK (or CLK) – SCK (Serial Clock) – SPI communication.The clock pulses which synchronize data transmission generated by the master. GPIO pin
- S1 (or SD1) – Master Out/Slave In (MOSI). SPI communication. The Master line for sending data to the peripherals. GPIO pin
- S2 (or SD2) – GPIO pin
- S3 (or SD3) – GPIO pin
- VU (or VUSB) – external power 5VDC.
- A0 – ADC output.
- RSV – reserved
Wiring

Nodemcu 1.0 | 5VDC relay module |
GND | GND |
VU (5V) | VCC |
D1 (GPIO5) | IN1 |
D2 (GPIO4) | IN2 |
Step by Step instruction
1. Adding ESP8266 platform to Arduino IDE
The Arduino environment has to be set up to make it compatible with the ESP8266 ESP-12E module. We are using PC with Windows 7 64 bit OS.
1.Download and install the Arduino IDE. You can download it here
2.Open Arduino IDE.
3.Open the Preferences window from the Arduino IDE. Go to File -> Preferences.

4.Enter http://arduino.esp8266.com/stable/package_esp8266com_index.json into Additional Board Manager URLs field and click the “OK” button. If you already have a URL in there, and want to keep it, you can separate multiple URLs by placing a comma between them. (Arduino 1.6.5 added an expanded text box, separate links in here by line.)

5.Open Boards manager. Go to Tools -> Board -> Boards Manager…

7.There should be a couple new entries in addition to the standard Arduino boards. Look for esp8266. or scroll down to the ESP8266 entry (usually at the bottom). Select the ESP8266 entry. When you click it an install option will appear. Select the latest version and click install.

8.The board definitions and tools for the ESP8266 include a whole new set of gcc, g++, and other reasonably large, compiled binaries, so it may take a few minutes to download and install (the archived file is ~110MB). Once the installation has completed, an Arduino-blue “INSTALLED” will appear next to the entry.


2. Uploading sketch to ESP8266 ESP-12E development board
If you’re using an ESP-12E NodeMCU Kit, uploading the sketch is very simple, since it has built-in programmer.
Before use ESP8266 ESP-12E WI FI module (LoLin NODEMCU V3), you need to download the manufacture’s driver (CH340) for this chip and install it in your PC. Here is the link. See the description of driver installation package below: CH340 / CH341 USB to serial WINDOWS driver installation package that supports 32/64 bit Windows 10 / 8.1 / 8/7 / VISTA / XP, SERVER 2016/2012/2008/2003, 2000 / ME / 98, through Microsoft digital signature authentication, support USB to 3-wire and 9-wire serial port, with the product release To the end user. Applicable scope: CH340G, CH340C, CH340B, CH340E, CH340T, CH340R, CH341A, CH341T, CH341H chips.
If you have CP2102 chip then you need to download the manufacture’s driver for this chip and install it in your PC. Driver for Mac, Windows, Linux or more..
- Do wiring.
- Open Arduino IDE.
- Plug your ESP8266 ESP-12E module into your PC USB port.
- Choose your NodeMCU board. Go to Tools -> Board -> NodeMCU 1.0 (ESP-12E Module)
- Select the correct com port.
- Modify the sketch with your local network SSID and password and required IP address, gateway, subnet, primary DNS, secondary DNS, web server port; you will also need to change username and password (by default they are admin/admin).
- Verify and upload it to your ESP8266 ESP-12E module.
- After uploading the code open the Arduino IDE Serial monitor at 115200 bps. Press onboard RST button. You will see the IP address (in our case IP address is 192.168.1.211)
- Open any web browser and type in http://your-ip-address (in our case http://192.168.1.211).
- Type your username and password and click on Login button.
- You can see the temperature readings and can control 5VDC relay module with 2 channels. You can also see the state of each GPIO pin.




Wrapping up
We have learnt how to make a simple protected web server to control some 5VDC relay modules and show the temperature from thermistor.
Check for more DIY projects here.
Thank you for reading and supporting us.
Check for more DIY projects on Acoptex.lt and Acoptex.com!
If you are looking for high quality PCBs PCBWay is the best choice:

RELATED POSTS
Installing the ESP8266 NodeMCU Board in Arduino IDE 2.0 (Windows, Mac OS X, Linux)
How to flash NodeMCU ESP8266 firmware
How to control servo with joystick PS2 using NRF24L01 2.4GHZ RF transceiver module