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

Starting out

Hi, I've being using an arduino to collect pressure measurements from the BOSCH BMP280 pressure sensor over I2C. I want to do the same using the nRF52840 and miniturize my device. I want to send the data over bluetooth to my PC. Where are the tutorials and sample code that would help me? Is there a sample project similar to this?

Parents
  • I think it's best to do it in smaller steps, so I would suggest that you start getting the sensor reading over I2C to work first, then once that's done you can start with the BLE part. The TWI Sensor Example can be modified to read data from the bosch sensor. Also, see TWI master for documentation of the driver itself. 

  • That doesn't sound reassuring from a respected company like Nordic!

    Are there not a lot of people requesting the same thing?

  • The thingy FW is not a part of our regular SDK release. It's built on an older SDK version. Also, it doesn't include project files for Segger Embedded Studio IDE, requiring you to either Makefiles or Keil uVision to build it. It's certainly not the most straightforward example to start with. Again, my advice is to do it in smaller steps. I would have started developing the FW on an nRF52840 DK connected to a BMP280 breakout board (or an Arduino type shield if that exists) and get the I2C part to work first. The development kits, unlike the thingy:52, include an onboard Jlink lite debugger that you can later use to program your custom boards.

    Our online power profiler makes it easy to estimate current based on various parameters: https://devzone.nordicsemi.com/nordic/power. It does not include the sensor, but it will likely have little impact on the average power consumption. It depends on how frequent you need an updated reading and what the sensor's standby current is. For actual measurements on the DK, see Measuring current

  • It's certainly not the most straightforward example to start with

    Ha ha - no kidding!!

    Smiley

    To be fair, the Thingy is a pretty complex system - certainly not a beginning example!

    I wouldn't be surprised to find that most people just buy it and use it as-is ... ?

  • Hi Vidar and awneil,
    The example
    examples\peripheral\temperature\pca10056\blank\ses\temperature_pca 10056
     works for me. It outputs temperature.
    For the TWI example twi_sensor
     I need the mbed board which I have ordered.
    In the meantime, I have connected my Bosch BMP280 pressure sensor board to the Nordic nRF5 DK board.
    VCC 5V
    GND GND
    SCL P027
    SDA P026
    When I run examples\peripheral\twi_scanner\pca10056\blank\ses
    twi_scanner_pca10056
    I get TWI device detected at address 0x76
    However, when I run twi_sensor (no mbed board but with the BMP280 pressure sensor connected), I don't see any readings although I get the output "TWI sensor example started."
    I can see two possible reasons why I'm not seeing any output.
    That example is trying to get output from an accelerometer?
    Or that example is configured with different pins for the SCL and SDA?
    Have you any ideas how I might get reading from the pressure sensor by modifying this example?
    Best regards,
    John A.
  • Hi John,

    ARDUINO_SCL_PIN and ARDUINO_SDA_PIN are by default mapped to 27 and 26, respectively. So the connections are correct. The test you did with the scanner example also confirms this. The sensor would not have been detected otherwise. That said, VCC must be the same as the nRF IO voltage +-0.3V to not exceed the maximum voltage ratings of the chip (Absolute maximum ratings). 5 volt can actually cause damage to the HW. You can use the output labeled with "VDD" on the DK as supply to the sensor. This will ensure the same voltage level on both sides. VDD ranges from ~1.8v - 3v depending on your power configuration.  

    The bosch sensor has its own register addresses and commands that the example needs to be adapted to. The datasheet should include more information about how you can interact with the sensor. 

    Do you have access to a logic analyzer or scope? It's very helpful to be able to inspect the TWI transfers on the bus lines to verify that data is transmitted and received according to the datasheet.  

    Best regards,

    Vidar

Reply
  • Hi John,

    ARDUINO_SCL_PIN and ARDUINO_SDA_PIN are by default mapped to 27 and 26, respectively. So the connections are correct. The test you did with the scanner example also confirms this. The sensor would not have been detected otherwise. That said, VCC must be the same as the nRF IO voltage +-0.3V to not exceed the maximum voltage ratings of the chip (Absolute maximum ratings). 5 volt can actually cause damage to the HW. You can use the output labeled with "VDD" on the DK as supply to the sensor. This will ensure the same voltage level on both sides. VDD ranges from ~1.8v - 3v depending on your power configuration.  

    The bosch sensor has its own register addresses and commands that the example needs to be adapted to. The datasheet should include more information about how you can interact with the sensor. 

    Do you have access to a logic analyzer or scope? It's very helpful to be able to inspect the TWI transfers on the bus lines to verify that data is transmitted and received according to the datasheet.  

    Best regards,

    Vidar

Children
No Data
Related