Analog inputs read 0 in Codesys



  • Hello,

    I would much appreciate some help with the UniPi V1.1 and the Analog inputs that come from the MCP3422 (I2C chip).

    The problem I am experiencing is that even thought the onboard I2C relays work, my analog inputs read ‘0’ when power is applied to the analog inputs.

    I have already tried the following:

    -Editted the /boot/config.txt (dtparam=i2c_arm=on, dtparam=i2c_baudrate=400000) and the rest
    -When this did not work I ran the CODESYS_for_Unipi_Setup.sh on the Pi
    -In the Raspberry Pi It does show a chip with address 0x68 (when using I2Cdetect, this should be the ADC)
    -Cleaned all, then downloaded with Codesys

    For some reason it’s not coming with any values besides 0 in Codesys, but the I2C bus is running, as you can see in the screenshot:
    codesysai.png

    I am calling the AI1 and AI2 from a PRG file, so it’s not that the analog inputs aren’t accessed by the code.

    Does anyone have a clue as to what I am missing here?

    I know by now that UniPi does not support the codesys analog input implementation from @DavidCozens of COSOSO, and I allready mailed COSOCO support, but maybe someone over here has the same experience..

    any help would be much appreciated



  • It seems like the whole connection up to Codesys is fine. When I delete the UniPi_AI I2C module and instead of that insert the MCP3424, I do get data, but it doesn't seem correct. Even if I leave the Unipi AI module and then use the I2C_master.read(16#68, ADR(baReadBufferV), 4); command, it shows data in the buffers that varies when the input voltage is adjusted.. Does anyone have more info on the UniPi_AI I2C chip driver?


Log in to reply