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.


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.


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:

How to install Espruino firmware in an ESP8266 board


This is an update to the installation tutorial I’ve already wrote: Run JavaScript on your ESP8266 using Espruino firmware

For this installation I’m using a D1 mini board which is a “wrapper” for the ESP8266 (ESP-12) board.

Flash the Espruino firmware

The first step is to flash the Espruino firmware into the ESP board. You can find a tutorial in the Espruino site. In this article I’m putting a short list of instructions ready to use.

Install the ESP tools with the following command:

The ESP tools are a set of Python scripts necessary to flash a firmware in the ESP board.

We need now the last version of the Espruino firmware, you can get it from the download page of the Espruino site. The zip file will contain the Espruino firmware also for the ESP8266 board.

We are ready to flash our board. The following instruction are for a ESP-12 board connected to the /dev/ttyUSB0 port. Please refer to the original tutorial for a different version of the ESP board. First move to the folder where you have unzipped the firmware.

The blue led in the board will start blinking and you will see the following output in console:

If you’re having problems finding the correct device path in Linux:

  • first check that you’re using an USB data cable. The first time I’ve tried I was getting crazy because I was using a simple power USB cable.
  • second try this console command to print the system events when the USB cable is plugged:

    When you plug the cable you will get something like this:

Ready to run

After the flash operation the board is ready to receive your JavaScript commands!

To send the commands you need to connect to the board using a serial connection (through the USB port). Under linux you can use the screen program:

Now you can send JavaScript commands that will be interpreted and the output provided as response.

For example writing:

you will get:

You can call functions, for example:

it will reset the board and print a boot message:

If you want to exit from Screen press CTRL-A and then \.

Now you’re ready to write your JavaScript code and run it in a ESP8266 board, for example using the Espruino Web IDE.