Skip to content

ESP sensor

The ESP sensor is a small Wi-Fi device that measures temperature, humidity, pressure and light. The node finds it on the network automatically, and its readings are added to the results of every experiment in the same incubator. The parts are inexpensive.

The sensor runs on any NodeMCU-compatible board, based on the ESP32 or the ESP8266. The ESP8266 is recommended: it is cheaper, more compact, more reliable for this use, and has a range of shields. The lab uses:

The two parts are kept apart because the ESP’s Wi-Fi module gives off enough heat to distort the temperature reading.

Solder the pins to both boards; sockets are not needed. Connect the BME280 with an I2C cable: red to GND, black to D2 (SDA), yellow to D1 (SCL) and white to 3.3 V.

A WeMos D1 Mini and its BH1750 light shield, before and after stacking

The assembled sensor in its printed case, open and closed

The BME280 comes in two versions, a 4-pin board for 1.8–5 V and a 6-pin board for 3.3 V; both work. The chip you want is square, with a black dot on its left.

The 4-pin BME280 board, which works over a wide range of voltages and measures humidity

The BME280 and the BMP280 side by side: the BME280 chip is square, the BMP280 chip rectangular

  1. Install the Arduino IDE.

  2. In Preferences, add this address to Additional Board Manager URLs:

    https://github.com/esp8266/Arduino/releases/download/3.1.2/package_esp8266com_index.json

    Wait a minute or two for the IDE to download the package list, then install the ESP8266 family from Boards → Boards Manager.

  3. Install these libraries: EEPROM_Rotate by Xose Pérez, Adafruit BME280 Library, BH1750FVI by PeterEmbedded, and ArduinoJson by Benoît Blanchon.

  4. Open the sensor sketch from the ethoscope repository. Select WeMos D1 R1 as the board for an ESP8266, or ESP32 Dev Module for an ESP32.

  5. Connect the board, select its port (usually /dev/ttyUSB0), then compile and upload.

The node finds the sensor and lists it at the top of its main page, as etho_sensor_000 by default. Change its name and location from the node, or open http://etho_sensor_000.local/web in a browser on the ethoscope network. The name is up to you; the location must match the name of one of the incubators registered on the node. When you start a tracking or video experiment in that incubator, the sensor’s readings are added to the results. The name and location are stored on the sensor itself.

The sensor’s own web page: board type, name, location and current readings, with the configuration form

The sensor’s web page also shows its readings; refresh it to update them.

For weather data, or for a sensor without hardware, see the virtual sensor.