SW_DevRPiCtrl - fablab-wue/piTelex GitHub Wiki
Device Module "RPiCtrl"
Description
This module adds some control options for the Raspberry Pi, mostly additional push buttons and status LEDs.
It is not suitable for standard computers running Windows, MAC OS or Linux.
Especially when using piTelex without a CCU, its functions (and UI) must be replicated by piTelex. This module provides you with the required features.
To make use of its functions, create a device entry in the config file (Default: RPiCtrl) that points to this module and enable it.
[!CAUTION] Please note that the configuration options
pin_xyz
do not specify the physical pin numbers on the interface header of the RPi, but actually refer to the corresponding GPIO port numbers.Example:
"pin_relay": 22
specifies GPIO port 22, which is connected to pin 15 of the 40-pin header.
[!TIP]
For a complete documentation of the GPIO pins see https://www.raspberrypi.com/documentation/computers/raspberry-pi.html#gpio
Buttons
-
pin_button_[AT|ST|LT]
: Pressing pushbuttons connected from these pins to ground will switch piTelex to the corresponding state: AT to start an outgoing call, ST to end a connection, LT to enter local mode. -
delay_[AT|ST]
allows to insert a delay from pressing 'AT' or 'ST' to altering the state to 'WB' or 'Z'. This is just to give the system e more realistic "feel" -
button_1T
is a special variation of the above buttons. Pressing it repeatedly will cycle through the states AT,ST,LT,off -
If dialing with a number switch, it can be connected to
pin_number_switch
.[!NOTE] Set
pin_number_switch
of module RPiTTY to -1 in this case. -
pin_button_PT
allows to switch the connected equipment on or off manually; toggles the state ofpin_power
.pin_power
as an output pin is used to control a power relay /SSR for switching mains power of the connected system (CCU and/or teletype) and is meant for power saving by switching off the equipment when not in use
-
pin_button_U[1..4]
Allow you to create hardware shortcut buttons. Pressing push buttons connected from these pins to ground will output the corresponding text defined intext_button_U[1..4]
.
LEDs
-
pin_LED_[WB|A|WB_A]
allow to connect LED's for signalisation of the respective states- WB - ready to dial ("Wählbereitschaft")
- A - Active (Connected or in local mode)
- WB_A - LED lit in states A and WB
-
pin_LED_Z
together withLED_Z_heartbeat
can be used for monitoring of piTelex. As long asLED-Z
is flashing in Standby ("ZZ"), piTelex is healthy, up and running. -
pin_LED_status_[R|G]
are meant to connect to a dual LED (red/green) which delivers more detailed information about piTelex' states by combining different brightness levels of the two LED colors.
[!NOTE]
All LED's connect to GND and must have a resistor of 500-1000 ohms in series, depending on the LED type.
Module Information
System
System | Comments |
---|---|
RPi | All boards with Raspberry Pi OS |
PC Linux | n/a |
PC Windows | n/a |
Mac | n/a |
Dependencies
PythonModule | Install | Anaconda |
---|---|---|
pigpio | pip install pigpio | conda install pigpio |
Command Line Arguments
None.
Config File Parameter
Parameter | Default | Type/Range | Description |
---|---|---|---|
pin_number_switch | 0 | number | GPIO# of pin connected to number switch of CCU (use a pullup resistor 10kOhm to 3.3V); if 0, use kbd dialling |
inv_number_switch | true | false / true | If true, use inverted signal on pin |
pin_button_AT | 0 | number | GPIO# of button AT (optional) Button connects to GND |
pin_button_ST | 0 | number | GPIO# of button ST (optional) Button connects to GND |
pin_button_LT | 0 | number | GPIO# of button LT (optional) Button connects to GND |
pin_button_1T | 0 | number | GPIO# of Single button (optional), press button 1T repeatedly to cycle through states Offline, Active, WB |
pin_button_PT | 0 | number | GPIO# of power button PT (optional) Button connects to GND |
delay_AT | 0 | non-neg. int | delay in seconds before reacting on button AT pressed |
delay_ST | 0 | non-neg. int | delay in seconds before reacting on button ST pressed |
pin_LED_A | 0 | number | GPIO# of LED indicating state „A“ ; LED connects to GND (1kOhm in series!) |
pin_LED_WB | 0 | number | GPIO# of LED indicating state „WB“ ; LED connects to GND (1kOhm in series!) |
pin_LED_WB_A | 0 | number | GPIO# of LED indicating state „WB_A“ ; LED connects to GND (1kOhm in series!) |
pin_LED_LT | 0 | number | GPIO# of LED indicating Local Mode ; LED connects to GND (1kOhm in series!) |
pin_LED_status_R | 0 | number | GPIO# of RED status LED ; LED connects to GND (1kOhm in series!) |
pin_LED_status_G | 0 | number | GPIO# of GREEN status LED ; LED connects to GND (1kOhm in series!) |
pin_LED_Z | 0 | number | GPIO# of LED indicating status "Z" and "ZZ"; LED connects to GND (1kOhm in series!) |
LED_Z_heartbeat | 6 | number | defines heartbeat duty cycle for LED_Z , off if set to 0 (=> LED_Z always on), otherwise LED_Z is turned off for (LED_Z_heartbeat * 500ms) and on for 500ms |
pin_power | 0 | number | GPIO# of pin for power (save) relay / SSR |
inv_power | false | false / true | If true, use inverted signal on pin |
pin_button_U1 | 0 | number | GPIO# of button user1 (optional) Button connects to GND |
text_button_U1 | "RY" | string | text to print if button user1 is pressed |
pin_button_U2 | 0 | number | GPIO# of button user2 (optional) Button connects to GND |
text_button_U2 | "RYRY ... RY" | string | Text associated with button user2 |
pin_button_U3 | 0 | number | GPIO# of button user3 (optional) Button connects to GND |
text_button_U3 | "#" | string | Text associated with button user3 |
pin_button_U4 | 0 | number | GPIO# of button user4 (optional) Button connects to GND |
text_button_U4 | "@" | string | Text associated with button user4 |
Example Config file snippet
"RPiCtrl": {
"type": "RPiCtrl",
"enable": true,
"pin_number_switch": 5,
"inv_number_switch": false,
"pin_button_1T": 0, # unused
"pin_button_AT": 25, # GPIO for "Anruftaste"
"pin_button_ST": 7, # GPIO for "Schlusstaste"
"pin_button_LT": 8, # GPIO for "Lokaltaste"
"pin_button_U1": 0, # GPIO for User Button 1 (unused)
"pin_button_U2": 0, # GPIO for User Button 2 (unused)
"pin_button_U3": 20, # GPIO for User Button 3 (used for Software ID)
"pin_button_U4": 0, # GPIO for User Button 4 (unused)
"pin_LED_A": 23, # GPIO for LED "Amt"
"pin_LED_WB": 24, # GPIO for LED "Wählbereitschaft"
"pin_LED_WB_A": 0, # GPIO for LED "Amt oder Wählbereitschaft"
"pin_LED_LT": 16, # GPIO for LED "Lokalbetrieb"
"pin_LED_Z": 21, # GPIO for LED "Offline/Sleep"
"pin_LED_status_R": 0, # GPIO for green status LED
"pin_LED_status_G": 0, # GPIO for red status LED
"delay_AT": 1, # Add 1s of delay
"delay_ST": 1 # Add 1s of delay
},