A universal python library for GPIO control using Radxa PCBs.
Note
Version 1.0 is almost here!
This will include pin toggle, and reading pin input values (Read was moved to Version 2.0, as it is deprecated on the SYSfs interface), with support for all Rock 4-Series models. This will use the SYSfs innerface.
If you want your device to be next, contact me and I will make sure to add it to the next version!
Important
For any bugs found, please open an issue here on github.
Optionally, contact me by pinging @lukaspalm
in the radxa discord server, or by sending a DM on discord.
🔴 - Not started
🟡 - Work in progress
🟢 - Done and ready to use
Feature/Device | X2L |
---|---|
Pinouts | 🟡 |
16x2 LCD Display | 🔴 |
Individual pin on/off | 🔴 |
Individual pin read input | 🔴 |
Servo-Motor | 🔴 |
Stepper-Motor | 🔴 |
Motion Detector | 🔴 |
Keypad (link) | 🔴 |
Ultrasonic Sensor (HC-SR04) | 🔴 |
Feature/Device | Rock Pi E |
---|---|
Pinouts | 🟡 |
16x2 LCD Display | 🔴 |
Individual pin on/off | 🔴 |
Individual pin read input | 🔴 |
Servo-Motor | 🔴 |
Stepper-Motor | 🔴 |
Motion Detector | 🔴 |
Keypad (link) | 🔴 |
Ultrasonic Sensor (HC-SR04) | 🔴 |
Feature/Device | Zero | Zero 2 Pro | Zero 3E | Zero 3W |
---|---|---|---|---|
Pinouts | 🟡 | 🟡 | 🟡 | 🟡 |
16x2 LCD Display | 🔴 | 🔴 | 🔴 | 🔴 |
Individual pin on/off | 🔴 | 🔴 | 🔴 | 🔴 |
Individual pin read input | 🔴 | 🔴 | 🔴 | 🔴 |
Servo-Motor | 🔴 | 🔴 | 🔴 | 🔴 |
Stepper-Motor | 🔴 | 🔴 | 🔴 | 🔴 |
Motion Detector | 🔴 | 🔴 | 🔴 | 🔴 |
Keypad (link) | 🔴 | 🔴 | 🔴 | 🔴 |
Ultrasonic Sensor (HC-SR04) | 🔴 | 🔴 | 🔴 | 🔴 |
Feature/Device | Rock Pi S | Rock S0 |
---|---|---|
Pinouts | 🟡 | 🟡 |
16x2 LCD Display | 🔴 | 🔴 |
Individual pin on/off | 🔴 | 🔴 |
Individual pin read input | 🔴 | 🔴 |
Servo-Motor | 🔴 | 🔴 |
Stepper-Motor | 🔴 | 🔴 |
Motion Detector | 🔴 | 🔴 |
Keypad (link) | 🔴 | 🔴 |
Ultrasonic Sensor (HC-SR04) | 🔴 | 🔴 |
Feature/Device | Rock 3A | Rock 3B | Rock 3C |
---|---|---|---|
Pinouts | 🟡 | 🟡 | 🟡 |
Camera RPI v1.3 | 🟢 | N/A | 🟢 |
16x2 LCD Display | 🔴 | 🔴 | 🔴 |
Individual pin on/off | 🔴 | 🔴 | 🔴 |
Individual pin read input | 🔴 | 🔴 | 🔴 |
Servo-Motor | 🔴 | 🔴 | 🔴 |
Stepper-Motor | 🔴 | 🔴 | 🔴 |
Motion Detector | 🔴 | 🔴 | 🔴 |
Keypad (link) | 🔴 | 🔴 | 🔴 |
Ultrasonic Sensor (HC-SR04) | 🔴 | 🔴 | 🔴 |
Feature/Device | Rock 4SE | Rock 4A | Rock 4A+ | Rock 4B | Rock 4B+ | Rock 4C+ |
---|---|---|---|---|---|---|
Pinouts | 🟢 | 🟢 | 🟢 | 🟢 | 🟢 | 🟢 |
Camera RPI v1.3 | 🟢 | 🟢 | 🟢 | 🟢 | 🟢 | N/A |
16x2 LCD Display | 🟡 | 🟡 | 🟡 | 🟡 | 🟡 | 🟡 |
Individual pin on/off | 🟢 | 🟢 | 🟢 | 🟢 | 🟢 | 🟢 |
Individual pin read input | 🟡 | 🟡 | 🟡 | 🟡 | 🟡 | 🟡 |
Servo-Motor | 🔴 | 🔴 | 🔴 | 🔴 | 🔴 | 🔴 |
Stepper-Motor | 🔴 | 🔴 | 🔴 | 🔴 | 🔴 | 🔴 |
Motion Detector | 🔴 | 🔴 | 🔴 | 🔴 | 🔴 | 🔴 |
Keypad (link) | 🔴 | 🔴 | 🔴 | 🔴 | 🔴 | 🔴 |
Ultrasonic Sensor (HC-SR04) | 🔴 | 🔴 | 🔴 | 🔴 | 🔴 | 🔴 |
Feature/Device | Rock 5A | Rock 5B |
---|---|---|
Pinouts | 🟡 | 🟡 |
16x2 LCD Display | 🔴 | 🔴 |
Individual pin on/off | 🔴 | 🔴 |
Individual pin read input | 🔴 | 🔴 |
Servo-Motor | 🔴 | 🔴 |
Stepper-Motor | 🔴 | 🔴 |
Motion Detector | 🔴 | 🔴 |
Keypad (link) | 🔴 | 🔴 |
Ultrasonic Sensor (HC-SR04) | 🔴 | 🔴 |
Warning
This library does not yet exist on pypi, as this is a work in progress.
The code may not be complete. Wait for release, or do debugging yourself.
You will need python3-dev
, on Debian/Ubuntu. You can install this with:
sudo apt install python3-dev
Use the package manager pip to install rocklib.
pip install rocklib
Camera
from rocklib import camera
# Replace picture.png with your outfile name
# Replace /dev/video0 with your video device
camera.takePicture(out="picture.jpg", device="/dev/video0")
Pin Toggle
from rocklib import pins, pinouts
# Example for Rock Pi 4-Series
# Initialize the GPIO pinout for Rock 4-series
pins.initialize(pinouts.ROCK4)
# Set pin 22 to value 1. Now pin 22 will be HIGH
pins.setPin(22, 1)
# Set pin 22 to value 0. Now pin 22 will be LOW
pins.setPin(22, 0)
More coming soon...
- Pinouts for all versions
- Pin-control without depending on gpiod
- Finding members of the community for testing on new versions
- Pin control with SYSfs innerface
You can wish devices that I will add support for, if it does not already exist. View the list of supported devices.
Contact me by pinging me in the Radxa discord server @lukaspalm
, or by sending me a DM on discord.