Building your software from scratch [LEGACY]

Guide for building your software

The current software explained in this guide belongs to our prototype software. We are actively working on our new scalable solution and details on how to get started will follow soon.

This page describes installing and building the AstroPlant software manually. If you received a pre-assembled SD-card or simply want to download and flash the AstroPlant image skip this page and go to the "quick setup" page.

Software preparation and installation

Firstly we will install Rasbian lite and install, configure all needed packages. Secondly we will power the RPi via a standard RPi power supply only and test the sensors. Before continuing make sure you have the water temperature, LCD, CO2 and relative humidity/ambient sensor hooked up.

Step 1 Rasbian lite installation

Download the Raspbian lite (Stretch) image from the following URL:

In order to flash the Rasbian image download and install Etcher :

Make sure an SD card is inserted in your computer and startup Etcher. In turn select the downloaded Rasbian image and flash to the SD card.

Step 2 Enable SSH and internet via SD card

Once you've burned/etched the Raspbian image onto the microSD card, connect the card to your working PC and you'll see the card being mounted as "boot". Inside this "boot" directory, you need to make 2 new files. You may need to re-insert the SD card to see the "boot" folder. Step 1: Create an empty file. You can use Notepad on Windows or TextEdit to do so by creating a new file. Just name the file ssh. Save that empty file and dump it into boot partition (microSD). Step 2: Create another file named wpa_supplicant.conf . This time you need to write a few lines of text for this file, adjust the file below accordingly.

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
ssid="your network"
psk="your pass"

Insert the SD card in the RPi.

Step 3 Connect the RPi to the extension board

You may skip this section if you already hooked up the RPi to extension board either via RPi usb cable or AstroPlant power supply

  1. Plug the Raspberry Pi on the extension board (be care to align the 40-pin header)

    • Check the jumper configuration

  2. Plug the USB power supply on the Raspberry Pi

    • The green LED should light on

      • If not, unplug the power supply quickly: there is a short circuit -> check continuity of 3.3V and 5V

  3. Power off the Raspberry and remove the USB supply

  4. Do this test again but with a jumper on JP1 between on the RPi side and remove any jumper on JP2

    • Jumper configuration:

    RPi [xx]x In
    • The amber LED D5 on the extension board should be on at step 2

Step 4 Headless: Connecting to the RPi via SSH

You may skip this section if you use a screen and keyboard.

Once you setup your internet connection and enables SSH, we can connect via the computer to the RPi. This example uses the Linux terminal to ssh.

$ ssh pi@raspberrypi.local

If it cannot find the raspberry pi, use a tool like AngryIP scanner or your routers configuration to figure out the IP address of the Rasberry Pi. In turn you can connect via "ssh pi@<ip_address>"

Step 5 Enabling sensors and changing the password via Raspi-config

Once inside the RPi system you need to login. The default username is "pi" and password is "raspberry".

Open Raspi-config.

$ sudo raspi-config

You'll see the following screen

Do the following on Interfacing options:

  • Enable camera

  • Enable SPI interface

  • Enable I2C

  • Enable serial 1) Do not enable login shell, click no 2) enable serial port hardware, click yes

  • Enable 1-wire

Change the user password, to your preferred password. If you wish you can also change the timezone in the Localisation options to your country's timezone.

Step 6 Installing software packages

Update your system

$ sudo apt-get update
$ sudo apt-get upgrade

Install the following packages

$ sudo apt-get install python3-pip -y
$ sudo apt-get install git
$ sudo apt-get install pigpio python-pigpio python3-pigpio python3-smbus
$ sudo apt-get install python3-picamera
$ sudo pip3 install pyserial

Reboot the Rpi

$ sudo reboot now

Step 7 Test sensors

This step is optional.

Clone the test repository in the home directory:

$ git clone

Change directory to the folder. And run step by step the following commands.

$ python3
$ python3
$ python3
$ python3
# if camera is attached
$ python3
# for LCD screen, you may need to check your I2c address and adjust in script (default = 0x27)
$ python3

Make sure you retrieve readings.

For the humidity and temperature sensor clone the following repository and install the library.

$ git clone
$ sudo pip3 install Adafruit_DHT

Change directory to Adafruit_Python_DHT/examples and run the following

$ python3 2302 17

Step 8 Installing the AstroPlant cloud software

Clone the following packages in the home directory:

$ git clone
$ git clone

In both directories perform the following commands

$ pip3 install -r requirements.txt
$ pip3 install -e .

Step 9 Registration of your kit and testing cloud connection

Go to and fill in your credentials. You will receive an activation mail. Keep in mind that it can be in your spam mail!

Once activated you'll see this screen:

Click on add kit. Generate your secret keys and store it somewhere save.

