I/O Expander hardware block

Connect buttons, switches, LED lights, and some (analog) sensors using the I/O Expander hardware block. This block supports eight analog inputs (0-3V) and/or 8 digital input/outputs. There is a ten screw terminal connector on back for connecting wires to the block. The connector block can also output 3.3V or 5V for powering an external device.

There are many vendors to purchase sensors, sensor breakout boards, LEDs, and switches that can be connected to Interstacks. Some include Adafruit, Sparkfun, and Digikey.

You can individually change the function of each of the eight I/O connections on the back of the I/O Expander hardware block by editing their corresponding property in the “Property Editor” in the bottom right of Stackbuilder.

iox_sblder

Select the I/O Expander block by clicking on it once. You will see the “Property Editor” in the bottom right for the block selected. Click in the "Initial Value" column for the "Name" of the property you want to set and type the value (if a character or string, use quotes).

Property HT1_Mode specifies the function of I/O connection 1 (the leftmost connection, looking into the back of the block). If you are connecting a switch (button), you would likely enter a 3 (digital input - send on change. Sends character ‘0’ or ‘1'). If you would like to drive a digital output e.g. an LED, enter a 1 (digital output - character ‘0’ low, ‘1’ high). If you would like to connect an analog input voltage that varies between 0 and 3V, set the property to a 4. Refer to the detailed property spec sheet for advanced options.

ioexpander_back

I/O Expander Connector - Looking into back

iox_pinout

DC Out is 3.3V if property Voltage is 1 (default). 5V if property Voltage is 0. Can supply 400 mA.

Analog input signals
For analog input signals (0 - 3V), there are a number of signal processing features that can be enabled by setting the property for the I/O pin. The property set to 4 will simply read the voltage and output a number 0 -1000 whenever requested by sending any message to the input terminal that corresponds to that pin. If set to 5, the value will be automatically sent if its value changes by greater than the corresponding hysteresis property e.g. ‘HT1_Hysteresis’. If set to 6, a ‘1’ will be output if the value is greater than the comparison property e.g. ‘HT1_Threshold’. If set to 7, the value will be output every xx milliseconds based on the rate property for the pin e.g. ‘HT1_Rate’.


For advanced users, the full blocks detail spec sheet with all properties and terminals.
I/O EXPANDER
Eight digital in, analog in, or digital out signals. For buttons, sensors, and other external devices.

Properties
Type (uuid): Module Type
Version (int): Firmware Version

HT1_Mode through HT8_Mode (int): Define behavior of I/O1 - I/O 8
0 nothing - never does anything.
1 Digital Output. Input terminal character '0' or '1' will make I/O pin low or high.
2 Digital Input. Output terminal will output character '0' or '1' dependent on state of I/O pin when requested by sending any message to the corresponding input terminal.
3 Digital Input Send Change. Will output on any state change.
4 Analog input on demand.
Output terminal will output an int (0 - 1000) based on analog voltage of I/O pin when requested by sending any message to the corresponding input terminal.
5 Analog input send change. Will output analog value on any change while filtering based on the value of the HTx_Hysteresis property for that pin.
6 Analog input with compare. Outputs a ‘1’ on change to above comparison value property. Outputs a ‘0’ on change to below comparison value property HTx_Threshold for that pin.
7 Analog input, send every x milliseconds based on update rate property HTx_Rate for that pin.
8 Digital input, accumulate duty cycle - Send update every HTx_Rate mS.
Accumulates the amount of high signal during update and sends this as value (currently samples once per mS).
(Have used with dust sensors (particulates)).
9 Digital edge count - send number of edges counted every HTx_Rate mS. (min 1ms pulses).

HT1_Hysteresis through HT8_Hysteresis (int): Hysterisis value for analog input send on change. default is 5. (multiples of about 3mV).
Each input used as analog input has its own hysterisis property, hence H1 through H8.
If analog input signal is noisy, use a higher value to reduce automatic value update sends.

HT1_Threshold through HT8_Threshold (int): Comparison value for analog input compare mode. default is 500.
HT1_Rate through HT8_Rate (int): Update rate, in milliseconds (1000 is 1 second), for analog input update rate mode.

Voltage (int): 0 to set external power terminal to 5V. 1 for 3.3V (default).

Terminals
“Properties” - in (List or Property Name string): To set property. Send property name, Value. For example [’N’,’netname’].
To get property, just send property name. For example. ’N'
“Presponse” - out (List or True) : On set, responds with True when done.
On get, responds with list. For example [’N’, ‘netname’].

Terminals In and out 1 - 8. See above description of properties 1-8.
“In 1”
“Out 1”

“In 8”
“Out 8"
If property defines I/O pin as output, character '0' makes pin low, '1' high.
If property defines I/O pin as digital input, will output character '0' or '1' based on level on I/O pin.
If property defines I/O pin as analog input, will output int with I/O pin analog voltage. Outputs a number 0 - 1000.
If analog input with compare, outputs on change character ‘0’ if below compare value and ‘1’ if above.

Note: Digital inputs configured with weak pullups. so can connect buttons without external resistor.

Refer to documentation on many other topics at interstacks.com/support.
Please email info@interstacks.com with any questions.