Temp. and RH Data Logger With Wifi UI

I know! You’re thinking: ā€œOh god… another ESP temperature and humidity silly projectā€¦ā€ but wait! Here are the characteristics that might interest you:

  • this data loggerĀ can run for 55 daysĀ before theĀ memory is fullĀ (considering a 15 minutes sampling rate and a 64K SPIFFS)
  • ItĀ can run for 43+ monthsĀ before runningĀ out of batteryĀ (considering a 15 minutes sampling rate)
  • You can easily turn on/off Access Point Wifi mode to pair it with your cell phone (or tablet, laptop etc.) to download the data in a snap!Ā (<- that’s what is uncommon!)

Why I created that project? Because I needed to log the temperature and humidity with a 15 minutes rate during a 6Ā days backpacking expeditionĀ through theĀ Gran Desierto de AltarĀ (111+miles). I needed it to beĀ cheap,Ā reliable,Ā precise,Ā easy to useĀ and most of all that couldĀ run for daysĀ without having to either free memory space or recharge the batteries.

Temp. and RH Data Logger With Wifi UI

How I built it? Follow the steps!

You love it? Please vote!
Here:Ā https://www.instructables.com/contest/Microcontrol…
And here:Ā https://www.instructables.com/contest/sensors2017/

Step 1: Parts List

The pars are quite easy to find (Amazon, Ebay, local dealer etc.) and relatively cheap:

  • 1 xĀ ESP8266Ā version ESP07 (my favourite)
  • 1 xĀ SI7021Ā temperature and humidity industrial sensor, I2C connectivity
  • 1 xĀ LT1529-3.3Ā 3.3V voltage regulator with ultra-low quiescent current
  • 1 xĀ 22µFĀ 100V electrolytic capacitor
  • 1 xĀ 1900mAhĀ 3.7V LiPo/Li-ion battery
  • 1 xĀ TP4056Ā Li-ion charger board
  • 2 x single rowĀ male headers
  • 2 xĀ Slide switches
  • 2 xĀ Momentary pushĀ buttons
  • 1 xĀ Plastic enclosure
  • 1 x piece ofĀ aluminium screen

You will also needĀ regular electronics toolsĀ like soldering iron, pliers, wires etc., aĀ hot glue gunĀ and aĀ FTDI232 3.3VĀ programmer.

Step 2: Solder the Parts Together

We are going to build the circuit.

First we need to wire the ESP properly:

  1. wire GPIO15 to GND (mode configuration)
  2. wire GPIO02 to VCC (mode configuration)
  3. wire EN/CH_PD to VCC (to enable the chip)
  4. wire GPIO16 to RST (for the deep-sleep wakeup)
  5. wire a slide switch between GPIO00 and GND, we’ll name itĀ program switchĀ (to switch between running and programming mode)
  6. wire a momentary push button between GPIO04 and GND, we’ll name itĀ Wifi buttonĀ (to de/activate Access Point Wifi mode)
  7. wire a momentary push button between RST and GND, we’ll name itĀ Reset buttonĀ (to be able to reset the ESP at any time)
  8. solder the 2 headers to RX and TX (this will ease the connection between the programmer and the ESP)

Then we can connect the Temp. RH sensor to the ESP:

  1. wire SI’s SDA to ESP’s GPIO13
  2. wire SI’s SCL to ESP’s GPIO12
  3. wire SI’s GND to ESP’s GND
  4. wire SI’s 3.3V VCC to ESP’s VCC

Finally we need to build the power setup:

  1. wire battery’s Pos. to a slide switch
  2. wire the slide switch to LT’s VIN, we’ll name itĀ power switch
  3. wire battery’s Neg. to LT’s GND
  4. wire LT’s SENSE to LT’s OUTPUT
  5. wire the capacitor between LT’s OUPUT and GND
  6. wire TP’s BAT Pos. to battery’s Pos.
  7. wire TP’s BAT Neg. to battery’s Neg.

Now we can pair the power circuit with the rest:

  1. wire LT’s OUTPUT to ESP’s VCC
  2. wire LT’s GND to ESP’s GND

At this point, you should be able to see the EPS’s and SI’s power LEDs turn on when switching on the power slide switch. If not, double check your circuit for openings and shorts, make sure your battery is fully charged.

The LEDs draw unnecessary current and must be removed by either desoldering them or carefully ā€œdestroyingā€ them with pliers.

Here is a breadboard schematic view of the circuit, you can download the Fritzing fileĀ here.

Step 3: Send the Program to the ESP

To flash the ESP we will use the Arduino IDE. It’s almost as easy as flashing an Arduino.

Make sure theĀ power switchĀ is turner off.

First connect your FTDI programmer as follow:

FTDI pin ESP pin
RX TX
TX RX
GND GND

Do not connect FTDI’s VCC to ESP’s VCC as ESP is already powered by the battery and it could damage it.

Connect the programmer to your computer’s USB port.

Install Arduino IDE: see the first step of one of my Ibles.:Ā https://www.instructables.com/id/IoT-Door-Alarm-UPGRADED/#step1

Download the SI7021 library and uncompress it in the Arduino’s Library folder:Ā https://github.com/LowPowerLab/SI7021/archive/master.zip

Download the latest version of the code from my Github:Ā https://github.com/ClemRz/EspDataLogger/archive/master.zip

Unzip the file in the Arduino’s folder and openĀ EspDataLogger/software design/ESP8266_data_logger/ESP8266_data_logger.inoĀ with Arduino IDE.

Set theĀ program switchĀ so there is continuity between GPIO00 and GND, this isĀ program modeĀ (V.S.Ā run mode).

Turn on theĀ power switch.

Push the Upload button of the Arduino IDE, the ESP should be flashed with the firmware smoothly.

Set theĀ program switchĀ toĀ run mode.

Step 4: [Optional] Code Documentation

In this step I explain roughly how the software/firmware works.

There are 2 main ā€œfunctionsā€:

  • one that logs the temperature and humidity in a very power-efficient manner
  • another that activate the wifi and provide a UI to serve data and parameters

When the ESP starts or wakeup, it runs theĀ setupĀ function where we read GIPO04, the one connected to theĀ Wifi button.

  • If this pin is high it means that the button is not pressed (due to internal pull up resistor). In this case we will read the sensor, store the value read into the file and go to sleep for an amount of time defined by the sampling rate parameter.
  • If it is low, it means that the button is being pressed and instead of logging a new set of values we will activate the Wifi in the Access Point mode and serve a web page. This web page provide a form with different fields to allow visualisation, download and actions such as:
    • delete the file from te EEPROM memory
    • change the value of the sampling rate parameter (wakeup rate)
    • reset the ESP
    • etc.

If you want to know more about it feel free to check theĀ readmeĀ fileĀ here.

Step 5: Preliminary Tests

Before moving everything into a nice enclosure we will make sure that it is working as designed.

Turn on the Access Point / Wifi doing the following:

  1. Make sure the circuit is energised
  2. Push and maintain pushed theĀ Wifi button
  3. Push and release theĀ Reset button
  4. Wait for 3 seconds
  5. Release theĀ Wifi button

Using any wifi enabled device, like a smart phone, a tablet or a computer, search the open wifi signal namedĀ espDataLoggerĀ and pair with it.

Using a web browser on the paired device, visit the following url:Ā http://192.168.4.1

You should see a UI similar to this one:

Source: Temp. and RH Data Logger With Wifi UI


About The Author

Muhammad Bilal

I am a highly skilled and motivated individual with a Master's degree in Computer Science. I have extensive experience in technical writing and a deep understanding of SEO practices.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top