Hello! My team and I are attempting to build an ROV that utilizes both the Bar30 Pressure sensor and the TSY01 Temperature sensor (from BlueRobotics). We opted to run these both off a Raspberry Pi rather than use the stock Arduino libraries. We found the I2C addresses to each on their respective data sheets, but we are having trouble addressing and implementing them together. According to its data sheet, the temperature can have two addresses, depending on the value selected by its CSB (?) pin. The data sheet seems to suggest, however, that some sort of chip is needed to run the sensors. Could someone clear this up for me and my team (We are new to the ROV scene).
The Celsius temperature sensor has a default I2C address of 0x77 and the Bar30 is 0x76. You should be able to operate them together just fine. Have you gotten them to work individually?
I am having some trouble with the Bar30 sensor. We are using a teensy 2.0 with 3.3V power with pull-ups to the sensor. It works for a while but then locks up the micro completely until power reset. This does not seem to happen with the sensor in air but within an hour or so under water. The tether is about 2m long. I am going to try some I2C extender chips but I am wondering if the problem is due to the poor Arduino wire software. Has anybody experienced this and used a better I2C program ?
The I2C bus was never intended for communication over long distances. It was really designed for onboard communication between ICs or for board to board communication for boards that are closely spaced.
When controlling my BlueESC Thrusters, I had to reduce the Arduino I2C program clock speed to obtain consistent communication with all six Thrusters some of which were around 24 inches from the Arduino Uno.
I think that attempting to use the I2C bus over a two meter cable is not consistent with the I2C design theory.
Yes. But there is considerable discourse on the Arduino forums that the wire library has a tendency to hang the whole Arduino up. I am going to try two ideas -1 ) I have some I2C extender chips that go on either end and claim 10 m communication. Also - 2) I am going to try some other I2C libraries that claim to enforce an timeout to prevent the bus from hanging the micro up.
Does the Teensy 2.0 use 3.3V or 5V logic on the SDA and SCL pins?
I have been using the wire library with the LSM303 for months now and have not experienced any problems.
Teensy 2.0 claims to use 5v or 3.3V as far as I can tell. I will try to use a level shifter and see if that helps. I did port the MS5837 library on bluerobotics to work with I2C master instead of wire. It does work but occasionally the sensor does not respond. Unlike wire, the I2C library can have a timeout so the failed sensor does not hang up the whole program. I have not tested the I2C extender chips but I have them on my desk. Strangely enough, I developed the original project using the MS5807 pressure sensor and it has no problems running reliably using wire. I like the packaging of the bluerobotics sensor but it has been a real pain to make it work right.
My mistake - the earlier sensor I was using was MS5803 not MS5807.
I have a few questions:
What resistors are you using for pull-ups? You are pulling up to 3.3V, right?
Which MS5803 board were you using? Something like the Sparkfun one has pull-ups built in and they might be stronger than what you are using.
Can you verify that it definitely does not happen in air but does happen in water? If that’s the case, something else may be going on.
Hopefully we can get this figured out quickly!
- 4.7K to 3.3V
- Yes. I was using the Sparkfun board for the MS5803.
- It only happens in water so I am building a new enclosure and cable (now twisted pair with shield) to ensure we are waterproof. Probably a capacitance issue. I also have I2C compatible level shifter on order though I believe the Teeensy 2.0 can handle 3.3V I2C. I will also try the P82B715P I2C extenders. My max line is 2 m but these are supposed to support I2C up to 50m with 1 chip on each end.
- I think the I2C Master library is better than wire.
- There is bug in your MS5837 library. There is an unnecessary Serial.println("----"). It threw me off for a while because it certainly was not in my program ! No good programming practice to leave prints in a library. You probably want to fix it.
- I would like to use your tether cable but it is too fat and I only need 2 pair.
Okay. I think the Teensy 2.0 drives with 3.3V logic, but I can’t find anything that absolutely confirms that. If it’s 5V, that would definitely be a problem because the MS5837 SDA and SCL are not 5V tolerant.
Thanks for catching that bug! I have removed it and made a new release so the Arduino library should be updated soon.
The Sparkfun board has 2.2K pull-ups, so you might want to try something a little stronger like that.
Bar30 and Celsius Fast response sensors together??
Over the past number of years I have been mentoring students here at our local high school using ROVs as tools of investigation. Recently we have been collecting temperature depth profiles using the Bar30 depth pressure sensor and the ancillary temperature (degrees C) provided by the same sensor. The data is collected (Arduino Uno) recorded on a SD card for graphing and analysis back at school. We have gotten fairly good qualitative results, however when temperature and depth are plotted, the graph produces somewhat of an oval as the sensor goes up and down through various depths (at the same location). This indicates a substantial time lag between the depth and the time it takes for the temperature sensor part of Bar30 to acclimate to the new temperature (i.e. slow response time).
We have purchased the Celsius Fast Response sensor in hopes to collect better data. Unfortunately we have run into a programming “roadblock” when dealing with two I2C devices together on the same I2C buss. Each sensor works well alone with its accompanying device libraries (provided by blue robotics) used in conjunctions with the Arduino Wire library. However when we try to merge programs or modify programs (sketches) we get random readings on both sensors. We have looked at various tutorials on “multiple devices on an I2C buss” modified or merged various programs but still no luck. Looking at the data sheets for each device has helped but they get very confusing. I am afraid that we have gone out of knowledge base on the programming side of things. Has anyone tried using these two sensors together on the same I2C buss before? There is some discussion on the forum but it did not seem to help. Here is what we have….
Using an address scanner TSYS01 address = 119 (0x77 Hex)) and MS5837 address = 118 (0x76 Hex)
Each sensor is using its own I2C level converter (purchased from Blue Robotics), and each output of the level converters are attached to a common (in parallel) +5V, GND, SDA and SCL buss. The buss in turn is connected the Arduino +5V, GND, SDA, SCL pins respectively. Any sample code for the Arduino family would be appreciated.
Glad the Bar30 has been working well and collecting data for you! It’s definitely possible to operate the Bar30 and Celsius side by side on the same bus. I’m curious what might be happening here. It would be helpful if you could post any of your code if it’s available.
The first thing that comes to mind would be adding pull-up resistors to the I2C lines. Neither sensor has built-in pull-up resistors and the Arduino only have weak pull-ups. You might want to try adding 4.7k resistors from SDA to VCC and from SCL to VCC. You can google more about that if you’d like.
Are you using the level converter with the sensors?
Thanks you so much for the reply. We will add the pull up resistors and give it a try. I thought that they may have been built into the level shifters but apparently not. Many of my students are gone or leaving for Thanksgiving so it may be a day or so before I can track them down to get sample code. I will delay reply to the forum until we git this figured out, as I bet someone else is thinking about this too. Thanks again for you reply…