Skip to content

Hardware

TheYOSH edited this page Aug 26, 2021 · 32 revisions

This Hardware is for TerrariumPI version 3.X only! For TerrariumPI version 4.x go https://theyosh.github.io/TerrariumPI/hardware/


Here is a list of hardware that are supported by TerrariumPI

GPIO Pin setup

All hardware is connected using physical pin numbering. Which is from 1-40. The software will translate it to BCM if. https://pinout.xyz/

GPIO Power saving

In order to spare the device, you can use a second GPIO port for power management. In that case use the following value as address: [GPIO_ReadoutPin],[GPIO_Powerpin]. In this way, the second pin number is used for powering up and down the sensor. This will reduce the amount of power usage, and some sensors will benefit from this, especially moisture sensors.

I2C bus

I2C sensors are supported. By running i2cdetect -y X you can see the I2C addresses of the devices. These values are used as input address in TerrariumPI. TerrariumPI uses by default 1 for bus number.

When you need to enter an I2C_address, just use the value from blow. Do not enter 0x in front of it.

example output i2cdetect -y 1:

     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- --
10: 10 -- -- -- -- -- -- -- 18 -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- 29 -- 2b -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

You can create multiple I2C busses: https://www.instructables.com/id/Raspberry-PI-Multiple-I2c-Devices/ To use a different I2C bus then 1, add ',[I2C_BUS_NR]' to the device address.

When you get the following response:

     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f
10: 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f
20: 20 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f
30: 30 31 32 33 34 35 36 37 38 39 3a 3b 3c 3d 3e 3f

Then there is an issue with your I2C bus. Either disconnect the last attached device or pull the power from the Pi and then restart.

Analog sensors

It is possible to add analog sensors to TerrariumPI. But as TerrariumPI is only has a digital GPIO ports, an extra add on is needed to add analog ports. For now the RaspIO Analog Zero is known to work. But any MCP3008 based board should work.

OWFS

All sensors connected to an OWFS system will be recognized and added to the system. Some sensors can either be used by OWFS or for example 1Wire (DS1820).

Make sure the owserver process is running. If there the server is not running, try inspecting the I2C bus:

ps fax | grep owserver
  839 ?        Ssl    0:04 /usr/bin/owserver -c /etc/owfs.conf --pid-file /var/run/owfs/owserver.pid

Caching

All sensor data is cached for at least 30 seconds. And when sensors have multiple options like temperature and humidity, both values will be read out in one run and cached for 30 seconds. That way, the first request for temperature will take some time. The second request for the humidity value will then be read out the cache and will speed up the process. Especially MiFlora sensors, that have four sensor types, will benefit a lot of this caching system.

Sensors

Here you will see all the sensors that can be read out by TerrariumPI. There is also the possibility to have remote sensor, and script sensors (example). Both can be of any type. Make sure the output is always a float value. And for temperature we expect the value in Celsius degrees.

Temperature

Temperature sensors will be read out in degrees Celsius. The software will convert to Fahrenheit or Kelvin if needed.

Chirp

The Chirp sensor can read out temperature through I2C bus. It can be used on both I2C buses if needed.
https://www.tindie.com/products/miceuz/i2c-soil-moisture-sensor/
If you want to use multiple Chirp devices, make sure you change the I2C address per Chirp first to make sure they do not use the same address. This can be done with the debugging tools.

setting value: [I2C_address],[I2C_bus] where I2C_bus is optional

Debugging: To debug or change the address of your Chirp, use this code: https://github.com/ageir/chirp-rpi

MiFlora

The MiFlora can read out the temperature through bluetooth. Multiple MiFlora devices can be used.
The software will auto detect and add any nearby devices within about 3 - 5 meters of the Raspberry PI.

setting value: [Bluetooth_Address]

Debugging: ...

AM2302

DHT11

DHT22

DHTXX and AM2302 are supported through GPIO. Make sure you have the sensor connected correctly and using the right resistor. These sensors are a bit sensitive and can break easily.

Also some manufactures are better then others. https://github.com/adafruit/Adafruit_CircuitPython_DHT/issues/40

setting value: [GPIO_pin]

Debugging: ...

DS1820

Use the standard PI 1wire bus system to connect multiple DS1820 temperature sensors. The sensors will automatically detected and added to the system.
ex: http://www.reuk.co.uk/wordpress/raspberry-pi/connect-multiple-temperature-sensors-with-raspberry-pi/

setting value: None, will be automatic detected through 1wire bus or OWFS

Debugging: list the 1 wire system folder ls -l /sys/devices/w1_bus_master1/ and look for folder(s) starting with a number

SHT2X

SHT3X

This is a temperature and humidity sensor in one device. This device has no option to change the I2C address so only one sensor is supported at the moment.

setting value: [I2C_address],[I2C_bus] where I2C_bus is optional

Debugging: ...

BME280

This sensor is very small and should be ordered on a board that has an I2C connection. Then you can connect it to the I2C bus and enter the bus address to use the sensor.

setting value: [I2C_address],[I2C_bus] where I2C_bus is optional

Debugging: ...

MLX90614

This is a temperature sensor that can measure two temperatures. It measures the ambient temperature and with IR object temperature. This sensor is connected to the I2C bus. You can read out and use both temperatures in TerrariumPI

setting value: [I2C_address],[I2C_bus],[type] where I2C_bus is optional, and type is 'a' for ambient temperature or 'o' for object(default)

Debugging: ...

Humidity

AM2302

DHT11

DHT22

See temperature

HIH400

This sensor is currently only supported through OWFS.

SHT2X

See temperature

BME280

See temperature

Moisture

Chirp

See temperature

MiFlora

See temperature

YTXX

Use GPIO number for reading out the state. This will be used to read out the digital state of the sensor. This is either on or off. Where on is enough moisture, and off to low moisture. You have to calibrate the sensor with the on board potentiate meter.

setting value: [GPIO_pin],[GPIO_power_pin] where GPIO_power_pin is optional to use for power saving

Debugging: ...

Conductivity

Distance

HC-SR04

This is a distance sensors based on ultra sound waves. It uses two GPIO pins. One pin is for sending the ultra sound and the second one is used to measure the return sound. The time it takes is used for distance calculation.

setting value: [GPIO_TRIG_pin],[GPIO_ECHO_pin] both pin values are required

Debugging: ...

pH

pH sensors are mostly analog sensors and therefore TerrariumPI expects that there is a analog add-on being used.

SKU SEN0161

Light

Light can be measured in different ways with different meanings and values. We can measure the lux value which tells us how much light there is. And then there is also UVA and UVB which is needed for all reptiles and plants to live. TerrariumPI supports both types of light sensors but are not yet used in the environment system.

Lux

Chirp

See temperature

MiFlora

See temperature

UVA

VEML6075

This sensor is very small and should be ordered on a board that has an I2C connection. Then you can connect it to the I2C bus and enter the bus address to use the sensor.

setting value: [I2C_address],[I2C_bus] where I2C_bus is optional

Debugging: ...

Example hardware: https://www.aliexpress.com/item/VEML6040-Breakout-Vishay-RGBW-Sensor-Module/32797545230.html or https://www.adafruit.com/product/3964

UVB

See UVA

Fertility

MiFlora

See temperature

Power switches

Here you will see all the power switches that can be used by TerrariumPI. It is also possible to use scripts to power other exotic hardware. See the contrib folder for an example

GPIO

Nextevo

This is a 220-250 Volts dimmer that can be used to control lights and heaters directly. It needs to be connected to a PWM enabled pin on the Raspberry pi. Currently those are: 12 and 32. https://www.tindie.com/products/nEXT_EVO1/universal-ac-mains-dimmer-mpdmv41/

setting value: [GPIO_pin] where the pin is PWM enabled

Debugging: ...

VMA400

Switch

USB

EG-PM2

This is a USB enabled power switch that can operate 4 power outlets. Currently there is only support for one USB power device with 4 outlets.

setting value: [SOCKET_NR] where [SOCKET_NR] is from 1 to 4

Denkovi

Another USB enabled power switch that used is: https://denkovi.com/usb-relay-board-four-channels-for-home-automation. For the old v1 versions, select hardware type FDTI. For the newer V2 versions, see here

setting value: [SOCKET_NR],[BOARD_NR] where [SOCKET_NR] is from 1 to 8 and [BOARD_NR] is optional

Remote

EG-PM2-LAN

This is a network enabled power switch that can operate 4 power outlets. Make sure you are able to control this power device with your browser before adding it to the software.

setting value: http://[PASSWORD]@[EG-PM2_IP]#[SOCKET_NR] where [PASSWORD] is optional and [SOCKET_NR] is from 1 to 4

Debugging: Check manually with your browser

EG-PiMote

Meross MSS425E Power Switches

These switch will be automatic loaded after entering the Meross cloud login details on the system setting page. After saving the settings, the software needs to be restarted. After restarting, 4 new power switches should be added and can be used.

Warning: The Meross cloud login details will be stored in plain text!

Device(s): https://www.meross.com/product/16/article/

Display

The software supports different types of external displays. For now the LCD and OLED types are supported. For more detail on supported hardware see either the LCD or OLED display information.

The software will show every 30 seconds the state of the Pi in terms of uptime, CPU load and CPU temperature. Next to that it will show all averages per sensor type. At this moment it is not possible to select individual sensors to show on the display.

When an value is out of range (warning) the text line will be surrounded by '!'

Further it is possible to select different notification messages through the notification system

The software is capable of scrolling the text both horizontal (when longer then amount of chars) and/or vertical (when more messages then lines). It can detect by display type how much it can show. Make sure you select the right resolution!

LCD

The software supports LCD displays based on I2C communication. More information about connecting to a Pi: https://www.raspberrypi-spy.co.uk/2015/05/using-an-i2c-enabled-lcd-screen-with-the-raspberry-pi/

LCD 16x2

setting value:

  • Hardware holds the used LCD display chip
  • [I2C_address],[I2C_bus] where I2C_bus is optional

Debugging: ...

LCD 16x2 Serial

The software supports LCD displays based on serial communication. More information about connecting to a Pi: https://www.instructables.com/id/Raspberry-Pi-Arduino-LCD-Screen/

setting value:

  • Hardware holds the used LCD display chip
  • [/dev/USBDEVICE],[serial_speed]

Debugging: ...

LCD 20x4

See LCD 16x2

LCD 20x4 Serial

See LCD 16x2 Serial

Oled

The software supports OLED displays based on I2C communication.

128x64

See LCD 16x2

LED

Notification

It is possible to connect LED to three GPIO ports in order to display the status of TerrariumPI based on the log file. At normal operation a green LED will be on indicating all working fine. When a warning is triggered somewhere in the software an amber light will be turned on. This amber light will stay on for 15 minutes so that you have some time to notice it. An error will turn on a red LED and that will stay on for 60 minutes

In order to use this LED notifications, create a new logging settings file based on the original and name it logging.custom.cfg

Then edit in logging.custom.cfg the section handler_notificationHandler setting the args value to ([37,35,33],) where the numbers are the physical pin numbers in the order of green, amber, red

PiStop Traffic Light Add-on

For setting up, see general notification section above.
https://shop.4tronix.co.uk/products/4-pack-pi-stop-educational-pistop-traffic-light-add-on-for-raspberry-pi