Serial hardware block

Connect external sensors, small character displays, multi-RGB LED chains and many other peripherals. This block supports UART (3.3V), I2C, and SPI serial interface protocols. There is a ten wire screw terminal connector on back for connecting wires to the block.

There are many vendors to purchase sensors, sensor breakout boards, RGB LED chains, and small LCD character displays that can be connected to Interstacks. Some include Adafruit, Sparkfun, and Digikey.

There are a very large number of external devices that can be connected to the Interstacks Serial block using one of the three standard serial protocols. The serial block can communicate using all three types of serial connections simultaneously. Each type of serial communication has specific properties that are set in the Stackbuilder Property Editor that define their behavior.


To set properties in Stackbuilder: Select the Serial block by clicking on it once. Click in the “Property Editor” in the bottom right, in the first row, in the “Property” column. Type the property name (without quotes). Click in its corresponding “Default Value” column and type the value to set (if a character or string, use quotes).


Serial Connector - Looking into back


DC Out is 3.3V if property V is 1 (default). 5V if property V is 0. Can supply 400 mA.
( Version 1 Serial blocks supply 3.3V only. In addition, the I2C SDA and SCL lines are swapped from above)

RGB LED chains
The Interstacks Serial block directly supports two types of RGB LED chains via the SPI serial interface. See the Neopixel line from Adafruit (part # 1426 and many others). By setting the L property you can choose the type of RGB chain: 0 none, 1 LPD8806 type, 2 WS2812 (neopixel) type. After doing this, you can simply send character strings to the SPI Send input terminal to set the colors of the RGB LEDs in the chain. For example, 'rrrrrrrr', to set 8 LEDs to all red. (more info below).

I2C Sensors
Many sensors use the I2C serial protocol. For example: Luminosity sensor Taos TSL2561 breakout board from Adafruit (part #439). Temperature sensor from Sparkfun TI TMP102 breakout (part # SEN-11931). From Sparkfun, invensense breakout. 3 axis gyro. Invensense ITG3200.

LCD Character Displays
There are many small, LCD character displays that can be purchased and connected to the Serial module UART. For example: a 2 line x 16 character display from Digikey: Newhaven Display NHD-0216K3Z-NSW-BBW-v3.

For advanced users, included here is the full blocks detail spec sheet with all properties and terminals.
Connect to external serial devices using UART, I2C, or SPI protocols.

T (uuid): Module Type
F (int): Firmware Version

B (int): Uart baud rate. default 9600 baud.
U (int): Uart on 1 off 0. default is on.
C (int): Uart. Terminal 1 output chars received or not. int. 1 on (default) 0 off.
+ (Binary): Uart Bytes to prepend to all Uart strings sent to Terminal 1.
(This is useful for Uart devices like small LCD displays so can prepend a clear screen).
I (int): Uart Convert ints to string before sending out Uart. int 1 on 0 off. (This property is the letter "i" upper or lowercase)

S (int): I2C speed. 0 default is 100khz. 1 is 400 khz.
A (int): I2C slave address. default is 80 ($50)
(Note: this should be the 7 bit I2C slave address. Some data sheets call out the 8 bit version, some the 7 bit.)
N (int): I2C number of bytes to read. can be 1-4. default is 1.
P (int): I2C Sample rate for send value if changed. Only valid for I2C auto detect terminal.
Value is samples per second. Default is 0 or no send.
D (int): I2C if we auto-detect an I2C device, put its I2C device ID here.
Device IDs:
TAOS_LUMINOSITY 0x39 // adafruit breakout. Taos TSL2561 luminosity. dual ir and full spectrum.
TI_TMP102_TEMP \x49 // sparkfun breakout. TI TMP102. default is $49. can be $48, $4A, $4B.
VISHAY_VCNL4000_PROXIMITY \x13 // adafruit breakout. does short range, under 7" proximity. (does light also).
INVENSENSE_ITG3200_GYRO \x69 // sparkfun invensense breakout. 3 axis gyro.

X (int): SPI clock frequency for SPI serial interface. default is 100khz.
M (int): SPI protocol. 0,1,2, or 3. default is 0. Idle clock polarity and use first or second clk pulse.
00 - clock low, first edge. 1 - clock low, second edge. 2 - clock high, first edge 3-clock high, second edge
Y (int): SPI CS output pin. 0 low, 1 high. The default is 0.
L (int): Type of RGB LED chain connected to SPI port. 0 none, 1 LPD8806 type, 2 WS2812 (neopixel) type.
This module directly supports connecting two types of RGB LED strips to the SPI port.
If this property is set to non-zero, data received by the SPI Send terminal is interpreted as meant for one of the RGB LED strips.

V (int): 0 to set external power terminal to 5V. 1 for 3.3V (default).
* (int): Brightness 0-9 for RGB LED strip when used with string input. If binary input, has no effect.

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

"UART Send” - in (String, Binary, int): send string to UART, we only send valid ascii portion. Also accept binary raw bytes. Also int < 256. send out as raw byte.
"UART Receive” - out (String): Single byte received by UART. Sent as string.
"UART Receive Str" - out (String): Ascii strings that are identified by a CR or LF or CRLF termination.

"I2C Send” - in (String, Binary, int): I2C send data. (uses slave addess in property A) Also int < 256. send out as raw byte.
"I2C Request” - in (any): Request to read I2C data from slave.
"I2C Receive” - out (int): I2C read data. (uses slave address in property A, Number of bytes in property N)

"SPI Send” - in (String, Binary, int, list): accepts strings or binary (Binary) or int < 256. sends N bytes to SPI port.

You can optionally send a list [1, Binary data] that will toggle the SPI CS line before the send and after the send. Sometimes used with devices that separate command and data SPI sends via the CS line.

If property 'L' is non-zero, this terminal will interpret a received message as meant for a RGB LED chain.
If a string, each character is interpreted as a color: r-red o-orange y-yellow g-green b-blue m-magenta p-purple
c-cyan z-brown w-white x-clear (off). There should be a color for each LED position in the chain.
In addition, an embedded ‘*' followed by 0-9 will set the brightness for all subsequent colors.
Characters can be upper or lower case.
If binary, each LED is defined by 3 bytes in GRB format i.e. green first then red then blue.
The first 3 bytes are for the first LED in the daisy chain.
You must send all the values for the entire chain in one message.
Example: 'yrrrbboogg'. for a 10 LED chain with colors yellow-red-red etc.
Example: Binary('\xff\x00\x00\x00\xff\x00\x00\x00\xff') 3 LEDs, full bright green-red-blue.

"SPI Receive” - out (not implemented): gets data from SPI port and sends out terminal.

"I2C Auto Request” - in (Any): Trigger a I2C auto-detect sensor read.
"I2C Auto Receive” - out (int or char-int): I2C auto-detect sensors.
Also sends on value change based on P property, poll rate.
For sensors the firmware has "drivers" for, auto-detect what is connected, then a read sends out the value.
Temp-int, Light level-int, Proximity-int, gyro three char-int (x, y, z).

Refer to documentation on many other topics at
Please email with any questions.