Connect external sensors, small character displays, RGB LED chains, GPS receivers 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 “Initial Value” column for the property you want to edit (if a character or string, use quotes).
Serial 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.
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_Device 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).
Many sensors use the I2C serial protocol. For example: Light level sensors using the BH1750 or TSL2591. 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.
Block properties and terminals
Type (uuid): Module Type
Version (int): Firmware Version
U_Baud (int): Uart baud rate. default 9600 baud.
U_Enable (int): Uart on 1 off 0. default is on.
U_Receive (int): Uart. Terminal 1 output chars received or not. int. 1 on (default) 0 off.
U_Prepend (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).
U_IntToStr (int): Uart Convert ints to string before sending out Uart. int 1 on 0 off. (This property is the letter “i” upper or lowercase)
I2C_Speed (int): I2C speed. 0 default is 100khz. 1 is 400 khz.
I2C_Addr (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.)
I2C_Bytes (int): I2C number of bytes to read. can be 1-4. default is 1.
I2C_Rate (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.
I2C_Device (int): I2C if we auto-detect an I2C device, put its I2C device ID here. A scan for I2C devices is done on power up and when this property is read.
TI_TMP102_TEMP \x49 // sparkfun breakout. TI TMP102. default is $49.
VISHAY_VCNL4000_PROXIMITY \x13 // adafruit breakout. does short range, under 7″ proximity.
INVENSENSE_ITG3200_GYRO \x69 // sparkfun invensense breakout. 3 axis gyro.
BH170 light level sensor \x23
TSL2591 light level sensor \x29
SPI_Clock (int): SPI clock frequency for SPI serial interface. default is 100khz.
SPI_Protocol (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
SPI_CS (int): SPI CS output pin. 0 low, 1 high. The default is 0.
L_Device (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.
Voltage (int): 0 to set external power terminal to 5V. 1 for 3.3V (default).
L_Brightness (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_Device’ 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 interstacks.com/knowledge-base.
Please email email@example.com with any questions.