After several Arduino-based designs with the use of external Bluetooth and Wi-Fi modules, I decided to purchase a pair of NodeMCU – ESP8266 boards that incorporate Wi-Fi and BT connectivity and can be programmed from the arduino environment. There is also a lot of documentation about these boards. The idea is to use them to control domestic equipment such as heating or lighting by connecting to the Wi-Fi network, which is known as the Internet of Things or IoT.

The arduino environment does not support the esp8266 family boards by default, so you have to install the support as follows: in “Preferences” we add in “Additional Card URL Manager” the following link:

http: // arduino / stable / package_esp8266com_index.json

Once this is done, in Tools-> Board-> Board Manager we should find support for esp8266 boards but we must install it.

Finally we will have the option to select esp8266 based boards, this time “nodeMCU 1.0 – ESP-12E Module”.

As with any board, if we want to program at a low level, configuring, for example, timers through their associated registers we will have no choice but to read the corresponding datasheet. If what we are going to do instead is to use external libraries like those of Adafruit we will not notice hardly any change with respect to being working with any arduino board.

As I also recently acquired two BMP280 pressure and temperature sensors, I’m going to mess with these to see how things are going. The sensor itself is of a tiny size, just a couple of millimeters, and is welded on PCB together with four resistors and two capacitors and with 2.54 mm pins to be used on a test board.

This sensor provides quite accurate pressure and temperature readings through SPI or I2C communication. This is configured by connecting one of the pins called CSB to Vcc, so we select I2C, or to GND, then communicating through SPI.

I’m going to use the I2C bus, which only has the SDA and SCL lines. It is a bus that can be shared by several devices and the way to access each one is through a different address for each case. The BMP280, if I2C is used, allows you to choose the address to use, 76H or 77H. The way to choose is by connecting the SDO pin (which is not used in I2C mode) to Vcc, selecting 77H or GND for 76H. I am going to use the 77H which is the one that the Adafruit library uses by default.

You have to download two libraries, one for the bmp280 and one that is common for all sensors. They are the following:



Unzip the .zip files and copy the folder they contain in Documents / Arduino / libraries /, assuming we are using that path for our projects.

As always when a new library is installed, you should take a look at the examples if you had them. In this case comes a program called bmp280_test that I am going to test. It seems that it acquires the sensor readings and sends them through the serial port. The first attempt did not work, leaving the message “Could not find a valid BMP280 sensor, check wiring!”.

The first thing that is not clear is what pins to use on the nodeMCU for the I2C bus. I have read contradictory things in different forums and after experiencing I am clear that D1 is SCL and D2 is SDA. I have not needed to connect external pull-up resistors that the bus requires to operate, it is possible that the sensor module incorporates them since the nodeMCU I think does not include them.

The Adafruit library uses the 77H address for the sensor by default, so once configured in this way, connecting SDO to Vcc, it worked perfectly, obtaining through the serial monitor the pressure and temperature readings as well as an estimated calculation of altitude above sea level.