diff options
author | Shantur Rathore <[email protected]> | 2021-08-13 23:14:22 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2021-08-14 01:14:22 +0300 |
commit | e4903c5184c142d184937c7395a74a5639d7e4c3 (patch) | |
tree | 71f08f87a855a8fd18419ed2c106888160b307ee /testenv | |
parent | 8ea5aa1a1fa55735c033034cf693aef3c46280a6 (diff) |
Implement button push using servo motors controlled via pwm (#55)
1. Add to /boot/config.txt
```
dtoverlay=pwm
```
2. Create /etc/udev/rules.d/99-kvmd-pwm.rules
```
SUBSYSTEM=="pwm*", ACTION=="add", RUN+="/bin/chgrp -R kvmd /sys%p", RUN+="/bin/chmod -R g=u /sys%p"
SUBSYSTEM=="pwm*", ACTION=="change", ENV{TRIGGER}!="none", RUN+="/bin/chgrp -R kvmd /sys%p", RUN+="/bin/chmod -R g=u /sys%p"
```
3. Connect Servo motor like SG90 PWM connection to RPi GPIO18, +5V and GND to a 5V and GND pin on header
4. Add to /etc/kvmd/override.yaml
```
kvmd:
gpio:
drivers:
servo1:
type: pwm
pwm_chip: 0 # PWM Chip Number
pwm_period: 20000000 # Servo Motor SG90 Period in nano-seconds
duty_cycle_push: 1500000 # Servo Motor SG90 duty_cycle for pushing button
duty_cycle_release: 1000000 # Servo Motor SG90 duty_cycle for releasing button
scheme:
short_press:
driver: servo1
pin: 0 # Pin number is the PWM channel number on the PWM Chip
mode: output
switch: false
pulse:
delay: 0.5
max_delay: 2
long_press:
driver: servo1
pin: 0 # Pin number is the PWM channel number on the PWM Chip
mode: output
switch: false
pulse:
delay: 2
max_delay: 2
extra_long_press:
driver: servo1
pin: 0 # Pin number is the PWM channel number on the PWM Chip
mode: output
switch: false
pulse:
delay: 10
max_delay: 20
view:
header:
title: Controls
table:
- ["#Servo - Short Press", "short_press|Press"]
- ["#Servo - Long Press", "long_press|Press"]
- ["#Servo - Extra Long Press", "extra_long_press|Press"]
```
Diffstat (limited to 'testenv')
-rw-r--r-- | testenv/Dockerfile | 1 | ||||
-rw-r--r-- | testenv/linters/vulture-wl.py | 2 |
2 files changed, 3 insertions, 0 deletions
diff --git a/testenv/Dockerfile b/testenv/Dockerfile index 5e8b2a79..0f3d3bfd 100644 --- a/testenv/Dockerfile +++ b/testenv/Dockerfile @@ -23,6 +23,7 @@ RUN pacman -Syu --noconfirm \ python-yaml \ python-aiohttp \ python-aiofiles \ + python-periphery \ python-passlib \ python-pyserial \ python-setproctitle \ diff --git a/testenv/linters/vulture-wl.py b/testenv/linters/vulture-wl.py index 1074a689..a3013aa5 100644 --- a/testenv/linters/vulture-wl.py +++ b/testenv/linters/vulture-wl.py @@ -40,3 +40,5 @@ _Netcfg.net_mask _Netcfg.dhcp_option_3 _ScriptWriter.get_args + +_pwm.period_ns
\ No newline at end of file |