## The Basic Idea
The basic idea is to use a small Linux computer to create an isolated WiFi network (a "car network") and run Shairport Sync on it to provide an AirPlay service. An iPhone or an iPad with cellular capability can simultaneously connect to internet radio, YouTube, Apple Music, Spotify, etc. over the cellular network and send AirPlay audio through the car network to the AirPlay service provided by Shairport Sync. This sends the audio to the computer's DAC which is connected to the AUX input of your car audio.
-### Notes
-1. **Android:** Android phones and tablets can not, so far, do this trick of using the two networks simultaneously.
-2. **Volume Control, AirPlay 2:** In iOS 17 and later, if Shairport Sync is built for AirPlay 2, you won't be able to control the volume from your iOS device. This is because volume control settings are not sent from the iOS device to Shairport Sync in this mode.
-In practice, this should not be a problem -- you control the volume using the car audio's volume control, the same as any other source.
-3. **Volume Control, classic AirPlay ("AirPlay 1"):** if Shairport Sync is built for classic AirPlay, you can control the volume from your iOS device.
+
+Please note that Android phones and tablets can not, so far, do this trick of using the two networks simultaneously.
## Example
* Close the file and carefully dismount and eject the two drives. *Be sure to dismount and eject the drives properly; otherwise they may be corrupted.*
* Remove the SD card from the Linux machine, insert it into the Pi and reboot.
-After a short time, the Pi should appear on your network – it may take a minute or so. To check, try to `ping` it at the `<hostname>.local`, e.g. if the hostname is `bmw` then use `$ ping bmw.local`. Once it has appeared, you can SSH into it and configure it.
+After a short time, the Pi should appear on your network – it may take a couple of minutes. To check, try to `ping` it at the `<hostname>.local`, e.g. if the hostname is `bmw` then use `$ ping bmw.local`. Once it has appeared, you can SSH into it and configure it.
### Boot, Configure, Update
The first thing to do on a Pi would be to use the `raspi-config` tool to expand the file system to use the entire card. Next, do the usual update and upgrade:
```
Two `general` settings are worth noting.
-1. First, the option to ignore the sending device's volume control is enabled. This means that the car audio's volume control is the only one that affects the audio volume.
- As of iOS 17 it appears that volume control information is not forwarded to Shairport Sync when it is used like this. For this reason, it is important to set the `ignore_volume_control` setting in the configuration file to `"YES"`. This will allow audio to be forwarded to the car audio using the full volume range of the DAC instead of at the default initial volume, which may be quite low and which can't be changed from the iOS device.
+1. First, the option to ignore the sending device's volume control is enabled. This means that the car audio's volume control is the only one that affects the audio volume. This is a matter of personal preference.
-2. Second, the maximum output offered by the DAC to the AUX port of the car audio can be reduced if it is overloading the car audio's input circuits. Again, that's a matter for personal selection and adjustment.
+2. Second, the maximum output offered by the DAC to the AUX port of the car audio can be reduced if it is overloading the car audio's input circuits and causing distortion. Again, that's a matter for personal selection and adjustment.
The `alsa` settings are for the Pimoroni PHAT – it does not have a hardware mixer, so no `mixer_control_name` is given.
The DAC's 32-bit capability is automatically selected if available, so there is no need to set it here. Similarly, since `soxr` support is included in the build, `soxr` interpolation will be automatically enabled if the device is fast enough.
-Note that if you're upgrading the operating system to e.g. from Bullseye to Bookworm, the location of the output devices may change, and the names of the mixer controls may also change. You can use [`sps-alsa-explore`](https://github.com/mikebrady/sps-alsa-explore) to investigate device names and mixer names.
+Note that if you're upgrading the operating system to e.g. from Bullseye to Bookworm, the names and index numbers of the output devices may change, and the names of the mixer controls may also change. You can use [`sps-alsa-explore`](https://github.com/mikebrady/sps-alsa-explore) to discover device names and mixer names.
### Extra Packages
A number of packages to enable the Pi to work as a WiFi base station are needed:
# Make sure that the script will "exit 0" on success or any other
# value on error.
-# Uncomment the next line to exit the script, skipping the remainder of the script where the WiFi access point and Shairport Sync itself are started.
+# Uncomment the next line to exit the script here, skipping the remainder of the script where the WiFi access point and Shairport Sync itself are started.
# exit 0 # uncomment this line to exit the script here
/sbin/iw dev wlan0 set power_save off
As you can see, the effect of these commands is to start the WiFi transmitter, give the base station the IP address `10.0.10.1`, start a DHCP server and finally start the Shairport Sync service.
### Final Steps
-You should now disable the `NetworkManager` or the `dhcpcd` service -- whichever of them is in your system -- so that they won't run when the system reboots.
-To do this, perform the appropriate one of the following commands:
-
+You should now disable either the `NetworkManager` or the `dhcpcd` service (whichever is in your system) so that they won't run when the system reboots. You can find out which is in your system using the `ps -aux` command and looking for either `NetworkManager` or `dhcpcd`. Here is an example from a system running `dhcpcd`:
+```
+$ ps aux | grep 'NetworkManager\|dhcpcd' | grep -v grep
+root 596 0.0 0.2 3112 2216 ? Ss Oct08 0:51 /usr/sbin/dhcpcd -w -q
+```
+Once you have identified which service to disable, perform the appropriate one of the following commands:
```
# systemctl disable NetworkManager
```
```
# poweroff
```
-
### Optional: Optimise startup time – Raspberry Pi Specific
-
-This is applicable to a Raspberry Pi only and is optional. Some of it may be applicable to other systems, but it has not been tested on them.
-
-There are quite a few services that are not necessary for this setup. Disabling them can improve startup time. Running these commands disables them:
-
+These optional steps have been tested on a Raspberry Pi only. They have not been tested on other systems.
+Some services are not necessary for this setup. These commands disable them:
```
# systemctl disable systemd-timesyncd
# systemctl disable keyboard-setup
# systemctl disable triggerhappy
# systemctl disable dphys-swapfile
```
-
### Optional: Read-only mode – Raspberry Pi Specific
-This is applicable to a Raspberry Pi only and is optional. Run `sudo raspi-config` and then choose `Performance Options` > `Overlay Filesystem` and choose to enable the overlay filesystem, and to set the boot partition to be write-protected.
+This optional step is applicable to a Raspberry Pi only. Run `sudo raspi-config` and then choose `Performance Options` > `Overlay Filesystem` and choose to enable the overlay filesystem, and to set the boot partition to be write-protected.
### Ready
Install the Raspberry Pi in your car. It should be powered from a source that is switched off when you leave the car, otherwise the slight current drain will eventually flatten the car's battery.
When the power source is switched on, typically when you start the car, it will take maybe a minute for the system to boot up.
### Enjoy!
-
---
-
## Updating
From time to time, you may wish to update this installation. Assuming you haven't deleted your original WiFi network credentials, the easiest thing is to temporarily reconnect to the network you used when you created the system. To do that, you have to temporarily undo the "Final Steps" and some of the "Raspberry Pi Specific" steps you used. This will enable you to connect your device back to the network it was created on. You should then be able to update the operating system and libraries in the normal way and then update Shairport Sync.
then delete that line or comment it out -- it it no longer needed going forward.
If the file `/etc/dhcpcd.conf` doesn't exist, or the first line is not `denyinterfaces wlan0` as given here, then you don't need to do anything.
- (The reason for this suggestion is that a simpler way of preventing the `dhcpcd` service from trying to manage the `wlan0` interface is now used -- the `dhcpcd` service is now completely disabled.)
+ (The reason for this suggestion is that a simpler way is now used to prevent the `dhcpcd` service from trying to manage the interface -- the `dhcpcd` service is now completely disabled.)
3. Make sure you disable the `wpa_supplicant` service:
```
# systemctl disable wpa_supplicant
```
-
- (The reason for this suggestion is that it is important that the `wpa_supplicant` service not be running when the system is operating as a WiFi access point. Previous advice to enable the `wpa_supplicant` service when updating may result in it continuing to run even when the `dhcpcd` or `NetworkManager` has been disabled. So, please be sure to disable the `wpa_supplicant` service.)
+ (The reason for this suggestion is that previous advice may result in the `wpa_supplicant` service continuing to run even when the `dhcpcd` or `NetworkManager` has been disabled. This can cause connectivity problems.)
4. Re-enable either `NetworkManager` or `dhcpcd` as appropriate:
```
```
# systemctl enable systemd-timesyncd
```
+ This is needed because the correct time is necessary for detemininig what has been updated.
+
6. Edit `/etc/rc.local` to exit the script before enabling the WiFi access point and starting Shairport Sync. Do this by uncommenting the line:
```
# exit 0 # uncomment this line to exit the script here
Save the changes.
From this point on, if you reboot the machine, it will connect to the network it was configured on, i.e. the network you used when you set it up for the first time. This is because the name and password of the network it was created on would have been placed in `/etc/wpa_supplicant/wpa_supplicant` when the system was initially configured and will still be there.
+
7. Reboot and do normal updating.
### Revert to normal operation