From WiFi thermometer to advance home server.         Part 1 - WiFi thermometer.
Assembled board.

From WiFi thermometer to advance home server. Part 1 - WiFi thermometer.

This is a first article on this topic. I will explain how to build your own cheap WiFi climatic sensor, how to setup software, end eventually build advance home server for home automation, telemetry and learn lots of new open source project.

If you want to make this project please visit GitHab project page. You can find schematic, gerber files and STL files for printing an enclosure, and example of ESP home script configuration.

I will put a cost in a first place, so anyone could estimate whether it worth to put an effort into it or not.

Bill of material (BOM)

Cheap is good statement but how much ?

  1. PCB production: Base board - 5 EUR/10pcs - [jlcpcb]
  2. Sensors: AHT20+BMP280 - 1.25 EUR/1pcs [Aliexpress]
  3. LDO: AMS1117-3.3 - 0.11 EUR/1pcs?[Aliexpress]
  4. 6 Pin SMD USB type-C connector: 2 EUR/10pcs [Aliexpress]
  5. CPU + WiFi: ESP-01s - 1,11 EUR/1pcs [Aliexpress]

Total: 3.17 EUR/1 sensor (Discrete SMD parts are not tacked into account)

Additionally you need ESP-01 flasher 0.66 Eur/pcs [Aliexpress]

Schematic

Schematic is very simple:

  • USB-C for power input,
  • LDO for 3.3V, as ESP8266 need 3.3V
  • I2C pull-ups (optionally, as sensor board already have one)

No alt text provided for this image
Schematic of Wifi temperature sensor.

Sensors:

ESP-01 have only 2 free GPIO, so I2C is the only option for communication.

AHT20 - Humidity and temperature

Link to datasheet for information: [ link1, link2 ]

No alt text provided for this image
AHT20 specification

BMP280 - Digital Pressure Sensor

link to datasheet for information: [link]

No alt text provided for this image
BMP280 specification

PCB

PCB assembly requires medium soldering skills, due to USB connector.

Assembly requires few additional components:

Assembled board without ESP-01s soldered.


Power consideration.

Sensor, power supply and WiFi they all located on small board close to each other. Main problem of that dense packaging is a power dissipation of the components. Total heating from components may introduce an error into temperature measurement.

Minimum current ESP in active mode is 50 mA

Link to source
Power consumption of ESP8266 in different sates

ESP8266 requires 3.3 V power supply. In the schematic LDO is used as cheapest option. Simple calculation shows that

  • LDO overheating is (5 V - 3.3 V)*0.05 V = 0.085 W * 15 K/W = 1.25 degC,
  • ESP overheating is 3.3 V * 0.05 V = 0.165 W *100 K/W = 16 degC

Expected overheating is 17.25 degC, which could not be neglected. In order to reduce power consumption deep sleep for ESP8266 need to be used. Sensor will wake up for few seconds transmit data to server and go to sleep

Sleep mode modification

For enabling deep sleep on ESP-01s board, you need to solder a wire as shown below. That tiny pin is GPIO 16 and it needs to be connected to RST pin.

Sleep mode modification

Here is small video guide how make this modification: Link to Youtube

Enclosure

Enclosure have no any screw, two pieces clips into each other.

Be careful and flash ESP8266 before assembly into case, first time flashing requires wired connection.

Assembled sensor.

Software

I will describe software and integration in next articles as it is another huge part of talk. Here i will describe key features and may choice.

In order to simplify development and system integration i decided to use ESPHome open source software. This doesn't mean that using "bare metal" codding is forbidden. i just search for the way to make it as simple as possible.

ESPHome use simple yet powerful yaml scripting language. Example of script you may find in git hub repository

First time flashing

Unfortunately, first time flashing requires wire connection. I can recommend to flash ESP-01s before soldering.

There are several ways how to run ESPHome. I will describe here easiest one only. Install Home Assistant OS on raspberry pi then add ESPHome as component. There are lost of tutorial how to do it on youtube.

  1. Installing Home assistant on raspberry pi
  2. Make initial setup of Home Assistance OS
  3. Installing ESPHome
  4. Setup ESPHome.
  5. Press button "New device"
  6. Select ESP8266
  7. Generate initial config and flash it into ESP-01s module. Once this is done you can flash update it wireless
  8. Solder ESP-01s into sensor board.
  9. On your new device press "Edit" and copy content of yaml file from github into your new yaml file. Pay attention that some part of yaml file only need to be added and not replaced, aslo network setting need to be modified according to your routed settings.

Adding new device into ESPHome environment

Integration

First type of integration is a Home Assistant OS. This is pretty powerful tool and it is open source and free to use. After adding senor to home assistant you can read all measurements in real time and plot 1 month history.

ESPHome sensor integrated into Home Assistant OS

Second and more advance integration is:

ESPHome -> Home Assistant OS - > InfluxDB - > Grafana

ESPHome collecting data from hardware sensors and transmit it to Home Assistant OS which add automation to it, such as sensing data to InfluxDB. Grafana connects to InfluxDB and provide visualization of data in effortless way.

InfluxDB is open source data base server that provide enterprise experience.

Grafana is another open source data visualization service that has easy integration with InfluxDB.

This kind of services requires mode a bit more skills and infrastructure to run, but at the end you have unlimited capabilities for data collection and visualization.

Example of data visualization using Grafana.

I hope it was interesting for your.

Next articles i will focus on how to create cheap and powerful home server with enterprise features such as:

  • Linux containers (LXC) and Docker containers
  • Kernel Virtual Machines and QEMU
  • Storage and recourse (CPU and RAM) pulls.
  • Scheduled backups
  • Central management software
  • Power backup and shout-down on low battery


Martin Goodchild, PhD CPhys FIET FIAgrE FRSA

Sensors in Soils / Climate / Aquaculture / Agri-tech - Honorary Research Fellow | Advisory Council Member, Harvard Business Review

1 年

Very nice work, thanks for sharing. I notice your sensor also measures relative humidity. Combining T & RH enables a very important climate and horticulture parameter of vapour pressure deficit (VPD) to be calculated. More details can be found here, https://iopscience.iop.org/article/10.1088/1361-6501/acf878 So your home IOT system could easily become a greenhouse IOT system.

Simon Bramble

Staff Applications Engineer at Analog Devices

1 年

genius! Your company is lucky to have you

Venelin Despotov

Engineering Manager at Visteon Corporation

1 年

Great stuff

Good idea for home IOT applications!

回复

要查看或添加评论,请登录

社区洞察

其他会员也浏览了