Go to the peripheral devices tab:

Start with adding the CO2, light, water temperature sensors, set your preferred sensor names and keep everything else on default. For the relative humidity and ambient temperature sensors (DHT22), fill in pin number 17 in case the default value is 22.

Due to the possibility of loosing the internet connection it is recommended to make sure that local data logging is set. Configure another peripheral device to enable local data logging.

Next make sure to set your location and data access to public if you want to participate in AstroPlant-ESA experiments.

Click on the map to set your location. In turn click save.

Make sure "show on map" and "public dashboard" is selected.

That'll be it!

Test cloud connection on RPi

Test the system by creating a configuration file called kit_config.json in the astroplant-kit/astroplant_kit folder. Use your serial and secret tokens retrieved by registration.

"api": {
"root": ""
"websockets": {
"url": "wss://"
"auth": {
"serial": "[[INSERT KIT SERIAL HERE]]",
"secret": "[[INSERT SECRET HERE]]"
"debug": {
"level": "INFO",
"peripheral_display": {
"module_name": "peripheral",
"class_name": "BlackHoleDisplay"

You'll need to run the following commands to start the system:

$ sudo pigpiod
$ python3

If you know the I2C address of your LCD screen, you could change "debug" to the following to enable screen display

"debug": {
"level": "INFO",
"peripheral_display": {
"module_name": "astroplant_peripheral_device_library.lcd",
"class_name": "LCD",
"parameters": {
"i2c_address": "<my_I2Caddress"

At this point you can setup a cron job for the software service.

$ crontab -e

Inside this file add this line:

@reboot sleep 30; cd /home/pi/astroplant-kit/astroplant_kit && python3

Setup a cron job for pigpiod

$ sudo crontab -e

Inside this file add this line:

@reboot sudo pigpiod

Reboot your system:

$ sudo reboot now

Step 10 Installing Maxim's actuator control

Follow this section if you have the power supply and actuators connected. Make sure you already set the timezone in step 5.

For actuator control you can use AstroGeek's package. Clone the repository in the home directory:

$ git clone

Install the following package

$ sudo pip3 install pyzmq

Manually adjust the config.json in the root directory to the following GPIO ports:



Blue LED




Farred LED




Sensor fan


Config.json sample below:

"actuators": [
{ "className": "Led", "name": "Led.Blue", "pin": 21 },
{ "className": "Led", "name": "Led.Red", "pin": 20 },
{ "className": "Led", "name": "Led.FarRed", "pin": 18 },
{ "className": "Fan", "name": "Fan", "pin": 16 },
{ "className": "Fan", "name": "Sensor_Fan", "pin": 19 }

Install the library

$ sudo python3 install

Set a crontab with the following command

$ sudo crontab -e

This is an example you can use.

@reboot cd /home/pi/astrogeeks-actuator-control && ./controld
# on from 19:00 till 19:59
* 19 * * * cd /home/pi/astrogeeks-actuator-control && ./control "Led.FarRed" 20
# off from 20:00 till 18:59
* 20-23,0-18 * * * cd /home/pi/astrogeeks-actuator-control && ./control "Led.FarRed" 0.0
# off from 20:00 till 5:59
* 20-23,0-5 * * * cd /home/pi/astrogeeks-actuator-control && ./control "Led.Blue" 0.0
* 20-23,0-5 * * * cd /home/pi/astrogeeks-actuator-control && ./control "Led.Red" 0.0
# off from 4:00 till 5:59
* 4-5 * * * cd /home/pi/astrogeeks-actuator-control && ./control "Fan" 0
* 4-5 * * * cd /home/pi/astrogeeks-actuator-control && ./control "Sensor_Fan" 0
# on from 06:00 till 19:59
* 6-19 * * * cd /home/pi/astrogeeks-actuator-control && ./control "Led.Blue" 10
* 6-19 * * * cd /home/pi/astrogeeks-actuator-control && ./control "Led.Red" 20
# on from 6:00 till 3:59
* 6-23,0-3 * * * cd /home/pi/astrogeeks-actuator-control && ./control "Fan" 1
* 6-23,0-3 * * * cd /home/pi/astrogeeks-actuator-control && ./control "Sensor_Fan" 1

The numbers after the "" refer to intensity. For fans it is either 0 for off and 1 for on.

It is recommended to never set the intensity to 100% if you have the official AstroPlant LED panel. The total lifetime of the LEDs could be potentially reduced at 100%. Detailed spectrometer results coming soon!

An initial recommended setting can be found in the AstroPlant Growth Protocol.

Reboot the device and your LEDS and fans should turn on.

$ sudo reboot now


See the following Github pages for our software.

Peripheral device library:

AstroGeeks (Maxim's) actuator control:

AstroPlant-kit library: