Enviro Sensor Starter Pack

The Enviro Sensor Starter Pack includes the following hardware blocks: Superbase, Serial, I/O Expander, USB Keyboard/Mouse, and Wifi. It also includes: a CO2 gas level sensor with temperature and relative humidity (from CO2 meter), a dust sensor (large and small particulates), and a two line by sixteen character LCD display. The CO2 sensor and LCD display are connected to the UART interface on the Serial hardware block. The dust sensor is connected to screw terminals interface 7 and 8 on the I/O Expander hardware block.

There is an example project named “Enviro Sensor Starter” in Stackbuilder in the “Projects” tab, in the “Demo Projects” category. Click once on the “Demo Projects” category to expand it. You can then double click on the Enviro Sensor project to open it in Stackbuilder. It is an example of a project that uses the included accessories. The project displays all sensor values on the LCD display. You can make a copy of this project using the “Action" menu in the “Projects" tab and then make any modifications you want. To modify existing software blocks in the project, you will need to select the existing block, then select the Copy icon to make a copy of it. You must then connect the channels to your copy, then delete the original.

If you want to create a new project from scratch using the accessories, you will need to set some hardware block properties in Stackbuilder. To set properties in Stackbuilder: Select the 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).

To use the dust sensor, set property 7 and property 8 of the I/O Expander hardware block to 8 (digital input, accumulate duty cycle). Set properties R7 and R8 to 10000.

The CO2 level, with temperature and relative humidity is sent out of the Serial block “UART Receive Str” output terminal in the following format: a string with “H value T value Z value”. The accumulated dust sensor readings are sent out of the I/O Expander hardware block “Out 7” and “Out 8” output terminals. It can also be useful to set property "C" to 0 (zero) for the Serial block.

Example Python programming for a software block to parse the CO2 sensor data:

# parse CO2 sensor with humidity, temp, and CO2 level
x = message.split()  # separate single string into a 6 entry list
if len(x) >= 6 and x[0] == 'H' and x[2] == 'T' and x[4] == 'Z':
 G.humid = int(x[1])  # humidity
 G.temp = (int(x[3])-1000)  # temperature in celsius
 G.co2 = int(x[5])  # CO2 level

The easiest way to use the two line LCD display in your own projects is to use the built-in software block “LCD NHD0216” in your project blueprint. This can be found in the “Software” tab in Stackbuilder. Connect the output terminal (“ToLCD2x16”) to the “UART Send” input terminal of the Serial hardware block. Send the “Command” input terminal of the software block a list [2, ‘hello’] to send ‘hello’ to the LCD. Send [0] to clear the LCD. Send [1, [1,6] ] to position the display cursor on the second line, seventh character position.


You can also refer to the support documents for the individual hardware blocks.


Example Blueprint for Enviro Sensing


Enviro Starter, running average software block


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