Setting Up the Raspberry Pi from Scratch

This page gives a step-by-step guide on how to install the libraries for your Raspberry Pi to run the gateway software.

Important Note

The following commands are ones that I had taken out of my lab notebook for when I was installing packages. The commands in this tutorial are the ones that I made comments about working in my notebook, however since I do not have a spare Raspberry Pi to try on my own, there is a chance that further troubleshooting will be required. Where appropriate, I have included links that I used to find the appropriate commands and packages in hopes that they will help you, if you need to troubleshoot.

QT Designer

The following commands should get QT5 Creator (which includes Designer) up and running on your Pi. This software is useful to design the layout of the GUI visually, and then after importing the .ui file that it creates, you can add in functionality in Python to the widgets.

sudo apt-get update
sudo apt-get install qtcreator
sudo apt-get install qt5-default pyqt5-dev-tools

Note that the last command will take a long time to install.

To test this code, open a new Python window in your Python IDE (Thonny is the default) and see if you can get a simple window.

PyQt5.png.webp
from PyQt5.QtWidgets import QApplication, QMainWindow
import sys
 
class Window(QMainWindow):
   def __init__(self):
       super().__init__()
 
       self.setGeometry(300, 300, 600, 400)
       self.setWindowTitle("PyQt5 window")
       self.show()
 
app = QApplication(sys.argv)
window = Window()
sys.exit(app.exec_())

References

SQL

To install the MariaDB package:

sudo apt install mariadb-server

You can test this by immediately creating a database called "SSMachMo_test" (or whatever you like, but write down the name to change the GUI code) and then use this tutorial to create all the tables that you will need for your GUI.

References

Bluetooth Packages

To install Bluez 5.50, the C library that handles the communication with your Bluetooth peripheral: (note - this updates fairly often, there might be a new version by now)

wget http://www.kernel.org/pub/linux/bluetooth/bluez-5.50.tar.xz 
tar xvf bluez-5.50.tar.xz

Next, to install Bluepy, the Python wrapper that we'll use in the GUI:

sudo apt-get install python3-pip libglib2.0-dev
sudo pip3 install bluepy

During this step, I was able to use the package, but I was getting the error "BTLEManagementError: Failed to execute management command 'le on'". To solve this, I used this command (which I recommend you use now, replacing the path name where appropriate):

sudo setcap 'cap_net_raw,cap_net_admin+eip' PATH/TO/LIB/python3.5/site-packages/bluepy/bluepy-helper

References

Gateway Code

Both the gateway and the processor repos are set to Private on Github, so you will need to email me (Magdalena) for access. You should be able to find my email either from the school address book or by asking Patrick. You can also message me on Teams.

Here is the link to the gateway code (that you will have to clone through Git) - you will not be able to access it until I have shared it with your Github account. https://github.com/revvyrouser/SSMachMo_gateway

See Also

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License