This is the app that runs on the Raspberry Pi. The app is broken into modular "AppComponents", each in their own folder.
As of the latest setup, you do not need to manually start the backend.
When the Raspberry Pi boots:
- The backend app is automatically updated if connected to the internet (pulls the latest version from the
main
branch). - The app is executed as a systemd service.
- A Wi-Fi hotspot is started with the following credentials:
- SSID:
Magpi
- Password:
magmattic2025
- SSID:
- If connected to the Pi’s hotspot, the Pi is accessible at:
http://magpi.local
- Python 3.10 or higher
- Recommended: virtual environment (venv, conda, etc.)
- Install dependencies:
pip install -r requirements.txt
Use the following command to run the app:
python main.py [options]
You can configure which components to run via the following arguments:
-
--dev
: Enables development mode- Defaults to
VirtualMotorComponent
,VirtualADCComponent
, and disables the physical UI (PUI)
- Defaults to
-
--adc-mode [none|virtual|piplate]
: Overrides the ADC configuration -
--motor-mode [virtual|physical]
: Overrides the motor configuration -
--pui-mode [enable|disable]
: Enables/disables the physical user interface
Mode | Motor | ADC | PUI |
---|---|---|---|
None | Physical | None (wireless) | Enabled |
--dev |
Virtual | Virtual | Disabled |
With Flags | As specified | As specified | As specified |
Examples:
# Run in production mode with all physical components
python main.py
# Run in dev mode with all virtual components
python main.py --dev
# Run with physical motor, virtual ADC, and disable the UI
python main.py --motor-mode physical --adc-mode virtual --pui-mode disable
If you are not using magpi.local
, you can still find the Pi's IP address.
ifconfig
ipconfig