Menu
  • Use Cases
  • Stacks
  • Stackbuilder
  • MyStacks
  • Support
  • About Us
  • Contact
  • Use Cases
  • Stacks
  • Stackbuilder
  • MyStacks
  • Support
  • About Us
  • Contact
  • View Cart

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. The digital inputs must be dry contact switch closures or 5V DC maximum. Digital outputs are 3.3V. Other hardware blocks such as the Analog In Universal block support other voltage ranges. 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.

If you are programming a stack yourself using the Stackbuilder authoring software, 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 the corresponding property in the “Property Editor” in the bottom right. If your stack is pre-progrmmed via a Starter Kit or other Interstacks engineering support services, it will have been set up for the correct type of input.

To set properties in Stackbuilder: Select the I/O Expander block by clicking on it once. Click in the “Property Editor” in the bottom right, in the “Initial Value” column for the property you want to edit (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.

I/O Expander Connector – Looking into back

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’.

Block properties and terminals

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.

In HTx_Mode equal to 4, any message to the corresponding input terminal will cause the value to be sampled and sent out the output terminal.

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

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

Popular Articles

  • MyStacks Cloud Dashboard
  • Internet communication with HTTP block
  • Download and install Stackbuilder

Contact Us

Contact us with any questions or help with deploying your IoT projects.

CONTACT US

Connect

  • Facebook
  • Twitter
  • LinkedIn
  • Email

Sign up for the latest Interstacks news.

Join Our Newsletter
  Thank you for Signing Up
  Please correct the marked field(s) below.
1,false,1,First Name,2
Email:
1,true,6,Subscriber Email,2
Name:
1,false,1,Last Name,2

Copyright © 2023 Interstacks. All rights reserved. Privacy Policy | Terms and Conditions

Site by Imagebox