593ecfa7e0 | ||
---|---|---|
TemperatureSensorScript_for_ESP32 | ||
TemperatureSensorScript_for_ESP8266 | ||
README.md |
README.md
Arduino Temperature SensorScript
Preparations
To start you will need either an ESP32S or an ESP8266 as these scripts are made with them in mind.
The temperature sensor used for these scripts is the DHT22
Setup
To upload the script to the ESP you will first need to follow these steps:
- Download Arduino IDE from Arduino's website https://www.arduino.cc/en/software (be sure to checkmark Install USB driver and Associate .ino files in setup installation), then plug in your board
- Download the script fitting your board from this Git and open it in the IDE
- In the upper navigation bar click on
File
, then click onPreferences
- In Preferences there should be a field called
Additional Boards Manager URLs:
, copy and paste below links to that field, and then clickOK
- Once more in the navigation bar, click on
Tools
, thenBoard:
and thenBoards Manager...
- In Boards Manager search either esp32 or esp8266 depending on your board, and then click Install
- Back in
Board:
select the appropriate board (for ESP32 I use Node32s, and for ESP8266 Boards I use LOLIN(WeMos) D1 R1) - Still in the
Tools
click onPort:
and select the port your Arduino is in - Now in the navigation bar click on
Sketch
, thenInclude Library
, and thenManage Libraries...
- In the upper search in Library Manager search DHT sensor library and choose the library "DHT sensor library" by Adafruit, install all other libraries needed for the download to complete
- Finally upload the sketch by clicking the arrow pointing right (for the ESP32S you will need to hold down the Boot button and let go when it says Connecting... in the console)
- You should now be able to see it connecting to the internet through the serial monitor, or by observing the boards built in led
Connecting Sensor
These scripts use pin 21 for ESP32 and pin D4 for ESP8266, feel free to change them if needed.
The DHT22 needs to be connected to either 3V3 or 5V, ground (G), and the serial pin stated above.
Notes
Once it connects to the wifi, the board should send a POST request upon startup.
When connecting to wifi the built in LED will blink, when sending POST request it will flicker, and when it can't read the sensor it will be lit up