mirror of https://github.com/pikvm/pikvm.git
				
				
				
			add v4-mini pwm and servo docs (#1210)
This commit is contained in:
		
							parent
							
								
									029f1d824d
								
							
						
					
					
						commit
						d4c1ab40a3
					
				
							
								
								
									
										73
									
								
								docs/gpio.md
								
								
								
								
							
							
						
						
									
										73
									
								
								docs/gpio.md
								
								
								
								
							|  | @ -360,14 +360,26 @@ kvmd | ||||||
|         pwm_soft = 80 |         pwm_soft = 80 | ||||||
|         ``` |         ``` | ||||||
| 
 | 
 | ||||||
|  |         _Not needed for v4-mini because it does not have a fan._  | ||||||
|  | 
 | ||||||
|     Here the small example with servo control: |     Here the small example with servo control: | ||||||
| 
 | 
 | ||||||
|     1. Add to `/boot/config.txt`: |     1a. For ≤ v3 add to `/boot/config.txt`: | ||||||
| 
 | 
 | ||||||
|         ``` |         ``` | ||||||
|         dtoverlay=pwm |         dtoverlay=pwm | ||||||
|         ``` |         ``` | ||||||
| 
 | 
 | ||||||
|  |         to enable [PWM0_0](https://github.com/dotnet/iot/blob/main/Documentation/raspi-pwm.md#enabling-hardware-pwm) on RPi GPIO18.  | ||||||
|  | 
 | ||||||
|  |     1b. For ≥ v4 add to `/boot/config.txt`: | ||||||
|  | 
 | ||||||
|  |         ``` | ||||||
|  |         dtoverlay=pwm,pin=12,func=4 | ||||||
|  |         ``` | ||||||
|  | 
 | ||||||
|  |         to enable [PWM0_0](https://github.com/dotnet/iot/blob/main/Documentation/raspi-pwm.md#enabling-hardware-pwm) on CM4 GPIO12 (CN5 NeoPixel Pin) and set the PWM function to 4 (ALT0). | ||||||
|  | 
 | ||||||
|     2. Create `/etc/udev/rules.d/99-kvmd-pwm.rules`: |     2. Create `/etc/udev/rules.d/99-kvmd-pwm.rules`: | ||||||
| 
 | 
 | ||||||
|         ``` |         ``` | ||||||
|  | @ -375,7 +387,7 @@ kvmd | ||||||
|         SUBSYSTEM=="pwm*", ACTION=="change", ENV{TRIGGER}!="none", 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: |     3. Connect Servo motor like SG90 PWM connection to RPi GPIO18 or CM4 GPIO12, +5V and GND to a 5V and GND pin on header: | ||||||
| 
 | 
 | ||||||
|     4. Add to /etc/kvmd/override.yaml |     4. Add to /etc/kvmd/override.yaml | ||||||
| 
 | 
 | ||||||
|  | @ -390,6 +402,8 @@ kvmd | ||||||
|                         duty_cycle_push: 1500000     # Servo Motor SG90 duty_cycle for pushing button |                         duty_cycle_push: 1500000     # Servo Motor SG90 duty_cycle for pushing button | ||||||
|                         duty_cycle_release: 1000000  # Servo Motor SG90 duty_cycle for releasing button |                         duty_cycle_release: 1000000  # Servo Motor SG90 duty_cycle for releasing button | ||||||
|                 scheme: |                 scheme: | ||||||
|  |                     __v4_locator__:  # v4-mini only | ||||||
|  |                         pin: 18      # v4-mini only | ||||||
|                     short_press: |                     short_press: | ||||||
|                         driver: servo1 |                         driver: servo1 | ||||||
|                         pin: 0  # Pin number is the PWM channel number on the PWM Chip |                         pin: 0  # Pin number is the PWM channel number on the PWM Chip | ||||||
|  | @ -426,7 +440,7 @@ kvmd | ||||||
| 
 | 
 | ||||||
| ### Servo | ### Servo | ||||||
| ??? note "Click to view" | ??? note "Click to view" | ||||||
|     The `servo` module is built on top of the `pwm` module and allows user to define angles instead of `duty_cyles` to control a PWM enabled servo motor like SG90. When the button is pressed the servo motor moves to an angle defined by `angle_push` and when button is released it moves back to `angle_release`. In the example configuration for a [cheap 5V SG90 Servo](https://www.ebay.co.uk/itm/184555802744), the motor moves to an angle of 45 degrees when button is pressed and moves back to 20 degress when released. |     The `servo` module is built on top of the `pwm` module and allows user to define angles instead of `duty_cyles` to control a PWM enabled servo motor like SG90. When the button is pressed the servo motor moves to an angle defined by `angle_push` and when button is released it moves back to `angle_release`. In the example configuration for a [cheap 5V SG90 Servo](https://www.ebay.co.uk/sch/i.html?_nkw=5V+SG90+Servo), the motor moves to an angle of 45 degrees when button is pressed and moves back to 20 degress when released. | ||||||
| 
 | 
 | ||||||
|     !!! note |     !!! note | ||||||
|         Due to hardware limitations, this module conflicts with the **kvmd-fan** (PiKVM fan controller). |         Due to hardware limitations, this module conflicts with the **kvmd-fan** (PiKVM fan controller). | ||||||
|  | @ -437,6 +451,8 @@ kvmd | ||||||
|         pwm_soft = 80 |         pwm_soft = 80 | ||||||
|         ``` |         ``` | ||||||
| 
 | 
 | ||||||
|  |         _Not needed for v4-mini because it does not have a fan._  | ||||||
|  | 
 | ||||||
|     To use Servo motors in PiKVM you need to follow steps 1-3 for [PWM Module](#pwm) and then use the following configuration. |     To use Servo motors in PiKVM you need to follow steps 1-3 for [PWM Module](#pwm) and then use the following configuration. | ||||||
| 
 | 
 | ||||||
|     Add to `/etc/kvmd/override.yaml`: |     Add to `/etc/kvmd/override.yaml`: | ||||||
|  | @ -456,30 +472,33 @@ kvmd | ||||||
|                     angle_push: 45           # Servo Motor SG90 angle to push button |                     angle_push: 45           # Servo Motor SG90 angle to push button | ||||||
|                     angle_release: 20        # Servo Motor SG90 angle to release button |                     angle_release: 20        # Servo Motor SG90 angle to release button | ||||||
|             scheme: |             scheme: | ||||||
|                 short_press: |                 scheme: | ||||||
|                     driver: servo1 |                     __v4_locator__:  # v4-mini only | ||||||
|                     pin: 0  # Pin number is the PWM channel number on the PWM Chip |                         pin: 18      # v4-mini only | ||||||
|                     mode: output |                     short_press: | ||||||
|                     switch: false |                         driver: servo1 | ||||||
|                     pulse: |                         pin: 0  # Pin number is the PWM channel number on the PWM Chip | ||||||
|                         delay: 0.5 |                         mode: output | ||||||
|                         max_delay: 2 |                         switch: false | ||||||
|                 long_press: |                         pulse: | ||||||
|                     driver: servo1 |                             delay: 0.5 | ||||||
|                     pin: 0 |                             max_delay: 2 | ||||||
|                     mode: output |                     long_press: | ||||||
|                     switch: false |                         driver: servo1 | ||||||
|                     pulse: |                         pin: 0 | ||||||
|                         delay: 2 |                         mode: output | ||||||
|                         max_delay: 2 |                         switch: false | ||||||
|                 extra_long_press: |                         pulse: | ||||||
|                     driver: servo1 |                             delay: 2 | ||||||
|                     pin: 0 |                             max_delay: 2 | ||||||
|                     mode: output |                     extra_long_press: | ||||||
|                     switch: false |                         driver: servo1 | ||||||
|                     pulse: |                         pin: 0 | ||||||
|                         delay: 10 |                         mode: output | ||||||
|                         max_delay: 20 |                         switch: false | ||||||
|  |                         pulse: | ||||||
|  |                             delay: 10 | ||||||
|  |                             max_delay: 20 | ||||||
|             view: |             view: | ||||||
|                 header: |                 header: | ||||||
|                     title: Controls |                     title: Controls | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue