This project provides an EPICS (Experimental Physics and Industrial Control System) interface for controlling and monitoring GPIO pins, I2C devices, and UART communication on a Raspberry Pi. The project uses the
softioc
library to create EPICS records and the gpiozero
library to interact with GPIO pins.
- GPIO Control: Control and monitor GPIO pins using EPICS records.
- I2C Communication: Interact with I2C devices using EPICS records.
- UART Communication: Configure and send data over UART using EPICS records.
- Phoebus Interface: Generate a Phoebus interface file for easy visualization and control.
- Python 3.12 or higher
softioc
librarygpiozero
librarysmbus
libraryserial
librarycothread
librarynetifaces
libraryphoebusgen
library
-
Clone the repository:
git clone https://github.com/konosubakonoakua/impcas-ioc-rpi-io-phoebus.git cd impcas-ioc-rpi-io-phoebus
-
Create a virtual environment:
mkdir -p ~/.virtualenvs cd ~/.virutalenvs python3 -m venv ioc source ~/.virtualenvs/ioc/bin/activate
-
Install dependencies:
pip install -r requirements.txt
The script will automatically generate a Phoebus interface file (rpi_io.bob
) if it does not already exist.
chmod +x ./ioc_softioc.py
APPNAME="IO" DEBUG=True PREFIX="rpi:io" PHOEBUS_INTERFACE_FILE="rpi_io.bob" ./ioc_softioc.py
The GPIO pins are configured in the gpio_pins
dictionary. Each pin is mapped to a gpiozero.LED
object. You can modify this dictionary to add or remove GPIO pins as needed.
The I2C devices are detected automatically by scanning the I2C bus. The detected devices are stored in the i2c_devices
dictionary. You can modify the I2C address range in the i2c_devices
loop.
The UART configuration is set using EPICS records. You can modify the initial values for the UART port, baud rate, and timeout in the records
dictionary.
This project is licensed under the MIT License. See the LICENSE file for more details.