Jump to content
  • 0

chipKIT Uno32, Sensor Integration Trouble


Nick Johnson

Question

Hello Digilent Community,

I am a mechanical engineering student at WSU and some of my friends and I am working on a personal project which involves taking pressure and temperature readings. To accomplish this we bought a couple of BMP280 Arduino sensors from Amazon.com found here: https://www.amazon.com/Diymore-Atmospheric-Pressure-Breakout-Replace/dp/B01IR44E1G/ref=sr_1_1?ie=UTF8&qid=1517419990&sr=8-1&keywords=diymore+bmp280

We are attempting to integrate this sensor with a chipKIT Uno32 board, however, no matter what we've tried we haven't been able to establish communication with the sensor. Whenever we run an example program and open the serial monitor, an error appears saying that no sensor could be found and to check the wiring. I will include a photo of the sensor to show how the pins are labeled. The "VCC" pin is wired to the 3.3V power terminal on the board and the "GND" pin is wired to the board's ground port, both via breadboard. I believe that the problem lies in the other two pins that are needed. We have tried wiring the "SCL" and "SDA" pins to several ports on the board to no avail. The sensor's Amazon page states that this board can use both I2C and SPI communication protocols, but me and my group of ME friends aren't really sure how to interpret this information. It would be very helpful if the pin correspondence for this sensor with the Uno32 was known, and assistance with this problem would be much appreciated. Our group is pretty out of our element here, and I apologize if I used some lingo incorrectly. To be clear, this is not a senior project or a graded assignment of any sort. We're just a few hobbyists. :)

Thank you and best regards,

Nick and the Team

Pinout.PNG

Link to comment
Share on other sites

7 answers to this question

Recommended Posts

Hi @Nick Johnson,

Unfortunately those of us at Digilent won't have the time to fully develop the code for this sensor or anything like that, but I can help make sure that the pins are all connected to the correct locations.

I'm not certain which Rev of the Uno32 you have, but SDA on the Uno32 is available on A4 and SCL is available on A5. Both of those pins will require some external pull-up resistors in order to work (as a requirement of the I2C protocol) and the two jumpers on the Uno32 next to those pins will need shifted over so that they straddle RG3 and the center pin and RG2 and its center pin as well.

The SPI protocol pins on the Uno32 that I tend to use are located on pins (as labeled on the silkscreen) 10, 11, 12, and 13 for CS (labeled CSB on your board), MOSI (labeled SDA on your board), MISO (labeled SDO on your board) and SCK (labeled SCL on your board). If you are using a predefined SPI library, you will likely want the jumper next to pin 10 on the silkscreen set to the RG9 side.

Otherwise, the main thing you will want to do is decide if you want to use I2C or SPI to communicate with your device. If you are planning to use I2C, connect CSB to a logic high voltage because (according to page 28 of the datasheet) if CSB is brought to a logic low state at any point, the SPI mode will be internally selected and will not switch back to I2C until a hardware reset occurs.

If you want to check out some examples of using SPI or I2C, I would recommend looking at some of the demo code for our Pmods. A SPI example is available on the Pmod ALS Resource Center and an I2C on the Pmod HYGRO Resource Center.

Let me know if you have any other questions.

Thanks,
JColvin

Link to comment
Share on other sites

Hi @JColvin,

Thank you for such a quick response. I currently have the board connected to my computer and have decided to take the SPI route since it does not require additional resistors. I have connected the CSB, SDA, SDO and SCL pins on the sensor to ports 10, 11, 12 and 13 on the board respectively. I am using a predefined library for this board, and I made sure that the jumper next to pin 10 is set to the RG9 side. After uploading the sample code to the board the serial monitor is still displaying the same error. What would you recommend that I do to continue troubleshooting? Below is a snapshot of the beginning of the code, and I believe that the pins are defined as you stated in the previous post.

Thank you again for your help.

Best,

Nick

Test Code Pic.PNG

Link to comment
Share on other sites

Hello @Nick Johnson,

It looks like you've commented out the SPI hardware commands (the bme(BMP_CS) and bme(CMP_CS, BMP_MOSI, BMP_MISO, BMP_SCK)) but left the I2C initialization intact. If you're not using the Wire.h library (the I2C library) you can comment it out as well.

Let me know if you have any questions about this.

Thanks,
JColvin

Link to comment
Share on other sites

Hi @JColvin

Thank you, I apologize for my coding incompetence. I commented out the I2C initialization and uncommented the SPI commands. However, when I have both the SPI commands uncommented the program throws an error that says I'm redefining 'Adafruit_BMP280 bme' as shown in the snapshot below. Do I need both lines of code for this program?

Best,

Nick

Redefinition Error.PNG

Link to comment
Share on other sites

Ah. It looks like multiple objects with the same name are being defined for the Adafruit_BMP280 class, so yes you can comment one out. I haven't looked at the library though, so I'm not certain which would be more appropriate to comment out with regards to your application though.

Thanks,
JColvin

Link to comment
Share on other sites

Hey JColvin.

I'm working on this project with Nick and have tried to go the I2C route. I haven't been able to get the serial monitor to display anything but garbled symbols. Though they do change based on what I comment out or when I change the delay. EX: if I cut the delay in half, I get twice as many symbols. Looking at tutorials of people using this sensor with Arduino boards they did not include resistors. Some only used voltage, ground, SCL, SDA. Some also connected the CSB and SDO to voltage and ground as well (to supposedly tell the sensor you want to use I2C). I'm wondering where you are suggesting putting the resistors and what kinds? I assume this would be for the CSB and/or SDO? 

Thanks for all the help so far. 

Nolan

Link to comment
Share on other sites

Hi @Nolan,

On page 29 of the datasheet here is states that CSB must be connected to Vddio to select I2C interface. SDI is bi-directional with open drain to gnd. It must be externally connected to Vddio vai a pull up resister. On page 38 it shows the suggested circuit for seting to I2C for the BMP280 Digital Pressure sensor. Looks like they suggest 2 capacitors.  They recomment C1 and C2 to be at 100 nF.

thank you,

Jon

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...