Application Note: WL-MIO-AN-36050


Analog Output 0-20 mA Module

Part No.: VPE-6050

Analog Output 4 Channel Module 0-20 mA Python Demo Software


Responsive image

The VPE-6050 Analog Output 4 Channel 0-20 mA Module has 4 analog outputs that can be independantly controlled.

The VPE-6050 module can either source a mA signal between the Common and the AO channel terminal blocks, or sink a mA signal between the +V and AO channel terminal blocks.

Configure Value 0 = source current
Configure Value 1 = sink current

The analog output module can be installed in any backplane position. The NodeID referred to in the demo program is the "Backplane ID" determined by the backplane jumpers and the addition of the slot in which the power supply is plugged into.
Example 1: If the backplane has no jumpers and the analog output module is plugged into slot position 0, the NodeID is 0 + 0 = 0.
Example 2: If the backplane has a jumper in the "8" position and the analog output module is plugged into slot position 2, the NodeID is 8 + 2 = 10.

During normal operation, the status LED flashes GREEN once per second as a "heartbeat" indicator that everything is functioning normally. If the onboard firmware detects any fault conditions, the Status LED will flash either AMBER or RED.

For the following demo code to work, the "libwlmio" library has to be installed.


Demo Python Code

The Backplane has ID = 0 and the analog output module is plugged into slot postion 3.

# vpe6050 Analog Output 4-20 mA Module 4 Channel
# Demo Program sources outputs:
# 4 ma on Channel 1
# 8 ma on Channel 2
# 12 ma on Channel 3
# 20 ma on Channel 4

import asyncio
from pywlmio import *

NodeID = 3  #NodeID location is the Bacplane ID (Jumpers) and Power Supply Slot location

async def main():
  init()

  ao = VPE6050(NodeID)
  
  try:
    await asyncio.gather(
      ao.ch1.configure(0),   # Configure as current output source
      ao.ch2.configure(0),   # Configure as current output source 
      ao.ch3.configure(0),   # Configure as current output source
      ao.ch4.configure(0)    # Configure as current output source
    )

  except WlmioWrongNodeError:
    print("Error NodeID = %d Wrong module installed" % NodeID)  # Error Check if wrong type of module installed
  except WlmioInternalError:
    print("Error NodeID = %d Timed out" % NodeID)               # Error Check - Typically module not installed

  while True:
    try:
      await asyncio.gather(
        ao.ch1.write(4000),  # Values written as uA (4 mA)
        ao.ch2.write(8000),  # Values written as uA (8 mA)
        ao.ch3.write(12000), # Values written as uA (12 mA)
        ao.ch4.write(20000)  # Values written as uA (20 mA)
      )

    except WlmioWrongNodeError:
      print("Error NodeID = %d Wrong module installed" % NodeID)  # Error Check if wrong type of module installed
    except WlmioInternalError:
      print("Error NodeID = %d Timed out" % NodeID)               # Error Check - Typically module not installed

    await asyncio.sleep(1)

asyncio.run(main(), debug=True)
		

Back to Top