Skip to content

I'm going to participate in #GrowLab challenge initiated by Alex Ellis @AlexEllisUK

Notifications You must be signed in to change notification settings

sergevas/growlab-v1

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

85 Commits
 
 
 
 
 
 
 
 

Repository files navigation

!!! THIS PROJECT IS WORK IN PROGRESS !!!

The connected Garden application

Inspired by the #Growlab contest, initiated by Alex Ellis

This repo contains an application, intended to be installed on the Raspberry Pi.

Also, a few dependencies should be installed before the application deployment:

JDK 11

The application runs fine with Azul Zulu Build of OpenJDK for Linux ARM 32-bit.

Pi4J

Note: the current implementation depends on Pi4J Version 2.0

Install Pi4J version 1.4

See Maven Settings

See Raspberry Pi pinout

Mosquitto MQTT

Note: current implementation doesn't use Mosquitto

Mosquitto server can be installed from the Debian repository.

See Mosquitto Debian repository

# On the Raspberry Pi
wget http://repo.mosquitto.org/debian/mosquitto-repo.gpg.key
sudo apt-key add mosquitto-repo.gpg.key
cd /etc/apt/sources.list.d/
# For Raspbian GNU/Linux 10 (buster)
sudo wget http://repo.mosquitto.org/debian/mosquitto-buster.list

sudo apt update
sudo apt install mosquitto mosquitto-clients

Mosquitto starts on boot after the installation.

"mosquitto" system service status check:

sudo systemctl status mosquitto

Add config file:

sudo nano /etc/mosquitto/conf.d/rpi.conf

with the following content:

connection_messages true

Enable Username and Password Authentication:

cd /etc/mosquitto
sudo mosquitto_passwd -c passwds garden
#Enter password for garden user

Update config file /etc/mosquitto/conf.d/rpi.conf with the following content:

allow_anonymous false
password_file /etc/mosquitto/passwds

Restart "mosquitto" system service:

sudo systemctl restart mosquitto

Deployment

The process implemented with Wagon Maven Plugin

The application jar and Helidon libs directory content are copied into the device using the plugin:

scp://${rpi.ip}/home/pi/growlabv1/app/helidon

See the application's pom.xml for the details.

The device authentication profile has to be added into servers element of Maven's settings.xml file

Linux service for Java application

Describes how to configure Linux service, running the Java application deployed as a jar file.

The device OS has to be prepared to run the application. See discussion on Pi4J v2 issue #60

Main points:

  • Pi4J native libs have a dependency on pigpio library. The installation procedure can be found here: Download & Install

    I ran through the Download and install the latest version section without any issues:

    wget https://github.com/joan2937/pigpio/archive/master.zip
    unzip master.zip
    cd pigpio-master
    make
    sudo make install
  • the default pigpio daemon should be stopped

    sudo killall pigpiod
    sudo systemctl disable pigpiod
  • the application has to be run using sudo

To run the application as systemctl Linux service:

  • put growlabv1.service into /etc/systemd/system
  • reload systemd manager configuration
    systemctl daemon-reload
  • start growlabv1.service
    systemctl start growlabv1.service
  • enable growlabv1.service
    systemctl enable growlabv1.service
  • see the application logs
    journalctl --unit=growlabv1.service -f

About

I'm going to participate in #GrowLab challenge initiated by Alex Ellis @AlexEllisUK

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages