Using a BMP280 with the BBC Microbit V2 and Zephyr OS

I wanted to continue my investigation of the Microbit V2 and Zephyr by adding an external I2C device. The BMP280 module I chose is able to report back temperature and atmospheric pressure. I thought it would be nice to combine this with the earlier ST7789 example to produce a live reading of temperature and pressure on the display. This required a slight modification to the ST7789 setup as it is not possible to use both I2C1 and SPI1 in the same NRF52833 (microbit) project. This was easily fixed as the NRF52833 has SPI interfaces 0 to 2. I chose SPI1 which led me to write the following app.overlay file:

&spi2 {
 compatible = "nordic,nrf-spi";
 status = "okay";
 sck-pin = <17>;
 mosi-pin = <13>;
 /* Redirecting MISO to a pin that is not connected on the microbit v2 board */
 miso-pin = <27>;
 clock-frequency = <1000000>;
&i2c1 {
	compatible = "nordic,nrf-twim";
	status = "okay";
	sda-pin = < 0x20 >; // P1.0 = pin reference 32+0 = I2c_EXT_SDA
	scl-pin = < 0x1a >; // P0.26 = pin reference 0x1a = I2C_EXT_SCL

Code is available over here on github.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s