ale na platformie ARM w moim przypadku Orange Pi 3 LTS więcej LINK ... zasada będzie pewnie podobna dla innych modeli: OrangePi lite / Raspberry Pi itd ... wybrałem model Opi-3lts bo ma wbudowaną pamięć stałą emmc 8GB na której możemy po skonfigurowaniu systemu na karcie SD wgrać system na w/w i zapomnieć o kartach SD które pewnie jak wiecie nie są wieczne a z doświadczenia po ok 3 / 6 latach ulegają awarii (ciągły zapis -odczyt) i lepiej mieć backup takich SD jeśli nie mamy emmc !!! jak taki zrobić żeby system się uruchamiał itd
viewtopic.php?t=184218
Ważne dla mnie było użycie wyświetlacza LCD np. 16x2 / 40x2 i podstawowa opcja żeby można było na bieżąco odczytać nazwę stacji radiowej ,odtwarzanego utworu muzycznego / artysty (zespołu) jeśli takowe są dostarczane ze stremowanej stacji radiowej + ewentualnie aktualną godzinę.
Sciągamy i instalujemy firmware np. Orangepi3-lts_3.0.8_debian_bullseye_server_linux5.16.17 ( bo i po co nam wersja Desktop-owa )
https://drive.google.com/drive/folders/ ... R7UYQgZiXP
Po rozpakowaniu nagrywamy w/w na kartę SD ( pomocna będzie przejściówka SD/USB ) podłączamy OrangePi pod HDMI (np. TV)
podczas pierwszego boot-owania podajemy / ustawiamy swoje hasło dla systemu jest to hasło dla root-a ! ( w systemie brak zwykłego usera ) od teraz login do systemu / ssh to: root / ustawione hasło. Logujemy się do systemu i łączymy się do naszego internetu przez TV / terminal ( będzie to jednorazowa czynność zapamiętana na stałe )
Wyświetlamy listę dostępnych WiFi :
Kod: Zaznacz cały
nmcli device wifi list
Kod: Zaznacz cały
nmcli device wifi connect "$SSID" password "$PASSWORD"
Kod: Zaznacz cały
ssh root@192.168.1.17
Kod: Zaznacz cały
apt update
apt upgrade
Kod: Zaznacz cały
apt install mpd mpc
apt-get install lcdproc lcdproc-extra-drivers
apt install pulseaudio
apt-get install -y lirc lirc-compat-remotes
apt-get install -y ir-keytable
Kod: Zaznacz cały
sudo apt-get install ntpdate
ntpdate pool.ntp.org
Kod: Zaznacz cały
dpkg-reconfigure tzdata
Kod: Zaznacz cały
orangepi-config

Uruchamiamy w systemie opcję IR żeby można było użyć pilota zdalnego sterowania do sterownia radiem ...uruchamiamy konfigurację
orangepi-config / opcja :Wired /Wireless/Blutoo ... : Remove IR support lub Enable IR support
Lub korzystamy z innego pilota z czujnikiem pod Usb ( ja preferuję pilota radiowego firmy medion x10 który niestety już nie jest produkowany a umożliwia sterowanie radiem z drugiego pokoju przez ścianę a nawet dwie ...używki można jeszcze nabyć na różnych aukcjach )


Konfigurujemy pilota radiowego
komenda wyświetla listę sterowników a pilot x10 korzysta z : atilibusb
Kod: Zaznacz cały
lircd --driver=
Kod: Zaznacz cały
lircd --driver=atilibusb
Kod: Zaznacz cały
nano /etc/lirc/lirc_options.conf
Kod: Zaznacz cały
nano /etc/lirc/lircd.conf
Kod: Zaznacz cały
# Please make this file available to others
# by sending it to <lirc@bartelmus.de>
#
# this config file was automatically generated
# using lirc-0.8.3(default) on Sat Apr 23 13:45:36 2011
#
# contributed by
#
# brand: or24v / or28v :-)
# model no. of remote control:
# devices being controlled by this remote:
#
begin remote
name or28v
bits 16
eps 30
aeps 100
one 0 0
zero 0 0
pre_data_bits 8
pre_data 0x14
post_data_bits 16
post_data 0x0
gap 219976
toggle_bit_mask 0x80800000
min_repeat 1
suppress_repeat 5
begin codes
UP 0xEF1A
DOWN 0x77A2
LEFT 0xF21D
RIGHT 0x749F
VOL_UP 0xDE09
VOL_DOWN 0x5D88
CH_UP 0xE00B
CH_DOWN 0x618C
MUTE 0xD500
OK 0x739E
SELECT 0xF01B
1 0x628D
2 0xE30E
3 0x648F
4 0xE510
5 0x6691
6 0xE712
7 0x6893
8 0xE914
9 0x6A95
0 0xEC17
CLEAR 0x85B0
ENTER 0x0B36
PLAY 0x7AA5
PAUSE 0xFE29
STOP 0x7DA8
RECORD 0xFC27
REW 0x79A4
FORWARD 0xFB26
BACK 0x75A0
INFO 0x042F
POWER 0xD702
RED 0x0732
YELLOW 0x89B4
BLUE 0x0A35
GREEN 0x88B3
PREV 0xF621
NEXT 0x78A3
TEXT 0xEB16
RECORDED 0xED18
MOVIE 0x719C
MUSIC 0x0631
FOTO 0x5984
HASH 0x0D38
STAR 0x8CB7
end codes
end remote
Kod: Zaznacz cały
irw

Konfigurujemy program mpd ...w pliku mpd.conf podajemy własne ścieżki do konfiguracji : playlisty / muzyki / karty dźwiękowej itd
U mnie konfiguracja jest w folderze : /radio ...( uwaga nie używajcie folderu : media bo po przeniesieniu systemu na pamięć emmc system tam zapisuje i kasuje wszelką konfiguracje ) mój przykład:
Kod: Zaznacz cały
nano /etc/mpd.conf
Kod: Zaznacz cały
# An example configuration file for MPD.
# Read the user manual for documentation: http://www.musicpd.org/doc/user/
# or /usr/share/doc/mpd/html/user.html
# Files and directories #######################################################
#
# This setting controls the top directory which MPD will search to discover the
# available audio files and add them to the daemon's online database. This
# setting defaults to the XDG directory, otherwise the music directory will be
# be disabled and audio files will only be accepted over ipc socket (using
# file:// protocol) or streaming files over an accepted protocol.
#
music_directory "/radio/music"
#
# This setting sets the MPD internal playlist directory. The purpose of this
# directory is storage for playlists created by MPD. The server will use
# playlist files not created by the server but only if they are in the MPD
# format. This setting defaults to playlist saving being disabled.
#
playlist_directory "/radio/playlists"
#
# This setting sets the location of the MPD database. This file is used to
# load the database at server start up and store the database while the
# server is not up. This setting defaults to disabled which will allow
# MPD to accept files over ipc socket (using file:// protocol) or streaming
# files over an accepted protocol.
#
db_file "/radio/tag_cache"
#
# These settings are the locations for the daemon log files for the daemon.
# These logs are great for troubleshooting, depending on your log_level
# settings.
#
# The special value "syslog" makes MPD use the local syslog daemon. This
# setting defaults to logging to syslog, or to journal if mpd was started as
# a systemd service.
#
log_file "/radio/mpd.log"
#
# This setting sets the location of the file which stores the process ID
# for use of mpd --kill and some init scripts. This setting is disabled by
# default and the pid file will not be stored.
#
pid_file "/radio/pid"
#
# This setting sets the location of the file which contains information about
# most variables to get MPD back into the same general shape it was in before
# it was brought down. This setting is disabled by default and the server
# state will be reset on server start up.
#
state_file "/radio/state"
#
# The location of the sticker database. This is a database which
# manages dynamic information attached to songs.
#
sticker_file "/radio/sticker.sql"
#
###############################################################################
# General music daemon options ################################################
#
# This setting specifies the user that MPD will run as. MPD should never run as
# root and you may use this setting to make MPD change its user ID after
# initialization. This setting is disabled by default and MPD is run as the
# current user.
#
user "mpd"
#
# This setting specifies the group that MPD will run as. If not specified
# primary group of user specified with "user" setting will be used (if set).
# This is useful if MPD needs to be a member of group such as "audio" to
# have permission to use sound card.
#
#group "nogroup"
#
# This setting sets the address for the daemon to listen on. Careful attention
# should be paid if this is assigned to anything other than the default, any.
# This setting can deny access to control of the daemon. Choose any if you want
# to have mpd listen on every address. Not effective if systemd socket
# activation is in use.
#
# For network
bind_to_address "localhost"
#
# And for Unix Socket
#bind_to_address "/run/mpd/socket"
#
# This setting is the TCP port that is desired for the daemon to get assigned
# to.
#
#port "6600"
#
# Suppress all messages below the given threshold. Use "verbose" for
# troubleshooting. Available setting arguments are "notice", "info", "verbose",
# "warning" and "error".
#
#log_level "notice"
#
# Setting "restore_paused" to "yes" puts MPD into pause mode instead
# of starting playback after startup.
#
#restore_paused "no"
#
# This setting enables MPD to create playlists in a format usable by other
# music players.
#
#save_absolute_paths_in_playlists "no"
#
# This setting defines a list of tag types that will be extracted during the
# audio file discovery process. The complete list of possible values can be
# found in the user manual.
#metadata_to_use "artist,album,title,track,name,genre,date,composer,performer,disc"
#
# This example just enables the "comment" tag without disabling all
# the other supported tags:
#metadata_to_use "+comment"
#
# This setting enables automatic update of MPD's database when files in
# music_directory are changed.
#
#auto_update "yes"
#
# Limit the depth of the directories being watched, 0 means only watch
# the music directory itself. There is no limit by default.
#
#auto_update_depth "3"
#
###############################################################################
# Symbolic link behavior ######################################################
#
# If this setting is set to "yes", MPD will discover audio files by following
# symbolic links outside of the configured music_directory.
#
#follow_outside_symlinks "yes"
#
# If this setting is set to "yes", MPD will discover audio files by following
# symbolic links inside of the configured music_directory.
#
#follow_inside_symlinks "yes"
#
###############################################################################
# Zeroconf / Avahi Service Discovery ##########################################
#
# If this setting is set to "yes", service information will be published with
# Zeroconf / Avahi.
#
#zeroconf_enabled "yes"
#
# The argument to this setting will be the Zeroconf / Avahi unique name for
# this MPD server on the network. %h will be replaced with the hostname.
#
#zeroconf_name "Music Player @ %h"
#
###############################################################################
# Permissions #################################################################
#
# If this setting is set, MPD will require password authorization. The password
# setting can be specified multiple times for different password profiles.
#
#password "password@read,add,control,admin"
#
# This setting specifies the permissions a user has who has not yet logged in.
#
#default_permissions "read,add,control,admin"
#
###############################################################################
# Database #######################################################################
#
# An example of a database section instead of the old 'db_file' setting.
# It enables mounting other storages into the music directory.
#
#database {
# plugin "simple"
# path "/var/lib/mpd/tag_cache"
# cache_directory "/var/lib/mpd/cache"
#}
#
# An example of database config for a sattelite setup
#
#music_directory "nfs://fileserver.local/srv/mp3"
#database {
# plugin "proxy"
# host "other.mpd.host"
# port "6600"
#}
# Input #######################################################################
#
input {
plugin "curl"
# proxy "proxy.isp.com:8080"
# proxy_user "user"
# proxy_password "password"
}
# Decoder #####################################################################
#
decoder {
plugin "hybrid_dsd"
enabled "no"
# gapless "no"
}
decoder {
plugin "wildmidi"
enabled "no"
#config_file "/etc/timidity/timidity.cfg"
}
#
###############################################################################
# Audio Output ################################################################
#
# MPD supports various audio output types, as well as playing through multiple
# audio outputs at the same time, through multiple audio_output settings
# blocks. Setting this block is optional, though the server will only attempt
# autodetection for one sound card.
#
# An example of an ALSA output:
#
audio_output {
type "alsa"
name "Audio"
device "hw:1,0" # optional
format "192000:32:2"
mixer_type "software" # optional
mixer_device "default" # optional
mixer_control "PCM" # optional
## mixer_index "0" # optional
}
#
# An example of an OSS output:
#
#audio_output {
# type "oss"
# name "My OSS Device"
## device "/dev/dsp" # optional
## mixer_type "hardware" # optional
## mixer_device "/dev/mixer" # optional
## mixer_control "PCM" # optional
#}
#
# An example of a shout output (for streaming to Icecast):
#
#audio_output {
# type "shout"
# encoder "vorbis" # optional
# name "My Shout Stream"
# host "localhost"
# port "8000"
# mount "/mpd.ogg"
# password "hackme"
# quality "5.0"
# bitrate "128"
# format "44100:16:1"
## protocol "icecast2" # optional
## user "source" # optional
## description "My Stream Description" # optional
## url "http://example.com" # optional
## genre "jazz" # optional
## public "no" # optional
## timeout "2" # optional
## mixer_type "software" # optional
#}
#
# An example of a recorder output:
#
#audio_output {
# type "recorder"
# name "My recorder"
# encoder "vorbis" # optional, vorbis or lame
# path "/var/lib/mpd/recorder/mpd.ogg"
## quality "5.0" # do not define if bitrate is defined
# bitrate "128" # do not define if quality is defined
# format "44100:16:1"
#}
#
# An example of a httpd output (built-in HTTP streaming server):
#
#audio_output {
# type "httpd"
# name "My HTTP Stream"
# encoder "vorbis" # optional, vorbis or lame
# port "8000"
# bind_to_address "0.0.0.0" # optional, IPv4 or IPv6
## quality "5.0" # do not define if bitrate is defined
# bitrate "128" # do not define if quality is defined
# format "44100:16:1"
# max_clients "0" # optional 0=no limit
#}
#
# An example of a pulseaudio output (streaming to a remote pulseaudio server)
# Please see README.Debian if you want mpd to play through the pulseaudio
# daemon started as part of your graphical desktop session!
#
#audio_output {
# type "pulse"
# name "My Pulse Output"
## server "remote_server" # optional
## sink "remote_server_sink" # optional
## media_role "media_role" #optional
#}
#
# An example of a winmm output (Windows multimedia API).
#
#audio_output {
# type "winmm"
# name "My WinMM output"
## device "Digital Audio (S/PDIF) (High Definition Audio Device)" # optional
# or
## device "0" # optional
## mixer_type "hardware" # optional
#}
#
# An example of an openal output.
#
#audio_output {
# type "openal"
# name "My OpenAL output"
## device "Digital Audio (S/PDIF) (High Definition Audio Device)" # optional
#}
#
# An example of an sndio output.
#
#audio_output {
# type "sndio"
# name "sndio output"
# mixer_type "hardware"
#}
#
# An example of an OS X output:
#
#audio_output {
# type "osx"
# name "My OS X Device"
## device "Built-in Output" # optional
## channel_map "-1,-1,0,1" # optional
#}
#
## Example "pipe" output:
#
#audio_output {
# type "pipe"
# name "my pipe"
# command "aplay -f cd 2>/dev/null"
## Or if you're want to use AudioCompress
# command "AudioCompress -m | aplay -f cd 2>/dev/null"
## Or to send raw PCM stream through PCM:
# command "nc example.org 8765"
# format "44100:16:2"
#}
#
## An example of a null output (for no audio output):
#
#audio_output {
# type "null"
# name "My Null Output"
# mixer_type "none" # optional
#}
#
###############################################################################
# Normalization automatic volume adjustments ##################################
#
# This setting specifies the type of ReplayGain to use. This setting can have
# the argument "off", "album", "track" or "auto". "auto" is a special mode that
# chooses between "track" and "album" depending on the current state of
# random playback. If random playback is enabled then "track" mode is used.
# See <https://wiki.hydrogenaud.io/index.php?title=Replaygain> for
# more details about ReplayGain.
# This setting is off by default.
#
#replaygain "album"
#
# This setting sets the pre-amp used for files that have ReplayGain tags. By
# default this setting is disabled.
#
#replaygain_preamp "0"
#
# This setting sets the pre-amp used for files that do NOT have ReplayGain tags.
# By default this setting is disabled.
#
#replaygain_missing_preamp "0"
#
# This setting enables or disables ReplayGain limiting.
# MPD calculates actual amplification based on the ReplayGain tags
# and replaygain_preamp / replaygain_missing_preamp setting.
# If replaygain_limit is enabled MPD will never amplify audio signal
# above its original level. If replaygain_limit is disabled such amplification
# might occur. By default this setting is enabled.
#
#replaygain_limit "yes"
#
# This setting enables on-the-fly normalization volume adjustment. This will
# result in the volume of all playing audio to be adjusted so the output has
# equal "loudness". This setting is disabled by default.
#
#volume_normalization "no"
#
###############################################################################
# Character Encoding ##########################################################
#
# If file or directory names do not display correctly for your locale then you
# may need to modify this setting.
#
filesystem_charset "UTF-8"
#
###############################################################################
Kod: Zaznacz cały
cat /proc/asound/cards
Kod: Zaznacz cały
aplay -l
Standardowa karta to : allwinnerac200c ...i jest jako card 0 / device 0 (hw:0,0) w mpd.conf zapisujemy to w sekcji Alsa !card 0: allwinnerac200c [allwinner,ac200-codec], device 0: 508f000.i2s-acx00-dai acx00-codec-0 [508f000.i2s-acx00-dai acx00-codec-0]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: Audio [USB2.0 High-Speed True HD Audio], device 0: USB Audio [USB Audio]
Subdevices: 0/1
Subdevice #0: subdevice #0
card 2: sun9ihdmi [sun9i-hdmi], device 0: SUN9I-HDMI PCM i2s-hifi-0 [SUN9I-HDMI PCM i2s-hifi-0]
Subdevices: 1/1
Subdevice #0: subdevice #0
Kod: Zaznacz cały
audio_output {
type "alsa"
name "allwinnerac200c"
device "hw:0,0" # optional
# format "192000:32:2"
mixer_type "software" # optional
#mixer_device "default" # optional
#mixer_control "PCM" # optional
auto_resample "no"
auto_channels "no"
auto_format "no"
use_mmap "no"
# mixer_index "0" # optional
}
Kod: Zaznacz cały
nano /etc/asound.conf
Kod: Zaznacz cały
pcm.!default {
type hw
card 0
device 0
}
ctl.!default {
type hw
card 0
}
Kod: Zaznacz cały
defaults.pcm.card 0
defaults.ctl.card 0

Żeby uruchomić jakieś stacje radiowe z pilota musimy jeszcze skonfigurować dwa pliki : lircrc / plik playlistę ze stacjami radiowymi u mnie mpd poprawnie czyta: .pls / .m3u więcej w informacji terminal : mpd -V
lista radio.pls przykład:
Kod: Zaznacz cały
[playlist]
Version=2
numberofentries=170
File1=http://stream10.radioagora.pl/tuba140-1.mp3
Title1=RADIO POGODA
File2=http://gdansk1-1.radio.pionier.net.pl:8000/pl/tuba10-1.mp3
Title2=RADIO TOK FM
File3=http://stream3.polskieradio.pl:8900/
Title3=POLSKIE RADIO 1
File4=http://stream3.polskieradio.pl:8904/
Title4=POLSKIE RADIO 3
File5=http://stream3.polskieradio.pl:8080/
Title5=POLSKIE RADIO 24
Kod: Zaznacz cały
http://stream10.radioagora.pl/tuba140-1.mp3
http://gdansk1-1.radio.pionier.net.pl:8000/pl/tuba10-1.mp3
http://stream3.polskieradio.pl:8900/
http://stream3.polskieradio.pl:8904/
http://51.68.135.155:80/stream
http://195.150.20.8:8000/rmf_5
http://stream3.polskieradio.pl:8080/
http://stream4.nadaje.com:8306/rbstudiosuwalki
http://stream4.nadaje.com:9680/radiokrakow-s3
ładowaniu do mpc

Kod: Zaznacz cały
nano /radio/music/radio.m3u
Kod: Zaznacz cały
mpc load radio.m3u
mpc load radio.pls
Kod: Zaznacz cały
mpc play
Kod: Zaznacz cały
mpc clear
mpc load radio2.m3u
Jeśli działa trzeba skonfigurować plik lircrc żeby można było sterować radiem przez pilota radiowego
Kod: Zaznacz cały
nano /etc/lirc/lircrc
Kod: Zaznacz cały
begin
prog = irexec
button = KEY_CHANNELDOWN
config = mpc prev
repeat = 0
end
begin
prog = irexec
button = KEY_CHANNELUP
config = mpc next
repeat = 0
end
begin
prog = irexec
button = KEY_LEFT
config = mpc prev
repeat = 0
end
begin
prog = irexec
button = KEY_RIGHT
config = mpc next
repeat = 0
end
begin
prog = irexec
button = KEY_DOWN
config = mpc prev
repeat = 0
end
begin
prog = irexec
button = KEY_UP
config = mpc next
repeat = 0
end
begin
prog = irexec
button = KEY_PLAY
config = mpc toggle
end
begin
prog = irexec
button = KEY_VOLUMEDOWN
config = mpc volume -3
repeat = 0
end
begin
prog = irexec
button = KEY_VOLUMEUP
config = mpc volume +3
repeat = 0
end
begin
prog = irexec
button = KEY_STOP
config = /root/mpc-stop.sh
repeat = 0
end
poszczególnych klawiszy np. jeśli naciśniemy play / lub 1 ...i otrzymamyw terminalu komenda :irw : PLAY / 1 to wpisujemy w pliku lircrc
Kod: Zaznacz cały
sudo /etc/init.d/lircd restart
Uwaga w ten sposób możemy także uruchomić pilotem jakiś skrypt na linux-ie np Czytanie aktualnej daty i godziny : KLIKbegin
prog = irexec
button = PLAY
config = mpc play
end
begin
prog = irexec
button = 1
config = mpc play 1
end
Niestety ale nie udało mi się uruchomić starego pilota z czujnikiem na podczerwień w prog. lirc .Mój pilot to standardowy Microsift (drivery mce / rc6 ) i bliźniak OrigenAe (nieco więcej przycisków) także na driverach rc6. Co dziwne na OrangePi lite oba działają prawidłowo. Ale skorzystałem z programu : ir-keytable i zadziałały.begin
prog = irexec
button = RED
config = /root/skrypt.sh
repeat = 0
end

