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.