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

 

Leave a Reply

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

Time limit is exhausted. Please reload CAPTCHA.