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 in Stackbuilder. Click in the “Property Editor” in the bottom right, in the first row, in the “Property” column. Type a “1” (without quotes). Click in its corresponding “Default Value” column and type a number 0 - 8, to specify 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 V is 1 (default). 5V if property V is 0. Can supply 400 mA.
(Version 1 I/O Expanders supply 5V only.)

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. ‘H1’. If set to 6, a ‘1’ will be output if the value is greater than the comparison property e.g. ‘C1’. If set to 7, the value will be output every xx milliseconds based on the rate property for the pin e.g. ‘R1’.


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
T (uuid): Module Type
F (int): Firmware Version

1-8 (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 H (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 C for that pin.
7 Analog input, send every x milliseconds based on update rate property R for that pin.
8 Digital input, accumulate duty cycle - Send update every Rx 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)).

H1-H8 (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.

C1-C8 (int): Comparison value for analog input compare mode. default is 500.
R1-R8 (int): Update rate, in milliseconds (1000 is 1 second), for analog input update rate mode.

V (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.