Snippet Tag: python 4-20mA

raspberry pi python 4-20mA current receiver

# Distributed with a free-will license. # Use it any way you want, profit or free, provided it fits in the licenses of its associated works. # MCP3428 # This code is designed to work with the MCP3428_I2CADC I2C Mini Module available from ControlEverything.com. # https://shop.controleverything.com/collections/4-20-ma-current-loop-input import smbus import time DL = 0.01 DL1 = 0.01 # Get I2C bus address = 0x68 bus = smbus.SMBus(1) # MCP3428 address, 0x68(104) # Send configuration command # 0x11(17)Continuous conversion mode, Channel-1, 12-bit Resolution,gain2 while True: bus.write_byte(address, 0x11) time.sleep(DL1) # MCP3428 address, 0x68(104) # Read data back from 0x00(0), 2 bytes # raw_adc

Read More »