Skip to content

datajango/self2023_iot

Repository files navigation

self2023_iot

SELF 2023

Block Diagram

Raspberry PI Machine

  • Hardware

    • Raspberry PI-4B 8GB
    • SanDisk Extreme Pro microSDHC UHS-I Card, 32 GB
  • Operating System

    • Raspbian GNU/Linux 11 (bullseye) 32-bit Edition
  • Software

    • MS Visual Studio Code
      • Installs using Recommended Software
    • gnome-screenshot
      • sudo apt install gnome-screenshot
    • git was preinstalled on Raspberry PI OS Rasbian 11

Git Setup

Repo

Mosquitto Setup

  1. Update your package list: First, it's always a good idea to update your package list before installing any new software. This ensures that you'll get the latest available version. You can update your package list with the following command:
sudo apt update
  1. Install Mosquitto: You can install the Mosquitto broker with the following command:
sudo apt install -y mosquitto mosquitto-clients
  1. Start and enable Mosquitto service: You'll want to configure Mosquitto to start on boot. You can do this with the following commands:
sudo systemctl enable mosquitto.service
sudo systemctl start mosquitto.service
  1. Test the broker: To test if your broker is working, you can subscribe to a topic in one terminal window, and then publish to that topic in another terminal window. Here are the commands you can use to do that:

In one terminal window, enter:

mosquitto_sub -h localhost -t "test/topic"

And in another terminal window, enter:

mosquitto_pub -h localhost -t "test/topic" -m "Hello, World!"

You should see Hello, World! printed in the first terminal window. This means that the broker is successfully relaying messages between the publisher and subscriber.

Setup Python

  1. Create the virtual environment. You do this with the python3 -m venv command, followed by the name of the virtual environment.
python -m venv .venv
  1. Activate the virtual environment.
source .venv/bin/activate
  1. You can use the pip install -r command to install all the packages listed in the requirements file. For example:
pip install attrdict

pip install -r requirements.txt
  • on Unbunto 22.04
pip install -U -f https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-22.04/ wxPython

Update May 29. 2023

  1. Install Python 3.9.2
pyenv install 3.9.2
  1. Set the local version of Python to 3.9.2
pyenv local 3.9.2
  1. Create the virtual environment. You do this with the python3 -m venv command, followed by the name of the virtual environment.
 pyenv exec python -m venv .venv
  1. Activate the virtual environment. (Windows running bash)
source .venv/Scripts/activate
  1. You can use the pip install -r command to install all the packages listed in the requirements file. For example:
pip install -r requirements.txt

Testing with MQTT Explorer

  1. First, you can grab MQTT Explorer from the MQTT Explorer website.
  2. Next, you can install MQTT Explorer by unzipping the downloaded file and running the executable.
  3. Once you have MQTT Explorer installed, you can open it up and connect to your broker. You can do this by clicking the Add Connection button in the top left corner of the window.
  4. Here is a sample of the MQTT Explorer window.
  5. Next you can use MQTT Explorer to subscribe to the test/topic topic. You can do this by clicking the Subscribe button in the top left corner of the window.
  6. After this you can publish a message to the test/topic topic. You can do this by clicking the Publish button in the top left corner of the window.

About

SELF 2023, IOT, MQTT, Raspberry PI, ESP32

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published