Scott
Posts: 4
Joined: Fri Apr 25, 2014 9:17 am

How to use a I2C-AI418S 4-20ma board with i2c?

Fri Apr 25, 2014 9:21 am

http://www.ereshop.com/shop/analog-inpu ... p-805.html

I'm relatively new to i2c and I can't figure this out at all. The board is connected to a 4-20 mA current loop generator (with a current loop).

i2cdetect -y 1 shows the board at 0x68.

I can access the board via smbus and notsmb, but I have no idea how to use it.

The data sheet provided there (http://www.ereshop.com/shop/free/I2C-AI418S_SHEET.pdf) doesn't offer much help. I have the jumpers set to the first setting and it says the address byte for reading is S[0xD1]A, address byte for writing is S[0xD0]A.

I tried sending those and didn't get back anything useful. I don't know how many bytes to expect or even what those bytes are for.

Has anyone done something like this before? Any pointers? Any i2c primers I should be reading (preferably for someone as dumb as a bag of rocks)?

I'd appreciate any help.

Best,
Scott

BMS Doug
Posts: 4423
Joined: Thu Mar 27, 2014 2:42 pm
Location: London, UK

Re: How to use a I2C-AI418S 4-20ma board with i2c?

Fri Apr 25, 2014 11:38 am

I think this may help SRF08 Range Sensor.

I think that your analogue input board will need a query from the pi before it replies, like the range sensor described in the link.

I hope this helps, I'm trying to figure out i2c at the moment too.
Doug.
Building Management Systems Engineer.

User avatar
joan
Posts: 16257
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: How to use a I2C-AI418S 4-20ma board with i2c?

Fri Apr 25, 2014 11:46 am

The schematic shows that the I2C bus is connected to a MCP3424. You probably need to read its datasheet for the I2C commands.

BMS Doug
Posts: 4423
Joined: Thu Mar 27, 2014 2:42 pm
Location: London, UK

Re: How to use a I2C-AI418S 4-20ma board with i2c?

Fri Apr 25, 2014 12:02 pm

joan wrote:The schematic shows that the I2C bus is connected to a MCP3424. You probably need to read its datasheet for the I2C commands.

yes, Pages 19-24 of the MCP3424 PDF have a lot of information on the i2c commands.
Doug.
Building Management Systems Engineer.

User avatar
joan
Posts: 16257
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: How to use a I2C-AI418S 4-20ma board with i2c?

Fri Apr 25, 2014 12:10 pm

That datasheet looks rather daunting!

It might be worth checking with the vendor in case there is a simpler procedure.

Scott
Posts: 4
Joined: Fri Apr 25, 2014 9:17 am

Re: How to use a I2C-AI418S 4-20ma board with i2c?

Fri Apr 25, 2014 2:27 pm

The data sheet is very daunting for someone who's never made anything using i2c!

The vendor wasn't any help, unfortunately.

User avatar
joan
Posts: 16257
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: How to use a I2C-AI418S 4-20ma board with i2c?

Fri Apr 25, 2014 3:11 pm

Google for MCP3424 examples and you'll get hits such as http://www.phanderson.com/picaxe/mcp3421.html

Eventually you may find something you are comfortable with.

ddahms
Posts: 77
Joined: Tue Mar 18, 2014 3:38 pm

Re: How to use a I2C-AI418S 4-20ma board with i2c?

Fri Apr 25, 2014 10:44 pm

The fact that i2cdetect shows the 0x68 means you have it wired up correctly. That's half the battle.

There is really not that much to it. You may need to write one configuration byte to it to select the channel or change from the default settings. Then you just read two bytes from it and stick them together with a shift.

For starters, you can use i2cget and i2cset to read and write it. Here is documentation for i2cget and I2cset.

Something like "i2cget -y 1 0x68 w" should read two bytes from it (I think).

If you want to do more than just poke at it, you can write a program in Python or C.

gbarnes59
Posts: 4
Joined: Sun Mar 30, 2014 11:15 am

Re: How to use a I2C-AI418S 4-20ma board with i2c?

Tue Jun 02, 2015 10:31 am

Did you get anywhere with this?
I'm using the WiringPi library with the MCP3422 extension (the documentation says it will work with MCP3424)
It seems to set up OK, but the analogRead function hangs.
Similarly, when I test it with the GPIO aread facility it hangs.

My setup command is mcp3422Setup (1920, 104, MCP3422_SR_15, MCP3422_GAIN_1) ;

The read command is analogRead(1920 + channel);

I'm really stumped on this one.

Return to “Interfacing (DSI, CSI, I2C, etc.)”