Skip to content

PI-SPI-8AI16B channels mirror output signal #14

@Cesar-AlKaisy

Description

@Cesar-AlKaisy

Hi, I need help troubleshooting an issue with the Widgetlords PI-SPI-8AI16B module.

I'm using it to read two 4–20 mA signals:

Channel 0 is connected to a configurable output (simulated signal)

Channel 1 is connected to a CO₂ sensor

The problem is that both channels return the same value which is whatever is set on the configurable output, even though the CO₂ sensor is connected and active. It seems like the output signal is bleeding into the other channel, and the sensor reading is being overridden.

from widgetlords.pi_spi import *
from widgetlords import *
import time

init()

input_module = Mod8AI16B()
input_module.set_channel(0)  # Configurable output

input_module2 = Mod8AI16B()
input_module2.set_channel(1)  # CO₂ sensor

while True:
    ad_30 = input_module.read()
    ad_100 = input_module2.read()
    print("Channel 0:", ad_30)
    print("Channel 1:", ad_100)
    time.sleep(1)

I also tried using just one instance of Mod8AI16B() and switching channels between reads:

input_module = Mod8AI16B()

while True:
    input_module.set_channel(0)
    ad_30 = input_module.read()

    input_module.set_channel(1)
    ad_100 = input_module.read()

    print("Channel 0:", ad_30)
    print("Channel 1:", ad_100)
    time.sleep(1)

But the result was the same

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions