WiFi Sensors


This page describes my experiments with WiFi Sensors based on ESP8266 modules.

ESP8266 and sensors

I use ESP-07 and ESP-12E modules and simple universal board. For measuring I use following sensor types:

ESP8266 has pins Reset and GPIO16 connected and deep sleep functionality is used. Sensors measure values every 5 minutes and sleep between measuring. This allows live with two AA bateries more than one month. In my experience, that modules works with voltage about 2.8 V correctly.

Source code

Here is source code, developed using Arduino IDE. It's common for my four sensors and concrete one must be enabled by uncomenting some lines at top of code.

ESP8266 programming

For programming, I use CP2104 USB UART and Level shifter for 5 V -> 3.3V conversion.

IOT database

I store measured data to Oracle database. Yes, this is overkill, but I have this database installed for work development and I am too lazy to install something else. Database model is very simple and self explained, I hope:

Database model

Scripts for initial populate of DB tables are located in project IotDbScripts


IotDatabase is ORM layer between Oracle tables and Java. It's use EclipseLinkexternal link as ORM engine. For each database table, there is mapping class - SensorOwner, SensorType, Sensor, etc. Also service layer for obvious tasks are created.



IotService is Java EE application based on:

Yes, it's maybe another overkill, but I want to learn some Java EE technologies.

IOT Service

IotService is deployed on Apache Tomcat server, and this service has following purposes:


This controller is responsible for storing data from sensors, and for sending alerts. Everytime sensor measure value, WiFi connection is established and following HTTP GET request is sent to IotService:


Request contain sensor code and measured value.

IOT Service

When measured value is under/over defined alert, email message is sent, like this:

Alert email


This controller generates web page with chart. It loads values and create desired averages. Google chartsexternal link API is used for chart rendering. Controller serves JSON data for chart.


Other Controllers

I have developed some other controllers for getting data in JSON and other things.


At this time, I have four ESP modules with various sensors in gardenhouse, greenhouse and outdoor. Server side service is under daily development, but if somebody is interested about source code, let me mail, it's nothing secret.

Valid XHTML 1.0!     Creative Commons License - non commercial