This project contains a Web Server for fetching the room temperature with a Temperature Sensor (BME280 Sensor Module).
- Install Arduino CLI
https://arduino.github.io/arduino-cli/1.2/installation/
You need:
- Mini D1 ESP32
- BME280 Sensor Module
- 4 wires
- USB Cable
Wiring:
- Place the controller on the edge of the breadboard
- Connect the wires as following:
BME280 Sensor Module -> Mini D1 ESP32:
- VCC -> 3.3V
- GNC -> GNC
- SCL -> IO22
- SDA -> IO21
- Connect the controller to the computer
-
Open the Arduino CLI
-
Go to File > Preferences > Click on the Icon next to "Additional boards manager URLS:" > Enter the URL: https://espressif.github.io/arduino-esp32/package_esp32_index.json > Click "Ok" > Go to Tools > Boards Manager > Search for "esp32" and install it (not esp32 boards) Source: https://docs.espressif.com/projects/arduino-esp32/en/latest/installing.html#installing-using-boards-manager
-
Got to Tools > Boards > Boards Manager > Search for "Wemos D1 Mini Esp32" and select your USB Port (for me it was "COM3")
-
Go to Tools > Manage Libraries > Install these libraries:
- Adafruit BMP280
- Adafruit BusIO
- Adafruit Unified Sensor
- ArduinoJson
-
Create a secrets.h file like in secrets.h.example with your ssid and wifi password. And also in temperatues.ino set the ssid to your routers ssid.
-
Create a temperature.ino file and paste the contents of the current temperature.ino file (on Gitlab) in this file
-
If your client runs on WSL/Virtual Machine in Ubuntu:
- The name resolution via dns doesnt work there, you have to either give the ip address or install a mdns responder with these libraries to enable dns-resolution from host:
sudo apt update sudo apt install avahi-daemon libnss-mdns # restart Wsl or reload /etc/nsswitch.conf # /etc/nsswitch.conf should have this line: # hosts: files mdns4_minimal [NOTFOUND=return] dns
- Upload the code
- Go to http://roomtemperature.local/temperature. You should see a json of the current room temperature like this: {"temperature":25.49}