This repository contains a generic software base for Raspberry Pi Pico (and compatible microcontrollers) used in IoT projects for the academic year 2024. It is designed to be modular, extensible, and easy to adapt for various sensor, actuator, and communication scenarios.
This project provides a flexible foundation for developing IoT applications on the Raspberry Pi Pico platform using MicroPython. It includes drivers for common sensors, MQTT communication, WiFi management, and a structured approach to device state and lifecycle management.
- Modular Sensor Support: Easily add and manage sensors (e.g., gas, temperature, humidity)
- MQTT Communication: Built-in support for MQTT messaging
- WiFi Management: Simple WiFi connection and reconnection logic
- Device State & Lifecycle: Robust state management for reliable operation
- Extensible Architecture: Add your own sensors, actuators, and logic
generic-pico-sw/
├── bsp/ # Board support package (power, watchdog, etc.)
├── config/ # Configuration files (JSON)
├── lib/ # External libraries (e.g., umqtt)
├── my/ # User scripts, experiments, and tests
├── src/ # Main application source code
│ ├── app.py # Application entry point
│ ├── main.py # Main loop/initialization
│ ├── communication/ # MQTT and WiFi managers
│ ├── control/ # Device state, error handling, lifecycle
│ ├── sensors/ # Sensor drivers and management
│ └── utils/ # Utilities (config, logging, etc.)
└── README.md # Project documentation
- Environmental Monitoring: Collect data from gas, temperature, and humidity sensors and publish via MQTT
- Remote Device Control: Manage actuators or relays based on sensor input and remote commands
- Educational Projects: Use as a base for coursework or prototyping new IoT ideas
- Object-Oriented Design: Sensor and device abstraction
- Event-Driven Programming: State and lifecycle management
- Configuration Management: JSON-based config for easy deployment
- Network Communication: MQTT and WiFi integration
- Language: MicroPython / Python 3 (for Pico)
- Hardware: Raspberry Pi Pico (or compatible)
- Protocols: MQTT, WiFi
- Raspberry Pi Pico (or compatible board)
- MicroPython firmware installed
- MQTT broker (e.g., Mosquitto)
- WiFi network credentials
- Clone this repository:
git clone <repo-url> cd generic-pico-sw
- Edit
config/config.jsonwith your WiFi and MQTT settings. - Copy the contents to your Pico (using Thonny, ampy, or similar tools).
- Run
src/main.pyorsrc/app.pyas your entry point.
- Open
src/main.pyin Thonny and click Run. - Monitor output via serial console.
- Add new sensors in
src/sensors/and register them insensor_manager.py. - Implement custom logic in
src/app.pyor create new scripts inmy/. - Adjust configuration in
config/config.json.
This repository is licensed under the MIT License. You are free to use, modify, and distribute the code for educational and non-commercial purposes. See the LICENSE file for details.