Internal/External temperature sensor with two ESP8266 boards and Espruino

In this article we will use two ESP8266 board to show internal and external temperature in an OLED screen using Espruino and some JavaScript code.

 

 

 

 

The internal board will:

  • read the temperature and humidity from a DHT22 sensor
  • receive the external temperature and pressure from the external ESP board
  • show all the information in the OLED screen

The external board will:

  • read the temperature and barometric pressure from a BMP085 sensor
  • send the temperature and the pressure to the internal board using a WiFi connection

In this article we will reuse the wiring and the code we wrote in the previous articles about the ESP8266 board.

Wiring

The internal board is wired to the DHT22 sensor and the OLED screen:

The external board will be connected to the BMP085 sensor:

Internal board code

The internal board gets the internal temperature using the DHT22 sensor and print it in the OLED screen. The board prints also the external board information, we keep such information in an externalData variable.

But how the externalData variable get updated? Through a socket server that listen for new connection on port 1234. When a connection is established the server read the sent data.

The complete code is available as attachment. Time to setup the external board.

External board code

The external board reads the temperature and the barometric pressure from the BMP085 sensor and send it to the internal board using a TCP connection.

The result

 

Reading pressure and temperature from a BMP085 using an ESP8266 board and Espruino

In this short tutorial we will read the barometric pressure from the BMP085 sensor using an ESP8266 board and Espruino with some Javascript code.

Wiring

Our BMP085 sensor communicates through an I2C connection, so we need to connect the SCL pin to the corresponding D1 pin and the SDA pin to the corresponding D2 pin in the ESP board. The other two pins are dedicated to the power.

Code

To read both pressure and temperature we will use the BMP085 module of Espruino. After the I2C connection is setup we initialize the BMP085 module, then we start polling and printing the sensor information.

Here the result: