Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 41 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# RuneAudioLCD
Small script written in Python for RuneAudio project (www.RuneAudio.com) running on Raspberry Pi 1/2 computer, which displays all neccessary info on a LCD display and which uses hardware buttons and IR remote controller to control playback and system.

RuneAudioLCD is a python script used on RuneAudio player for displaying playback information on LCD screen and controlling of player via hardware buttons and IR remote.

This repository aim to merge the original repositoy (https://github.com/RandyCupic/RuneAudioLCD) with a modded version of it called "RuneAudioLCDMod" (https://github.com/lukazgur/RuneAudioLCDMod)

## Modifications done by lukazgur on "RuneAudioLCDMod"
- code migrated to Python 3,
- implementation of direct pins connection for LCD display (I2C is already implemented in original script),
- selection of display screens with hardware button,
- control of backlight ON/OFF with hardware button.

## Modifications made here
- fix for i2c displays (parallel displays not tested after modifications)
- add GPIO namming mode option in start.py
- some cleanning

## Features
### Display features
Expand Down Expand Up @@ -29,10 +43,33 @@ Small script written in Python for RuneAudio project (www.RuneAudio.com) running
- turn on/off LCD backlight

## Requirements
- Raspberry Pi 1/2 computer running RuneAudio distribution based on modified Archlinux (from www.RuneAudio.com)
- Raspberry Pi running RuneAudio (http://www.runeaudio.com/)
- 16x2 or 20x4 I2C LCD display (not neccesarry)
- up to 5 hardware push buttons (not neccessarry)
- up to 8 hardware push buttons (not neccessarry)
- IR receiver (not neccessarry)
- installed Python2 compiler
- Python 3 installed
- installed and working LIRC (required for IR remote to work)
- Adafruit LCD char library installed for parallel display.
- script for IR remote which sends required strings via pipeline on button presses

## Installation
TODO : detail installation procedure (for all dependencies)

The easiest solution to run the RuneAudioLCDMod python script every time you turn on RuneAudio player is to setup a deamon
that executes python script. Bash script and service definition are included in repository.
- create a shell script such as /usr/bin/control_script.sh
- create a service file in /lib/systemd/control_script.service
- make systemd aware of your new service:
- systemctl daemon-reload
- systemctl enable control_script.service (if error with symbolic link -> run systemctl enable "FULLPATHTOSERVICE")
- systemctl start control_script.service
- reboot the RPI to see script in action.

#### Useful commands
- systemctl status control_script.service
- systemctl stop control_script.service
- systemctl start control_script.service
- systemctl disable control_script.service

Services "log":
- journalctl /usr/lib/systemd/systemd -b
24 changes: 18 additions & 6 deletions buttons.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ def __init__(self, button_pins, bounce_time):

# Set buttons
self.buttons = button_pins

# Initialize display client
self.display = False

# Set GPIO numbering mode
GPIO.setmode(GPIO.BOARD)

# We don't need warnings from GPIO
GPIO.setwarnings(False)

Expand All @@ -30,14 +30,26 @@ def __init__(self, button_pins, bounce_time):
# Register MPD client to send it commands
def register(self, mpd):
self.mpd = mpd

# Register display client so this thread can send commands to it
def register_display(self, display):
self.display = display

def button_pressed(self, channel):
# Debouncing
time.sleep(0.05)
if (GPIO.input(channel) == 0):
# Find out which button was pressed
for button in self.buttons:
if (channel == self.buttons[button]):
if (channel == self.buttons[button]):
# Change screen
if (button == 'MODE_BUTTON'):
if (self.display != False):
self.display.change_screen()
# Toggle backlight
elif (button == 'PAUSE_BUTTON'):
if (self.display != False):
self.display.toggle_backlight()
# Send command to MPD client
if (self.mpd != False):
self.mpd.commands(button.replace('_BUTTON', ''))
elif (self.mpd != False):
self.mpd.commands(button.replace('_BUTTON', ''))
12 changes: 12 additions & 0 deletions control_script.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[Unit]
Description=Control mpd service
After=dhcpcd.service

[Service]
Type=simple
ExecStart=/usr/bin/control_script.sh
RestartSec=30
Restart=on-failure

[Install]
WantedBy=multi-user.target
3 changes: 3 additions & 0 deletions control_script.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

python /root/controls/start.py
Loading