pHAT DAC & Openelec\Kodi [SOLVED]

I have bought a Pi Zero and pHAT DAC and was hoping to use them for an OpenElec/Kodi based music system. I have looked at the pHAT DAC installation instructions, but they only seem to work for a Raspian system. I did try opening a terminal to OpenElec, through Putty, but couldn’t work out where to go next as, when I tried creating the asound.conf file, the Terminal said I had a Read Only file system :-( Any ideas?

I’m not very familiar with OpenElec but my understanding is that it is quite a restrictive environment out of the box, yes.

I found the following which should hopefully be of use to you, given the underlying hardware in the pHAT DAC is identical (AFAIK):

I suspect that once you have mounted a rw filesystem you might be able to just recycle the entire phatdac script, but if not it shouldn’t be too complicated either.

I’ve got it working on Lakka, which is based upon OpenELEC. I recall copying the device tree blob from Raspbian’s /boot/overlay into the /boot/overlay of Lakka and enabling it, but I’m not sure what I did from there.

Works a treat though!

( I think I remember running into the write-only filesystem problem and manually putting the alsa conf file into my home directory instead, or something like that. I really should have written this stuff down! )

Hello Phil (and RogueM),

I can’t spend any more time this weekend trying to get the pHAT DAC to work in this way, but will try and have a go at what you suggest later next week.

I gave up with OpenElec in the end and then tried OSMC. At least it let me use sudo from an SSH window, unlike OpenElec. I then tried the same installation process from: but did not have a raspi-blacklist.conf file to edit (see step 1).

when I looked for snd_bcm2835 in the modules file, it wasn’t there.

finally, when I tried step 3, I was told that I couldn’t write the file from nano, as access was denied! Agggh!

In my travels around the web, I tried this Configuring OSMC for HiFiBerry.

and this…pHAT DAC on OSMC, which was too sketchy.

In between times, I have ended up corrupting my SD card a few times and had to re-write the image, all of which takes time. Having started fiddling at 3pm, it is now 9pm :-(

Surely, I am not the only one who thinks it a good idea to combine a little Pi Zero, with a pHAT DAC and a media system like OSMC. Is there any chance that Pimoroni could look at getting some more support docs produced for the pHAT DAC? The page mentioned above seems to indicate that these instructions were rather hastily put together.

If all else fails, I guess I could bring it along to the RPi 4th birthday party. Someone there will surely be able to fix my fiddlings!

Thanks again to you both for your help.

I am very sure I ran into the same issue when writing the phatdac script on Raspbian (Jessie) too. The workaround is indeed to create the asound file in another place then move it with mv. Try:

sudo echo -e "pcm.! \bdefault {\n type hw card 0\n}" > ~/asound.conf
sudo echo -e "ctl.! \bdefault {\n type hw card 0\n}" >> ~/asound.conf
sudo mv ~/asound.conf /etc/asound.conf

Edit: this is a full replacement for Step 3 described in learn portal, lifted from script tested in Raspbian, untested anywhere else, but should work elsewhere. If you prefer you can use nano, creating the file in your home directory, before moving it in place.

Thank you RogueM for coming back to me on this. I’ll give it a shot mid-week and give an update.

np… if you’re patient enough I had it on my list to check out OSMC and the pHAT DAC in tandem. I’ll knock off a script if I manage to get it working!

i personally don’t bother with Openelec or OSMC specific builds. On my PiZero I have a full raspbian OS running and Kodi installed. Works perfectly, it means I have a unrestricted operating system and Kodi Media centre. Kodi controlled through the Kodi remote on iOS/Android. I do have a pHAT DAC which I’ll have a play around with haven’t up to now as audio via the hdmi has been fine for me. If u need any more details let me know

Thank you batesm0t31. Hopefully have a look at this later tonight. I am just getting started with media systems. I just thought it could be a good use of my £4 Pi Zero. I’ve got a non-smart flat screen TV in my kitchen and a son who likes to play music from his laptop. I was hoping to make my TV more flexible, being able to use on-demand players on it and also cut my electric bill, as my son shouldn’t feel the need to have his Mac on for hours at a time.

Do you also have a full size Pi ?

From a clean Raspbian image basically do this :

sudo apt-get install kodi -y

sudo addgroup --system input

sudo usermod -a -G audio,video,input,dialout,plugdev,tty kodi

sudo nano /etc/udev/rules.d/99-input.rules

-Create some permissions for the input group. Add the lines :

SUBSYSTEM==“input”, GROUP=“input”, MODE="0660"
KERNEL==“tty[0-9]*”, GROUP=“tty”, MODE=“0660”

-Open the Kodi default configuration

sudo nano /etc/default/kodi

-Enable Kodi to boot on startup by changing ENABLED to 1

Set this to 1 to enable startup


-Enable GPU memory, 128 MB should play back HD video

sudo nano /boot/config.txt


-Update Kodi

sudo apt-get update && sudo apt-get upgrade -y

I have looked into this, using the latest images for Openelec and OSMC and the only step to take (besides choosing the right output device) is to add the following to /boot/config.txt:


as to how to add that line to /boot/config.txt, you may either edit the file on the SD using another computer, or ssh into it… both methods worked for me, OSMC in particular did not complain.

Incidentally, both OSMC and OpenElec support the Raspberry Pi Official Touchscreen out of the box (including lcd_rotate=2 flag)

… in case this helps these are the options you should be able to choose from after editing the /boot/config.txt file:




Just wanted to say thanks for all the advice in this thread, I’ve now got OpenElec up and running on an A+, connected to the official Raspberry Pi touchscreen, with a pHAT DAC sending music from a USB stick to a UE Boom 2.

A really nice standalone solution for my home office. :-)