ESP8266 IoT Temperature Sensor
2019-06-06 | By ShawnHymel
License: Attribution Capacitors Resistors
In the fourth episode of my Bantam Tools milling machine video series, I show how to create a double-sided printed circuit board (PCB) for fast and easy prototyping.
To view parts 1 - 3 click the links below.
- Create PCBs for Rapid Prototyping – Part 1 – Setting up a Bantam Tools PCB Milling Machine
- Create PCBs for Rapid Prototyping – Part 2 – Using KiCad to design a PCB
- Create PCBs for Rapid Prototyping – Part 3 – Creating & Milling a Single Sided PCB
In an effort to create a reason for why someone might need a double-sided PCB, I threw together a quick-and-dirty Internet of Things (IoT) sensor using an ESP8266 and an MCP9808 temperature sensor. As to be expected, I used KiCad to create the PCB. In a sense, I created a sort of “temperature sensor throwie.”
If you would like to create your own version of this throwie or use it as the basis for your own IoT sensor design, you are more than welcome to download the schematic, layout files, and code from the following GitHub repository:
https://github.com/ShawnHymel/esp8266-temp-proto
If you are curious about the electrical design, it can be found in PDF form here.
You will need to mill your own board or send out the KiCad layout files for production by a professional manufacturer. If you want solder mask and silkscreen, you will need to run a new set of gerbers from within KiCad.
Next, order the parts found in the bill of materials (BOM) and solder them to the board. You will need to connect a Serial-to-USB converter to upload code to the board.
Press and hold both buttons. Release the RESET button while still holding the PROG button. After 1-2 seconds, release the PROG button. This will put the ESP8266 in bootloader/programming mode. From here, you can upload the esp8266-temp-get.ino Arduino sketch found in the Firmware section of the repository. Don’t forget to update the WiFi SSID and password along with your server’s IP address.
With Python installed, run the server.py program found in the Software section of the repository. This will run a simple web server that listens for HTTP requests on your computer. Plug in power to the ESP8266, and it should connect to your network. After a moment, it will sample temperature from the sensor and send that to your web server. Temperature readings should be printed to the console.
And there you have it! A fast prototype of an IoT device that transmits temperature data over WiFi to a local server.
Have questions or comments? Continue the conversation on TechForum, DigiKey's online community and technical resource.
Visit TechForum