https://github.com/mariolpantunes/rpi_iot
Example code used at the 11th of November 2021 workshop.
https://github.com/mariolpantunes/rpi_iot
adafruit iot mqtt python rpi
Last synced: about 1 month ago
JSON representation
Example code used at the 11th of November 2021 workshop.
- Host: GitHub
- URL: https://github.com/mariolpantunes/rpi_iot
- Owner: mariolpantunes
- License: mit
- Created: 2021-11-11T14:15:38.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2021-11-22T14:52:15.000Z (over 4 years ago)
- Last Synced: 2025-09-12T22:27:43.205Z (10 months ago)
- Topics: adafruit, iot, mqtt, python, rpi
- Language: Python
- Homepage:
- Size: 1.2 MB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# IoT (RPI)
Example code used at the 25th of November 2021 workshop (slides [here](presentation/Internet-of-cheap-Things.pdf)).
# Usage
1. Install the git client and clone this repository
```bash
sudo apt install git
mkdir ~/git
cd ~/git
git clone https://github.com/mariolpantunes/rpi_iot.git
```
2. Install Mosquitto (MQTT broker)
```bash
sudo apt install mosquitto mosquitto-clients
```
3. Stop the broker and edit the configuration file
```bash
sudo systemctl stop mosquitto
sudo nano /etc/mosquitto/mosquitto.conf
```
4. Add the following lines:
```
allow_anonymous true
listener 1883 0.0.0.0
listener 9001 0.0.0.0
protocol websockets
```
5. Restart the broker
```bash
sudo systemctl start mosquitto
```
6. Install nginx to display the webpage
```
sudo apt install nginx-light
cd /var/www/html/
sudo ln -s /home/pi/git/rpi_iot/web/index.html index.html
```
7. Create a virtual enviroment and run the code
```bash
cd ~/git/rpi_iot/
python3 -m venv venv
source venv/bin/activate
CFLAGS="-fcommon" pip install -r rpi/requirements.txt
python rpi/main.py
```
8. Explore the MQTT messages with the application [MQTT5-Explorer](https://github.com/Omniaevo/mqtt5-explorer)
## Authors
* **Mário Antunes** - [mariolpantunes](https://github.com/mariolpantunes)
## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details