Shop OBEX P1 Docs P2 Docs Learn Events
Stamp PLC Code for 4-20mA — Parallax Forums

Stamp PLC Code for 4-20mA

KyeKye Posts: 2,200
edited 2008-02-07 04:55 in BASIC Stamp
Hello,

I've currently been working on using the Parallax PLC with 4 - 20 ma current loop signals and I've been having some problems.·I'm using the OMEGA PX605 - 1kg pressure sensor with the MAX1270 ADC reading the voltage in the·Stamp PLC.

So far I've gotten correct readings within a certain range... but as I increase the pressure (what the sensor is reading), the value read is incorrect.

I've called tech support at OMEGA and they said that the sensor has a linear scale from 4 - 20 ma. I've also confirmed that the sensor works correctly with other pressure reading systems from OMEGA.

So, I did some rsearch online that said, to properly use a 4 - 20 ma signal a 250 OHM resistor must be shunted across the sensor output and the ADC input. And that the ADC should be configured to read 0 - 5 VDC.

And the Stamp PLC reflects this...

So I would like help with the code that should be implemented to correctly read the ADC 4 - 20 ma loop. Since the Stamp PLC says it supports this, I am assuming the hardware is correct.

Post Edited By Moderator (Chris Savage (Parallax)) : 2/6/2008 9:36:49 PM GMT

Comments

  • KyeKye Posts: 2,200
    edited 2008-02-07 02:53
    Thank you for the documents, the first one proved to be most helpful. I already looked at the other two before.


    Now, my problem really was caused by me not implementing a conversion factor on the ADC.

    To keep it short, I need to implement the equation...

    x = (5/4096) * ((b - a) / 5) * U

    Where x is the pressure reading
    Where b is the maximum pressure reading (1000) - Leaving the equation open for other 4 - 20 ma circuits
    Where a is the minimum pressure reading (0) - Leaving the equation open for other 4 - 20 ma circuits
    Where U is the value produced by the ADC

    ...

    My problem is representing (5/4096) = 0.001220703125
    I need to use the full number, or I'll have to sacrifice accuracy. Is there any way of doing so? And if so what is the most compact and code efficent way?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Nyamekye,

    Post Edited (Kye) : 10/24/2008 4:01:14 AM GMT
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2008-02-07 03:00
  • Shawn LoweShawn Lowe Posts: 635
    edited 2008-02-07 04:55
    LOL! PJ Allen - a man of few words! [noparse]:)[/noparse] Just as a side note, Emesystems (Tracy Allen's website, I believe· know that's the correct name) is LOADED with excellent information on math, interfacing of sensors, and just good reading on programming anything with a stamp.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Shawn Lowe


    Maybe I should have waited to do that......
Sign In or Register to comment.