Pymate-16ADI16DO-introduction

From pymate.io wiki
Revision as of 19:36, 23 June 2026 by Dodomi (talk | contribs) (→‎Wiring)
Jump to navigation Jump to search


Important note

Charts and graphics are made to be easy to follow.

The Pymate boards are drawed without connectors to avoids parallax shift. The real board are fitted with the connectors.

Board_ID

It is essential to identify the Board_ID of the 16ADI16DO expansion.

Here a reminder of few tutorials around the "Board_ID".

Board_ID

Tlogo-board-id.png

Identification of expansion board

CAN Scan

Tlogo-can-scan.png

Scanning the CAN bus for boards and check for CAN error.

Change Board_ID

Tlogo-board-id.png

How to change the 16ADI16DO board identification on the CAN bus.

 

Input

Input are high when voltage on the Input is higher than 8V.

Input return to low state when the voltage drops under 5V

Wiring

Pymate-input-2.png

Coding

The following example query the state if imput 3 and displays the results on the REPL session.

from pymate.pymateio import PymateIO
from machine import Pin
import time

i3 = PymateIO( "IN3", Pin.IN )

while True:
    print( "i3= %s" % i3.read() )
    time.sleep( 0.5 ) # Wait 1/2 second

Which would display the following in the REPL:

1
1
0
1
0
0

Where:

  • 0 is at LOW state, meaning that low voltage is applied on the input (< 5 Volts).
  • 1 is at HIGH state, meaning that high voltage is applied on the input (> 8 Volts).

MicroPython alike call

MicroPython coder usually use Pin.value() to read the state of an input.

Such method is also available on the PymateIO class to act like an usual `Pin` class.

The script above could also be written by using value() instead of read() as follow:

from pymate.pymateio import PymateIO
from machine import Pin
import time

i3 = PymateIO( "IN3", Pin.IN )

while True:
    print( "i3= %s" % i3.value() )
    time.sleep( 0.5 ) # Wait 1/2 second