This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

How to connect nrf9160 with multiple bme280 sensor?

Hello!

I have followed nrf connect sdk tutorial part3 and have walked through for bme280. But now I want to connect two or more bme280 sensors to my dk. How should I modify the prj.conf file, the overlay file and the main.c file?

Thanks a lot.

Regards

PoNien Su

Parents
  • Hello PoNien Su,

    Here is an example of how you can connect three BM280 sensors to the nRF9160 DK using the I2C-interface.

    Since the device addresses of the BME280 are limited to 0x76 and 0x77, you can connect two sensors to one I2C-bus and the third to an additional one.

    Your overlay file will then look like this:

    &i2c2 {
    	bme280_76@76 {
    		compatible = "bosch,bme280";
    		reg = <0x76>;
    		label = "BME280_76";
    	};
    	bme280@77 {
    		compatible = "bosch,bme280";
    		reg = <0x77>;
    		label = "BME280";
    	};
    };
    
    &i2c3 {
    	sda-pin = < 0x12 >;
    	scl-pin = < 0x11 >;
    	compatible = "nordic,nrf-twim";
    	status = "okay";	
    	bme280_i2c3@77 {
    		compatible = "bosch,bme280";
    		reg = <0x77>;
    		label = "BME280_I2C3";
    	};
    };
    
    &spi3 {
    	status = "disabled";
    };

    Be aware that due to memory instantiation, you have to disable the SPI3 interface. See:

    https://infocenter.nordicsemi.com/index.jsp?topic=%2Fps_nrf9160%2Fmemory.html&anchor=topic

    Make sure that you are using the following options in prj.conf:

     

    CONFIG_I2C=y
    CONFIG_SENSOR=y
    CONFIG_BME280=y

    You can now use the sensors in main.c in the same way as demonstrated in the tutorial.

    I hope this will help you! Let me know if you have any more questions.

    Regards,

    Markus

Reply
  • Hello PoNien Su,

    Here is an example of how you can connect three BM280 sensors to the nRF9160 DK using the I2C-interface.

    Since the device addresses of the BME280 are limited to 0x76 and 0x77, you can connect two sensors to one I2C-bus and the third to an additional one.

    Your overlay file will then look like this:

    &i2c2 {
    	bme280_76@76 {
    		compatible = "bosch,bme280";
    		reg = <0x76>;
    		label = "BME280_76";
    	};
    	bme280@77 {
    		compatible = "bosch,bme280";
    		reg = <0x77>;
    		label = "BME280";
    	};
    };
    
    &i2c3 {
    	sda-pin = < 0x12 >;
    	scl-pin = < 0x11 >;
    	compatible = "nordic,nrf-twim";
    	status = "okay";	
    	bme280_i2c3@77 {
    		compatible = "bosch,bme280";
    		reg = <0x77>;
    		label = "BME280_I2C3";
    	};
    };
    
    &spi3 {
    	status = "disabled";
    };

    Be aware that due to memory instantiation, you have to disable the SPI3 interface. See:

    https://infocenter.nordicsemi.com/index.jsp?topic=%2Fps_nrf9160%2Fmemory.html&anchor=topic

    Make sure that you are using the following options in prj.conf:

     

    CONFIG_I2C=y
    CONFIG_SENSOR=y
    CONFIG_BME280=y

    You can now use the sensors in main.c in the same way as demonstrated in the tutorial.

    I hope this will help you! Let me know if you have any more questions.

    Regards,

    Markus

Children
No Data
Related