ir-keytable konfiguracja pilota na podczerwień czyli czujnik na płytce OrangePi 3 LTS
komenda pokazuje informacje konfiguracyjne:
Kod: Zaznacz cały
ir-keytable
Kod: Zaznacz cały
Found /sys/class/rc/rc0/ with:
Name: sunxi-ir
Driver: sunxi-ir
Default keymap: rc-empty
Input device: /dev/input/event2
LIRC device: /dev/lirc0
Attached BPF protocols: Operacja nie obsługiwana
Supported kernel protocols: lirc rc-5 rc-5-sz jvc sony nec sanyo mce_kbd rc-6 sharp xmp imon rc-mm
Enabled kernel protocols: lirc
bus: 25, vendor/product: 0001:0001, version: 0x0100
Repeat delay = 500 ms, repeat period = 125 ms
Włączony jest tylko : lirc
Jeśli chcemy sterownik : rc6 to wykonujemy
Kod: Zaznacz cały
ir-keytable -p rc-6,lirc
Teraz testujemy czy pilot działa komenda jest równoznaczna do polecenia irw z prog. lirc
Kod: Zaznacz cały
ir-keytable -t
Musimy wyszukać i załadować plik o rozszerzeniu .toml dotyczący naszego pilota u mnie rc6 który to zmieni (podobnie jak w prog. lirc plik lircd.conf) można w internecie lub w systemie w ścieżce : /lib/udev/rc_keymaps . U mnie jest plik: rc6_mce.toml
Zapisujemy:
Kod: Zaznacz cały
sudo cp /lib/udev/rc_keymaps/rc6_mce.toml /etc/rc_keymaps
Kod: Zaznacz cały
root@orangepi3-lts:~# ir-keytable -t
Testing events. Please, press CTRL-C to abort.
33045.683183: lirc protocol(rc6_mce): scancode = 0x800f0422
33045.683217: event type EV_MSC(0x04): scancode = 0x800f0422
33045.683217: event type EV_KEY(0x01) key_down: KEY_OK(0x0160)
33045.683217: event type EV_SYN(0x00).
33045.816084: event type EV_KEY(0x01) key_up: KEY_OK(0x0160)
33045.816084: event type EV_SYN(0x00).
33048.810437: lirc protocol(rc6_mce): scancode = 0x800f0401 toggle=1
33048.810477: event type EV_MSC(0x04): scancode = 0x800f0401
33048.810477: event type EV_KEY(0x01) key_down: KEY_NUMERIC_1(0x0201)
33048.810477: event type EV_SYN(0x00).
33048.944042: event type EV_KEY(0x01) key_up: KEY_NUMERIC_1(0x0201)
33048.944042: event type EV_SYN(0x00).
33056.974660: lirc protocol(rc6_mce): scancode = 0x800f0410
33056.974703: event type EV_MSC(0x04): scancode = 0x800f0410
33056.974703: event type EV_KEY(0x01) key_down: KEY_VOLUMEUP(0x0073)
33056.974703: event type EV_SYN(0x00).
33057.108040: event type EV_KEY(0x01) key_up: KEY_VOLUMEUP(0x0073)
33057.108040: event type EV_SYN(0x00).
Kod: Zaznacz cały
nano /etc/rc_maps.cfg
Kod: Zaznacz cały
* * /etc/rc_keymaps/rc6_mce.toml
Kod: Zaznacz cały
ir-keytable -r

Kod: Zaznacz cały
sudo apt-get install triggerhappy
Kod: Zaznacz cały
mkdir -p /etc/triggerhappy/triggers.d/
Kod: Zaznacz cały
thd -d /dev/input/event*
Kod: Zaznacz cały
EV_KEY KEY_PLAY 1 /dev/input/event2
# KEY_PLAY 1 command
EV_KEY KEY_PLAY 0 /dev/input/event2
# KEY_PLAY 0 command
EV_KEY KEY_STOP 1 /dev/input/event2
# KEY_STOP 1 command
EV_KEY KEY_STOP 0 /dev/input/event2
# KEY_STOP 0 command
Kod: Zaznacz cały
nano /etc/triggerhappy/triggers.d/triggerhappy.conf
Kod: Zaznacz cały
KEY_PLAY 1 /usr/bin/mpc play
KEY_STOP 1 /usr/bin/mpc stop
KEY_MEDIA 1 /root/mpc-start.sh
zmieniamy to w pliku na root:
Kod: Zaznacz cały
nano /etc/systemd/system/multi-user.target.wants/triggerhappy.service

Kod: Zaznacz cały
systemctl enable triggerhappy
systemctl start triggerhappy
systemctl status triggerhappy
Musimy wpisać odpowiednie dane odnośnie lkoalizacji drivera hd44780, identyfikacji naszego LCD (f3) , 16x2 lub 40x2 , wielkość zegara itp
Edytujemy pliki LCDd.conf i lcdproc.conf i wstawiamy odpowiednie dane
Kod: Zaznacz cały
nano /etc/LCDd.conf
Kod: Zaznacz cały
## Server section with all kinds of settings for the LCDd server ##
[server]
DriverPath=/usr/lib/aarch64-linux-gnu/lcdproc/
Driver=hd44780
Bind=127.0.0.1
Port=13666
ReportLevel=3
User=root
Foreground=no
Hello="Welcome to"
Hello="OrangePi3 LTS"
GoodBye="Internet Radio"
GoodBye="OrangePi3 LTS"
WaitTime=5
ServerScreen=off
Backlight=off
Heartbeat=off
TitleSpeed=4
ToggleRotateKey=Enter
PrevScreenKey=Left
NextScreenKey=Right
## The menu section. The menu is an internal LCDproc client. ##
[menu]
## Hitachi HD44780 driver ##
[HD44780]
ConnectionType=i2c
Device=/dev/i2c-0
Port=0x3f
Backlight=no
Size=40x2
DelayBus=false
DelayMult=1
Keypad=no
Speed=0
i2c_line_RS=0x01
i2c_line_RW=0x02
i2c_line_EN=0x04
i2c_line_BL=0x08
i2c_line_D4=0x10
i2c_line_D5=0x20
i2c_line_D6=0x40
i2c_line_D7=0x80
BacklightInvert=no
# EOF
Kod: Zaznacz cały
cd /
find -name hd44780.so
Kod: Zaznacz cały
nano /etc/lcdproc.conf
Kod: Zaznacz cały
# LCDproc client configuration file
## general options ##
[lcdproc]
# address of the LCDd server to connect to
Server=localhost
# Port of the server to connect to
Port=13666
# set reporting level
ReportLevel=2
# report to to syslog ?
ReportToSyslog=false
# run in foreground [default: false; legal: true, false]
#Foreground=true
# PidFile location when running as daemon [default: /var/run/lcdproc.pid]
#PidFile=/var/run/lcdproc.pid
# slow down initial announcement of modes (in 1/100s)
#delay=2
# display name for the main menu [default: LCDproc HOST]
#DisplayName=lcdproc
## screen specific configuration options ##
[CPU]
# Show screen
Active=false
OnTime=1
OffTime=2
ShowInvisible=false
[Iface]
# Show screen
Active=false
# Show stats for Interface0
Interface0=eth0
# Interface alias name to display [default: <interface name>]
Alias0=LAN
# Show stats for Interface1
Interface1=wlan0
Alias1=WLAN
# Show stats for Interface2
#Interface2=eth2
#Alias2=MGMT
# for more than 3 interfaces change MAX_INTERFACES in iface.h and rebuild
# Units to display [default: byte; legal: byte, bit, packet]
unit=bit
# add screen with transferred traffic
#transfer=TRUE
[Memory]
# Show screen
Active=false
[Load]
# Show screen
Active=false
# Min Load Avg at which the backlight will be turned off [default: 0.05]
LowLoad=0.05
# Max Load Avg at which the backlight will start blinking [default: 1.3]
HighLoad=1.3
[TimeDate]
# Show screen
Active=false
# time format [default: %H:%M:%S; legal: see strftime(3)]
TimeFormat="%H:%M:%S"
# date format [default: %x; legal: see strftime(3)]
DateFormat="%x"
[About]
# Show screen
Active=false
[SMP-CPU]
# Show screen
Active=false
[OldTime]
# Show screen
Active=false
# time format [default: %H:%M:%S; legal: see strftime(3)]
TimeFormat="%H:%M:%S"
# date format [default: %x; legal: see strftime(3)]
DateFormat="%x"
# Display the title bar in two-line mode. Note that with four lines or more
# the title is always shown. [default: true; legal: true, false]
#ShowTitle=false
[BigClock]
# Show screen
Active=true
[Uptime]
# Show screen
Active=false
[Battery]
# Show screen
Active=false
[CPUGraph]
# Show screen
Active=false
[ProcSize]
# Show screen
Active=false
[Disk]
# Show screen
Active=false
[MiniClock]
# Show screen
Active=false
# time format [default: %H:%M; legal: see strftime(3)]
TimeFormat="%H:%M"
# EOF
odtwarzanego utworu muzycznego / nazwę zespołu jeśli takowe dane są dostarczane ...mnie tyle wystarczy

Musicie szukać jakiś wyświetlaczy przynajmniej LCD 16x2 lub 40x2 kompatybilnych z driverami : hd44780 ten drugi wyświetli wszystkie info na LCD a na 16x2 zawija text i nie wszystko się mieści (chyba że jesteśmy programistami w pythonie to można sobie dostosować specjalne przewijanie) Ja zastosowałem LCD 40x2 firmy Winstar (3.3V) (oled) oparty o kontroler / driver: WS0010 kompatybilny z hd44780 + Konwerter I2C dla wyświetlacza LCD HD44780


Podpinanie LCD do OrangePi3 LTS ...najpierw podpinamy do LCD konwerter I2C w przypadku 16x2 jest prosto bo zawsze jest tak samo lutujemy 16 pinów do LCD jak na zdjęciu (na LCD tak 16x2 jak 40x2 piny są numerowane 1 do 16 więc nie ma problemu z tym że 40x2 piny ma nie po kolei a na przemian w dwóch rzędach )
Konwerter I2C ma cztery piny które potem podłączamy do płyty OrangePi 3LTS :
Schemat pinów na Opi-3 LTS i info podłączenia pinów konwertera I2C: vcc/sda/scl/gndGND - masa
VCC - napięcie (3 / 5V)
SDA - dane
SCL - dane

Musimy zainstalować WiringOP i odblokować w systemie interface I2C dla LCD
Kod: Zaznacz cały
sudo apt update
sudo apt install -y git
git clone https://github.com/orangepi-xunlong/wiringOP
cd wiringOP
sudo ./build clean
sudo ./build
Kod: Zaznacz cały
gpio readall

dodajemy w systemie pewne wpisy:
Kod: Zaznacz cały
nano /etc/modules
Kod: Zaznacz cały
i2c-dev
Kod: Zaznacz cały
cd /boot
nano orangepiEnv.txt
Kod: Zaznacz cały
overlays= i2c0 i2c1 i2c2
jeszcze instalujemy
Kod: Zaznacz cały
sudo apt-get install -y python-smbus i2c-tools
jeśli w systemie nie ma python-smbus to może:
Kod: Zaznacz cały
sudo apt-get install i2c-tools
sudo apt-get install python3-smbus
sudo apt-get install libhdf5-dev
sudo apt install pip
sudo pip install smbus
sudo pip3 install smbus
Kod: Zaznacz cały
sudo i2cdetect -y 0
Kod: Zaznacz cały
root@orangepi3-lts:~# sudo i2cdetect -y 0
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 3f
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --

Teraz już tylko odpowiedni program napisany w python -ie do obsługi naszego LCD / OrangePi / mpd / mpc ...problem polega na tym że w systemie debian bullseye nie ma już prog. python v2 gdyż został zastąpiony w 2020r przez python3 a nasz program jest oparty i napisany w python v2 jest więc niekompatybilny. Potrzebny programista

albo pewien sposób więcej:
Musimy utworzyć środowisko wirtualne dla Pythona 2 w systemie
U mnie python2 (virtual) jest zainstalowany w ścieżce : /root/venv/python2/bin/python
tworzymy plik w pythonie np. o nazwie np. start.py
Kod: Zaznacz cały
nano /root/start.py
zawartość :# Define some device parameters
I2C_ADDR = 0x3f # I2C device address
LCD_WIDTH = 40 # Maximum characters per line
LCD_HEIGHT = 2
Kod: Zaznacz cały
#!/usr/bin/python
# -*- coding: utf-8 -*-
import smbus
import time
import subprocess
from time import sleep, strftime
from datetime import datetime
from subprocess import *
# Define some device parameters
I2C_ADDR = 0x3f # I2C device address
LCD_WIDTH = 40 # Maximum characters per line
LCD_HEIGHT = 2
# Define some device constants
LCD_CHR = 1 # Mode - Sending data
LCD_CMD = 0 # Mode - Sending command
LCD_LINE_1 = 0x80 # LCD RAM address for the 1st line
LCD_LINE_2 = 0xC0 # LCD RAM address for the 2nd line
LCD_LINE_3 = 0x94 # LCD RAM address for the 3rd line
LCD_LINE_4 = 0xD4 # LCD RAM address for the 4th line
LCD_BACKLIGHT = 0x08 # On
#LCD_BACKLIGHT = 0x0C # Off
ENABLE = 0b00000100 # Enable bit
# Timing constants
E_PULSE = 0.005
E_DELAY = 0.005
#Open I2C interface
bus = smbus.SMBus(0) # Rev 1 Pi uses 0 (and Orange PI PC, for pins 3 and 5)
#bus = smbus.SMBus(1) # Rev 2 Pi uses 1
def lcd_byte(bits, mode):
# Send byte to data pins
# bits = the data
# mode = 1 for data
# 0 for command
bits_high = mode | (bits & 0xF0) | LCD_BACKLIGHT
bits_low = mode | ((bits<<4) & 0xF0) | LCD_BACKLIGHT
# High bits
bus.write_byte(I2C_ADDR, bits_high)
lcd_toggle_enable(bits_high)
# Low bits
bus.write_byte(I2C_ADDR, bits_low)
lcd_toggle_enable(bits_low)
def lcd_toggle_enable(bits):
# Toggle enable
time.sleep(E_DELAY)
bus.write_byte(I2C_ADDR, (bits | ENABLE))
time.sleep(E_PULSE)
bus.write_byte(I2C_ADDR,(bits & ~ENABLE))
time.sleep(E_DELAY)
def lcd_string(message,line):
# Send string to display
message = message.ljust(LCD_WIDTH," ")
lcd_byte(line, LCD_CMD)
for i in range(LCD_WIDTH):
lcd_byte(ord(message[i]),LCD_CHR)
def replace_pl(chars):
pl = { 'ą': 'a',
'ć': 'c',
'ę': 'e',
'ł': 'l',
'ń': 'n',
'ó': 'o',
'ś': 's',
'ź': 'z',
'ż': 'z',
'Ą': 'A',
'Ć': 'C',
'Ę': 'E',
'Ł': 'L',
'Ń': 'N',
'Ó': 'O',
'Ś': 'S',
'Ź': 'Z',
'Ż': 'Z',
}
for f, t in pl.items():
chars = chars.replace(f,t)
return chars
def main():
counter = 0
while True:
# Get current status and playtime
process = subprocess.Popen('sudo mpc -v', shell=True, stdout=subprocess.PIPE)
ekran1 = process.communicate()[0]
ekran1 = replace_pl(ekran1)
statusLines = ekran1.split('\n')
ekran1 = statusLines[1]
if ekran1 <> '':
ekran1L1 = ekran1.split(' ',1)[0].strip()
ekran1L2temp = ekran1.split(' ',1)[1].strip()
ekran1L2 = ekran1L2temp.split(' ',1)[0].strip()
process = subprocess.Popen('sudo mpc -f %name%', shell=True, stdout=subprocess.PIPE)
ekran2 = process.communicate()[0]
ekran2 = replace_pl(ekran2)
statusLines = ekran2.split('\n')
ekran2 = statusLines[0]
ekran2L1 = ekran2[0:40]
ekran2L2 = ekran2[40:80]
process = subprocess.Popen('sudo mpc -f %artist%', shell=True, stdout=subprocess.PIPE)
ekran3 = process.communicate()[0]
ekran3 = replace_pl(ekran3)
statusLines = ekran3.split('\n')
ekran3 = statusLines[0]
ekran3L1 = ekran3[0:40]
ekran3L2 = ekran3[40:80]
process = subprocess.Popen('sudo mpc -f %title%', shell=True, stdout=subprocess.PIPE)
ekran4 = process.communicate()[0]
ekran4 = replace_pl(ekran4)
statusLines = ekran4.split('\n')
ekran4 = statusLines[0]
ekran4L1 = ekran4[0:40]
ekran4L2 = ekran4[40:80]
if counter == 1:
if ekran1 == "":
counter = 7
else:
lcd_string(ekran1L1,LCD_LINE_1)
lcd_string(ekran1L2,LCD_LINE_2)
if counter == 7:
if ekran2 == "":
counter = 14
else:
lcd_string(ekran2L1,LCD_LINE_1)
lcd_string(ekran2L2,LCD_LINE_2)
if counter == 14:
if ekran3 == "":
counter = 30
else:
lcd_string(ekran3L1,LCD_LINE_1)
lcd_string(ekran3L2,LCD_LINE_2)
if counter == 30:
if ekran4 == "":
counter = 46
else:
lcd_string(ekran4L1,LCD_LINE_1)
lcd_string(ekran4L2,LCD_LINE_2)
sleep(0.1)
counter = counter + 1
if counter == 53:
counter = 1
if __name__ == '__main__':
try:
main()
except KeyboardInterrupt:
pass
finally:
lcd_byte(0x00, LCD_CMD)
lcd_byte(0x01, LCD_CMD)
lcd_byte(0x08, LCD_CMD)
Kod: Zaznacz cały
/root/venv/python2/bin/python /root/start.py
Kod: Zaznacz cały
nano /root/python2.sh
Kod: Zaznacz cały
#!/bin/bash
sleep 5
/root/venv/python2/bin/python /root/start.py
Kod: Zaznacz cały
chmod +x /root/python2.sh
Kod: Zaznacz cały
nano /etc/rc.local
Kod: Zaznacz cały
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
/root/python2.sh &
exit 0
Z zegarem na LCD miałem spore kłopoty a dokładnie pomiędzy dwoma programami lcdproc / prog. python do obsługi LCD / mpd /mpc. Sam program lcdproc działa OK i zegar jest wyświetlany prawidłowo ale zmiana między w/w powoduje błędy na wyświetlaczu LCD. OK działa ale konfiguracja jest powiem krótko ...dziwna i mało profesjonalna może ktoś obeznany i bardziej kumaty to poprawi

