Configuration - ST Tracker

Go to content

Main menu:

Configuration:
  • To allow the connection between the Raspberry Pi and the attached devices, it was necessary to enable the I2C bus. For this purpose, the command sudo raspi-config was executed from the terminal and Interfacing options was selected from the displayed menu.

  • By default the RTC module and the accelerometer use the same address (0x68) of the I2C bus number 1, creating a conflict. So it was necessary to enable the I2C bus number 3 between pins 23 and 24 to which the accelerometer is connected. Therefore the line dtoverlay=12c-gpio,bus=3,i2c_gpio_sda=23,i2c_gpio_scl=24 was added to the /boot/config.txt file.

Device
I2C Bus Address
UPS HAT V1.1
10x36
RTC DS3231
10x68
MPU6050
3
0x68

  • For correct operation of the RTC DS3231 module, the following procedure must be followed:
    1. Add to /boot/config.txt file the line dtoverlay=i2c-rtc ds3231;
    2. Restart the Raspberry;
    3. Run the following commands in order:
      sudo apt-get -y remove fake-hwclock
      sudo update-rc.d -f fake-hwclock remove
      sudo systemctl disable fake-hwclock
    4. In the /lib/udev/hwclock-set file, comment out the following lines:
      #if [ -e /run/systemd/system ] ; then
      #  exit 0
      #fi

      #/sbin/hwclock --rtc=$dev --systz --badyear

      #/sbin/hwclock --rtc=$dev --systz
    5. Restart the Raspberry;
    6. Run the following commands in order:
      sudo hwclock -w
      sudo hwclock -r
      sudo hwclock -s

  • LAMP platform configuration:
1. Run the following commands in order:
sudo apt install apache2
sudo apt install php
sudo apt install mariadb-server
sudo mysql_secure_installation
sudo apt install phpmyadmin
sudo apt install python-mysqldb
2. In the /etc/apache2/apache2.conf file add include /etc/phpmyadmin/apache.conf;
3. From the browser, access localhost/phpmyadmin with the username and password set in the mySQL platform configuration and create the database.
4. Add the tables to the database:
create table today_time (activity int not null,
start datetime primary key,
end datetime not null,
check(activity>=1 and activity<=8));
create table daily_activities (data date primary key,
act1 time not null,
act2 time not null,
act3 time not null,
act4 time not null,
act5 time not null,
act6 time not null,
act7 time not null,
act8 time not null);
create table battery_status ( voltage float, percentage int);

  • Load the web application to the /var/www/html/ directory and provide the necessary permissions with the command sudo chmod -R 777 /var/www;

  • To run the Python script at startup, you need to add the command to the /etc/rc.local file before the exit 0 line.
Università degli studi di Udine
Dipartimento politecnico di ingegneria e architettura
Designed by Riccardo Deana & Pierluigi Fabbro
Back to content | Back to main menu