> For the complete documentation index, see [llms.txt](https://docs.aic-eec.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.aic-eec.com/general/hot-cloud/connect-esp3266-to-mqtt/connect-esp3266-to-sensor.md).

# Connect ESP3266 to sensor

Connecting this ESP3266 to a temperature sensor is easy. All you need to do is a datasheet.&#x20;

![](https://1856353139-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MClo3nC-1US0rbK8Qau%2F-MDStn3IZ5J_c9dqi_2Z%2F-MDSzTKfmIclsngsuJ6f%2FNodeMCU-ESP8266-Pinout.jpg?alt=media\&token=21e945d8-a037-4717-8318-cdcc811de95f)

We will use DS18b20 temperature sensor. There are 3 pins for this sensor which are GND (Ground), VCC (Voltage Common Collector), and SIG (Signal). &#x20;

![VCC (Green), GND (Red), and SIG (Yellow)](https://1856353139-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MClo3nC-1US0rbK8Qau%2F-MDStn3IZ5J_c9dqi_2Z%2F-MDSurmGSOisJ5A8Xsme%2F20200729_132257.jpg?alt=media\&token=c5a407dd-481e-4642-a2f4-bde91169a56f)

How we connect the sensor to ESP3266:&#x20;

* GND (Red): To "G" pin of ESP3266
* VCC (Green): to 3V pin of ESP3266
* SIG (Yellow): to D4 pin of ESP3266

Oh, don't forget a resistor (330 ohms) between a 3V pin and D4 pin.&#x20;

![](https://1856353139-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MClo3nC-1US0rbK8Qau%2F-MDStn3IZ5J_c9dqi_2Z%2F-MDSuxracEFucwQiRO1y%2F20200729_132234.jpg?alt=media\&token=b823bdfe-1472-4cb7-aaed-11d4e91aea96)
