<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://laimburggasse.onthewifi.com/mediawiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Uwe</id>
	<title>aquarium-doc - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="http://laimburggasse.onthewifi.com/mediawiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Uwe"/>
	<link rel="alternate" type="text/html" href="http://laimburggasse.onthewifi.com/mediawiki/index.php/Special:Contributions/Uwe"/>
	<updated>2026-09-02T10:20:29Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.37.1</generator>
	<entry>
		<id>http://laimburggasse.onthewifi.com/mediawiki/index.php?title=Control_application&amp;diff=161</id>
		<title>Control application</title>
		<link rel="alternate" type="text/html" href="http://laimburggasse.onthewifi.com/mediawiki/index.php?title=Control_application&amp;diff=161"/>
		<updated>2023-04-08T17:59:11Z</updated>

		<summary type="html">&lt;p&gt;Uwe: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The main control application of Aquarium control implements the following features:&lt;br /&gt;
&lt;br /&gt;
* [[Data acquisition of water temperature, pH and conductivity]]&lt;br /&gt;
* [[Data acquisition of ambient temperature and humidity]]&lt;br /&gt;
* Fresh water refill control&lt;br /&gt;
* Feed control&lt;br /&gt;
* Water temperature control using air ventilation and heater&lt;br /&gt;
* [[Calculation of refill tank content]] based on [[water level measurement]] &lt;br /&gt;
* Actuation of pump for water exchange&lt;br /&gt;
&lt;br /&gt;
Additionally, the main control application implements the following supporting features:&lt;br /&gt;
* HW-Tests&lt;br /&gt;
* Text-To-Speech interface&lt;br /&gt;
* Logging&lt;br /&gt;
* Command interface to receive instructions from outside of the application&lt;br /&gt;
* Storage of recorded data in SQL database&lt;br /&gt;
* File-based communication to web application&lt;br /&gt;
* [[Relay Board Control|Monitoring and repair of relay board state]]&lt;br /&gt;
* [[Device Scheduling]]&lt;br /&gt;
&lt;br /&gt;
The control application makes extensive use of the [https://abyz.me.uk/rpi/pigpio/ pigpio library].&lt;br /&gt;
&lt;br /&gt;
The [[architecture]] of the application uses various threads.&lt;br /&gt;
&lt;br /&gt;
The application is [[automatic start by using systemd]].&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
for the installation of the operating system on the Raspberry Pi, please follow the instructions of the [https://www.raspberrypi.com Raspberry Pi foundation].&lt;br /&gt;
Use the 64-bit version.&lt;br /&gt;
&lt;br /&gt;
=== Clone the repository, build and install the control SW ===&lt;br /&gt;
Create the folder with the usage rights:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo mkdir /usr/local/src/aquarium-ctrl&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo chown pi /usrlocal/src/aquarium-ctrl&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;cd /usr/local/src/aquarium-ctrl&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next, clone the repository:&lt;br /&gt;
&amp;lt;code&amp;gt;git clone https://in-dubio@bitbucket.org/in-dubio/aquarium-ctrl.git&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Install the required libraries:&lt;br /&gt;
&amp;lt;code&amp;gt;bash libinstall.sh&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Enable I2C on Raspberry Pi ===&lt;br /&gt;
See [https://www.mathworks.com/help/supportpkg/raspberrypiio/ref/enablei2c.html detailed instructions how to use rasp-config].&lt;br /&gt;
&lt;br /&gt;
=== Create a file for the message queue ===&lt;br /&gt;
The file is automatically created when running &amp;lt;code&amp;gt;make install&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Alternatively, run the command &amp;lt;code&amp;gt;sudo touch /var/local/aquarium-ctrl.mq&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The file is defined in the source file &amp;lt;code&amp;gt;UsrIntrfc/MsgQu.h&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Create a ramdisk ===&lt;br /&gt;
Create the folder &amp;lt;code&amp;gt;/mnt/ramdisk&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Add the following line to &amp;lt;code&amp;gt;/etc/fstab&amp;lt;/code&amp;gt;: &amp;lt;code&amp;gt;tmpfs /mnt/ramdisk tmpfs nodev,nosuid,size=50M 0 0&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Add a symbolic link using the command &amp;lt;code&amp;gt;ln -s /mnt/ramdisk /var/local/aquarium-ctrl&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Automatic start of control application ===&lt;br /&gt;
[[Automatic_start_by_using_systemd|Follow instructions for configuring automatic start of control application.]]&lt;br /&gt;
&lt;br /&gt;
=== Create the website ===&lt;br /&gt;
In the folder &amp;lt;code&amp;gt;/var/www/html&amp;lt;/code&amp;gt;, create the website using &amp;lt;code&amp;gt;git clone https://in-dubio@bitbucket.org/in-dubio/aquarium-web.git&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Change the owner of the website to user &amp;lt;code&amp;gt;pi&amp;lt;/code&amp;gt; and change the group of the website to &amp;lt;code&amp;gt;www-data&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Create a symbolic link to the log file running &amp;lt;code&amp;gt;ln -s /var/log/aquarium-ctrl-session.log /var/www/html/aquarium-web/logfile.txt&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Create the file &amp;lt;code&amp;gt;/var/www/app.ini&amp;lt;/code&amp;gt; with the following content (set the correct password):&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[database]&lt;br /&gt;
&lt;br /&gt;
server = localhost&lt;br /&gt;
&lt;br /&gt;
port = 3306&lt;br /&gt;
&lt;br /&gt;
user = aquarium&lt;br /&gt;
&lt;br /&gt;
password = YourPassword&lt;br /&gt;
&lt;br /&gt;
database = aquarium&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Download and install the node JavaScript libraries.]]&lt;br /&gt;
&lt;br /&gt;
=== Setup of database ===&lt;br /&gt;
* Download or clone an SQL database dump: &amp;lt;code&amp;gt;git clone https://in-dubio@bitbucket.org/in-dubio/aquarium-database.git&amp;lt;/code&amp;gt;&lt;br /&gt;
* [https://www.digitalocean.com/community/tutorials/how-to-import-and-export-databases-in-mysql-or-mariadb Import a database.]&lt;br /&gt;
* Create the user &amp;lt;code&amp;gt;aquarium&amp;lt;/code&amp;gt; and assign access rights to the &amp;lt;code&amp;gt;aquarium&amp;lt;/code&amp;gt; database.&lt;br /&gt;
* Check the user rights using [https://www.phpmyadmin.net phpmyadmin]&lt;/div&gt;</summary>
		<author><name>Uwe</name></author>
	</entry>
	<entry>
		<id>http://laimburggasse.onthewifi.com/mediawiki/index.php?title=Control_application&amp;diff=160</id>
		<title>Control application</title>
		<link rel="alternate" type="text/html" href="http://laimburggasse.onthewifi.com/mediawiki/index.php?title=Control_application&amp;diff=160"/>
		<updated>2023-04-08T17:58:19Z</updated>

		<summary type="html">&lt;p&gt;Uwe: /* Installation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The main control application of Aquarium control implements the following features:&lt;br /&gt;
&lt;br /&gt;
* [[Data acquisition of water temperature, pH and conductivity]]&lt;br /&gt;
* [[Data acquisition of ambient temperature and humidity]]&lt;br /&gt;
* Fresh water refill control&lt;br /&gt;
* Feed control&lt;br /&gt;
* Water temperature control using air ventilation and heater&lt;br /&gt;
* [[Calculation of refill tank content]] based on [[water level measurement]] &lt;br /&gt;
* Actuation of pump for water exchange&lt;br /&gt;
&lt;br /&gt;
Additionally, the main control application implements the following supporting features:&lt;br /&gt;
* HW-Tests&lt;br /&gt;
* Text-To-Speech interface&lt;br /&gt;
* Logging&lt;br /&gt;
* Command interface to receive instructions from outside of the application&lt;br /&gt;
* Storage of recorded data in SQL database&lt;br /&gt;
* File-based communication to web application&lt;br /&gt;
* [[Relay Board Control|Monitoring and repair of relay board state]]&lt;br /&gt;
* [[Device Scheduling]]&lt;br /&gt;
&lt;br /&gt;
The control application makes extensive use of the [https://abyz.me.uk/rpi/pigpio/ pigpio library].&lt;br /&gt;
&lt;br /&gt;
The [[architecture]] of the application uses various threads.&lt;br /&gt;
&lt;br /&gt;
The application is [[automatic start by using systemd]].&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
for the installation of the operating system on the Raspberry Pi, please follow the instructions of the [https://www.raspberrypi.com Raspberry Pi foundation].&lt;br /&gt;
Use the 64-bit version.&lt;br /&gt;
&lt;br /&gt;
=== Clone the repository, build and install the control SW ===&lt;br /&gt;
Create the folder with the usage rights:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo mkdir /usr/local/src/aquarium-ctrl&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo chown pi /usrlocal/src/aquarium-ctrl&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;cd /usr/local/src/aquarium-ctrl&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next, clone the repository:&lt;br /&gt;
&amp;lt;code&amp;gt;git clone https://in-dubio@bitbucket.org/in-dubio/aquarium-ctrl.git&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Install the required libraries:&lt;br /&gt;
&amp;lt;code&amp;gt;bash libinstall.sh&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Enable I2C on Raspberry Pi ===&lt;br /&gt;
See [https://www.mathworks.com/help/supportpkg/raspberrypiio/ref/enablei2c.html detailed instructions how to use rasp-config].&lt;br /&gt;
&lt;br /&gt;
=== Create a file for the message queue ===&lt;br /&gt;
The file is automatically created when running &amp;lt;code&amp;gt;make install&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Alternatively, run the command &amp;lt;code&amp;gt;sudo touch /var/local/aquarium-ctrl.mq&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The file is defined in the source file &amp;lt;code&amp;gt;UsrIntrfc/MsgQu.h&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Create a ramdisk ===&lt;br /&gt;
Create the folder &amp;lt;code&amp;gt;/mnt/ramdisk&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Add the following line to &amp;lt;code&amp;gt;/etc/fstab&amp;lt;/code&amp;gt;: &amp;lt;code&amp;gt;tmpfs /mnt/ramdisk tmpfs nodev,nosuid,size=50M 0 0&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Add a symbolic link using the command &amp;lt;code&amp;gt;ln -s /mnt/ramdisk /var/local/aquarium-ctrl&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Automatic start of control application ===&lt;br /&gt;
[[Automatic_start_by_using_systemd|Follow instructions for configuring automatic start of control application.]]&lt;br /&gt;
&lt;br /&gt;
=== Create the website ===&lt;br /&gt;
In the folder &amp;lt;code&amp;gt;/var/www/html&amp;lt;/code&amp;gt;, create the website using &amp;lt;code&amp;gt;git clone https://in-dubio@bitbucket.org/in-dubio/aquarium-web.git&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Change the owner of the website to user &amp;lt;code&amp;gt;pi&amp;lt;/code&amp;gt; and change the group of the website to &amp;lt;code&amp;gt;www-data&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Create a symbolic link to the log file running &amp;lt;code&amp;gt;ln -s /var/log/aquarium-ctrl-session.log /var/www/html/aquarium-web/logfile.txt&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Create the file &amp;lt;code&amp;gt;/var/www/app.ini&amp;lt;/code&amp;gt; with the following content (set the correct password):&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[database]&lt;br /&gt;
&lt;br /&gt;
server = localhost&lt;br /&gt;
&lt;br /&gt;
port = 3306&lt;br /&gt;
&lt;br /&gt;
user = aquarium&lt;br /&gt;
&lt;br /&gt;
password = YourPassword&lt;br /&gt;
&lt;br /&gt;
database = aquarium&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Download and install the node JavaScript libraries.]]&lt;br /&gt;
&lt;br /&gt;
=== Setup of database ===&lt;br /&gt;
* Download or [[git clone https://in-dubio@bitbucket.org/in-dubio/aquarium-database.git|clone an SQL database dump]].&lt;br /&gt;
* [https://www.digitalocean.com/community/tutorials/how-to-import-and-export-databases-in-mysql-or-mariadb Import a database.]&lt;br /&gt;
* Create the user &amp;lt;code&amp;gt;aquarium&amp;lt;/code&amp;gt; and assign access rights to the &amp;lt;code&amp;gt;aquarium&amp;lt;/code&amp;gt; database.&lt;br /&gt;
* Check the user rights using [https://www.phpmyadmin.net phpmyadmin]&lt;/div&gt;</summary>
		<author><name>Uwe</name></author>
	</entry>
	<entry>
		<id>http://laimburggasse.onthewifi.com/mediawiki/index.php?title=Control_application&amp;diff=159</id>
		<title>Control application</title>
		<link rel="alternate" type="text/html" href="http://laimburggasse.onthewifi.com/mediawiki/index.php?title=Control_application&amp;diff=159"/>
		<updated>2023-04-08T17:42:10Z</updated>

		<summary type="html">&lt;p&gt;Uwe: /* Setup of database */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The main control application of Aquarium control implements the following features:&lt;br /&gt;
&lt;br /&gt;
* [[Data acquisition of water temperature, pH and conductivity]]&lt;br /&gt;
* [[Data acquisition of ambient temperature and humidity]]&lt;br /&gt;
* Fresh water refill control&lt;br /&gt;
* Feed control&lt;br /&gt;
* Water temperature control using air ventilation and heater&lt;br /&gt;
* [[Calculation of refill tank content]] based on [[water level measurement]] &lt;br /&gt;
* Actuation of pump for water exchange&lt;br /&gt;
&lt;br /&gt;
Additionally, the main control application implements the following supporting features:&lt;br /&gt;
* HW-Tests&lt;br /&gt;
* Text-To-Speech interface&lt;br /&gt;
* Logging&lt;br /&gt;
* Command interface to receive instructions from outside of the application&lt;br /&gt;
* Storage of recorded data in SQL database&lt;br /&gt;
* File-based communication to web application&lt;br /&gt;
* [[Relay Board Control|Monitoring and repair of relay board state]]&lt;br /&gt;
* [[Device Scheduling]]&lt;br /&gt;
&lt;br /&gt;
The control application makes extensive use of the [https://abyz.me.uk/rpi/pigpio/ pigpio library].&lt;br /&gt;
&lt;br /&gt;
The [[architecture]] of the application uses various threads.&lt;br /&gt;
&lt;br /&gt;
The application is [[automatic start by using systemd]].&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
for the installation of the operating system on the Raspberry Pi, please follow the instructions of the [https://www.raspberrypi.com Raspberry Pi foundation].&lt;br /&gt;
Use the 64-bit version.&lt;br /&gt;
&lt;br /&gt;
=== Clone the repository, build and install the control SW ===&lt;br /&gt;
Create the folder with the usage rights:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo mkdir /usr/local/src/aquarium-ctrl&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo chown pi /usrlocal/src/aquarium-ctrl&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;cd /usr/local/src/aquarium-ctrl&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next, clone the repository:&lt;br /&gt;
&amp;lt;code&amp;gt;git clone https://in-dubio@bitbucket.org/in-dubio/aquarium-ctrl.git&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Install the required libraries:&lt;br /&gt;
&amp;lt;code&amp;gt;bash libinstall.sh&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Enable I2C on Raspberry Pi ===&lt;br /&gt;
See [https://www.mathworks.com/help/supportpkg/raspberrypiio/ref/enablei2c.html detailed instructions how to use rasp-config].&lt;br /&gt;
&lt;br /&gt;
=== Create a file for the message queue ===&lt;br /&gt;
The file is automatically created when running &amp;lt;code&amp;gt;make install&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Alternatively, run the command &amp;lt;code&amp;gt;sudo touch /var/local/aquarium-ctrl.mq&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The file is defined in the source file &amp;lt;code&amp;gt;UsrIntrfc/MsgQu.h&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Create a ramdisk ===&lt;br /&gt;
Create the folder &amp;lt;code&amp;gt;/mnt/ramdisk&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Add the following line to &amp;lt;code&amp;gt;/etc/fstab&amp;lt;/code&amp;gt;: &amp;lt;code&amp;gt;tmpfs /mnt/ramdisk tmpfs nodev,nosuid,size=50M 0 0&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Add a symbolic link using the command &amp;lt;code&amp;gt;ln -s /mnt/ramdisk /var/local/aquarium-ctrl&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Automatic start of control application ===&lt;br /&gt;
[[Automatic_start_by_using_systemd|Follow instructions for configuring automatic start of control application.]]&lt;br /&gt;
&lt;br /&gt;
=== Create the website ===&lt;br /&gt;
In the folder &amp;lt;code&amp;gt;/var/www/html&amp;lt;/code&amp;gt;, create the website using &amp;lt;code&amp;gt;git clone https://in-dubio@bitbucket.org/in-dubio/aquarium-web.git&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Change the owner of the website to user &amp;lt;code&amp;gt;pi&amp;lt;/code&amp;gt; and change the group of the website to &amp;lt;code&amp;gt;www-data&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Create a symbolic link to the log file running &amp;lt;code&amp;gt;ln -s /var/log/aquarium-ctrl-session.log /var/www/html/aquarium-web/logfile.txt&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Create the file &amp;lt;code&amp;gt;/var/www/app.ini&amp;lt;/code&amp;gt; with the following content (set the correct password):&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[database]&lt;br /&gt;
&lt;br /&gt;
server = localhost&lt;br /&gt;
&lt;br /&gt;
port = 3306&lt;br /&gt;
&lt;br /&gt;
user = aquarium&lt;br /&gt;
&lt;br /&gt;
password = YourPassword&lt;br /&gt;
&lt;br /&gt;
database = aquarium&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Download and install the node JavaScript libraries.]]&lt;br /&gt;
&lt;br /&gt;
=== Setup of database ===&lt;br /&gt;
* [https://www.digitalocean.com/community/tutorials/how-to-import-and-export-databases-in-mysql-or-mariadb Import a database.]&lt;br /&gt;
* Create the user &amp;lt;code&amp;gt;aquarium&amp;lt;/code&amp;gt; and assign access rights to the &amp;lt;code&amp;gt;aquarium&amp;lt;/code&amp;gt; database.&lt;br /&gt;
* Check the user rights using [https://www.phpmyadmin.net phpmyadmin]&lt;/div&gt;</summary>
		<author><name>Uwe</name></author>
	</entry>
	<entry>
		<id>http://laimburggasse.onthewifi.com/mediawiki/index.php?title=Control_application&amp;diff=158</id>
		<title>Control application</title>
		<link rel="alternate" type="text/html" href="http://laimburggasse.onthewifi.com/mediawiki/index.php?title=Control_application&amp;diff=158"/>
		<updated>2023-04-08T17:37:37Z</updated>

		<summary type="html">&lt;p&gt;Uwe: /* Setup of database */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The main control application of Aquarium control implements the following features:&lt;br /&gt;
&lt;br /&gt;
* [[Data acquisition of water temperature, pH and conductivity]]&lt;br /&gt;
* [[Data acquisition of ambient temperature and humidity]]&lt;br /&gt;
* Fresh water refill control&lt;br /&gt;
* Feed control&lt;br /&gt;
* Water temperature control using air ventilation and heater&lt;br /&gt;
* [[Calculation of refill tank content]] based on [[water level measurement]] &lt;br /&gt;
* Actuation of pump for water exchange&lt;br /&gt;
&lt;br /&gt;
Additionally, the main control application implements the following supporting features:&lt;br /&gt;
* HW-Tests&lt;br /&gt;
* Text-To-Speech interface&lt;br /&gt;
* Logging&lt;br /&gt;
* Command interface to receive instructions from outside of the application&lt;br /&gt;
* Storage of recorded data in SQL database&lt;br /&gt;
* File-based communication to web application&lt;br /&gt;
* [[Relay Board Control|Monitoring and repair of relay board state]]&lt;br /&gt;
* [[Device Scheduling]]&lt;br /&gt;
&lt;br /&gt;
The control application makes extensive use of the [https://abyz.me.uk/rpi/pigpio/ pigpio library].&lt;br /&gt;
&lt;br /&gt;
The [[architecture]] of the application uses various threads.&lt;br /&gt;
&lt;br /&gt;
The application is [[automatic start by using systemd]].&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
for the installation of the operating system on the Raspberry Pi, please follow the instructions of the [https://www.raspberrypi.com Raspberry Pi foundation].&lt;br /&gt;
Use the 64-bit version.&lt;br /&gt;
&lt;br /&gt;
=== Clone the repository, build and install the control SW ===&lt;br /&gt;
Create the folder with the usage rights:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo mkdir /usr/local/src/aquarium-ctrl&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo chown pi /usrlocal/src/aquarium-ctrl&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;cd /usr/local/src/aquarium-ctrl&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next, clone the repository:&lt;br /&gt;
&amp;lt;code&amp;gt;git clone https://in-dubio@bitbucket.org/in-dubio/aquarium-ctrl.git&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Install the required libraries:&lt;br /&gt;
&amp;lt;code&amp;gt;bash libinstall.sh&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Enable I2C on Raspberry Pi ===&lt;br /&gt;
See [https://www.mathworks.com/help/supportpkg/raspberrypiio/ref/enablei2c.html detailed instructions how to use rasp-config].&lt;br /&gt;
&lt;br /&gt;
=== Create a file for the message queue ===&lt;br /&gt;
The file is automatically created when running &amp;lt;code&amp;gt;make install&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Alternatively, run the command &amp;lt;code&amp;gt;sudo touch /var/local/aquarium-ctrl.mq&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The file is defined in the source file &amp;lt;code&amp;gt;UsrIntrfc/MsgQu.h&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Create a ramdisk ===&lt;br /&gt;
Create the folder &amp;lt;code&amp;gt;/mnt/ramdisk&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Add the following line to &amp;lt;code&amp;gt;/etc/fstab&amp;lt;/code&amp;gt;: &amp;lt;code&amp;gt;tmpfs /mnt/ramdisk tmpfs nodev,nosuid,size=50M 0 0&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Add a symbolic link using the command &amp;lt;code&amp;gt;ln -s /mnt/ramdisk /var/local/aquarium-ctrl&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Automatic start of control application ===&lt;br /&gt;
[[Automatic_start_by_using_systemd|Follow instructions for configuring automatic start of control application.]]&lt;br /&gt;
&lt;br /&gt;
=== Create the website ===&lt;br /&gt;
In the folder &amp;lt;code&amp;gt;/var/www/html&amp;lt;/code&amp;gt;, create the website using &amp;lt;code&amp;gt;git clone https://in-dubio@bitbucket.org/in-dubio/aquarium-web.git&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Change the owner of the website to user &amp;lt;code&amp;gt;pi&amp;lt;/code&amp;gt; and change the group of the website to &amp;lt;code&amp;gt;www-data&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Create a symbolic link to the log file running &amp;lt;code&amp;gt;ln -s /var/log/aquarium-ctrl-session.log /var/www/html/aquarium-web/logfile.txt&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Create the file &amp;lt;code&amp;gt;/var/www/app.ini&amp;lt;/code&amp;gt; with the following content (set the correct password):&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[database]&lt;br /&gt;
&lt;br /&gt;
server = localhost&lt;br /&gt;
&lt;br /&gt;
port = 3306&lt;br /&gt;
&lt;br /&gt;
user = aquarium&lt;br /&gt;
&lt;br /&gt;
password = YourPassword&lt;br /&gt;
&lt;br /&gt;
database = aquarium&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Download and install the node JavaScript libraries.]]&lt;br /&gt;
&lt;br /&gt;
=== Setup of database ===&lt;br /&gt;
* Import a database.&lt;br /&gt;
* Create the user &amp;lt;code&amp;gt;aquarium&amp;lt;/code&amp;gt; and assign access rights to the &amp;lt;code&amp;gt;aquarium&amp;lt;/code&amp;gt; database.&lt;br /&gt;
* Check the user rights using [https://www.phpmyadmin.net phpmyadmin]&lt;/div&gt;</summary>
		<author><name>Uwe</name></author>
	</entry>
	<entry>
		<id>http://laimburggasse.onthewifi.com/mediawiki/index.php?title=Control_application&amp;diff=157</id>
		<title>Control application</title>
		<link rel="alternate" type="text/html" href="http://laimburggasse.onthewifi.com/mediawiki/index.php?title=Control_application&amp;diff=157"/>
		<updated>2023-04-08T17:32:11Z</updated>

		<summary type="html">&lt;p&gt;Uwe: /* Installation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The main control application of Aquarium control implements the following features:&lt;br /&gt;
&lt;br /&gt;
* [[Data acquisition of water temperature, pH and conductivity]]&lt;br /&gt;
* [[Data acquisition of ambient temperature and humidity]]&lt;br /&gt;
* Fresh water refill control&lt;br /&gt;
* Feed control&lt;br /&gt;
* Water temperature control using air ventilation and heater&lt;br /&gt;
* [[Calculation of refill tank content]] based on [[water level measurement]] &lt;br /&gt;
* Actuation of pump for water exchange&lt;br /&gt;
&lt;br /&gt;
Additionally, the main control application implements the following supporting features:&lt;br /&gt;
* HW-Tests&lt;br /&gt;
* Text-To-Speech interface&lt;br /&gt;
* Logging&lt;br /&gt;
* Command interface to receive instructions from outside of the application&lt;br /&gt;
* Storage of recorded data in SQL database&lt;br /&gt;
* File-based communication to web application&lt;br /&gt;
* [[Relay Board Control|Monitoring and repair of relay board state]]&lt;br /&gt;
* [[Device Scheduling]]&lt;br /&gt;
&lt;br /&gt;
The control application makes extensive use of the [https://abyz.me.uk/rpi/pigpio/ pigpio library].&lt;br /&gt;
&lt;br /&gt;
The [[architecture]] of the application uses various threads.&lt;br /&gt;
&lt;br /&gt;
The application is [[automatic start by using systemd]].&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
for the installation of the operating system on the Raspberry Pi, please follow the instructions of the [https://www.raspberrypi.com Raspberry Pi foundation].&lt;br /&gt;
Use the 64-bit version.&lt;br /&gt;
&lt;br /&gt;
=== Clone the repository, build and install the control SW ===&lt;br /&gt;
Create the folder with the usage rights:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo mkdir /usr/local/src/aquarium-ctrl&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo chown pi /usrlocal/src/aquarium-ctrl&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;cd /usr/local/src/aquarium-ctrl&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next, clone the repository:&lt;br /&gt;
&amp;lt;code&amp;gt;git clone https://in-dubio@bitbucket.org/in-dubio/aquarium-ctrl.git&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Install the required libraries:&lt;br /&gt;
&amp;lt;code&amp;gt;bash libinstall.sh&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Enable I2C on Raspberry Pi ===&lt;br /&gt;
See [https://www.mathworks.com/help/supportpkg/raspberrypiio/ref/enablei2c.html detailed instructions how to use rasp-config].&lt;br /&gt;
&lt;br /&gt;
=== Create a file for the message queue ===&lt;br /&gt;
The file is automatically created when running &amp;lt;code&amp;gt;make install&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Alternatively, run the command &amp;lt;code&amp;gt;sudo touch /var/local/aquarium-ctrl.mq&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The file is defined in the source file &amp;lt;code&amp;gt;UsrIntrfc/MsgQu.h&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Create a ramdisk ===&lt;br /&gt;
Create the folder &amp;lt;code&amp;gt;/mnt/ramdisk&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Add the following line to &amp;lt;code&amp;gt;/etc/fstab&amp;lt;/code&amp;gt;: &amp;lt;code&amp;gt;tmpfs /mnt/ramdisk tmpfs nodev,nosuid,size=50M 0 0&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Add a symbolic link using the command &amp;lt;code&amp;gt;ln -s /mnt/ramdisk /var/local/aquarium-ctrl&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Automatic start of control application ===&lt;br /&gt;
[[Automatic_start_by_using_systemd|Follow instructions for configuring automatic start of control application.]]&lt;br /&gt;
&lt;br /&gt;
=== Create the website ===&lt;br /&gt;
In the folder &amp;lt;code&amp;gt;/var/www/html&amp;lt;/code&amp;gt;, create the website using &amp;lt;code&amp;gt;git clone https://in-dubio@bitbucket.org/in-dubio/aquarium-web.git&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Change the owner of the website to user &amp;lt;code&amp;gt;pi&amp;lt;/code&amp;gt; and change the group of the website to &amp;lt;code&amp;gt;www-data&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Create a symbolic link to the log file running &amp;lt;code&amp;gt;ln -s /var/log/aquarium-ctrl-session.log /var/www/html/aquarium-web/logfile.txt&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Create the file &amp;lt;code&amp;gt;/var/www/app.ini&amp;lt;/code&amp;gt; with the following content (set the correct password):&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[database]&lt;br /&gt;
&lt;br /&gt;
server = localhost&lt;br /&gt;
&lt;br /&gt;
port = 3306&lt;br /&gt;
&lt;br /&gt;
user = aquarium&lt;br /&gt;
&lt;br /&gt;
password = YourPassword&lt;br /&gt;
&lt;br /&gt;
database = aquarium&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Download and install the node JavaScript libraries.]]&lt;br /&gt;
&lt;br /&gt;
=== Setup of database ===&lt;br /&gt;
* Import an empty database.&lt;br /&gt;
* Create the user &amp;lt;code&amp;gt;aquarium&amp;lt;/code&amp;gt; and assign access rights to the &amp;lt;code&amp;gt;aquarium&amp;lt;/code&amp;gt; database.&lt;/div&gt;</summary>
		<author><name>Uwe</name></author>
	</entry>
	<entry>
		<id>http://laimburggasse.onthewifi.com/mediawiki/index.php?title=Control_application&amp;diff=156</id>
		<title>Control application</title>
		<link rel="alternate" type="text/html" href="http://laimburggasse.onthewifi.com/mediawiki/index.php?title=Control_application&amp;diff=156"/>
		<updated>2023-04-08T17:31:31Z</updated>

		<summary type="html">&lt;p&gt;Uwe: /* Clone the repository, build and install the control SW */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The main control application of Aquarium control implements the following features:&lt;br /&gt;
&lt;br /&gt;
* [[Data acquisition of water temperature, pH and conductivity]]&lt;br /&gt;
* [[Data acquisition of ambient temperature and humidity]]&lt;br /&gt;
* Fresh water refill control&lt;br /&gt;
* Feed control&lt;br /&gt;
* Water temperature control using air ventilation and heater&lt;br /&gt;
* [[Calculation of refill tank content]] based on [[water level measurement]] &lt;br /&gt;
* Actuation of pump for water exchange&lt;br /&gt;
&lt;br /&gt;
Additionally, the main control application implements the following supporting features:&lt;br /&gt;
* HW-Tests&lt;br /&gt;
* Text-To-Speech interface&lt;br /&gt;
* Logging&lt;br /&gt;
* Command interface to receive instructions from outside of the application&lt;br /&gt;
* Storage of recorded data in SQL database&lt;br /&gt;
* File-based communication to web application&lt;br /&gt;
* [[Relay Board Control|Monitoring and repair of relay board state]]&lt;br /&gt;
* [[Device Scheduling]]&lt;br /&gt;
&lt;br /&gt;
The control application makes extensive use of the [https://abyz.me.uk/rpi/pigpio/ pigpio library].&lt;br /&gt;
&lt;br /&gt;
The [[architecture]] of the application uses various threads.&lt;br /&gt;
&lt;br /&gt;
The application is [[automatic start by using systemd]].&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
for the installation of the operating system on the Raspberry Pi, please follow the instructions of the [https://www.raspberrypi.com Raspberry Pi foundation].&lt;br /&gt;
&lt;br /&gt;
=== Clone the repository, build and install the control SW ===&lt;br /&gt;
Create the folder with the usage rights:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo mkdir /usr/local/src/aquarium-ctrl&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo chown pi /usrlocal/src/aquarium-ctrl&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;cd /usr/local/src/aquarium-ctrl&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next, clone the repository:&lt;br /&gt;
&amp;lt;code&amp;gt;git clone https://in-dubio@bitbucket.org/in-dubio/aquarium-ctrl.git&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Install the required libraries:&lt;br /&gt;
&amp;lt;code&amp;gt;bash libinstall.sh&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Enable I2C on Raspberry Pi ===&lt;br /&gt;
See [https://www.mathworks.com/help/supportpkg/raspberrypiio/ref/enablei2c.html detailed instructions how to use rasp-config].&lt;br /&gt;
&lt;br /&gt;
=== Create a file for the message queue ===&lt;br /&gt;
The file is automatically created when running &amp;lt;code&amp;gt;make install&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Alternatively, run the command &amp;lt;code&amp;gt;sudo touch /var/local/aquarium-ctrl.mq&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The file is defined in the source file &amp;lt;code&amp;gt;UsrIntrfc/MsgQu.h&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Create a ramdisk ===&lt;br /&gt;
Create the folder &amp;lt;code&amp;gt;/mnt/ramdisk&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Add the following line to &amp;lt;code&amp;gt;/etc/fstab&amp;lt;/code&amp;gt;: &amp;lt;code&amp;gt;tmpfs /mnt/ramdisk tmpfs nodev,nosuid,size=50M 0 0&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Add a symbolic link using the command &amp;lt;code&amp;gt;ln -s /mnt/ramdisk /var/local/aquarium-ctrl&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Automatic start of control application ===&lt;br /&gt;
[[Automatic_start_by_using_systemd|Follow instructions for configuring automatic start of control application.]]&lt;br /&gt;
&lt;br /&gt;
=== Create the website ===&lt;br /&gt;
In the folder &amp;lt;code&amp;gt;/var/www/html&amp;lt;/code&amp;gt;, create the website using &amp;lt;code&amp;gt;git clone https://in-dubio@bitbucket.org/in-dubio/aquarium-web.git&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Change the owner of the website to user &amp;lt;code&amp;gt;pi&amp;lt;/code&amp;gt; and change the group of the website to &amp;lt;code&amp;gt;www-data&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Create a symbolic link to the log file running &amp;lt;code&amp;gt;ln -s /var/log/aquarium-ctrl-session.log /var/www/html/aquarium-web/logfile.txt&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Create the file &amp;lt;code&amp;gt;/var/www/app.ini&amp;lt;/code&amp;gt; with the following content (set the correct password):&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[database]&lt;br /&gt;
&lt;br /&gt;
server = localhost&lt;br /&gt;
&lt;br /&gt;
port = 3306&lt;br /&gt;
&lt;br /&gt;
user = aquarium&lt;br /&gt;
&lt;br /&gt;
password = YourPassword&lt;br /&gt;
&lt;br /&gt;
database = aquarium&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Download and install the node JavaScript libraries.]]&lt;br /&gt;
&lt;br /&gt;
=== Setup of database ===&lt;br /&gt;
* Import an empty database.&lt;br /&gt;
* Create the user &amp;lt;code&amp;gt;aquarium&amp;lt;/code&amp;gt; and assign access rights to the &amp;lt;code&amp;gt;aquarium&amp;lt;/code&amp;gt; database.&lt;/div&gt;</summary>
		<author><name>Uwe</name></author>
	</entry>
	<entry>
		<id>http://laimburggasse.onthewifi.com/mediawiki/index.php?title=Control_application&amp;diff=155</id>
		<title>Control application</title>
		<link rel="alternate" type="text/html" href="http://laimburggasse.onthewifi.com/mediawiki/index.php?title=Control_application&amp;diff=155"/>
		<updated>2023-04-08T17:31:05Z</updated>

		<summary type="html">&lt;p&gt;Uwe: /* Clone the repository, build and install the control SW */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The main control application of Aquarium control implements the following features:&lt;br /&gt;
&lt;br /&gt;
* [[Data acquisition of water temperature, pH and conductivity]]&lt;br /&gt;
* [[Data acquisition of ambient temperature and humidity]]&lt;br /&gt;
* Fresh water refill control&lt;br /&gt;
* Feed control&lt;br /&gt;
* Water temperature control using air ventilation and heater&lt;br /&gt;
* [[Calculation of refill tank content]] based on [[water level measurement]] &lt;br /&gt;
* Actuation of pump for water exchange&lt;br /&gt;
&lt;br /&gt;
Additionally, the main control application implements the following supporting features:&lt;br /&gt;
* HW-Tests&lt;br /&gt;
* Text-To-Speech interface&lt;br /&gt;
* Logging&lt;br /&gt;
* Command interface to receive instructions from outside of the application&lt;br /&gt;
* Storage of recorded data in SQL database&lt;br /&gt;
* File-based communication to web application&lt;br /&gt;
* [[Relay Board Control|Monitoring and repair of relay board state]]&lt;br /&gt;
* [[Device Scheduling]]&lt;br /&gt;
&lt;br /&gt;
The control application makes extensive use of the [https://abyz.me.uk/rpi/pigpio/ pigpio library].&lt;br /&gt;
&lt;br /&gt;
The [[architecture]] of the application uses various threads.&lt;br /&gt;
&lt;br /&gt;
The application is [[automatic start by using systemd]].&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
for the installation of the operating system on the Raspberry Pi, please follow the instructions of the [https://www.raspberrypi.com Raspberry Pi foundation].&lt;br /&gt;
&lt;br /&gt;
=== Clone the repository, build and install the control SW ===&lt;br /&gt;
Create the folder with the usage rights:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo mkdir /usr/local/src/aquarium-ctrl&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo chown pi /usrlocal/src/aquarium-ctrl/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;cd /usr/local/src/aquarium-ctrl&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next, clone the repository:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;git clone https://in-dubio@bitbucket.org/in-dubio/aquarium-ctrl.git&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Install the required libraries:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;bash libinstall.sh&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Enable I2C on Raspberry Pi ===&lt;br /&gt;
See [https://www.mathworks.com/help/supportpkg/raspberrypiio/ref/enablei2c.html detailed instructions how to use rasp-config].&lt;br /&gt;
&lt;br /&gt;
=== Create a file for the message queue ===&lt;br /&gt;
The file is automatically created when running &amp;lt;code&amp;gt;make install&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Alternatively, run the command &amp;lt;code&amp;gt;sudo touch /var/local/aquarium-ctrl.mq&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The file is defined in the source file &amp;lt;code&amp;gt;UsrIntrfc/MsgQu.h&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Create a ramdisk ===&lt;br /&gt;
Create the folder &amp;lt;code&amp;gt;/mnt/ramdisk&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Add the following line to &amp;lt;code&amp;gt;/etc/fstab&amp;lt;/code&amp;gt;: &amp;lt;code&amp;gt;tmpfs /mnt/ramdisk tmpfs nodev,nosuid,size=50M 0 0&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Add a symbolic link using the command &amp;lt;code&amp;gt;ln -s /mnt/ramdisk /var/local/aquarium-ctrl&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Automatic start of control application ===&lt;br /&gt;
[[Automatic_start_by_using_systemd|Follow instructions for configuring automatic start of control application.]]&lt;br /&gt;
&lt;br /&gt;
=== Create the website ===&lt;br /&gt;
In the folder &amp;lt;code&amp;gt;/var/www/html&amp;lt;/code&amp;gt;, create the website using &amp;lt;code&amp;gt;git clone https://in-dubio@bitbucket.org/in-dubio/aquarium-web.git&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Change the owner of the website to user &amp;lt;code&amp;gt;pi&amp;lt;/code&amp;gt; and change the group of the website to &amp;lt;code&amp;gt;www-data&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Create a symbolic link to the log file running &amp;lt;code&amp;gt;ln -s /var/log/aquarium-ctrl-session.log /var/www/html/aquarium-web/logfile.txt&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Create the file &amp;lt;code&amp;gt;/var/www/app.ini&amp;lt;/code&amp;gt; with the following content (set the correct password):&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[database]&lt;br /&gt;
&lt;br /&gt;
server = localhost&lt;br /&gt;
&lt;br /&gt;
port = 3306&lt;br /&gt;
&lt;br /&gt;
user = aquarium&lt;br /&gt;
&lt;br /&gt;
password = YourPassword&lt;br /&gt;
&lt;br /&gt;
database = aquarium&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Download and install the node JavaScript libraries.]]&lt;br /&gt;
&lt;br /&gt;
=== Setup of database ===&lt;br /&gt;
* Import an empty database.&lt;br /&gt;
* Create the user &amp;lt;code&amp;gt;aquarium&amp;lt;/code&amp;gt; and assign access rights to the &amp;lt;code&amp;gt;aquarium&amp;lt;/code&amp;gt; database.&lt;/div&gt;</summary>
		<author><name>Uwe</name></author>
	</entry>
	<entry>
		<id>http://laimburggasse.onthewifi.com/mediawiki/index.php?title=Control_application&amp;diff=154</id>
		<title>Control application</title>
		<link rel="alternate" type="text/html" href="http://laimburggasse.onthewifi.com/mediawiki/index.php?title=Control_application&amp;diff=154"/>
		<updated>2023-04-08T17:30:40Z</updated>

		<summary type="html">&lt;p&gt;Uwe: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The main control application of Aquarium control implements the following features:&lt;br /&gt;
&lt;br /&gt;
* [[Data acquisition of water temperature, pH and conductivity]]&lt;br /&gt;
* [[Data acquisition of ambient temperature and humidity]]&lt;br /&gt;
* Fresh water refill control&lt;br /&gt;
* Feed control&lt;br /&gt;
* Water temperature control using air ventilation and heater&lt;br /&gt;
* [[Calculation of refill tank content]] based on [[water level measurement]] &lt;br /&gt;
* Actuation of pump for water exchange&lt;br /&gt;
&lt;br /&gt;
Additionally, the main control application implements the following supporting features:&lt;br /&gt;
* HW-Tests&lt;br /&gt;
* Text-To-Speech interface&lt;br /&gt;
* Logging&lt;br /&gt;
* Command interface to receive instructions from outside of the application&lt;br /&gt;
* Storage of recorded data in SQL database&lt;br /&gt;
* File-based communication to web application&lt;br /&gt;
* [[Relay Board Control|Monitoring and repair of relay board state]]&lt;br /&gt;
* [[Device Scheduling]]&lt;br /&gt;
&lt;br /&gt;
The control application makes extensive use of the [https://abyz.me.uk/rpi/pigpio/ pigpio library].&lt;br /&gt;
&lt;br /&gt;
The [[architecture]] of the application uses various threads.&lt;br /&gt;
&lt;br /&gt;
The application is [[automatic start by using systemd]].&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
for the installation of the operating system on the Raspberry Pi, please follow the instructions of the [https://www.raspberrypi.com Raspberry Pi foundation].&lt;br /&gt;
&lt;br /&gt;
=== Clone the repository, build and install the control SW ===&lt;br /&gt;
Create the folder with the usage rights:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo mkdir /usr/local/src/aquarium-ctrl&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo chown pi /usrlocal/src/aquarium-ctrl/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;cd /usr/local/src/aquarium-ctrl&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next, clone the repository:&lt;br /&gt;
&amp;lt;code&amp;gt;git clone https://in-dubio@bitbucket.org/in-dubio/aquarium-ctrl.git&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Install the required libraries:&lt;br /&gt;
&amp;lt;code&amp;gt;bash libinstall.sh&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Enable I2C on Raspberry Pi ===&lt;br /&gt;
See [https://www.mathworks.com/help/supportpkg/raspberrypiio/ref/enablei2c.html detailed instructions how to use rasp-config].&lt;br /&gt;
&lt;br /&gt;
=== Create a file for the message queue ===&lt;br /&gt;
The file is automatically created when running &amp;lt;code&amp;gt;make install&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Alternatively, run the command &amp;lt;code&amp;gt;sudo touch /var/local/aquarium-ctrl.mq&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The file is defined in the source file &amp;lt;code&amp;gt;UsrIntrfc/MsgQu.h&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Create a ramdisk ===&lt;br /&gt;
Create the folder &amp;lt;code&amp;gt;/mnt/ramdisk&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Add the following line to &amp;lt;code&amp;gt;/etc/fstab&amp;lt;/code&amp;gt;: &amp;lt;code&amp;gt;tmpfs /mnt/ramdisk tmpfs nodev,nosuid,size=50M 0 0&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Add a symbolic link using the command &amp;lt;code&amp;gt;ln -s /mnt/ramdisk /var/local/aquarium-ctrl&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Automatic start of control application ===&lt;br /&gt;
[[Automatic_start_by_using_systemd|Follow instructions for configuring automatic start of control application.]]&lt;br /&gt;
&lt;br /&gt;
=== Create the website ===&lt;br /&gt;
In the folder &amp;lt;code&amp;gt;/var/www/html&amp;lt;/code&amp;gt;, create the website using &amp;lt;code&amp;gt;git clone https://in-dubio@bitbucket.org/in-dubio/aquarium-web.git&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Change the owner of the website to user &amp;lt;code&amp;gt;pi&amp;lt;/code&amp;gt; and change the group of the website to &amp;lt;code&amp;gt;www-data&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Create a symbolic link to the log file running &amp;lt;code&amp;gt;ln -s /var/log/aquarium-ctrl-session.log /var/www/html/aquarium-web/logfile.txt&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Create the file &amp;lt;code&amp;gt;/var/www/app.ini&amp;lt;/code&amp;gt; with the following content (set the correct password):&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[database]&lt;br /&gt;
&lt;br /&gt;
server = localhost&lt;br /&gt;
&lt;br /&gt;
port = 3306&lt;br /&gt;
&lt;br /&gt;
user = aquarium&lt;br /&gt;
&lt;br /&gt;
password = YourPassword&lt;br /&gt;
&lt;br /&gt;
database = aquarium&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Download and install the node JavaScript libraries.]]&lt;br /&gt;
&lt;br /&gt;
=== Setup of database ===&lt;br /&gt;
* Import an empty database.&lt;br /&gt;
* Create the user &amp;lt;code&amp;gt;aquarium&amp;lt;/code&amp;gt; and assign access rights to the &amp;lt;code&amp;gt;aquarium&amp;lt;/code&amp;gt; database.&lt;/div&gt;</summary>
		<author><name>Uwe</name></author>
	</entry>
	<entry>
		<id>http://laimburggasse.onthewifi.com/mediawiki/index.php?title=Automatic_start_by_using_systemd&amp;diff=153</id>
		<title>Automatic start by using systemd</title>
		<link rel="alternate" type="text/html" href="http://laimburggasse.onthewifi.com/mediawiki/index.php?title=Automatic_start_by_using_systemd&amp;diff=153"/>
		<updated>2023-04-08T13:57:36Z</updated>

		<summary type="html">&lt;p&gt;Uwe: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The content of systemd unit file /lib/systemd/system/aquarium-ctrl.service as following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
[Unit]&lt;br /&gt;
&lt;br /&gt;
Description=Aquarium Control Application&lt;br /&gt;
&lt;br /&gt;
After=multi-user.target&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[Service]&lt;br /&gt;
&lt;br /&gt;
Type=forking&lt;br /&gt;
&lt;br /&gt;
ExecStart=bash /usr/local/bin/aquarium-ctrl-startup&lt;br /&gt;
&lt;br /&gt;
[Install]&lt;br /&gt;
&lt;br /&gt;
WantedBy=multi-user.target&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Upon creation/modification of the unit file, one must run the command &amp;lt;code&amp;gt;sudo systemctl daemon-reload&amp;lt;/code&amp;gt; in order to activate the changes.&lt;br /&gt;
&lt;br /&gt;
Then, also the command &amp;lt;code&amp;gt;sudo systemctl enable aquarium-ctrl.service&amp;lt;/code&amp;gt; is required to enable the service.&lt;br /&gt;
&lt;br /&gt;
For starting the control application manually via systemd, one can use the command &amp;lt;code&amp;gt;sudo systemctl start aquarium-ctrl.service&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
When running the application in a configuration that utilises the relay board, the startup script needs to start the &amp;lt;code&amp;gt;screen&amp;lt;code&amp;gt; application prior to the control application in order to set the baud rate of the relay boards:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
screen -dm /dev/ttyUSB0 19200&lt;br /&gt;
&lt;br /&gt;
screen -dm /dev/ttyUSB1 19200&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/aquarium-ctrl -f On -r On -u Off -d On -s On -g On -t Off -b On &amp;gt; /dev/null&amp;amp;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;/div&gt;</summary>
		<author><name>Uwe</name></author>
	</entry>
	<entry>
		<id>http://laimburggasse.onthewifi.com/mediawiki/index.php?title=Automatic_start_by_using_systemd&amp;diff=152</id>
		<title>Automatic start by using systemd</title>
		<link rel="alternate" type="text/html" href="http://laimburggasse.onthewifi.com/mediawiki/index.php?title=Automatic_start_by_using_systemd&amp;diff=152"/>
		<updated>2023-04-08T13:44:13Z</updated>

		<summary type="html">&lt;p&gt;Uwe: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The content of systemd unit file /lib/systemd/system/aquarium-ctrl.service as following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
[Unit]&lt;br /&gt;
&lt;br /&gt;
Description=Aquarium Control Application&lt;br /&gt;
&lt;br /&gt;
After=multi-user.target&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[Service]&lt;br /&gt;
&lt;br /&gt;
Type=forking&lt;br /&gt;
&lt;br /&gt;
ExecStart=bash /usr/local/bin/aquarium-ctrl-startup&lt;br /&gt;
&lt;br /&gt;
[Install]&lt;br /&gt;
&lt;br /&gt;
WantedBy=multi-user.target&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Upon creation/modification of the unit file, one must run the command &amp;lt;code&amp;gt;sudo systemctl daemon-reload&amp;lt;/code&amp;gt; in order to activate the changes.&lt;br /&gt;
&lt;br /&gt;
For starting the control application manually via systemd, one can use the command &amp;lt;code&amp;gt;sudo systemctl start aquarium-ctrl.service&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
When running the application in a configuration that utilises the relay board, the startup script needs to start the &amp;lt;code&amp;gt;screen&amp;lt;code&amp;gt; application prior to the control application in order to set the baud rate of the relay boards:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
screen -dm /dev/ttyUSB0 19200&lt;br /&gt;
&lt;br /&gt;
screen -dm /dev/ttyUSB1 19200&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/aquarium-ctrl -f On -r On -u Off -d On -s On -g On -t Off -b On &amp;gt; /dev/null&amp;amp;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;/div&gt;</summary>
		<author><name>Uwe</name></author>
	</entry>
	<entry>
		<id>http://laimburggasse.onthewifi.com/mediawiki/index.php?title=Device_Scheduling&amp;diff=151</id>
		<title>Device Scheduling</title>
		<link rel="alternate" type="text/html" href="http://laimburggasse.onthewifi.com/mediawiki/index.php?title=Device_Scheduling&amp;diff=151"/>
		<updated>2023-04-02T10:41:33Z</updated>

		<summary type="html">&lt;p&gt;Uwe: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The following components actuate the relays:&lt;br /&gt;
* Refill Control: refilling of fresh water depending on water level&lt;br /&gt;
* Feeder Control: stopping flow pumps, skimmer and actuating the feeder&lt;br /&gt;
* Water Exchange Control: actuating the external pump for water exchange&lt;br /&gt;
* Balling Control: actuating the pumps for mineral dosing&lt;br /&gt;
&lt;br /&gt;
There are two requirements, which ask for a more sophisticated control of the relays:&lt;br /&gt;
* The dosing of minerals needs to be as precise as possible.&lt;br /&gt;
* The hardware shall be tested before commencing certain operations.&lt;br /&gt;
* The communication with the board needs to be reinitialised or reopened after certain periods of time.&lt;br /&gt;
&lt;br /&gt;
== Avoiding conflicting access to the relays ==&lt;br /&gt;
This functionality is implemented in &amp;lt;code&amp;gt;DevSchdlr/DevSchdlr.c&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Mutual exclusion is implemented using a semaphore.&lt;br /&gt;
&lt;br /&gt;
The semaphore is used only by the function &amp;lt;code&amp;gt;DevSchdlr&amp;lt;/code&amp;gt;.&lt;br /&gt;
This function is the central gateway for all other components to initiate usage of the relays.&lt;br /&gt;
It shall give control of the hardware to a calling component so that the calling component can execute a sequence of commands which shall not be interrupted. &lt;br /&gt;
&lt;br /&gt;
The function uses three callbacks which are provided via argument and a label informing which component is using the relay board:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;DevSchdlr (int TestFuncRlyBrd(void), int TestFuncControllino(void), void ExecFunc(void), char *lbl)&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The first and second callback functions (&amp;lt;code&amp;gt;TestFunc&amp;lt;/code&amp;gt;) allow the calling component to determine specifically which tests needs to be carried out before the sequence can be initiated.&lt;br /&gt;
For example, the Balling dosing only needs to actuate the low voltage relays while the feeder control only actuates the high voltage relays.&lt;br /&gt;
&lt;br /&gt;
The test functions implement specific recovery strategy.&lt;br /&gt;
&lt;br /&gt;
The callback function (&amp;lt;code&amp;gt;ExecFunc&amp;lt;/code&amp;gt;) gives control to the calling component for execution of the sequence.&lt;br /&gt;
Execution is only triggered if one call of the test function returned with a successful result.&lt;/div&gt;</summary>
		<author><name>Uwe</name></author>
	</entry>
	<entry>
		<id>http://laimburggasse.onthewifi.com/mediawiki/index.php?title=Relay_Board_Control&amp;diff=150</id>
		<title>Relay Board Control</title>
		<link rel="alternate" type="text/html" href="http://laimburggasse.onthewifi.com/mediawiki/index.php?title=Relay_Board_Control&amp;diff=150"/>
		<updated>2023-04-02T10:37:01Z</updated>

		<summary type="html">&lt;p&gt;Uwe: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The relay board control implements the following features:&lt;br /&gt;
* Low level communication via serial port to the board&lt;br /&gt;
* Watchdog for reading/writing to serial port&lt;br /&gt;
* HW functionality test before executing commands&lt;br /&gt;
* Monitoring and repair of relay board states&lt;br /&gt;
* Avoiding conflicting access to relay board&lt;br /&gt;
&lt;br /&gt;
== Low level communication via serial port ==&lt;br /&gt;
This functionality is implemented in &amp;lt;code&amp;gt;RlyBrdCtrl/RlyBrdCmd.c&amp;lt;/code&amp;gt;.&lt;br /&gt;
The communication follows the protocol laid out in the [https://asset.conrad.com/media10/add/160267/c1/-/gl/000197720ML02/bedienungsanleitung-197720-conrad-components-197720-relaiskarte-baustein-12-vdc-24-vdc.pdf user manual of the 197730/197730 relay boards].&lt;br /&gt;
&lt;br /&gt;
Every command consists of a sequence of 4 byte.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ command sequence for 197730/197720 relay boards&lt;br /&gt;
|-&lt;br /&gt;
! Byte # !! Content&lt;br /&gt;
|-&lt;br /&gt;
| 0 || command&lt;br /&gt;
|-&lt;br /&gt;
| 1 || board address&lt;br /&gt;
|-&lt;br /&gt;
| 2 || data&lt;br /&gt;
|-&lt;br /&gt;
| 3 || checksum&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The command can assume one of 8 values, whereby the controller only uses a subset of these:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ commands used for control of 197730/197720 relay boards&lt;br /&gt;
|-&lt;br /&gt;
! command # !! Meaning !! byte 0 value in board response&lt;br /&gt;
|-&lt;br /&gt;
| 1 || initialisation || 254&lt;br /&gt;
|-&lt;br /&gt;
| 2 || get relay states || 253&lt;br /&gt;
|-&lt;br /&gt;
| 6 || switch on relay || 249&lt;br /&gt;
|-&lt;br /&gt;
| 7 || switch off relay || 248&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The relay boards offer functionality to connect multiple boards in a bus system.&lt;br /&gt;
Therefore, the commands have to specify an address to identify the board for which the command is issued.&lt;br /&gt;
The aquarium controller does not use this functionality. Low voltage board and high voltage board are connected via separate USB connections.&lt;br /&gt;
Hence, address is always set to one.&lt;br /&gt;
&lt;br /&gt;
The checksum is computed as XOR of byte 0, 1 and 2.&lt;br /&gt;
&lt;br /&gt;
The low level communication is done using one of two functions inside &amp;lt;code&amp;gt;RlyBrdCmd.c&amp;lt;/code&amp;gt;.&lt;br /&gt;
* &amp;lt;code&amp;gt;RlyBrdInitCom&amp;lt;/code&amp;gt; for initialisation of the communication&lt;br /&gt;
* &amp;lt;code&amp;gt;RlyBrdCmd&amp;lt;/code&amp;gt; for sending commands to the boards&lt;br /&gt;
&lt;br /&gt;
Both commands use the semaphore &amp;lt;code&amp;gt;mutexRlyBrd&amp;lt;/code&amp;gt; to guarantee exclusive access to the devices.&lt;br /&gt;
Both commands check the length of the response from the board and issue an error if the length is not as expected.&lt;br /&gt;
&lt;br /&gt;
During the initialisation, the board responds an 8 byte sequence which seems to correspond to the SW version. Information regarding this sequence could not be found inside the user manual.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ initialisation response for 197730/197720 relay boards&lt;br /&gt;
|-&lt;br /&gt;
! Byte #!! 0 !! 1 !! 2 !! 3 !! 4 !! 5 !! 6 !! 7&lt;br /&gt;
|-&lt;br /&gt;
| Value || 0xfe || 0x01 || 0x0b || 0xf4 || 0x01 || 0x02 || 0x0b || 0x08&lt;br /&gt;
|}&lt;br /&gt;
The command &amp;lt;code&amp;gt;RlyBrdInitCom&amp;lt;/code&amp;gt; checks if the relay board responds with this sequence.&lt;br /&gt;
&lt;br /&gt;
The command &amp;lt;code&amp;gt;RlyBrdCmd&amp;lt;/code&amp;gt; checks the checksum of the board's response.&lt;br /&gt;
Additionally, the function checks the response of the relay board.&lt;br /&gt;
The response of the relay board sporadically deviates from the response defined in the user manual.&lt;br /&gt;
Specified is a response which can be computed as &amp;lt;code&amp;gt;255 - command #&amp;lt;/code&amp;gt;.&lt;br /&gt;
After some time of operation the board changes to responding with &amp;lt;code&amp;gt; command #&amp;lt;/code&amp;gt;.&lt;br /&gt;
After some more time of operation, the board may change back to the specified response.&lt;br /&gt;
The control adapts to this toggling response behaviour.&lt;br /&gt;
Expected response is computed accordingly. Each byte of the board's response is checked.&lt;br /&gt;
&lt;br /&gt;
== Watchdog for reading/writing to serial port ==&lt;br /&gt;
This functionality is implemented in &amp;lt;code&amp;gt;RlyBrdCtrl/RlyBrdWtchDg.c&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
For communication with the relay boards, the application uses read and write instructions which may block the control flow at these points if the operation does not terminate.&lt;br /&gt;
&lt;br /&gt;
In order to detect such events, a separate thread &amp;lt;code&amp;gt;RlyBrdRdWrWtchDgThread&amp;lt;/code&amp;gt; monitors the duration of the read/write operations.&lt;br /&gt;
The flag monitors how long certain flags are &amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt;:&lt;br /&gt;
* &amp;lt;code&amp;gt;RBC_Get_flgRlyBrdRdStarting&amp;lt;/code&amp;gt; provides the flag for monitoring read operations.&lt;br /&gt;
* &amp;lt;code&amp;gt;RBC_Get_flgRlyBrdWrStarting&amp;lt;/code&amp;gt; provides the flag for monitoring write operations.&lt;br /&gt;
&lt;br /&gt;
The flags are set to &amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt; directly before the read/write operation and they are set to &amp;lt;code&amp;gt;false&amp;lt;/code&amp;gt; directly after the operation.&lt;br /&gt;
&lt;br /&gt;
The watch dog thread increases a counter for each second the read/write operation takes. When the counter exceeds the threshold &amp;lt;/code&amp;gt;RLYBRD_RD_WR_WTCHDG_MAX_T&amp;lt;/code&amp;gt;, the thread issues a log file entry, forces flushing of file buffers via &amp;lt;code&amp;gt;sync();&amp;lt;/code&amp;gt; and initiates a reboot of the device using &amp;lt;code&amp;gt;reboot(RB_AUTOBOOT);&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== HW functionality test ==&lt;br /&gt;
This functionality is implemented in &amp;lt;code&amp;gt;RlyBrdCtrl/RlyBrdFdbck.c&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The control system connects a voltage input through one relay of each board to a GPIO pin of the Raspberry Pi.&lt;br /&gt;
&lt;br /&gt;
By measuring the GPIO pin state, the control system can determine if the opening/closing of the relay really happened instead of just relying on the feedback of each board.&lt;br /&gt;
&lt;br /&gt;
The feedback test evaluates three steps:&lt;br /&gt;
# Starting with an open relay, check if GPIO state is &amp;lt;code&amp;gt;FALSE&amp;lt;/code&amp;gt;&lt;br /&gt;
# Closing the relay, check if GPIO state is &amp;lt;code&amp;gt;TRUE&amp;lt;/code&amp;gt;&lt;br /&gt;
# Opening the relay, check if GPIO state is &amp;lt;code&amp;gt;FALSE&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The feedback test executed before relay switching sequences (e.g. feeding pattern, Balling dosing, ...) and in regular time intervals (every 30min).&lt;br /&gt;
&lt;br /&gt;
== Monitoring and repair of relay board states ==&lt;br /&gt;
This functionality is implemented in &amp;lt;code&amp;gt;RlyBrdCtrl/RlyBrdMidLay.c&amp;lt;/code&amp;gt;.&lt;br /&gt;
This middle layer component was introduced to record the commanded states and acquire the state information responded by the relay boards.&lt;br /&gt;
Except for initialisation and shutdown, the low level communication with the board passes through this component.&lt;br /&gt;
The function &amp;lt;code&amp;gt;RlyBrdChckStates&amp;lt;/code&amp;gt; inside this component compares the commanded and the responded state.&lt;br /&gt;
In case of differences, the function &amp;lt;code&amp;gt;RlyBrdRepairStates&amp;lt;/code&amp;gt; issues commands to the related relay board in order to reestablish the previously commanded state.&lt;br /&gt;
Both functions are called every minute from &amp;lt;code&amp;gt;RlyBrdChckStateThread&amp;lt;/code&amp;gt;.&lt;/div&gt;</summary>
		<author><name>Uwe</name></author>
	</entry>
	<entry>
		<id>http://laimburggasse.onthewifi.com/mediawiki/index.php?title=Device_Scheduling&amp;diff=149</id>
		<title>Device Scheduling</title>
		<link rel="alternate" type="text/html" href="http://laimburggasse.onthewifi.com/mediawiki/index.php?title=Device_Scheduling&amp;diff=149"/>
		<updated>2023-04-02T10:35:42Z</updated>

		<summary type="html">&lt;p&gt;Uwe: Created page with &amp;quot;The following components actuate the relays: * Refill Control: refilling of fresh water depending on water level * Feeder Control: stopping flow pumps, skimmer and actuating the feeder * Water Exchange Control: actuating the external pump for water exchange * Balling Control: actuating the pumps for mineral dosing  There are two requirements, which ask for a more sophisticated control of the relays: * The dosing of minerals needs to be as precise as possible. * The HW sh...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The following components actuate the relays:&lt;br /&gt;
* Refill Control: refilling of fresh water depending on water level&lt;br /&gt;
* Feeder Control: stopping flow pumps, skimmer and actuating the feeder&lt;br /&gt;
* Water Exchange Control: actuating the external pump for water exchange&lt;br /&gt;
* Balling Control: actuating the pumps for mineral dosing&lt;br /&gt;
&lt;br /&gt;
There are two requirements, which ask for a more sophisticated control of the relays:&lt;br /&gt;
* The dosing of minerals needs to be as precise as possible.&lt;br /&gt;
* The HW shall be tested before commencing certain operations.&lt;br /&gt;
* The communication with the board needs to be reinitialised or reopened after certain periods of time.&lt;/div&gt;</summary>
		<author><name>Uwe</name></author>
	</entry>
	<entry>
		<id>http://laimburggasse.onthewifi.com/mediawiki/index.php?title=Control_application&amp;diff=148</id>
		<title>Control application</title>
		<link rel="alternate" type="text/html" href="http://laimburggasse.onthewifi.com/mediawiki/index.php?title=Control_application&amp;diff=148"/>
		<updated>2023-04-02T10:33:07Z</updated>

		<summary type="html">&lt;p&gt;Uwe: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The main control application of Aquarium control implements the following features:&lt;br /&gt;
&lt;br /&gt;
* [[Data acquisition of water temperature, pH and conductivity]]&lt;br /&gt;
* [[Data acquisition of ambient temperature and humidity]]&lt;br /&gt;
* Fresh water refill control&lt;br /&gt;
* Feed control&lt;br /&gt;
* Water temperature control using air ventilation and heater&lt;br /&gt;
* [[Calculation of refill tank content]] based on [[water level measurement]] &lt;br /&gt;
* Actuation of pump for water exchange&lt;br /&gt;
&lt;br /&gt;
Additionally, the main control application implements the following supporting features:&lt;br /&gt;
* HW-Tests&lt;br /&gt;
* Text-To-Speech interface&lt;br /&gt;
* Logging&lt;br /&gt;
* Command interface to receive instructions from outside of the application&lt;br /&gt;
* Storage of recorded data in SQL database&lt;br /&gt;
* File-based communication to web application&lt;br /&gt;
* [[Relay Board Control|Monitoring and repair of relay board state]]&lt;br /&gt;
* [[Device Scheduling]]&lt;br /&gt;
&lt;br /&gt;
The control application makes extensive use of the [https://abyz.me.uk/rpi/pigpio/ pigpio library].&lt;br /&gt;
&lt;br /&gt;
The [[architecture]] of the application uses various threads.&lt;br /&gt;
&lt;br /&gt;
The application is [[automatic start by using systemd]].&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
=== Enable I2C on Raspberry Pi ===&lt;br /&gt;
See [https://www.mathworks.com/help/supportpkg/raspberrypiio/ref/enablei2c.html detailed instructions how to use rasp-config].&lt;br /&gt;
&lt;br /&gt;
=== Create a file for the message queue ===&lt;br /&gt;
The file is automatically created when running &amp;lt;code&amp;gt;make install&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Alternatively, run the command &amp;lt;code&amp;gt;sudo touch /var/local/aquarium-ctrl.mq&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The file is defined in the source file &amp;lt;code&amp;gt;UsrIntrfc/MsgQu.h&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Create a ramdisk ===&lt;br /&gt;
Create the folder &amp;lt;code&amp;gt;/mnt/ramdisk&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Add the following line to &amp;lt;code&amp;gt;/etc/fstab&amp;lt;/code&amp;gt;: &amp;lt;code&amp;gt;tmpfs /mnt/ramdisk tmpfs nodev,nosuid,size=50M 0 0&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Add a symbolic link using the command &amp;lt;code&amp;gt;ln -s /mnt/ramdisk /var/local/aquarium-ctrl&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Automatic start of control application ===&lt;br /&gt;
[[Automatic_start_by_using_systemd|Follow instructions for configuring automatic start of control application.]]&lt;br /&gt;
&lt;br /&gt;
=== Create the website ===&lt;br /&gt;
In the folder &amp;lt;code&amp;gt;/var/www/html&amp;lt;/code&amp;gt;, create the website using &amp;lt;code&amp;gt;git clone https://in-dubio@bitbucket.org/in-dubio/aquarium-web.git&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Change the owner of the website to user &amp;lt;code&amp;gt;pi&amp;lt;/code&amp;gt; and change the group of the website to &amp;lt;code&amp;gt;www-data&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Create a symbolic link to the log file running &amp;lt;code&amp;gt;ln -s /var/log/aquarium-ctrl-session.log /var/www/html/aquarium-web/logfile.txt&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Create the file &amp;lt;code&amp;gt;/var/www/app.ini&amp;lt;/code&amp;gt; with the following content (set the correct password):&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[database]&lt;br /&gt;
&lt;br /&gt;
server = localhost&lt;br /&gt;
&lt;br /&gt;
port = 3306&lt;br /&gt;
&lt;br /&gt;
user = aquarium&lt;br /&gt;
&lt;br /&gt;
password = YourPassword&lt;br /&gt;
&lt;br /&gt;
database = aquarium&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Download and install the node JavaScript libraries.]]&lt;br /&gt;
&lt;br /&gt;
=== Setup of database ===&lt;br /&gt;
* Import an empty database.&lt;br /&gt;
* Create the user &amp;lt;code&amp;gt;aquarium&amp;lt;/code&amp;gt; and assign access rights to the &amp;lt;code&amp;gt;aquarium&amp;lt;/code&amp;gt; database.&lt;/div&gt;</summary>
		<author><name>Uwe</name></author>
	</entry>
	<entry>
		<id>http://laimburggasse.onthewifi.com/mediawiki/index.php?title=Relay_boards&amp;diff=147</id>
		<title>Relay boards</title>
		<link rel="alternate" type="text/html" href="http://laimburggasse.onthewifi.com/mediawiki/index.php?title=Relay_boards&amp;diff=147"/>
		<updated>2023-04-02T10:27:49Z</updated>

		<summary type="html">&lt;p&gt;Uwe: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The control system can use up to two relay boards.&lt;br /&gt;
[[File:RelayBoardsMountedInControlCabinet.jpg|thumb|Relay boards mounted in the control cabinet. Low voltage to the left, high voltage to the right]]&lt;br /&gt;
The supplier of the relay boards is Conrad electronics:&lt;br /&gt;
* [https://www.conrad.at/de/p/conrad-components-197720-relaiskarte-baustein-12-v-dc-24-v-dc-197720.html Low-voltage relay board 197720]&lt;br /&gt;
* [https://www.conrad.at/de/p/conrad-components-197730-relaiskarte-baustein-12-v-dc-197730.html High-voltage relay board 197730]&lt;br /&gt;
&lt;br /&gt;
The Raspberry Pi communicates with the relay board via USB, therefore an additional module needs to be assembled onto each relay board:&lt;br /&gt;
* [https://www.conrad.at/de/p/197257-schnittstellenwandler-1-st-197257.html RS232 to USB converter]&lt;br /&gt;
&lt;br /&gt;
Experience from longer usage indicates that the high-voltage relay board is not stable leading to a major failure of the control system.&lt;br /&gt;
The low-voltage relay board only showed minor deviations in device response, there it has been deactivated for the main controls as well.&lt;br /&gt;
&lt;br /&gt;
Both relay boards have been replaced by [[Controllino]].&lt;br /&gt;
&lt;br /&gt;
For future extensions, the control SW still includes the SW parts for operating the relay boards.&lt;/div&gt;</summary>
		<author><name>Uwe</name></author>
	</entry>
	<entry>
		<id>http://laimburggasse.onthewifi.com/mediawiki/index.php?title=Relay_boards&amp;diff=146</id>
		<title>Relay boards</title>
		<link rel="alternate" type="text/html" href="http://laimburggasse.onthewifi.com/mediawiki/index.php?title=Relay_boards&amp;diff=146"/>
		<updated>2023-04-02T10:27:15Z</updated>

		<summary type="html">&lt;p&gt;Uwe: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The control system can use up to two relay boards.&lt;br /&gt;
[[File:RelayBoardsMountedInControlCabinet.jpg|thumb|Relay boards mounted in the control cabinet. Low voltage to the left, high voltage to the right]]&lt;br /&gt;
The supplier of the relay boards is Conrad electronics:&lt;br /&gt;
* [https://www.conrad.at/de/p/conrad-components-197720-relaiskarte-baustein-12-v-dc-24-v-dc-197720.html Low-voltage relay board 197720]&lt;br /&gt;
* [https://www.conrad.at/de/p/conrad-components-197730-relaiskarte-baustein-12-v-dc-197730.html High-voltage relay board]&lt;br /&gt;
&lt;br /&gt;
The Raspberry Pi communicates with the relay board via USB, therefore an additional module needs to be assembled onto each relay board:&lt;br /&gt;
* [https://www.conrad.at/de/p/197257-schnittstellenwandler-1-st-197257.html RS232 to USB converter]&lt;br /&gt;
&lt;br /&gt;
Experience from longer usage indicates that the high-voltage relay board is not stable leading to a major failure of the control system.&lt;br /&gt;
The low-voltage relay board only showed minor deviations in device response, there it has been deactivated for the main controls as well.&lt;br /&gt;
&lt;br /&gt;
Both relay boards have been replaced by [[Controllino]].&lt;br /&gt;
&lt;br /&gt;
For future extensions, the control SW still includes the SW parts for operating the relay boards.&lt;/div&gt;</summary>
		<author><name>Uwe</name></author>
	</entry>
	<entry>
		<id>http://laimburggasse.onthewifi.com/mediawiki/index.php?title=Control_cabinet&amp;diff=145</id>
		<title>Control cabinet</title>
		<link rel="alternate" type="text/html" href="http://laimburggasse.onthewifi.com/mediawiki/index.php?title=Control_cabinet&amp;diff=145"/>
		<updated>2023-04-02T10:23:33Z</updated>

		<summary type="html">&lt;p&gt;Uwe: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The control cabinet includes the following components&lt;br /&gt;
&lt;br /&gt;
* Main control unit (Raspberry Pi)&lt;br /&gt;
* [[Controllino]]&lt;br /&gt;
* [[Relay boards]]&lt;br /&gt;
* Power supply 12V&lt;br /&gt;
* Power supply 5V&lt;br /&gt;
* Fuses&lt;br /&gt;
* Circuit breaker&lt;br /&gt;
* Relays for [[manual control of pumps and skimmer]]&lt;br /&gt;
* Sockets for power output to pumps and skimmer&lt;br /&gt;
* Voltage converter&lt;/div&gt;</summary>
		<author><name>Uwe</name></author>
	</entry>
	<entry>
		<id>http://laimburggasse.onthewifi.com/mediawiki/index.php?title=Control_application&amp;diff=144</id>
		<title>Control application</title>
		<link rel="alternate" type="text/html" href="http://laimburggasse.onthewifi.com/mediawiki/index.php?title=Control_application&amp;diff=144"/>
		<updated>2023-03-28T07:40:36Z</updated>

		<summary type="html">&lt;p&gt;Uwe: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The main control application of Aquarium control implements the following features:&lt;br /&gt;
&lt;br /&gt;
* [[Data acquisition of water temperature, pH and conductivity]]&lt;br /&gt;
* [[Data acquisition of ambient temperature and humidity]]&lt;br /&gt;
* Fresh water refill control&lt;br /&gt;
* Feed control&lt;br /&gt;
* Water temperature control using air ventilation and heater&lt;br /&gt;
* [[Calculation of refill tank content]] based on [[water level measurement]] &lt;br /&gt;
* Actuation of pump for water exchange&lt;br /&gt;
&lt;br /&gt;
Additionally, the main control application implements the following supporting features:&lt;br /&gt;
* HW-Tests&lt;br /&gt;
* Text-To-Speech interface&lt;br /&gt;
* Logging&lt;br /&gt;
* Command interface to receive instructions from outside of the application&lt;br /&gt;
* Storage of recorded data in SQL database&lt;br /&gt;
* File-based communication to web application&lt;br /&gt;
* [[Relay Board Control|Monitoring and repair of relay board state]]&lt;br /&gt;
&lt;br /&gt;
The control application makes extensive use of the [https://abyz.me.uk/rpi/pigpio/ pigpio library].&lt;br /&gt;
&lt;br /&gt;
The [[architecture]] of the application uses various threads.&lt;br /&gt;
&lt;br /&gt;
The application is [[automatic start by using systemd]].&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
=== Enable I2C on Raspberry Pi ===&lt;br /&gt;
See [https://www.mathworks.com/help/supportpkg/raspberrypiio/ref/enablei2c.html detailed instructions how to use rasp-config].&lt;br /&gt;
&lt;br /&gt;
=== Create a file for the message queue ===&lt;br /&gt;
The file is automatically created when running &amp;lt;code&amp;gt;make install&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Alternatively, run the command &amp;lt;code&amp;gt;sudo touch /var/local/aquarium-ctrl.mq&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The file is defined in the source file &amp;lt;code&amp;gt;UsrIntrfc/MsgQu.h&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Create a ramdisk ===&lt;br /&gt;
Create the folder &amp;lt;code&amp;gt;/mnt/ramdisk&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Add the following line to &amp;lt;code&amp;gt;/etc/fstab&amp;lt;/code&amp;gt;: &amp;lt;code&amp;gt;tmpfs /mnt/ramdisk tmpfs nodev,nosuid,size=50M 0 0&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Add a symbolic link using the command &amp;lt;code&amp;gt;ln -s /mnt/ramdisk /var/local/aquarium-ctrl&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Automatic start of control application ===&lt;br /&gt;
[[Automatic_start_by_using_systemd|Follow instructions for configuring automatic start of control application.]]&lt;br /&gt;
&lt;br /&gt;
=== Create the website ===&lt;br /&gt;
In the folder &amp;lt;code&amp;gt;/var/www/html&amp;lt;/code&amp;gt;, create the website using &amp;lt;code&amp;gt;git clone https://in-dubio@bitbucket.org/in-dubio/aquarium-web.git&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Change the owner of the website to user &amp;lt;code&amp;gt;pi&amp;lt;/code&amp;gt; and change the group of the website to &amp;lt;code&amp;gt;www-data&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Create a symbolic link to the log file running &amp;lt;code&amp;gt;ln -s /var/log/aquarium-ctrl-session.log /var/www/html/aquarium-web/logfile.txt&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Create the file &amp;lt;code&amp;gt;/var/www/app.ini&amp;lt;/code&amp;gt; with the following content (set the correct password):&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[database]&lt;br /&gt;
&lt;br /&gt;
server = localhost&lt;br /&gt;
&lt;br /&gt;
port = 3306&lt;br /&gt;
&lt;br /&gt;
user = aquarium&lt;br /&gt;
&lt;br /&gt;
password = YourPassword&lt;br /&gt;
&lt;br /&gt;
database = aquarium&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Download and install the node JavaScript libraries.]]&lt;br /&gt;
&lt;br /&gt;
=== Setup of database ===&lt;br /&gt;
* Import an empty database.&lt;br /&gt;
* Create the user &amp;lt;code&amp;gt;aquarium&amp;lt;/code&amp;gt; and assign access rights to the &amp;lt;code&amp;gt;aquarium&amp;lt;/code&amp;gt; database.&lt;/div&gt;</summary>
		<author><name>Uwe</name></author>
	</entry>
	<entry>
		<id>http://laimburggasse.onthewifi.com/mediawiki/index.php?title=Control_application&amp;diff=143</id>
		<title>Control application</title>
		<link rel="alternate" type="text/html" href="http://laimburggasse.onthewifi.com/mediawiki/index.php?title=Control_application&amp;diff=143"/>
		<updated>2023-03-26T07:38:16Z</updated>

		<summary type="html">&lt;p&gt;Uwe: /* Automatic start of control application */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The main control application of Aquarium control implements the following features:&lt;br /&gt;
&lt;br /&gt;
* [[Data acquisition of water temperature, pH and conductivity]]&lt;br /&gt;
* [[Data acquisition of ambient temperature and humidity]]&lt;br /&gt;
* Fresh water refill control&lt;br /&gt;
* Feed control&lt;br /&gt;
* Water temperature control using air ventilation and heater&lt;br /&gt;
* [[Calculation of refill tank content]] based on [[water level measurement]] &lt;br /&gt;
* Actuation of pump for water exchange&lt;br /&gt;
&lt;br /&gt;
Additionally, the main control application implements the following supporting features:&lt;br /&gt;
* HW-Tests&lt;br /&gt;
* Text-To-Speech interface&lt;br /&gt;
* Logging&lt;br /&gt;
* Command interface to receive instructions from outside of the application&lt;br /&gt;
* Storage of recorded data in SQL database&lt;br /&gt;
* File-based communication to web application&lt;br /&gt;
* [[Relay Board Control|Monitoring and repair of relay board state]]&lt;br /&gt;
&lt;br /&gt;
The control application makes extensive use of the [https://abyz.me.uk/rpi/pigpio/ pigpio library].&lt;br /&gt;
&lt;br /&gt;
The [[architecture]] of the application uses various threads.&lt;br /&gt;
&lt;br /&gt;
The application is [[automatic start by using systemd]].&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
=== Enable I2C on Raspberry Pi ===&lt;br /&gt;
See [https://www.mathworks.com/help/supportpkg/raspberrypiio/ref/enablei2c.html detailed instructions how to use rasp-config].&lt;br /&gt;
&lt;br /&gt;
=== Create a file for the message queue ===&lt;br /&gt;
The file is automatically created when running &amp;lt;code&amp;gt;make install&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Alternatively, run the command &amp;lt;code&amp;gt;sudo touch /var/local/aquarium-ctrl.mq&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The file is defined in the source file &amp;lt;code&amp;gt;UsrIntrfc/MsgQu.h&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Create a ramdisk ===&lt;br /&gt;
Create the folder &amp;lt;code&amp;gt;/mnt/ramdisk&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Add the following line to &amp;lt;code&amp;gt;/etc/fstab&amp;lt;/code&amp;gt;: &amp;lt;code&amp;gt;tmpfs /mnt/ramdisk tmpfs nodev,nosuid,size=50M 0 0&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Add a symbolic link using the command &amp;lt;code&amp;gt;ln -s /mnt/ramdisk /var/local/aquarium-ctrl&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Automatic start of control application ===&lt;br /&gt;
[[Automatic_start_by_using_systemd|Follow instructions for configuring automatic start of control application.]]&lt;br /&gt;
&lt;br /&gt;
=== Create the website ===&lt;br /&gt;
In the folder &amp;lt;code&amp;gt;/var/www/html&amp;lt;/code&amp;gt;, create the website using &amp;lt;code&amp;gt;git clone https://in-dubio@bitbucket.org/in-dubio/aquarium-web.git&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Change the owner of the website to user &amp;lt;code&amp;gt;pi&amp;lt;/code&amp;gt; and change the group of the website to &amp;lt;code&amp;gt;www-data&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Create a symbolic link to the log file running &amp;lt;code&amp;gt;ln -s /var/log/aquarium-ctrl-session.log /var/www/html/aquarium-web/logfile.txt&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Create the file &amp;lt;code&amp;gt;/var/www/app.ini&amp;lt;/code&amp;gt; with the following content (set the correct password):&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
[database]&lt;br /&gt;
server = localhost&lt;br /&gt;
port = 3306&lt;br /&gt;
user = aquarium&lt;br /&gt;
password = YourPassword&lt;br /&gt;
database = aquarium&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Setup of database ===&lt;br /&gt;
* Import an empty database.&lt;br /&gt;
* Create the user &amp;lt;code&amp;gt;aquarium&amp;lt;/code&amp;gt; and assign access rights to the &amp;lt;code&amp;gt;aquarium&amp;lt;/code&amp;gt; database.&lt;/div&gt;</summary>
		<author><name>Uwe</name></author>
	</entry>
	<entry>
		<id>http://laimburggasse.onthewifi.com/mediawiki/index.php?title=Control_application&amp;diff=142</id>
		<title>Control application</title>
		<link rel="alternate" type="text/html" href="http://laimburggasse.onthewifi.com/mediawiki/index.php?title=Control_application&amp;diff=142"/>
		<updated>2023-03-26T07:37:25Z</updated>

		<summary type="html">&lt;p&gt;Uwe: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The main control application of Aquarium control implements the following features:&lt;br /&gt;
&lt;br /&gt;
* [[Data acquisition of water temperature, pH and conductivity]]&lt;br /&gt;
* [[Data acquisition of ambient temperature and humidity]]&lt;br /&gt;
* Fresh water refill control&lt;br /&gt;
* Feed control&lt;br /&gt;
* Water temperature control using air ventilation and heater&lt;br /&gt;
* [[Calculation of refill tank content]] based on [[water level measurement]] &lt;br /&gt;
* Actuation of pump for water exchange&lt;br /&gt;
&lt;br /&gt;
Additionally, the main control application implements the following supporting features:&lt;br /&gt;
* HW-Tests&lt;br /&gt;
* Text-To-Speech interface&lt;br /&gt;
* Logging&lt;br /&gt;
* Command interface to receive instructions from outside of the application&lt;br /&gt;
* Storage of recorded data in SQL database&lt;br /&gt;
* File-based communication to web application&lt;br /&gt;
* [[Relay Board Control|Monitoring and repair of relay board state]]&lt;br /&gt;
&lt;br /&gt;
The control application makes extensive use of the [https://abyz.me.uk/rpi/pigpio/ pigpio library].&lt;br /&gt;
&lt;br /&gt;
The [[architecture]] of the application uses various threads.&lt;br /&gt;
&lt;br /&gt;
The application is [[automatic start by using systemd]].&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
=== Enable I2C on Raspberry Pi ===&lt;br /&gt;
See [https://www.mathworks.com/help/supportpkg/raspberrypiio/ref/enablei2c.html detailed instructions how to use rasp-config].&lt;br /&gt;
&lt;br /&gt;
=== Create a file for the message queue ===&lt;br /&gt;
The file is automatically created when running &amp;lt;code&amp;gt;make install&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Alternatively, run the command &amp;lt;code&amp;gt;sudo touch /var/local/aquarium-ctrl.mq&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The file is defined in the source file &amp;lt;code&amp;gt;UsrIntrfc/MsgQu.h&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Create a ramdisk ===&lt;br /&gt;
Create the folder &amp;lt;code&amp;gt;/mnt/ramdisk&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Add the following line to &amp;lt;code&amp;gt;/etc/fstab&amp;lt;/code&amp;gt;: &amp;lt;code&amp;gt;tmpfs /mnt/ramdisk tmpfs nodev,nosuid,size=50M 0 0&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Add a symbolic link using the command &amp;lt;code&amp;gt;ln -s /mnt/ramdisk /var/local/aquarium-ctrl&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Automatic start of control application ===&lt;br /&gt;
[[http://laimburggasse.onthewifi.com/mediawiki/index.php/Automatic_start_by_using_systemd|Follow instructions for configuring automatic start of control application.]]&lt;br /&gt;
&lt;br /&gt;
=== Create the website ===&lt;br /&gt;
In the folder &amp;lt;code&amp;gt;/var/www/html&amp;lt;/code&amp;gt;, create the website using &amp;lt;code&amp;gt;git clone https://in-dubio@bitbucket.org/in-dubio/aquarium-web.git&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Change the owner of the website to user &amp;lt;code&amp;gt;pi&amp;lt;/code&amp;gt; and change the group of the website to &amp;lt;code&amp;gt;www-data&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Create a symbolic link to the log file running &amp;lt;code&amp;gt;ln -s /var/log/aquarium-ctrl-session.log /var/www/html/aquarium-web/logfile.txt&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Create the file &amp;lt;code&amp;gt;/var/www/app.ini&amp;lt;/code&amp;gt; with the following content (set the correct password):&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
[database]&lt;br /&gt;
server = localhost&lt;br /&gt;
port = 3306&lt;br /&gt;
user = aquarium&lt;br /&gt;
password = YourPassword&lt;br /&gt;
database = aquarium&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Setup of database ===&lt;br /&gt;
* Import an empty database.&lt;br /&gt;
* Create the user &amp;lt;code&amp;gt;aquarium&amp;lt;/code&amp;gt; and assign access rights to the &amp;lt;code&amp;gt;aquarium&amp;lt;/code&amp;gt; database.&lt;/div&gt;</summary>
		<author><name>Uwe</name></author>
	</entry>
	<entry>
		<id>http://laimburggasse.onthewifi.com/mediawiki/index.php?title=Control_application&amp;diff=141</id>
		<title>Control application</title>
		<link rel="alternate" type="text/html" href="http://laimburggasse.onthewifi.com/mediawiki/index.php?title=Control_application&amp;diff=141"/>
		<updated>2023-03-26T07:34:14Z</updated>

		<summary type="html">&lt;p&gt;Uwe: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The main control application of Aquarium control implements the following features:&lt;br /&gt;
&lt;br /&gt;
* [[Data acquisition of water temperature, pH and conductivity]]&lt;br /&gt;
* [[Data acquisition of ambient temperature and humidity]]&lt;br /&gt;
* Fresh water refill control&lt;br /&gt;
* Feed control&lt;br /&gt;
* Water temperature control using air ventilation and heater&lt;br /&gt;
* [[Calculation of refill tank content]] based on [[water level measurement]] &lt;br /&gt;
* Actuation of pump for water exchange&lt;br /&gt;
&lt;br /&gt;
Additionally, the main control application implements the following supporting features:&lt;br /&gt;
* HW-Tests&lt;br /&gt;
* Text-To-Speech interface&lt;br /&gt;
* Logging&lt;br /&gt;
* Command interface to receive instructions from outside of the application&lt;br /&gt;
* Storage of recorded data in SQL database&lt;br /&gt;
* File-based communication to web application&lt;br /&gt;
* [[Relay Board Control|Monitoring and repair of relay board state]]&lt;br /&gt;
&lt;br /&gt;
The control application makes extensive use of the [https://abyz.me.uk/rpi/pigpio/ pigpio library].&lt;br /&gt;
&lt;br /&gt;
The [[architecture]] of the application uses various threads.&lt;br /&gt;
&lt;br /&gt;
The application is [[automatic start by using systemd]].&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
=== Enable I2C on Raspberry Pi ===&lt;br /&gt;
See [https://www.mathworks.com/help/supportpkg/raspberrypiio/ref/enablei2c.html detailed instructions how to use rasp-config].&lt;br /&gt;
&lt;br /&gt;
=== Create a file for the message queue ===&lt;br /&gt;
The file is automatically created when running &amp;lt;code&amp;gt;make install&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Alternatively, run the command &amp;lt;code&amp;gt;sudo touch /var/local/aquarium-ctrl.mq&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The file is defined in the source file &amp;lt;code&amp;gt;UsrIntrfc/MsgQu.h&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Create a ramdisk ===&lt;br /&gt;
Create the folder &amp;lt;code&amp;gt;/mnt/ramdisk&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Add the following line to &amp;lt;code&amp;gt;/etc/fstab&amp;lt;/code&amp;gt;: &amp;lt;code&amp;gt;tmpfs /mnt/ramdisk tmpfs nodev,nosuid,size=50M 0 0&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Add a symbolic link using the command &amp;lt;code&amp;gt;ln -s /mnt/ramdisk /var/local/aquarium-ctrl&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Create the website ===&lt;br /&gt;
In the folder &amp;lt;code&amp;gt;/var/www/html&amp;lt;/code&amp;gt;, create the website using &amp;lt;code&amp;gt;git clone https://in-dubio@bitbucket.org/in-dubio/aquarium-web.git&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Change the owner of the website to user &amp;lt;code&amp;gt;pi&amp;lt;/code&amp;gt; and change the group of the website to &amp;lt;code&amp;gt;www-data&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Create a symbolic link to the log file running &amp;lt;code&amp;gt;ln -s /var/log/aquarium-ctrl-session.log /var/www/html/aquarium-web/logfile.txt&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Create the file &amp;lt;code&amp;gt;/var/www/app.ini&amp;lt;/code&amp;gt; with the following content (set the correct password):&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
[database]&lt;br /&gt;
server = localhost&lt;br /&gt;
port = 3306&lt;br /&gt;
user = aquarium&lt;br /&gt;
password = YourPassword&lt;br /&gt;
database = aquarium&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Setup of database ===&lt;br /&gt;
* Import an empty database.&lt;br /&gt;
* Create the user &amp;lt;code&amp;gt;aquarium&amp;lt;/code&amp;gt; and assign access rights to the &amp;lt;code&amp;gt;aquarium&amp;lt;/code&amp;gt; database.&lt;/div&gt;</summary>
		<author><name>Uwe</name></author>
	</entry>
	<entry>
		<id>http://laimburggasse.onthewifi.com/mediawiki/index.php?title=Control_application&amp;diff=140</id>
		<title>Control application</title>
		<link rel="alternate" type="text/html" href="http://laimburggasse.onthewifi.com/mediawiki/index.php?title=Control_application&amp;diff=140"/>
		<updated>2023-03-26T07:32:40Z</updated>

		<summary type="html">&lt;p&gt;Uwe: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The main control application of Aquarium control implements the following features:&lt;br /&gt;
&lt;br /&gt;
* [[Data acquisition of water temperature, pH and conductivity]]&lt;br /&gt;
* [[Data acquisition of ambient temperature and humidity]]&lt;br /&gt;
* Fresh water refill control&lt;br /&gt;
* Feed control&lt;br /&gt;
* Water temperature control using air ventilation and heater&lt;br /&gt;
* [[Calculation of refill tank content]] based on [[water level measurement]] &lt;br /&gt;
* Actuation of pump for water exchange&lt;br /&gt;
&lt;br /&gt;
Additionally, the main control application implements the following supporting features:&lt;br /&gt;
* HW-Tests&lt;br /&gt;
* Text-To-Speech interface&lt;br /&gt;
* Logging&lt;br /&gt;
* Command interface to receive instructions from outside of the application&lt;br /&gt;
* Storage of recorded data in SQL database&lt;br /&gt;
* File-based communication to web application&lt;br /&gt;
* [[Relay Board Control|Monitoring and repair of relay board state]]&lt;br /&gt;
&lt;br /&gt;
The control application makes extensive use of the [https://abyz.me.uk/rpi/pigpio/ pigpio library].&lt;br /&gt;
&lt;br /&gt;
The [[architecture]] of the application uses various threads.&lt;br /&gt;
&lt;br /&gt;
The application is [[automatic start by using systemd]].&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
=== Enable I2C on Raspberry Pi ===&lt;br /&gt;
See [https://www.mathworks.com/help/supportpkg/raspberrypiio/ref/enablei2c.html detailed instructions how to use rasp-config].&lt;br /&gt;
&lt;br /&gt;
=== Create a file for the message queue ===&lt;br /&gt;
The file is automatically created when running &amp;lt;code&amp;gt;make install&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Alternatively, run the command &amp;lt;code&amp;gt;sudo touch /var/local/aquarium-ctrl.mq&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The file is defined in the source file &amp;lt;code&amp;gt;UsrIntrfc/MsgQu.h&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Create a ramdisk ===&lt;br /&gt;
Create the folder &amp;lt;code&amp;gt;/mnt/ramdisk&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Add the following line to &amp;lt;code&amp;gt;/etc/fstab&amp;lt;/code&amp;gt;: &amp;lt;code&amp;gt;tmpfs /mnt/ramdisk tmpfs nodev,nosuid,size=50M 0 0&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Add a symbolic link using the command &amp;lt;code&amp;gt;ln -s /mnt/ramdisk /var/local/aquarium-ctrl&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Create the website ===&lt;br /&gt;
In the folder &amp;lt;code&amp;gt;/var/www/html&amp;lt;/code&amp;gt;, create the website using &amp;lt;code&amp;gt;git clone https://in-dubio@bitbucket.org/in-dubio/aquarium-web.git&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Change the owner of the website to user &amp;lt;code&amp;gt;pi&amp;lt;/code&amp;gt; and change the group of the website to &amp;lt;code&amp;gt;www-data&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Create a symbolic link to the log file running &amp;lt;code&amp;gt;ln -s /var/log/aquarium-ctrl-session.log /var/www/html/aquarium-web/logfile.txt&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Create the file &amp;lt;code&amp;gt;/var/www/app.ini&amp;lt;/code&amp;gt; with the following content (set the correct password):&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
[database]&lt;br /&gt;
server = localhost&lt;br /&gt;
port = 3306&lt;br /&gt;
user = aquarium&lt;br /&gt;
password = YourPassword&lt;br /&gt;
database = aquarium&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;/div&gt;</summary>
		<author><name>Uwe</name></author>
	</entry>
	<entry>
		<id>http://laimburggasse.onthewifi.com/mediawiki/index.php?title=Control_application&amp;diff=139</id>
		<title>Control application</title>
		<link rel="alternate" type="text/html" href="http://laimburggasse.onthewifi.com/mediawiki/index.php?title=Control_application&amp;diff=139"/>
		<updated>2023-03-26T07:24:53Z</updated>

		<summary type="html">&lt;p&gt;Uwe: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The main control application of Aquarium control implements the following features:&lt;br /&gt;
&lt;br /&gt;
* [[Data acquisition of water temperature, pH and conductivity]]&lt;br /&gt;
* [[Data acquisition of ambient temperature and humidity]]&lt;br /&gt;
* Fresh water refill control&lt;br /&gt;
* Feed control&lt;br /&gt;
* Water temperature control using air ventilation and heater&lt;br /&gt;
* [[Calculation of refill tank content]] based on [[water level measurement]] &lt;br /&gt;
* Actuation of pump for water exchange&lt;br /&gt;
&lt;br /&gt;
Additionally, the main control application implements the following supporting features:&lt;br /&gt;
* HW-Tests&lt;br /&gt;
* Text-To-Speech interface&lt;br /&gt;
* Logging&lt;br /&gt;
* Command interface to receive instructions from outside of the application&lt;br /&gt;
* Storage of recorded data in SQL database&lt;br /&gt;
* File-based communication to web application&lt;br /&gt;
* [[Relay Board Control|Monitoring and repair of relay board state]]&lt;br /&gt;
&lt;br /&gt;
The control application makes extensive use of the [https://abyz.me.uk/rpi/pigpio/ pigpio library].&lt;br /&gt;
&lt;br /&gt;
The [[architecture]] of the application uses various threads.&lt;br /&gt;
&lt;br /&gt;
The application is [[automatic start by using systemd]].&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
=== Enable I2C on Raspberry Pi ===&lt;br /&gt;
See [https://www.mathworks.com/help/supportpkg/raspberrypiio/ref/enablei2c.html detailed instructions how to use rasp-config].&lt;br /&gt;
&lt;br /&gt;
=== Create a file for the message queue ===&lt;br /&gt;
The file is automatically created when running &amp;lt;code&amp;gt;make install&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Alternatively, run the command &amp;lt;code&amp;gt;sudo touch /var/local/aquarium-ctrl.mq&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The file is defined in the source file &amp;lt;code&amp;gt;UsrIntrfc/MsgQu.h&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Create a ramdisk ===&lt;br /&gt;
Create the folder &amp;lt;code&amp;gt;/mnt/ramdisk&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Add the following line to &amp;lt;code&amp;gt;/etc/fstab&amp;lt;/code&amp;gt;: &amp;lt;code&amp;gt;tmpfs /mnt/ramdisk tmpfs nodev,nosuid,size=50M 0 0&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Add a symbolic link using the command &amp;lt;code&amp;gt;ln -s /mnt/ramdisk /var/local/aquarium-ctrl&amp;lt;/code&amp;gt;.&lt;/div&gt;</summary>
		<author><name>Uwe</name></author>
	</entry>
	<entry>
		<id>http://laimburggasse.onthewifi.com/mediawiki/index.php?title=Control_application&amp;diff=138</id>
		<title>Control application</title>
		<link rel="alternate" type="text/html" href="http://laimburggasse.onthewifi.com/mediawiki/index.php?title=Control_application&amp;diff=138"/>
		<updated>2023-03-26T07:24:36Z</updated>

		<summary type="html">&lt;p&gt;Uwe: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The main control application of Aquarium control implements the following features:&lt;br /&gt;
&lt;br /&gt;
* [[Data acquisition of water temperature, pH and conductivity]]&lt;br /&gt;
* [[Data acquisition of ambient temperature and humidity]]&lt;br /&gt;
* Fresh water refill control&lt;br /&gt;
* Feed control&lt;br /&gt;
* Water temperature control using air ventilation and heater&lt;br /&gt;
* [[Calculation of refill tank content]] based on [[water level measurement]] &lt;br /&gt;
* Actuation of pump for water exchange&lt;br /&gt;
&lt;br /&gt;
Additionally, the main control application implements the following supporting features:&lt;br /&gt;
* HW-Tests&lt;br /&gt;
* Text-To-Speech interface&lt;br /&gt;
* Logging&lt;br /&gt;
* Command interface to receive instructions from outside of the application&lt;br /&gt;
* Storage of recorded data in SQL database&lt;br /&gt;
* File-based communication to web application&lt;br /&gt;
* [[Relay Board Control|Monitoring and repair of relay board state]]&lt;br /&gt;
&lt;br /&gt;
The control application makes extensive use of the [https://abyz.me.uk/rpi/pigpio/ pigpio library].&lt;br /&gt;
&lt;br /&gt;
The [[architecture]] of the application uses various threads.&lt;br /&gt;
&lt;br /&gt;
The application is [[automatic start by using systemd]].&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
=== Enable I2C on Raspberry Pi ===&lt;br /&gt;
See [https://www.mathworks.com/help/supportpkg/raspberrypiio/ref/enablei2c.html detailed instructions how to use rasp-config].&lt;br /&gt;
&lt;br /&gt;
=== Create a file for the message queue ===&lt;br /&gt;
The file is automatically created when running &amp;lt;code&amp;gt;make install&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Alternatively, run the command &amp;lt;code&amp;gt;sudo touch /var/local/aquarium-ctrl.mq&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The file is defined in the source file &amp;lt;code&amp;gt;UsrIntrfc/MsgQu.h&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Create a ramdisk ==&lt;br /&gt;
Create the folder &amp;lt;code&amp;gt;/mnt/ramdisk&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Add the following line to &amp;lt;code&amp;gt;/etc/fstab&amp;lt;/code&amp;gt;: &amp;lt;code&amp;gt;tmpfs /mnt/ramdisk tmpfs nodev,nosuid,size=50M 0 0&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Add a symbolic link using the command &amp;lt;code&amp;gt;ln -s /mnt/ramdisk /var/local/aquarium-ctrl&amp;lt;/code&amp;gt;.&lt;/div&gt;</summary>
		<author><name>Uwe</name></author>
	</entry>
	<entry>
		<id>http://laimburggasse.onthewifi.com/mediawiki/index.php?title=Control_application&amp;diff=137</id>
		<title>Control application</title>
		<link rel="alternate" type="text/html" href="http://laimburggasse.onthewifi.com/mediawiki/index.php?title=Control_application&amp;diff=137"/>
		<updated>2023-03-26T07:19:36Z</updated>

		<summary type="html">&lt;p&gt;Uwe: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The main control application of Aquarium control implements the following features:&lt;br /&gt;
&lt;br /&gt;
* [[Data acquisition of water temperature, pH and conductivity]]&lt;br /&gt;
* [[Data acquisition of ambient temperature and humidity]]&lt;br /&gt;
* Fresh water refill control&lt;br /&gt;
* Feed control&lt;br /&gt;
* Water temperature control using air ventilation and heater&lt;br /&gt;
* [[Calculation of refill tank content]] based on [[water level measurement]] &lt;br /&gt;
* Actuation of pump for water exchange&lt;br /&gt;
&lt;br /&gt;
Additionally, the main control application implements the following supporting features:&lt;br /&gt;
* HW-Tests&lt;br /&gt;
* Text-To-Speech interface&lt;br /&gt;
* Logging&lt;br /&gt;
* Command interface to receive instructions from outside of the application&lt;br /&gt;
* Storage of recorded data in SQL database&lt;br /&gt;
* File-based communication to web application&lt;br /&gt;
* [[Relay Board Control|Monitoring and repair of relay board state]]&lt;br /&gt;
&lt;br /&gt;
The control application makes extensive use of the [https://abyz.me.uk/rpi/pigpio/ pigpio library].&lt;br /&gt;
&lt;br /&gt;
The [[architecture]] of the application uses various threads.&lt;br /&gt;
&lt;br /&gt;
The application is [[automatic start by using systemd]].&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
=== Enable I2C on Raspberry Pi ===&lt;br /&gt;
See [https://www.mathworks.com/help/supportpkg/raspberrypiio/ref/enablei2c.html detailed instructions how to use rasp-config].&lt;br /&gt;
&lt;br /&gt;
=== Create a file for the message queue ===&lt;br /&gt;
The file is automatically created when running &amp;lt;code&amp;gt;make install&amp;lt;/code&amp;gt;.&lt;br /&gt;
Alternatively, run the command &amp;lt;code&amp;gt;sudo touch /var/local/aquarium-ctrl.mq&amp;lt;/code&amp;gt;.&lt;br /&gt;
The file is defined in the source file &amp;lt;code&amp;gt;UsrIntrfc/MsgQu.h&amp;lt;/code&amp;gt;.&lt;/div&gt;</summary>
		<author><name>Uwe</name></author>
	</entry>
	<entry>
		<id>http://laimburggasse.onthewifi.com/mediawiki/index.php?title=Automatic_start_by_using_systemd&amp;diff=136</id>
		<title>Automatic start by using systemd</title>
		<link rel="alternate" type="text/html" href="http://laimburggasse.onthewifi.com/mediawiki/index.php?title=Automatic_start_by_using_systemd&amp;diff=136"/>
		<updated>2023-03-26T07:11:59Z</updated>

		<summary type="html">&lt;p&gt;Uwe: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The content of systemd unit file /lib/systemd/system/aquarium-ctrl.service as following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
[Unit]&lt;br /&gt;
&lt;br /&gt;
Description=Aquarium Control Application&lt;br /&gt;
&lt;br /&gt;
After=multi-user.target&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[Service]&lt;br /&gt;
&lt;br /&gt;
Type=forking&lt;br /&gt;
&lt;br /&gt;
ExecStart=bash /usr/local/bin/aquarium-ctrl-startup&lt;br /&gt;
&lt;br /&gt;
[Install]&lt;br /&gt;
&lt;br /&gt;
WantedBy=multi-user.target&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Upon creation/modification of the unit file, one must run the command &amp;lt;code&amp;gt;sudo systemctl daemon-reload&amp;lt;/code&amp;gt; in order to activate the changes.&lt;br /&gt;
&lt;br /&gt;
For starting the control application manually via systemd, one can use the command &amp;lt;code&amp;gt;sudo systemctl start aquarium-ctrl&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
When running the application in a configuration that utilises the relay board, the startup script needs to start the &amp;lt;code&amp;gt;screen&amp;lt;code&amp;gt; application prior to the control application in order to set the baud rate of the relay boards:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
screen -dm /dev/ttyUSB0 19200&lt;br /&gt;
&lt;br /&gt;
screen -dm /dev/ttyUSB1 19200&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/aquarium-ctrl -f On -r On -u Off -d On -s On -g On -t Off -b On &amp;gt; /dev/null&amp;amp;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;/div&gt;</summary>
		<author><name>Uwe</name></author>
	</entry>
	<entry>
		<id>http://laimburggasse.onthewifi.com/mediawiki/index.php?title=SQL_database&amp;diff=135</id>
		<title>SQL database</title>
		<link rel="alternate" type="text/html" href="http://laimburggasse.onthewifi.com/mediawiki/index.php?title=SQL_database&amp;diff=135"/>
		<updated>2023-03-24T13:29:28Z</updated>

		<summary type="html">&lt;p&gt;Uwe: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Aquarium Control uses MariaDB.&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
Use the following commands to install MariaDB:&lt;br /&gt;
* &amp;lt;code&amp;gt;sudo apt-get update&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;sudo apt-get upgrade&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;sudo apt install mariadb-server&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;sudo apt-get install libmariadb-dev&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;sudo apt-get install libmariadb-dev-compat&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;sudo apt-get install libgsl-dev&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The commands are also inside the &amp;lt;code&amp;gt;libinstall&amp;lt;/code&amp;gt; script inside the repository of aquarium-ctrl.&lt;br /&gt;
&lt;br /&gt;
== Backup ==&lt;br /&gt;
Manual backup works as following:&lt;br /&gt;
* Export of database with &amp;lt;code&amp;gt;sudo mysqldump -u root aquarium &amp;gt; name_of_backup.sql&amp;lt;/code&amp;gt;&lt;br /&gt;
* Transfer of data to alternative storage&lt;br /&gt;
* Before restoring, create the database &amp;lt;code&amp;gt;aquarium&amp;lt;/code&amp;gt; on the new device (log in with &amp;lt;code&amp;gt;sudo mysql -u root&amp;lt;/code&amp;gt; and execute &amp;lt;code&amp;gt;create database aquarium;&amp;lt;/code&amp;gt;)&lt;br /&gt;
* Restoring data from backup works with &amp;lt;code&amp;gt;sudo mysql -u root aquarium &amp;lt; name_of_backup.sql&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Create user ==&lt;br /&gt;
Create user &amp;quot;aquarium&amp;quot; with matching password when restoring on a new device:&lt;br /&gt;
* log in with &amp;lt;code&amp;gt;sudo mysql -u root&amp;lt;/code&amp;gt;&lt;br /&gt;
* execute &amp;lt;code&amp;gt;create user aquarium identified by 'password';&amp;lt;/code&amp;gt;&lt;br /&gt;
* execute &amp;lt;code&amp;gt;grant all privileges on aquarium.* to aquarium with grant option;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Maintaining the database ==&lt;br /&gt;
Use phpmyadmin to administrate user rights.&lt;br /&gt;
Installation is done with the following steps:&lt;br /&gt;
* &amp;lt;code&amp;gt;sudo apt install phpmyadmin&amp;lt;/code&amp;gt;&lt;br /&gt;
* Choose the Apache web server for configuration. This will automatically trigger the installation of Apache.&lt;br /&gt;
&lt;br /&gt;
== Structure of database ==&lt;br /&gt;
The database contains the following tables:&lt;/div&gt;</summary>
		<author><name>Uwe</name></author>
	</entry>
	<entry>
		<id>http://laimburggasse.onthewifi.com/mediawiki/index.php?title=SQL_database&amp;diff=134</id>
		<title>SQL database</title>
		<link rel="alternate" type="text/html" href="http://laimburggasse.onthewifi.com/mediawiki/index.php?title=SQL_database&amp;diff=134"/>
		<updated>2023-03-24T13:19:43Z</updated>

		<summary type="html">&lt;p&gt;Uwe: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Aquarium Control uses MariaDB.&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
Use the following commands to install MariaDB:&lt;br /&gt;
* &amp;lt;code&amp;gt;sudo apt-get update&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;sudo apt-get upgrade&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;sudo apt install mariadb-server&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;sudo apt-get install libmariadb-dev&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;sudo apt-get install libmariadb-dev-compat&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;sudo apt-get install libgsl-dev&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The commands are also inside the &amp;lt;code&amp;gt;libinstall&amp;lt;/code&amp;gt; script inside the repository of aquarium-ctrl.&lt;br /&gt;
&lt;br /&gt;
== Backup ==&lt;br /&gt;
Manual backup works as following:&lt;br /&gt;
* Export of database with &amp;lt;code&amp;gt;sudo mysqldump -u root aquarium &amp;gt; name_of_backup.sql&amp;lt;/code&amp;gt;&lt;br /&gt;
* Transfer of data to alternative storage&lt;br /&gt;
* Before restoring, create the database &amp;lt;code&amp;gt;aquarium&amp;lt;/code&amp;gt; on the new device (log in with &amp;lt;code&amp;gt;sudo mysql -u root&amp;lt;/code&amp;gt; and execute &amp;lt;code&amp;gt;create database aquarium;&amp;lt;/code&amp;gt;)&lt;br /&gt;
* Restoring data from backup works with &amp;lt;code&amp;gt;sudo mysql -u root aquarium &amp;lt; name_of_backup.sql&amp;lt;/code&amp;gt;&lt;br /&gt;
* keep in mind to create user &amp;quot;aquarium&amp;quot; with matching password when restoring on a new device&lt;br /&gt;
&lt;br /&gt;
== Maintaining the database ==&lt;br /&gt;
Use phpmyadmin to administrate user rights.&lt;br /&gt;
Installation is done with the following steps:&lt;br /&gt;
* &amp;lt;code&amp;gt;sudo apt install phpmyadmin&amp;lt;/code&amp;gt;&lt;br /&gt;
Choose the Apache web server for configuration. This will automatically trigger the installation of Apache.&lt;br /&gt;
&lt;br /&gt;
== Structure of database ==&lt;br /&gt;
The database contains the following tables:&lt;/div&gt;</summary>
		<author><name>Uwe</name></author>
	</entry>
	<entry>
		<id>http://laimburggasse.onthewifi.com/mediawiki/index.php?title=SQL_database&amp;diff=133</id>
		<title>SQL database</title>
		<link rel="alternate" type="text/html" href="http://laimburggasse.onthewifi.com/mediawiki/index.php?title=SQL_database&amp;diff=133"/>
		<updated>2023-03-24T13:18:53Z</updated>

		<summary type="html">&lt;p&gt;Uwe: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Aquarium Control uses MariaDB.&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
Use the following commands to install MariaDB:&lt;br /&gt;
* &amp;lt;code&amp;gt;sudo apt-get update&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;sudo apt-get upgrade&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;sudo apt install mariadb-server&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;sudo apt-get install libmariadb-dev&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;sudo apt-get install libmariadb-dev-compat&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;sudo apt-get install libgsl-dev&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The commands are also inside the &amp;lt;code&amp;gt;libinstall&amp;lt;/code&amp;gt; script inside the repository of aquarium-ctrl.&lt;br /&gt;
&lt;br /&gt;
== Backup ==&lt;br /&gt;
Manual backup works as following:&lt;br /&gt;
* Export of database with &amp;lt;code&amp;gt;sudo mysqldump -u root aquarium &amp;gt; name_of_backup.sql&amp;lt;/code&amp;gt;&lt;br /&gt;
* Transfer of data to alternative storage&lt;br /&gt;
* Before restoring, create the database &amp;lt;code&amp;gt;aquarium&amp;lt;/code&amp;gt; on the new device (log in with &amp;lt;code&amp;gt;sudo mysql -u root&amp;lt;/code&amp;gt; and execute &amp;lt;code&amp;gt;create database aquarium;&amp;lt;/code&amp;gt;)&lt;br /&gt;
* Restoring data from backup works with &amp;lt;code&amp;gt;sudo mysql -u root aquarium &amp;lt; name_of_backup.sql&amp;lt;/code&amp;gt;&lt;br /&gt;
* keep in mind to create user &amp;quot;aquarium&amp;quot; with matching password when restoring on a new device&lt;br /&gt;
&lt;br /&gt;
== Maintaining the database ==&lt;br /&gt;
Use phpmyadmin to administrate user rights.&lt;br /&gt;
Installation is done with the following steps:&lt;br /&gt;
* &amp;lt;code&amp;gt;sudo apt install phpmyadmin&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Structure of database ==&lt;br /&gt;
The database contains the following tables:&lt;/div&gt;</summary>
		<author><name>Uwe</name></author>
	</entry>
	<entry>
		<id>http://laimburggasse.onthewifi.com/mediawiki/index.php?title=SQL_database&amp;diff=132</id>
		<title>SQL database</title>
		<link rel="alternate" type="text/html" href="http://laimburggasse.onthewifi.com/mediawiki/index.php?title=SQL_database&amp;diff=132"/>
		<updated>2023-03-24T13:17:11Z</updated>

		<summary type="html">&lt;p&gt;Uwe: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Aquarium Control uses MariaDB.&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
Use the following commands to install MariaDB:&lt;br /&gt;
* &amp;lt;code&amp;gt;sudo apt-get update&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;sudo apt-get upgrade&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;sudo apt install mariadb-server&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;sudo apt-get install libmariadb-dev&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;sudo apt-get install libmariadb-dev-compat&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;sudo apt-get install libgsl-dev&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The commands are also inside the &amp;lt;code&amp;gt;libinstall&amp;lt;/code&amp;gt; script inside the repository of aquarium-ctrl.&lt;br /&gt;
&lt;br /&gt;
== Backup ==&lt;br /&gt;
Manual backup works as following:&lt;br /&gt;
* Export of database with &amp;lt;code&amp;gt;sudo mysqldump -u root aquarium &amp;gt; name_of_backup.sql&amp;lt;/code&amp;gt;&lt;br /&gt;
* Transfer of data to alternative storage&lt;br /&gt;
* Before restoring, create the database &amp;lt;code&amp;gt;aquarium&amp;lt;/code&amp;gt; on the new device (log in with &amp;lt;code&amp;gt;sudo mysql -u root&amp;lt;/code&amp;gt; and execute &amp;lt;code&amp;gt;create database aquarium;&amp;lt;/code&amp;gt;)&lt;br /&gt;
* Restoring data from backup works with &amp;lt;code&amp;gt;sudo mysql -u root aquarium &amp;lt; name_of_backup.sql&amp;lt;/code&amp;gt;&lt;br /&gt;
* keep in mind to create user &amp;quot;aquarium&amp;quot; with matching password when restoring on a new device&lt;br /&gt;
&lt;br /&gt;
== Maintaining the database ==&lt;br /&gt;
Use phpmyadmin to administrate user rights.&lt;br /&gt;
Installation is done with the following steps:&lt;br /&gt;
* &amp;lt;code&amp;gt;sudo apt-get install php&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Structure of database ==&lt;br /&gt;
The database contains the following tables:&lt;/div&gt;</summary>
		<author><name>Uwe</name></author>
	</entry>
	<entry>
		<id>http://laimburggasse.onthewifi.com/mediawiki/index.php?title=SQL_database&amp;diff=131</id>
		<title>SQL database</title>
		<link rel="alternate" type="text/html" href="http://laimburggasse.onthewifi.com/mediawiki/index.php?title=SQL_database&amp;diff=131"/>
		<updated>2023-03-24T13:16:58Z</updated>

		<summary type="html">&lt;p&gt;Uwe: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Aquarium Control uses MariaDB.&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
Use the following commands to install MariaDB:&lt;br /&gt;
* &amp;lt;code&amp;gt;sudo apt-get update&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;sudo apt-get upgrade&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;sudo apt install mariadb-server&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;sudo apt-get install libmariadb-dev&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;sudo apt-get install libmariadb-dev-compat&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;sudo apt-get install libgsl-dev&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The commands are also inside the &amp;lt;code&amp;gt;libinstall&amp;lt;/code&amp;gt; script inside the repository of aquarium-ctrl.&lt;br /&gt;
&lt;br /&gt;
== Backup ==&lt;br /&gt;
Manual backup works as following:&lt;br /&gt;
* Export of database with &amp;lt;code&amp;gt;sudo mysqldump -u root aquarium &amp;gt; name_of_backup.sql&amp;lt;/code&amp;gt;&lt;br /&gt;
* Transfer of data to alternative storage&lt;br /&gt;
* Before restoring, create the database &amp;lt;code&amp;gt;aquarium&amp;lt;/code&amp;gt; on the new device (log in with &amp;lt;code&amp;gt;sudo mysql -u root&amp;lt;/code&amp;gt; and execute &amp;lt;code&amp;gt;create database aquarium;&amp;lt;/code&amp;gt;)&lt;br /&gt;
* Restoring data from backup works with &amp;lt;code&amp;gt;sudo mysql -u root aquarium &amp;lt; name_of_backup.sql&amp;lt;/code&amp;gt;&lt;br /&gt;
* keep in mind to create user &amp;quot;aquarium&amp;quot; with matching password when restoring on a new device&lt;br /&gt;
&lt;br /&gt;
== Maintaining the database ==&lt;br /&gt;
Use phpmyadmin to administrate user rights.&lt;br /&gt;
Installation is done with the following steps:&lt;br /&gt;
* &amp;lt;code&amp;gt;sudo apt-get install apt&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Structure of database ==&lt;br /&gt;
The database contains the following tables:&lt;/div&gt;</summary>
		<author><name>Uwe</name></author>
	</entry>
	<entry>
		<id>http://laimburggasse.onthewifi.com/mediawiki/index.php?title=SQL_database&amp;diff=130</id>
		<title>SQL database</title>
		<link rel="alternate" type="text/html" href="http://laimburggasse.onthewifi.com/mediawiki/index.php?title=SQL_database&amp;diff=130"/>
		<updated>2023-03-24T13:12:19Z</updated>

		<summary type="html">&lt;p&gt;Uwe: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Aquarium Control uses MariaDB.&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
Use the following commands to install MariaDB:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get update&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get upgrade&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt install mariadb-server&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install libmariadb-dev&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install libmariadb-dev-compat&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install libgsl-dev&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The commands are also inside the &amp;lt;code&amp;gt;libinstall&amp;lt;/code&amp;gt; script inside the repository of aquarium-ctrl.&lt;br /&gt;
&lt;br /&gt;
== Backup ==&lt;br /&gt;
Manual backup works as following:&lt;br /&gt;
* Export of database with &amp;lt;code&amp;gt;sudo mysqldump -u root aquarium &amp;gt; name_of_backup.sql&amp;lt;/code&amp;gt;&lt;br /&gt;
* Transfer of data to alternative storage&lt;br /&gt;
* Before restoring, create the database &amp;lt;code&amp;gt;aquarium&amp;lt;/code&amp;gt; on the new device (log in with &amp;lt;code&amp;gt;sudo mysql -u root&amp;lt;/code&amp;gt; and execute &amp;lt;code&amp;gt;create database aquarium;&amp;lt;/code&amp;gt;)&lt;br /&gt;
* Restoring data from backup works with &amp;lt;code&amp;gt;sudo mysql -u root aquarium &amp;lt; name_of_backup.sql&amp;lt;/code&amp;gt;&lt;br /&gt;
* keep in mind to create user &amp;quot;aquarium&amp;quot; with matching password when restoring on a new device&lt;br /&gt;
&lt;br /&gt;
== Heading text ==&lt;br /&gt;
The database contains the following tables:&lt;/div&gt;</summary>
		<author><name>Uwe</name></author>
	</entry>
	<entry>
		<id>http://laimburggasse.onthewifi.com/mediawiki/index.php?title=SQL_database&amp;diff=129</id>
		<title>SQL database</title>
		<link rel="alternate" type="text/html" href="http://laimburggasse.onthewifi.com/mediawiki/index.php?title=SQL_database&amp;diff=129"/>
		<updated>2023-03-24T13:11:37Z</updated>

		<summary type="html">&lt;p&gt;Uwe: /* Backup */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Aquarium Control uses MariaDB.&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
Use the following commands to install MariaDB:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get update&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get upgrade&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt install mariadb-server&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install libmariadb-dev&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install libmariadb-dev-compat&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install libgsl-dev&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The commands are also inside the &amp;lt;code&amp;gt;libinstall&amp;lt;/code&amp;gt; script inside the repository of aquarium-ctrl.&lt;br /&gt;
&lt;br /&gt;
== Backup ==&lt;br /&gt;
Manual backup works as following:&lt;br /&gt;
* Export of database with &amp;lt;code&amp;gt;sudo mysqldump -u root aquarium &amp;gt; name_of_backup.sql&amp;lt;/code&amp;gt;&lt;br /&gt;
* Transfer of data to alternative storage&lt;br /&gt;
* Before restoring, create the database &amp;lt;code&amp;gt;aquarium&amp;lt;/code&amp;gt; on the new device (log in with &amp;lt;code&amp;gt;sudo mysql -u root&amp;lt;/code&amp;gt; and execute &amp;lt;code&amp;gt;create database aquarium;&amp;lt;/code&amp;gt;)&lt;br /&gt;
* Restoring data from backup works with &amp;lt;code&amp;gt;mysql aquarium &amp;lt; name_of_backup.sql&amp;lt;/code&amp;gt;&lt;br /&gt;
* keep in mind to create user &amp;quot;aquarium&amp;quot; with matching password when restoring on a new device&lt;br /&gt;
&lt;br /&gt;
== Heading text ==&lt;br /&gt;
The database contains the following tables:&lt;/div&gt;</summary>
		<author><name>Uwe</name></author>
	</entry>
	<entry>
		<id>http://laimburggasse.onthewifi.com/mediawiki/index.php?title=SQL_database&amp;diff=128</id>
		<title>SQL database</title>
		<link rel="alternate" type="text/html" href="http://laimburggasse.onthewifi.com/mediawiki/index.php?title=SQL_database&amp;diff=128"/>
		<updated>2023-03-24T13:05:06Z</updated>

		<summary type="html">&lt;p&gt;Uwe: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Aquarium Control uses MariaDB.&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
Use the following commands to install MariaDB:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get update&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get upgrade&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt install mariadb-server&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install libmariadb-dev&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install libmariadb-dev-compat&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install libgsl-dev&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The commands are also inside the &amp;lt;code&amp;gt;libinstall&amp;lt;/code&amp;gt; script inside the repository of aquarium-ctrl.&lt;br /&gt;
&lt;br /&gt;
== Backup ==&lt;br /&gt;
Manual backup works as following:&lt;br /&gt;
* Export of database with &amp;lt;code&amp;gt;sudo mysqldump -u root aquarium &amp;gt; name_of_backup.sql&amp;lt;/code&amp;gt;&lt;br /&gt;
* Transfer of data to alternative storage&lt;br /&gt;
* Restoring data from backup works with &amp;lt;code&amp;gt;mysql aquarium &amp;lt; name_of_backup.sql&amp;lt;/code&amp;gt;&lt;br /&gt;
* keep in mind to create user &amp;quot;aquarium&amp;quot; with matching password when restoring on a new device&lt;br /&gt;
&lt;br /&gt;
== Heading text ==&lt;br /&gt;
The database contains the following tables:&lt;/div&gt;</summary>
		<author><name>Uwe</name></author>
	</entry>
	<entry>
		<id>http://laimburggasse.onthewifi.com/mediawiki/index.php?title=SQL_database&amp;diff=127</id>
		<title>SQL database</title>
		<link rel="alternate" type="text/html" href="http://laimburggasse.onthewifi.com/mediawiki/index.php?title=SQL_database&amp;diff=127"/>
		<updated>2023-03-24T13:04:38Z</updated>

		<summary type="html">&lt;p&gt;Uwe: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Aquarium Control uses MariaDB.&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
Use the following commands to install MariaDB:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get update&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get upgrade&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt install mariadb-server&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install libmariadb-dev&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install libmariadb-dev-compat&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install libgsl-dev&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The commands are also inside the &amp;lt;code&amp;gt;libinstall&amp;lt;/code&amp;gt; script inside the repository of aquarium-ctrl.&lt;br /&gt;
&lt;br /&gt;
== Backup ==&lt;br /&gt;
Manual backup works as following:&lt;br /&gt;
* Export of database with &amp;lt;code&amp;gt;sudo mysqldump -u root aquarium &amp;gt; name_of_backup.sql&lt;br /&gt;
* Transfer of data to alternative storage&lt;br /&gt;
* Restoring data from backup works with &amp;lt;code&amp;gt;mysql aquarium &amp;lt; name_of_backup.sql&lt;br /&gt;
* keep in mind to create user &amp;quot;aquarium&amp;quot; with matching password when restoring on a new device&lt;br /&gt;
&lt;br /&gt;
== Heading text ==&lt;br /&gt;
The database contains the following tables:&lt;/div&gt;</summary>
		<author><name>Uwe</name></author>
	</entry>
	<entry>
		<id>http://laimburggasse.onthewifi.com/mediawiki/index.php?title=SQL_database&amp;diff=126</id>
		<title>SQL database</title>
		<link rel="alternate" type="text/html" href="http://laimburggasse.onthewifi.com/mediawiki/index.php?title=SQL_database&amp;diff=126"/>
		<updated>2023-03-24T10:35:31Z</updated>

		<summary type="html">&lt;p&gt;Uwe: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Aquarium Control uses MariaDB.&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
Use the following commands to install MariaDB:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get update&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get upgrade&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt install mariadb-server&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install libmariadb-dev&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install libmariadb-dev-compat&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install libgsl-dev&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The commands are also inside the &amp;lt;code&amp;gt;libinstall&amp;lt;/code&amp;gt; script inside the repository of aquarium-ctrl.&lt;br /&gt;
&lt;br /&gt;
== Backup ==&lt;br /&gt;
Manual backup works as following:&lt;br /&gt;
&lt;br /&gt;
== Heading text ==&lt;br /&gt;
The database contains the following tables:&lt;/div&gt;</summary>
		<author><name>Uwe</name></author>
	</entry>
	<entry>
		<id>http://laimburggasse.onthewifi.com/mediawiki/index.php?title=SQL_database&amp;diff=125</id>
		<title>SQL database</title>
		<link rel="alternate" type="text/html" href="http://laimburggasse.onthewifi.com/mediawiki/index.php?title=SQL_database&amp;diff=125"/>
		<updated>2023-03-24T10:32:51Z</updated>

		<summary type="html">&lt;p&gt;Uwe: /* Installation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Aquarium Control uses MariaDB.&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
Use the following commands to install MariaDB:&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get update&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get upgrade&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Backup ==&lt;br /&gt;
Manual backup works as following:&lt;br /&gt;
&lt;br /&gt;
== Heading text ==&lt;br /&gt;
The database contains the following tables:&lt;/div&gt;</summary>
		<author><name>Uwe</name></author>
	</entry>
	<entry>
		<id>http://laimburggasse.onthewifi.com/mediawiki/index.php?title=SQL_database&amp;diff=124</id>
		<title>SQL database</title>
		<link rel="alternate" type="text/html" href="http://laimburggasse.onthewifi.com/mediawiki/index.php?title=SQL_database&amp;diff=124"/>
		<updated>2023-03-24T10:31:21Z</updated>

		<summary type="html">&lt;p&gt;Uwe: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Aquarium Control uses MariaDB.&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
Use the following commands to install MariaDB:&lt;br /&gt;
{{code |lang=bash | sudo apt-get update}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Backup ==&lt;br /&gt;
Manual backup works as following:&lt;br /&gt;
&lt;br /&gt;
== Heading text ==&lt;br /&gt;
The database contains the following tables:&lt;/div&gt;</summary>
		<author><name>Uwe</name></author>
	</entry>
	<entry>
		<id>http://laimburggasse.onthewifi.com/mediawiki/index.php?title=SQL_database&amp;diff=123</id>
		<title>SQL database</title>
		<link rel="alternate" type="text/html" href="http://laimburggasse.onthewifi.com/mediawiki/index.php?title=SQL_database&amp;diff=123"/>
		<updated>2023-03-24T10:27:50Z</updated>

		<summary type="html">&lt;p&gt;Uwe: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Aquarium Control uses MariaDB.&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
Installation&lt;br /&gt;
&lt;br /&gt;
== Backup ==&lt;br /&gt;
Manual backup works as following:&lt;br /&gt;
&lt;br /&gt;
== Heading text ==&lt;br /&gt;
The database contains the following tables:&lt;/div&gt;</summary>
		<author><name>Uwe</name></author>
	</entry>
	<entry>
		<id>http://laimburggasse.onthewifi.com/mediawiki/index.php?title=SQL_database&amp;diff=122</id>
		<title>SQL database</title>
		<link rel="alternate" type="text/html" href="http://laimburggasse.onthewifi.com/mediawiki/index.php?title=SQL_database&amp;diff=122"/>
		<updated>2023-03-24T10:26:32Z</updated>

		<summary type="html">&lt;p&gt;Uwe: Created page with &amp;quot;Aquarium Control uses MariaDB.  == Heading text == Installation  == Heading text == Backup  == Heading text == Structure&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Aquarium Control uses MariaDB.&lt;br /&gt;
&lt;br /&gt;
== Heading text ==&lt;br /&gt;
Installation&lt;br /&gt;
&lt;br /&gt;
== Heading text ==&lt;br /&gt;
Backup&lt;br /&gt;
&lt;br /&gt;
== Heading text ==&lt;br /&gt;
Structure&lt;/div&gt;</summary>
		<author><name>Uwe</name></author>
	</entry>
	<entry>
		<id>http://laimburggasse.onthewifi.com/mediawiki/index.php?title=Aquarium-Control&amp;diff=121</id>
		<title>Aquarium-Control</title>
		<link rel="alternate" type="text/html" href="http://laimburggasse.onthewifi.com/mediawiki/index.php?title=Aquarium-Control&amp;diff=121"/>
		<updated>2023-03-24T10:25:27Z</updated>

		<summary type="html">&lt;p&gt;Uwe: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Aquarium-Control is a control system for salt-water aquariums.&lt;br /&gt;
&lt;br /&gt;
The main features include:&lt;br /&gt;
* [[Refill control for fresh water]]&lt;br /&gt;
* [[Data acquisition of water temperature, pH and conductivity|Data acquisition for sensor data of temperature, pH, conductivity]]&lt;br /&gt;
* Temperature control using ventilation fans and heater&lt;br /&gt;
* Automatic feeder&lt;br /&gt;
* Balling mineral dosing&lt;br /&gt;
&lt;br /&gt;
The components of the control system are assembled in one [[control cabinet]].&lt;br /&gt;
&lt;br /&gt;
Aquarium-Control consists of the following SW systems:&lt;br /&gt;
* [[Control application]]&lt;br /&gt;
* [[Dynamic Webpage]]&lt;br /&gt;
* [[SQL database]]&lt;br /&gt;
* [https://play.google.com/store/apps/details?id=com.laimburggasse.aquariumcontroller Android application]&lt;br /&gt;
&lt;br /&gt;
The control application, the webpage and the SQL database are designed to run on a [https://www.raspberrypi.org Raspberry Pi].&lt;/div&gt;</summary>
		<author><name>Uwe</name></author>
	</entry>
	<entry>
		<id>http://laimburggasse.onthewifi.com/mediawiki/index.php?title=Calculation_of_refill_tank_content&amp;diff=120</id>
		<title>Calculation of refill tank content</title>
		<link rel="alternate" type="text/html" href="http://laimburggasse.onthewifi.com/mediawiki/index.php?title=Calculation_of_refill_tank_content&amp;diff=120"/>
		<updated>2023-02-20T13:51:28Z</updated>

		<summary type="html">&lt;p&gt;Uwe: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Based on the geometrical parameters of the tank and the distance from the lid of the tank to the water surface, the control system calculates the content of the refill tank.&lt;br /&gt;
&lt;br /&gt;
The calculation assumes that the refill tank has the geometry of a cuboid.&lt;br /&gt;
&lt;br /&gt;
The calculation is done in the [[SW component RefillTnkLvl]].&lt;br /&gt;
&lt;br /&gt;
[[File:RefillTankLevelChart.png|1200px]]&lt;br /&gt;
&lt;br /&gt;
The control application applies two filters:&lt;br /&gt;
* a low-pass filter (blue signal)&lt;br /&gt;
* a filter checking if the new value is within a permissible range compared to the low-pass filtered signal&lt;/div&gt;</summary>
		<author><name>Uwe</name></author>
	</entry>
	<entry>
		<id>http://laimburggasse.onthewifi.com/mediawiki/index.php?title=Calculation_of_refill_tank_content&amp;diff=119</id>
		<title>Calculation of refill tank content</title>
		<link rel="alternate" type="text/html" href="http://laimburggasse.onthewifi.com/mediawiki/index.php?title=Calculation_of_refill_tank_content&amp;diff=119"/>
		<updated>2023-02-20T13:51:14Z</updated>

		<summary type="html">&lt;p&gt;Uwe: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Based on the geometrical parameters of the tank and the distance from the lid of the tank to the water surface, the control system calculates the content of the refill tank.&lt;br /&gt;
&lt;br /&gt;
The calculation assumes that the refill tank has the geometry of a cuboid.&lt;br /&gt;
&lt;br /&gt;
The calculation is done in the [[SW component RefillTnkLvl]].&lt;br /&gt;
&lt;br /&gt;
[[File:RefillTankLevelChart.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
The control application applies two filters:&lt;br /&gt;
* a low-pass filter (blue signal)&lt;br /&gt;
* a filter checking if the new value is within a permissible range compared to the low-pass filtered signal&lt;/div&gt;</summary>
		<author><name>Uwe</name></author>
	</entry>
	<entry>
		<id>http://laimburggasse.onthewifi.com/mediawiki/index.php?title=Calculation_of_refill_tank_content&amp;diff=118</id>
		<title>Calculation of refill tank content</title>
		<link rel="alternate" type="text/html" href="http://laimburggasse.onthewifi.com/mediawiki/index.php?title=Calculation_of_refill_tank_content&amp;diff=118"/>
		<updated>2023-02-20T13:51:03Z</updated>

		<summary type="html">&lt;p&gt;Uwe: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Based on the geometrical parameters of the tank and the distance from the lid of the tank to the water surface, the control system calculates the content of the refill tank.&lt;br /&gt;
&lt;br /&gt;
The calculation assumes that the refill tank has the geometry of a cuboid.&lt;br /&gt;
&lt;br /&gt;
The calculation is done in the [[SW component RefillTnkLvl]].&lt;br /&gt;
&lt;br /&gt;
[[File:RefillTankLevelChart.png|600px]]&lt;br /&gt;
&lt;br /&gt;
The control application applies two filters:&lt;br /&gt;
* a low-pass filter (blue signal)&lt;br /&gt;
* a filter checking if the new value is within a permissible range compared to the low-pass filtered signal&lt;/div&gt;</summary>
		<author><name>Uwe</name></author>
	</entry>
	<entry>
		<id>http://laimburggasse.onthewifi.com/mediawiki/index.php?title=Calculation_of_refill_tank_content&amp;diff=117</id>
		<title>Calculation of refill tank content</title>
		<link rel="alternate" type="text/html" href="http://laimburggasse.onthewifi.com/mediawiki/index.php?title=Calculation_of_refill_tank_content&amp;diff=117"/>
		<updated>2023-02-20T13:50:53Z</updated>

		<summary type="html">&lt;p&gt;Uwe: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Based on the geometrical parameters of the tank and the distance from the lid of the tank to the water surface, the control system calculates the content of the refill tank.&lt;br /&gt;
&lt;br /&gt;
The calculation assumes that the refill tank has the geometry of a cuboid.&lt;br /&gt;
&lt;br /&gt;
The calculation is done in the [[SW component RefillTnkLvl]].&lt;br /&gt;
&lt;br /&gt;
[[File:RefillTankLevelChart.png|200px]]&lt;br /&gt;
&lt;br /&gt;
The control application applies two filters:&lt;br /&gt;
* a low-pass filter (blue signal)&lt;br /&gt;
* a filter checking if the new value is within a permissible range compared to the low-pass filtered signal&lt;/div&gt;</summary>
		<author><name>Uwe</name></author>
	</entry>
	<entry>
		<id>http://laimburggasse.onthewifi.com/mediawiki/index.php?title=Calculation_of_refill_tank_content&amp;diff=116</id>
		<title>Calculation of refill tank content</title>
		<link rel="alternate" type="text/html" href="http://laimburggasse.onthewifi.com/mediawiki/index.php?title=Calculation_of_refill_tank_content&amp;diff=116"/>
		<updated>2023-02-20T13:45:10Z</updated>

		<summary type="html">&lt;p&gt;Uwe: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Based on the geometrical parameters of the tank and the distance from the lid of the tank to the water surface, the control system calculates the content of the refill tank.&lt;br /&gt;
&lt;br /&gt;
The calculation assumes that the refill tank has the geometry of a cuboid.&lt;br /&gt;
&lt;br /&gt;
The calculation is done in the [[SW component RefillTnkLvl]].&lt;br /&gt;
&lt;br /&gt;
[[File:RefillTankLevelChart.png|thumb]]&lt;br /&gt;
&lt;br /&gt;
The control application applies two filters:&lt;br /&gt;
* a low-pass filter (blue signal)&lt;br /&gt;
* a filter checking if the new value is within a permissible range compared to the low-pass filtered signal&lt;/div&gt;</summary>
		<author><name>Uwe</name></author>
	</entry>
	<entry>
		<id>http://laimburggasse.onthewifi.com/mediawiki/index.php?title=File:RefillTankLevelChart.png&amp;diff=115</id>
		<title>File:RefillTankLevelChart.png</title>
		<link rel="alternate" type="text/html" href="http://laimburggasse.onthewifi.com/mediawiki/index.php?title=File:RefillTankLevelChart.png&amp;diff=115"/>
		<updated>2023-02-20T13:44:47Z</updated>

		<summary type="html">&lt;p&gt;Uwe: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Chart generated by the website showing the raw signal and the filtered signal of the refill tank level water volume&lt;/div&gt;</summary>
		<author><name>Uwe</name></author>
	</entry>
	<entry>
		<id>http://laimburggasse.onthewifi.com/mediawiki/index.php?title=Water_level_measurement&amp;diff=114</id>
		<title>Water level measurement</title>
		<link rel="alternate" type="text/html" href="http://laimburggasse.onthewifi.com/mediawiki/index.php?title=Water_level_measurement&amp;diff=114"/>
		<updated>2023-02-19T09:52:54Z</updated>

		<summary type="html">&lt;p&gt;Uwe: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==== Motivation ====&lt;br /&gt;
The measured water level is input for the calculation of the refill tank content.&lt;br /&gt;
In order not to contaminate the water, a contact-less measurement is preferred.&lt;br /&gt;
&lt;br /&gt;
==== Implementation ====&lt;br /&gt;
The control system uses a device which generates an ultrasonic sound and measures when the sound wave has travelled back from the water surface.&lt;br /&gt;
The SW system will record the time used for this travel and calculate the corresponding distance using the speed of sound.&lt;br /&gt;
[[File:Ultra Sonic Distance Sensor Installed On Top Of Refill Tank.png|thumb|Ultra Sonic Distance Sensor Installed On Top Of Refill Tank]]&lt;br /&gt;
&lt;br /&gt;
==== Hardware ====&lt;br /&gt;
The ultrasonic distance measurement device is sold with the commercial name [https://www.sparkfun.com/products/15569 HC-SR04].&lt;br /&gt;
The device has 4 pins:&lt;br /&gt;
* VCC: Supply voltage 5V&lt;br /&gt;
* GND&lt;br /&gt;
* TRIG: external trigger for sound wave&lt;br /&gt;
* ECHO: measurement of return of sound wave&lt;br /&gt;
&lt;br /&gt;
The device is connected to an Arduino Uno.&lt;br /&gt;
&lt;br /&gt;
The control logic is as following:&lt;br /&gt;
* The control system sets the TRIG channel to high.&lt;br /&gt;
* HC-SR04 sends an ultrasonic wave to the surface of the water tank and set the ECHO channel to high at the same time.&lt;br /&gt;
* The surface reflects the wave back towards the microphone of the HC-SR04.&lt;br /&gt;
* The HC-SRC04 sets the ECHO channel to low upon receiving the reflected wave.&lt;br /&gt;
&lt;br /&gt;
==== Software ====&lt;br /&gt;
The Arduino Uno measures the travel time of the Ultra Sonic Wave.&lt;br /&gt;
Arduino Uno and Raspberry Pi are connected via USB.&lt;br /&gt;
The control SW running on the Raspberry Pi&lt;br /&gt;
* reads the travel time of the wave in the [[SW Component ArdnIntrfc]].&lt;br /&gt;
* calculates the travel distance and a low-pass filtered version of this signal in the [[SW Component UltrSncDstncMsr]].&lt;br /&gt;
* calculates the corresponding water level of the refill tank in the [[SW Component RefillTnkLvl]].&lt;/div&gt;</summary>
		<author><name>Uwe</name></author>
	</entry>
	<entry>
		<id>http://laimburggasse.onthewifi.com/mediawiki/index.php?title=Calculation_of_refill_tank_content&amp;diff=113</id>
		<title>Calculation of refill tank content</title>
		<link rel="alternate" type="text/html" href="http://laimburggasse.onthewifi.com/mediawiki/index.php?title=Calculation_of_refill_tank_content&amp;diff=113"/>
		<updated>2023-02-19T09:42:26Z</updated>

		<summary type="html">&lt;p&gt;Uwe: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Based on the geometrical parameters of the tank and the distance from the lid of the tank to the water surface, the control system calculates the content of the refill tank.&lt;br /&gt;
&lt;br /&gt;
The calculation assumes that the refill tank has the geometry of a cuboid.&lt;br /&gt;
&lt;br /&gt;
The calculation is done in the [[SW component RefillTnkLvl]].&lt;br /&gt;
&lt;br /&gt;
The control application applies two filters:&lt;br /&gt;
- a low-pass filter (blue signal)&lt;br /&gt;
- a filter checking if the new value is within a permissible range compared to the low-pass filtered signal&lt;/div&gt;</summary>
		<author><name>Uwe</name></author>
	</entry>
	<entry>
		<id>http://laimburggasse.onthewifi.com/mediawiki/index.php?title=Relay_Board_Control&amp;diff=112</id>
		<title>Relay Board Control</title>
		<link rel="alternate" type="text/html" href="http://laimburggasse.onthewifi.com/mediawiki/index.php?title=Relay_Board_Control&amp;diff=112"/>
		<updated>2023-01-05T16:03:59Z</updated>

		<summary type="html">&lt;p&gt;Uwe: /* Monitoring and repair of relay board states */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The following components utilise the relay board:&lt;br /&gt;
* Refill Control: refilling of fresh water depending on water level&lt;br /&gt;
* Feeder Control: stopping flow pumps, skimmer and actuating the feeder&lt;br /&gt;
* Water Exchange Control: actuating the external pump for water exchange&lt;br /&gt;
* Balling Control: actuating the pumps for mineral dosing&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There are two requirements, which ask for a more sophisticated control of the relay board:&lt;br /&gt;
* The dosing of minerals needs to be as precise as possible.&lt;br /&gt;
* The communication with the board needs to be reinitialised and even reopened after certain periods of time.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The relay board control implements the following features:&lt;br /&gt;
* Low level communication via serial port to the board&lt;br /&gt;
* Watchdog for reading/writing to serial port&lt;br /&gt;
* HW functionality test before executing commands&lt;br /&gt;
* Monitoring and repair of relay board states&lt;br /&gt;
* Avoiding conflicting access to relay board&lt;br /&gt;
&lt;br /&gt;
== Low level communication via serial port ==&lt;br /&gt;
This functionality is implemented in &amp;lt;code&amp;gt;RlyBrdCtrl/RlyBrdCmd.c&amp;lt;/code&amp;gt;.&lt;br /&gt;
The communication follows the protocol laid out in the [https://asset.conrad.com/media10/add/160267/c1/-/gl/000197720ML02/bedienungsanleitung-197720-conrad-components-197720-relaiskarte-baustein-12-vdc-24-vdc.pdf user manual of the 197730/197730 relay boards].&lt;br /&gt;
&lt;br /&gt;
Every command consists of a sequence of 4 byte.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ command sequence for 197730/197720 relay boards&lt;br /&gt;
|-&lt;br /&gt;
! Byte # !! Content&lt;br /&gt;
|-&lt;br /&gt;
| 0 || command&lt;br /&gt;
|-&lt;br /&gt;
| 1 || board address&lt;br /&gt;
|-&lt;br /&gt;
| 2 || data&lt;br /&gt;
|-&lt;br /&gt;
| 3 || checksum&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The command can assume one of 8 values, whereby the controller only uses a subset of these:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ commands used for control of 197730/197720 relay boards&lt;br /&gt;
|-&lt;br /&gt;
! command # !! Meaning !! byte 0 value in board response&lt;br /&gt;
|-&lt;br /&gt;
| 1 || initialisation || 254&lt;br /&gt;
|-&lt;br /&gt;
| 2 || get relay states || 253&lt;br /&gt;
|-&lt;br /&gt;
| 6 || switch on relay || 249&lt;br /&gt;
|-&lt;br /&gt;
| 7 || switch off relay || 248&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The relay boards offer functionality to connect multiple boards in a bus system.&lt;br /&gt;
Therefore, the commands have to specify an address to identify the board for which the command is issued.&lt;br /&gt;
The aquarium controller does not use this functionality. Low voltage board and high voltage board are connected via separate USB connections.&lt;br /&gt;
Hence, address is always set to one.&lt;br /&gt;
&lt;br /&gt;
The checksum is computed as XOR of byte 0, 1 and 2.&lt;br /&gt;
&lt;br /&gt;
The low level communication is done using one of two functions inside &amp;lt;code&amp;gt;RlyBrdCmd.c&amp;lt;/code&amp;gt;.&lt;br /&gt;
* &amp;lt;code&amp;gt;RlyBrdInitCom&amp;lt;/code&amp;gt; for initialisation of the communication&lt;br /&gt;
* &amp;lt;code&amp;gt;RlyBrdCmd&amp;lt;/code&amp;gt; for sending commands to the boards&lt;br /&gt;
&lt;br /&gt;
Both commands use the semaphore &amp;lt;code&amp;gt;mutexRlyBrd&amp;lt;/code&amp;gt; to guarantee exclusive access to the devices.&lt;br /&gt;
Both commands check the length of the response from the board and issue an error if the length is not as expected.&lt;br /&gt;
&lt;br /&gt;
During the initialisation, the board responds an 8 byte sequence which seems to correspond to the SW version. Information regarding this sequence could not be found inside the user manual.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ initialisation response for 197730/197720 relay boards&lt;br /&gt;
|-&lt;br /&gt;
! Byte #!! 0 !! 1 !! 2 !! 3 !! 4 !! 5 !! 6 !! 7&lt;br /&gt;
|-&lt;br /&gt;
| Value || 0xfe || 0x01 || 0x0b || 0xf4 || 0x01 || 0x02 || 0x0b || 0x08&lt;br /&gt;
|}&lt;br /&gt;
The command &amp;lt;code&amp;gt;RlyBrdInitCom&amp;lt;/code&amp;gt; checks if the relay board responds with this sequence.&lt;br /&gt;
&lt;br /&gt;
The command &amp;lt;code&amp;gt;RlyBrdCmd&amp;lt;/code&amp;gt; checks the checksum of the board's response.&lt;br /&gt;
Additionally, the function checks the response of the relay board.&lt;br /&gt;
The response of the relay board sporadically deviates from the response defined in the user manual.&lt;br /&gt;
Specified is a response which can be computed as &amp;lt;code&amp;gt;255 - command #&amp;lt;/code&amp;gt;.&lt;br /&gt;
After some time of operation the board changes to responding with &amp;lt;code&amp;gt; command #&amp;lt;/code&amp;gt;.&lt;br /&gt;
After some more time of operation, the board may change back to the specified response.&lt;br /&gt;
The control adapts to this toggling response behaviour.&lt;br /&gt;
Expected response is computed accordingly. Each byte of the board's response is checked.&lt;br /&gt;
&lt;br /&gt;
== Watchdog for reading/writing to serial port ==&lt;br /&gt;
This functionality is implemented in &amp;lt;code&amp;gt;RlyBrdCtrl/RlyBrdWtchDg.c&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
For communication with the relay boards, the application uses read and write instructions which may block the control flow at these points if the operation does not terminate.&lt;br /&gt;
&lt;br /&gt;
In order to detect such events, a separate thread &amp;lt;code&amp;gt;RlyBrdRdWrWtchDgThread&amp;lt;/code&amp;gt; monitors the duration of the read/write operations.&lt;br /&gt;
The flag monitors how long certain flags are &amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt;:&lt;br /&gt;
* &amp;lt;code&amp;gt;RBC_Get_flgRlyBrdRdStarting&amp;lt;/code&amp;gt; provides the flag for monitoring read operations.&lt;br /&gt;
* &amp;lt;code&amp;gt;RBC_Get_flgRlyBrdWrStarting&amp;lt;/code&amp;gt; provides the flag for monitoring write operations.&lt;br /&gt;
&lt;br /&gt;
The flags are set to &amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt; directly before the read/write operation and they are set to &amp;lt;code&amp;gt;false&amp;lt;/code&amp;gt; directly after the operation.&lt;br /&gt;
&lt;br /&gt;
The watch dog thread increases a counter for each second the read/write operation takes. When the counter exceeds the threshold &amp;lt;/code&amp;gt;RLYBRD_RD_WR_WTCHDG_MAX_T&amp;lt;/code&amp;gt;, the thread issues a log file entry, forces flushing of file buffers via &amp;lt;code&amp;gt;sync();&amp;lt;/code&amp;gt; and initiates a reboot of the device using &amp;lt;code&amp;gt;reboot(RB_AUTOBOOT);&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== HW functionality test ==&lt;br /&gt;
This functionality is implemented in &amp;lt;code&amp;gt;RlyBrdCtrl/RlyBrdFdbck.c&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The control system connects a voltage input through one relay of each board to a GPIO pin of the Raspberry Pi.&lt;br /&gt;
&lt;br /&gt;
By measuring the GPIO pin state, the control system can determine if the opening/closing of the relay really happened instead of just relying on the feedback of each board.&lt;br /&gt;
&lt;br /&gt;
The feedback test evaluates three steps:&lt;br /&gt;
# Starting with an open relay, check if GPIO state is &amp;lt;code&amp;gt;FALSE&amp;lt;/code&amp;gt;&lt;br /&gt;
# Closing the relay, check if GPIO state is &amp;lt;code&amp;gt;TRUE&amp;lt;/code&amp;gt;&lt;br /&gt;
# Opening the relay, check if GPIO state is &amp;lt;code&amp;gt;FALSE&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The feedback test executed before relay switching sequences (e.g. feeding pattern, Balling dosing, ...) and in regular time intervals (every 30min).&lt;br /&gt;
&lt;br /&gt;
== Monitoring and repair of relay board states ==&lt;br /&gt;
This functionality is implemented in &amp;lt;code&amp;gt;RlyBrdCtrl/RlyBrdMidLay.c&amp;lt;/code&amp;gt;.&lt;br /&gt;
This middle layer component was introduced to record the commanded states and acquire the state information responded by the relay boards.&lt;br /&gt;
Except for initialisation and shutdown, the low level communication with the board passes through this component.&lt;br /&gt;
The function &amp;lt;code&amp;gt;RlyBrdChckStates&amp;lt;/code&amp;gt; inside this component compares the commanded and the responded state.&lt;br /&gt;
In case of differences, the function &amp;lt;code&amp;gt;RlyBrdRepairStates&amp;lt;/code&amp;gt; issues commands to the related relay board in order to reestablish the previously commanded state.&lt;br /&gt;
Both functions are called every minute from &amp;lt;code&amp;gt;RlyBrdChckStateThread&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Avoiding conflicting access to relay board ==&lt;br /&gt;
This functionality is implemented in &amp;lt;code&amp;gt;RlyBrdCtrl/RlyBrdHiLay.c&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Mutual exclusion is implemented using the semaphore &amp;lt;code&amp;gt;mutRlyBrdSchdlr&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The semaphore is used only by the function &amp;lt;code&amp;gt;RlyBrdSchdlr&amp;lt;/code&amp;gt;.&lt;br /&gt;
This function is the central gateway for all other components to initiate usage of the relay board.&lt;br /&gt;
It shall give control of the relay board to a calling component so that the calling component can execute a sequence of commands which shall not be interrupted. &lt;br /&gt;
&lt;br /&gt;
The function uses two callbacks which are provided via argument and a label informing which component is using the relay board:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;RlyBrdSchdlr (int TestFunc(void), void ExecFunc(void), char *lbl)&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The first callback function (&amp;lt;code&amp;gt;TestFunc&amp;lt;/code&amp;gt;) allows the calling component to determine specifically which tests needs to be carried out before the relay board can be used.&lt;br /&gt;
For example, the Balling dosing only needs to actuate the low voltage relay board while the feeder control only actuates the high voltage relay board.&lt;br /&gt;
&lt;br /&gt;
In case the test function fails, there are two recovery strategies:&lt;br /&gt;
# The communication with the relay board is reinitialised sending the related command. The test function is called again.&lt;br /&gt;
# If the test function fails again, the serial device is reopened. The test function is called again.&lt;br /&gt;
&lt;br /&gt;
The second callback function (&amp;lt;code&amp;gt;ExecFunc&amp;lt;/code&amp;gt;) gives control to the calling component for execution of the sequence.&lt;br /&gt;
Execution is only triggered if one call of the test function returned with a successful result.&lt;/div&gt;</summary>
		<author><name>Uwe</name></author>
	</entry>
</feed>