Pliki z konfiguracją możecie pobrać z google drive Wszystkie pliki są w systemie w ścieżce : /root
Do poprawnego działania skorzystałem także z programu liblcm1602 który wymaga skompilowania.
Kod: Zaznacz cały
cd /root/liblcm1602
make clean
make
można ponownie skompilować po zmianie.
uruchamiając plik / skrypt mpc-start.sh z terminala lub przyciskiem z pilota uzyskałem sprawdzenie czy mpc odtwarza radio czy nie jeśli tak to wyświetla informację o w/w jeśli nie uruchamia Zegar centralnie na LCD :
Kod: Zaznacz cały
cd /root
/bin/bash ./mpc-start.sh
Plik: lcd.sh - sprawdza czy prog. LCDd jest uruchomiony jeśli tak nie robi nic jeśli nie uruchamia zegar
Plik: mpc.sh - sprawdza czy prog. mpc odtwarza radio ( tak naprawdę czy skrypt python-a jest uruchomiony ) jeśli tak nie robi nic ...jeśli nie uruchamia skrypt pythona do obsługi LCD / mpc /mpd
Na razie nie wiem czy nie umieszczę jednego do ciągłego sprawdzania np. w usłudze : cron
Można kombinować ... pozostawiam to każdemu jeśli się umie programować to super jeśli nie to wystarczy ta podstawowa konfiguracja.
Można zobaczyć jak mniej więcej to działa ( sory za jakość wideo ) KLIK
Muszę wspomnieć iż sam zastosowałem lepszą kartę dźwiękową (oparta o układ CM6631A) żeby uzyskać tzw DAC ( 32Bit ) przez usb . Niestety ale OrangePi 3 LTS nie ma możliwości uruchomienia interface I2S (audio brak dokumentacji tak producenta jak developera Armbian itd ) jak choćby na starszym bracie OrangePi lite a co dziwne najnowszy Ubuntu / Debian na Lite też nie miał tej opcji ...może jakieś prawa autorskie ? ostatnio udało mi się uruchomić ale tylko 24bit z układem : PCM5102 który kosztuje zaledwie 1/4 karty CM6631A

Parametry karty można uzyskać z komendy:
Kod: Zaznacz cały
cat /proc/asound/card1/pcm0p/sub0/hw_params
Kod: Zaznacz cały
format "192000:32:2"
Radio / Player oparty o OrangePi / mpd / mpc ma duży plus bo można nim sterować także przez PC ...linux / windows / androida (na linuxa jest prog. Ymuse) itd
A teraz minusy ...to co zauważyłem to wersja Opi3 LTS ma parę wad : CPU ciut za dużo się grzeje w stanie spoczynku 55 - 58 st C / lekkie obciążenie 70 C ... konieczny wysoki radiator ale już jako audio wideo player pewnie wentylator lub duży radiator na całą płytę. Brak w systemie działającej poprawnie usługi: lspci ... może jakaś wada konstrukcyjna ? wifi 5Ghz osiąga 120 / 120 Mbps chyba powinno być więcej do radia aż za dużo ...ale dla audio wideo ? Mój LCD podczas restartu systemu głupieje i są błędy ...lepiej zrobić poweroff / wakeup

Obudowę każdy zrobi sobie według gustu

Mój obraz OrangePi 3 lts : debian_bullseye_server_linux5.16.17 / + Opi lite itd zamieszczę na google drive
pozdro