I have a 4 channel 4-20mA receiver (PR33-15) with I2C interface to Arduino Uno.
The inputs to the receiver are several water level sensors from MoreSunsDIY (Biosensor P22-10MI), all the same sensors
The Arduino code is normally executed until Wire.beginTransmission(address) and hangs at Wire.endTransmission()
This happens with every sensor, so I assume something in my code is the cause. The sensors are new, several tests with different water depths cause the same hanger.
Thank you in advance for your help or suggestions, what might cause the code to hang.
Any idea to read the analog value of the sensors differently ?
Hi Bhaskar,
Thank you for your comment.
Is there any demo code for the MCP3428?
I’m getting locked in additional errors when replacing the library. Seem to be the parameters of the MCP3428 class.
Wilfried
the above lib is for mcp3428.
download the entire folder and copy/paste the .cpp and .h file in your arduino lib folder.
In the folder you will find a .ino file, open this file and upload it in the arduino.
On the serial monioter you should be able to see the 4-20mA values.
the mcp3428 lib folder contains 2 .ino-files: the …OneShot_Conversion.ino and the …MultiChannel.ino. I tried both and was in both cases blocked just as before at the same point: the code is executed until Wire.endTransmission().
This is the code for OneShot_Conversion, no error messages, MCP.devAddr = 104:
As you proposed, I installed the mcp3428 folder in the arduino lib folder and uploaded the .ino file in the arduino. I tried all possible jumper positions, corresponding the wiring diagram of the PR33-15. There was always the same result, the execution of the code hangs always at : Wire.endTransmission()
One time I could observe, that at one jumper position 2 or 3 times the execution continued and Wire.endTransmission() delivered the code: 2, so I could read this error code. But this never recurred in the same jumper position.
That makes me believe, that there is possibly a hardware flaw at the PR33-15 board ( the board is a new one ).
If this is not a hardware flaw, do you see other possibilities, maybe to access the board with instructions of another lib than wire ? My familiarity with arduino software is very limited.
Hi Bhaskar,
execution of the I2C-scan hangs with the wire.endTransmission (i).
I have added 2 program lines to print each for-loop after each Wire.beginTransmission (i) , see hardcopy. Execution hangs after Wire.beginTransmission (1).
I have been thinking lots of times, which port should be the right one to connect to the USB-shield and I was absolutely sure, that this has to be the out-port. As a misunderstanding this is now the best solution.