A simple physical controller for change and view the current pedalboard with 2 buttons and 7 two segments displays
╔═══════════════════════════════════════════╗ ║ P e d a l P i P0 ║ ║ ┌ ⎯ ⎯ ┐ ║ ║ |⎥⎯⎜⎥ ⎜ | ║ ║ |⎥ ⎥⎯⎜.| ║ ║ └-------┘ ║ ║---------------------┬---------------------╢ ║ ..=.............=.. | .........=......... ║ ║ ....=.........=.... | ......=.....=...... ║ ║ ......=.....=...... | ....=.........=.... ║ ║ .........=......... | ..=.............=.. ║ ╚═══════════════════════════════════════════╝
- Documentation:
- https://github.com/PedalPi/Raspberry-P0#raspberry-p0
- Code:
- https://github.com/PedalPi/Raspberry-P0
- Python Package Index:
- https://pypi.org/project/PedalPi-Raspberry-P0
- License:
- Apache License 2.0
PedalPi components enable the extension of Pedal Pi - Application. Through them, opening services are offered. A list of components can be found in the Components repository.
Use the pip to install the PedalPi-Raspberry-P0
pip3 install PedalPi-Raspberry-P0
The following example demonstrates a basic setup for the Pedal Pi - Raspberry P0. If you want to add other components, check the component list.
import sys
from signal import pause
from application.application import Application
from raspberry_p0.raspberry_p0 import RaspberryP0
application = Application(path_data="data/", address='localhost')
application.register(RaspberryP0(application))
application.start()
try:
pause()
except KeyboardInterrupt:
application.stop()
python3 program.py
The following image shows the connections between components and Raspberry Pi to the default configuration. If you wish to change the pins, refer to Configuration File.
The pins of the seven-segment displays are shared with each other. That
is, the pin_a
of display 1 is shorted with thepin_a
of display
2, pin_b
of display 1 is shorted withpin_b
of display 2 and so
on. However, this rule does not apply to common_pin
, where each
display must have its own control pin.
The used pins are:
Config identifier | Pin¹ | Type | Function |
---|---|---|---|
pin_a | 13 |
integer | Seven segments - Pin A |
pin_b | 6 |
integer | Seven segments - Pin B |
pin_c | 16 |
integer | Seven segments - Pin C |
pin_d | 20 |
integer | Seven segments - Pin D |
pin_e | 21 |
integer | Seven segments - Pin E |
pin_f | 19 |
integer | Seven segments - Pin F |
pin_g | 26 |
integer | Seven segments - Pin G |
pin_dp | 0 |
integer | Seven segments - Dot point pin |
common_pins | [5, 1] |
integer list | Seven segments - Common pins |
common_anode | True |
bool | True if the displays are
anode. False if are
cathode. |
next_pedalboard | 14 |
integer | Button - Set to next Pedalboard |
before_pedalboard | 15 |
integer | Button - Set to before Pedalboard |
momentary_footswitch | False |
bool | True if buttons are
momentary. False if buttons
are two state |
It's possible changes the pins using a configuration file. The numbering of the pins corresponds to BCM. Isn't necessary to inform all configurations. An element not informed will be treated with your default value.
A Raspberry Pi pinout schematic can be seen in pinout.xyz.
The config_file has the following structure:
[display] pin_a = 13 pin_b = 6 pin_c = 16 pin_d = 20 pin_e = 21 pin_f = 19 pin_g = 26 pin_dp = 0 common_pins = [5, 1] common_anode = True [pedalboard] next_pedalboard = 14 before_pedalboard = 15 momentary_footswitch = True [test] test = False
For P0 to loads the new configuration, references the file in
RaspberryP0
constructor.
# The config file has named as 'path/my_awersome_config.ini'.
application.register(RaspberryP0(application, configuration_file='my_awersome_config.ini'))
The seven-segment display consists of eight pins corresponding to the
leds (pin_a
topin_g
and pin_dp
) and two common pins (which
are short-circuited).
There are two types of seven-segment displays: Cathode and Anode.
common_anode
informs if the displays are Anode or Cathode.
The image obtained from Circuits Today illustrates the correspondence of the pins with the LEDs.
To save the amount of pins required for the project, the pins of the
seven-segment displays are shared with each other. In this way, the pins
corresponding to the pins leds (pin_a
topin_g
and pin_dp
)
must respectively be short-circuited to the displays. That is, the
pin_a
of display 1 is short-circuited with thepin_a
of display
2, pin_b
of display 1 is short-circuited withpin_b
of display
2 and so on.
Config identifier | Default value | Type | Function |
---|---|---|---|
pin_a |
13 |
integer | Pin A |
pin_b |
6 |
integer | Pin B |
pin_c |
16 |
integer | Pin C |
pin_d |
20 |
integer | Pin D |
pin_e |
21 |
integer | Pin E |
pin_f |
19 |
integer | Pin F |
pin_g |
26 |
integer | Pin G |
pin_dp |
0 |
integer | Dot point pin |
To describe the common_pin
of the displays, a list of integers is
used, where the significance of the digits follows the ascending order:
the tens corresponds to the first element of the list and the units
to the second element of the list.
Config identifier | Default value | Type | Function |
---|---|---|---|
common_pins |
[5, 1] |
integer list | Pin that controls the display view |
common_anode |
True |
bool | True if the displays are
anode. False if are
cathode. |
In Quora there is a tutorial on how you can identify if a display is cathode or anode.
Simple push buttons were used to change the current pedalboard. For use with foot, is recommended use footswitches (like the temporary footswitch in image below). The two types of buttons the system supports are temporary buttons and two-state buttons (on-off).
Config identifier | Default value | Type | Function |
---|---|---|---|
next_pedalboard | 14 |
integer | Set the current pedalboard for the next |
before_pedalboard | 15 |
integer | Set the current pedalboard for the before |
momentary_footswitch | False |
bool | True if buttons are momentary.
False if buttons are two state |
Config identifier | Default value | Type | Function |
---|---|---|---|
test |
False |
bool | Disable GPIOZero for development tests |
See FAQs on the wiki.