ArduSlave, environmental sensors for OpenROV

#21

Don't worry, that is the automatic upgrade system early code. You can safely ignore it for the moment.

0 Likes

#22

That one is special. the dia is for a diagnostic channel I have not implemented yet.

more like https://github.com/OpenROV/openrov-software/blob/v2.5.0-maint/arduino/OpenROV/MS5803_14BA.cpp#L110

0 Likes

#23

and he messagers in the right pannel?

0 Likes

#24

Ah. I see. The "unsupported software product rev 4" is from the MPU1950 library. Not sure why your seeing that. Is it happening all of the time? You might try leaving the IMU disconnected while working out the issues with the arduslave.

0 Likes

#25

Hello Brian,

I have upload my code to the firmware and I can see this:


As you see in the right pannel I have the following problems:

t sais Failed to read I2C from depth sensor so I don't know if I am causing a problem to the I2C with my device.

I only see one data at a time, it changing continuisly. Sometimes it pH sometimes its temperature, but I don't see them all as I planned to.

I have 0.00 in all values, so I think I am not receiving and that data is iniatialized at value 0? its right?

This is how the code is written:


What do you think?

Regards!

Javi

0 Likes

#26

Hey Javi,

Put the : at the end of the line so that the words before the : are unique and they wont overwrite one another.

So "Sensordata.conductivity.SG=:"

For the depth sensor, just make sure you don't have a conflict with the address. The depth sensor uses 0x76.

As far as getting zero values, it is hard to tell. Is the arduslave automatically always trying to send somehow? Usually I2C communications require the master to send a request code that signals the slave that to send data. I cannot see the arduslave code but I assume it somehow is always trying to send data?

0 Likes

#27

Hello Brian,

Thank you, as always you were right, now I have all the data.

The code of the arduino slave it’s also in the thread and it Works with a Wire.onRequest(requestEvent); and the direction 0x77 whichs is both in the slave arduino

const byte i2c_address=0x77; Wire.begin(i2c_address); and in the OpenROV the first thing that the device do in the loop is Wire.requestFrom(DevAddress, 32); and the direction is set on:


To try to find out what is happening I’ve done some test. First of all I’ve got sure that the arduino was taking data correctly by conecting it to the computer and using the serial monitor and it’s all right.

The second thing I have done is using a flag variable which is set equal to 1 if receives data and equal to cero if enters in the timeout you could see in my code. I first put that there serial.print only appear if the flag was in value 1 and in the cockpit didn’t appear anything, and then I changed it and put that the serialprints where only send when the flag were equal to 0 and then they all appear with 0 values, but the strange thing is that sometimes one of them change it value to a number, here you can see the cockpit:


The depth sensor I don’t know why it isn’t working. In the openrov.log I saw this, I don’t understand well why it’s happening:


I am going to make sure if disconnecting the arduino slave the Depth sensors Works and I will tell you.

Regards!

Javi

0 Likes

#28

I'm struggling to recall from memory, but I2c actually reserves a send and a receive channel. so the depth sensor when it reserves 0x76 actually takes that channel and the next one up. I forget how this is working in the Arduino I2C address space, and it may not be an issue, but can you bump the address your using up by an even number, to say 0x78 just to make sure it is completely clear of the depth sensor?

-Brian

0 Likes

#29

I've tried changing the direction to I2C but it does not work no matter the direction.

I've tried by disconecting the arduino and disactivating it in the code and the depth sensors does not work doesn't matter if the arduino is not there. Then I've tried a much simple code with both arduinos to transmit a single value and it doesn't transmit it, so I am pretty sure it must be a issue in the conection.

What do you think? have you check my codes? they seem to be all right?

Regards!

Javi

0 Likes

#30

I wonder why I have this in the log, it's founding devices in all I2C directions till the wachtdog clocl stop it. I think the error must be there.

In any case, I think I2C must be bad hooked. I don't know how to connect it, do you think any of this schemes will do?




0 Likes

#31

I've done some schemes for you to see it:




0 Likes

#32

This is a problem of conection I am sure. When I disconect the slave arduino, the depth sensor works perfectly, in the moment I try to connect the arduino, it found devices in all directions and I haven't been able to find out why is this happening.

0 Likes

#33

Did you already put the model number of the level shifter in the thread somewhere?

One idea I had to help unblock you. For testing, you can remove the level shifter all together and go directly from the 5V I2c pins on the controller board to the arduino you are using. Get that working first, then introduce the level shifter again when you are ready to mount the payload externally.

0 Likes

#34

I’m sorry for reviving this old thread, but I’m curious if I can get help with the similar project.
It looks like the code has been re-written since, and I can’t understand where and how to declare a new sensor. Is there a guide for the new code anywhere?

0 Likes