Skip to content

bostrum/esp32-nginxtemp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

esp32-nginxtemp

IoT sensor using ESP32 with Dallas temperature sensor and reading Nginx access logs.
No internal network access, exposed API or VPN required. Just internet connection and a web server.

The ESP32 sends HTTP request to your web server like below every 10 seconds. Which is then read by the bash script, exported to text file, read by javascript on the website and populated in elements with id footer and temperature.
"https://yourserver.com/?temperature=12.3"

Example

My self-hosted example, online unless power outage. Less downtime than Azure/O365 though..
"https://badtunna.kstad.se"

Getting started

  1. Clone repository, run bash script as service or cron job on your nginx server.
    Change variables on line 2-3 for your log file and output file if different.
  2. Connect Dallas temperature sensor to your ESP32, see wiring diagram below under images. (3.3V, GND, D2 and 4.7K ohm resistor between 3.3V and D2)
  3. Edit variables at lines 8-10 in 'esp32_temp.ino' for your Wi-Fi ssid, password and your server address. (For example: yourwebserver.com). PS. There is also the 'esp32_temp_battery.ino' using deep sleep, adjust SLEEP_TIME for longer sleep and better battery life.
  4. Confirm that the temperature is recieved in your nginx access log by running grep like below:
grep "temperature=" logs/access.log
  1. Add index.html to your Nginx server or just use parts of the <script></script> for your own site,
    just remember to edit the getElementById as needed or adding elements with same id like temperature and footer divs.
  2. ESP32 will send temperature data every 10 seconds.

Images:

  • Website:
    Example site for displaying temperature uploaded as index.html in the repository. example
  • Hardware:
    ESP32, DS18B20 Dallas waterproof temperature sensor and a electric junction box for outdoor use.
    Cable connector for sensor cable and soon another one for power as well. New Project (10)
  • Wiring:
    Please check so pinout is the same on your Arduino before connecting. Don't forget connecting the 4.7K ohm resistor between 3.3V and D2. I just cut the cables and soldered it in between. test

About

Lazy IoT temperature sensor by reading Nginx access logs sent by a Arduino ESP32 with Dallas. Therefore not exposing the Arduino itself to the internet, not requiring public IP-address or VPN connection off-site.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors