Building your kit software from scratch
This page describes installing and building the AstroPlant software manually.
First we will install Raspberry Pi OS Bullseye Lite and install all needed software. Before continuing make sure you have the LCD screen, water temperature sensor, CO2 sensor and relative humidity/ambient sensor hooked up.
Download the Raspberry Pi OS Bullseye Lite image from the following URL:
In order to flash the operating system image image to the SD card, use any tool suitable for flashing, such as Etcher:
To flash using Etcher, make sure an SD card is inserted in your computer and start Etcher. Select the downloaded Rasbian image and flash it to the SD card.
Once you've flashed the operating system image onto the SD card, (re-)insert the card and you'll see one of the partitions on the card being mounted as "boot". Ensure it is the partition boot, and not the directory boot on the SD system partition. If on Linux the SD partition is not mounted automatically, mount it manually. In the root of the filesystem on the SD boot partition, you need to create two new files.
- Step 2.1: Create an empty file called
sshin the root of the filesystem on the SD boot partition. For example, you can use Notepad on Windows or TextEdit on MacOS to create a new file named simply
ssh, without any content. On Linux
touch sshfrom the command line inside the SD boot partition.
- Step 2.2: Create a file named
wpa_supplicant.conf. This time you need to write a few lines of text to this file, adjust the file below accordingly by changing
countryto your ISO 3166 alpha-2 country code,
ssidto your network's name, and
pskto your network's password:
psk="YOUR NETWORK PASSWORD"
The first boot of a fresh Raspberry Pi install will take some time. On a Raspberry Pi Zero W it may take a few minutes.
You may skip this section if you use a monitor and keyboard.
Once you have set up your internet connection and enabled SSH, you can connect to the Raspberry Pi over the network. The default username is
piand password is
If your Raspberry Pi cannot be found, use a tool like Angry IP scanner to figure out the IP address of your Raspberry Pi. Alternatively, check your router's DHCP lease table. Then you can connect via
You'll see the following screen
Configure the Interfacing Options as follows:
- Enable the camera
- Enable the SPI interface
- Enable I2C
- Disable the login shell
- Enable serial port hardware
- Enable 1-wire
Optionally change the password for the
piuser. If you wish you can also change the timezone in the localization options to your country's timezone.
Update the package lists:
$ sudo apt-get update
Install the following packages:
$ sudo apt-get install git python3-pip libcapnp-dev pigpio python3-pigpio
$ sudo apt-get install libpng12-dev libatlas-base-dev libopenjp2-7-dev libtiff-dev
$ python3 -m pip install pyserial
$ sudo apt-get install python3-smbus
$ sudo apt-get install python3-w1thermsensor
$ sudo apt-get install python3-picamera
For completeness, reboot the Raspberry Pi:
$ sudo reboot now
This step is optional, but recommended.
Clone the test repository in the home directory (
$ git clone https://github.com/AstroPlant/sensor-test-scripts
Change directory to the folder. Run the following commands one-by-one. Ensure you retrieve readings from each sensor.
$ python3 bh1750.py
$ python3 co2.py
$ python3 waterTemp.py
$ python3 lcdi2c.py
# if camera is attached
$ python3 RPI_camera.py
# for LCD screen, you may need to check your I2C address
# and adjust in script (default used in code: 0x3f)
$ python3 lcdi2c.py
For the humidity and temperature sensor, install the Adafruit_DHT library.
$ python3 -m pip install Adafruit_DHT
Run a test script provided in that library's repository:
$ git clone https://github.com/adafruit/Adafruit_Python_DHT
$ python3 Adafruit_Python_DHT/examples/AdafruitDHT.py 2302 17
Install the Kit software:
Ensure the installation succeeded. The following command should output the kit software version:
$ astroplant-kit version
Follow these steps to register and configure a kit if you haven't already done so:
Take special note of the kit serial and the kit password. The kit password can be regenerated if needed (the password will be shown only once, and if lost, a new password needs to be generated).
Create a file named
kit_config.tomlin the home directory (
host = "mqtt.astroplant.io"
port = 1883
serial = "<<YOUR KIT SERIAL HERE>>"
secret = "<<YOUR KIT PASSWORD HERE>>"
level = "INFO"
module_name = "astroplant_peripheral_device_library.lcd"
class_name = "LCD"
LCD not working? By default 0x27 is used as the I2C address. Most likely your LCD screen uses another address. There are two ways of finding the correct I2C address.
1) (recommended) Perform step 7 "ldci2c.py". By default this script uses the address 0x3f.
2) Use the RPi tool "i2cdetect" to find out the address. Detach the light and air/humidity sensor to make sure you find only the LCD address.
Add the following to the kit_config.toml in case you know you have an address other than 0x27.
i2cAddress = "<<0x27 OR 0x3f FOR MOST COMMON ADDRESSES>>"
Run the kit, ensuring you are in the directory where you created
kit_config.toml(or specify a path to the configuration file as argument).
$ sudo pigpiod
$ astroplant-kit run
To run the kit without an SSH connection, you can set up a system task to launch it on boot, or e.g. launch it in the program
screen. Make sure pigpiod is activated.
Any issues? Please look at the FAQ or contact us