Difference between revisions of "Control application"

From aquarium-doc
Jump to navigationJump to search
 
(27 intermediate revisions by the same user not shown)
Line 1: Line 1:
The main control application of Aquarium control implements the following features:
The main control application of Aquarium control implements the following features:


* Data acquisition of water temperature, pH and conductivity
* [[Data acquisition of water temperature, pH and conductivity]]
* Data acquisition of ambient temperature and humidity
* [[Data acquisition of ambient temperature and humidity]]
* Fresh water refill control
* Fresh water refill control
* Feed control
* Feed control
* Water temperature control using air ventilation
* Water temperature control using air ventilation and heater
* Calculation of refill tank content based on water level measurement  
* [[Calculation of refill tank content]] based on [[water level measurement]]
* Actuation of pump for water exchange


Additionally, the main control application implements the following supporting features:
Additionally, the main control application implements the following supporting features:
Line 15: Line 16:
* Storage of recorded data in SQL database
* Storage of recorded data in SQL database
* File-based communication to web application
* File-based communication to web application
* Recording of WebCam picture
* [[Relay Board Control|Monitoring and repair of relay board state]]
* [[Device Scheduling]]
 
The control application makes extensive use of the [https://abyz.me.uk/rpi/pigpio/ pigpio library].
 
The [[architecture]] of the application uses various threads.
 
The application is [[automatic start by using systemd]].
 
== Installation ==
 
for the installation of the operating system on the Raspberry Pi, please follow the instructions of the [https://www.raspberrypi.com Raspberry Pi foundation].
Use the 64-bit version.
 
=== Clone the repository, build and install the control SW ===
Create the folder with the usage rights:
 
<code>sudo mkdir /usr/local/src/aquarium-ctrl</code>
 
<code>sudo chown pi /usrlocal/src/aquarium-ctrl</code>
 
<code>cd /usr/local/src/aquarium-ctrl</code>
 
Next, clone the repository:
<code>git clone https://in-dubio@bitbucket.org/in-dubio/aquarium-ctrl.git</code>
 
Install the required libraries:
<code>bash libinstall.sh</code>
 
=== Enable I2C on Raspberry Pi ===
See [https://www.mathworks.com/help/supportpkg/raspberrypiio/ref/enablei2c.html detailed instructions how to use rasp-config].
 
=== Create a file for the message queue ===
The file is automatically created when running <code>make install</code>.
 
Alternatively, run the command <code>sudo touch /var/local/aquarium-ctrl.mq</code>.
 
The file is defined in the source file <code>UsrIntrfc/MsgQu.h</code>.
 
=== Create a ramdisk ===
Create the folder <code>/mnt/ramdisk</code>.
 
Add the following line to <code>/etc/fstab</code>: <code>tmpfs /mnt/ramdisk tmpfs nodev,nosuid,size=50M 0 0</code>.
 
Add a symbolic link using the command <code>ln -s /mnt/ramdisk /var/local/aquarium-ctrl</code>.
 
=== Automatic start of control application ===
[[Automatic_start_by_using_systemd|Follow instructions for configuring automatic start of control application.]]
 
=== Create the website ===
In the folder <code>/var/www/html</code>, create the website using <code>git clone https://in-dubio@bitbucket.org/in-dubio/aquarium-web.git</code>.
 
Change the owner of the website to user <code>pi</code> and change the group of the website to <code>www-data</code>.
 
Create a symbolic link to the log file running <code>ln -s /var/log/aquarium-ctrl-session.log /var/www/html/aquarium-web/logfile.txt</code>.
 
Create the file <code>/var/www/app.ini</code> with the following content (set the correct password):
<code>
 
[database]
 
server = localhost
 
port = 3306
 
user = aquarium
 
password = YourPassword
 
database = aquarium
</code>
 
[[Download and install the node JavaScript libraries.]]
 
=== Setup of database ===
* Download or clone an SQL database dump: <code>git clone https://in-dubio@bitbucket.org/in-dubio/aquarium-database.git</code>
* [https://www.digitalocean.com/community/tutorials/how-to-import-and-export-databases-in-mysql-or-mariadb Import a database.]
* Create the user <code>aquarium</code> and assign access rights to the <code>aquarium</code> database.
* Check the user rights using [https://www.phpmyadmin.net phpmyadmin]

Latest revision as of 19:59, 8 April 2023

The main control application of Aquarium control implements the following features:

Additionally, the main control application implements the following supporting features:

The control application makes extensive use of the pigpio library.

The architecture of the application uses various threads.

The application is automatic start by using systemd.

Installation

for the installation of the operating system on the Raspberry Pi, please follow the instructions of the Raspberry Pi foundation. Use the 64-bit version.

Clone the repository, build and install the control SW

Create the folder with the usage rights:

sudo mkdir /usr/local/src/aquarium-ctrl

sudo chown pi /usrlocal/src/aquarium-ctrl

cd /usr/local/src/aquarium-ctrl

Next, clone the repository: git clone https://in-dubio@bitbucket.org/in-dubio/aquarium-ctrl.git

Install the required libraries: bash libinstall.sh

Enable I2C on Raspberry Pi

See detailed instructions how to use rasp-config.

Create a file for the message queue

The file is automatically created when running make install.

Alternatively, run the command sudo touch /var/local/aquarium-ctrl.mq.

The file is defined in the source file UsrIntrfc/MsgQu.h.

Create a ramdisk

Create the folder /mnt/ramdisk.

Add the following line to /etc/fstab: tmpfs /mnt/ramdisk tmpfs nodev,nosuid,size=50M 0 0.

Add a symbolic link using the command ln -s /mnt/ramdisk /var/local/aquarium-ctrl.

Automatic start of control application

Follow instructions for configuring automatic start of control application.

Create the website

In the folder /var/www/html, create the website using git clone https://in-dubio@bitbucket.org/in-dubio/aquarium-web.git.

Change the owner of the website to user pi and change the group of the website to www-data.

Create a symbolic link to the log file running ln -s /var/log/aquarium-ctrl-session.log /var/www/html/aquarium-web/logfile.txt.

Create the file /var/www/app.ini with the following content (set the correct password):

[database]

server = localhost

port = 3306

user = aquarium

password = YourPassword

database = aquarium

Download and install the node JavaScript libraries.

Setup of database