Raspberry Pi Media Server: a Wifi routing Hotspot, Music server and client


With the advent of the excellent Raspbian Pi platform it's now possible to run proper Linux programs like never before and that includes SeeDeclip4, giving you a multi-user wifi music server for the whole house, campervan, pub, club etc.


  • These Hotspot instructions relate only to the Pi 3B+ and Pi4 running on Stretch and Buster (Debian 9 and 10).
  • The new Pi4 is much faster but the 'Buster' Linux Raspbian isn't quite the same yet in small but vital areas.
  • The actual Seedeclip4 software will run on both without issue.

The Raspberry Pi running Raspbian Lite can be setup to run in the following ways:

Music server on a wired ethernet

  1. Install SeeDeClip4
  2. Add your music files

Music server on a portable wireless hotspot (optional wired ethernet)

  1. Setup the Pi3B+ or Pi4 as a WiFi hotspot with optional internet routing via ethernet
    There are many instructions about a dumb hotspot or a Wifi access point (bridge) but look here to find out how to have your own private, standalone Wifi hotspot that you can add internet access to simply by plugging in the ethernet.
    I.e. this is a wireless hotspot router, so you can surf the net while listening to music from your SeeDeClip4 server. Then you can unplug it and take it with you the car or campervan and use it as a hotspot music server there too.
  2. Install SeeDeClip4
  3. Add your music files

Music slave to drive a DAC via USB

  1. Install runslave.sh (downloaded from SeeDeClip4 when running) and configure]

Cooling the Pi4

The Pi4 needs a heatsink and a fan:
  1. The heatsink can be any stickon Pi3 type heatsink.
  2. The fan needs to be a 5V 30mm x 30mm x 7mm fan for the Pi

This can be bolted to the inside of the official plastic Pi4 case lid after a 29-30mm hole is drilled in it above the SOC.

Then pins along the GPI can be used:
  1. +5V
  2. +5V (Connect to the +ve bit of the fan)
  3. Gnd (Connect to the Source of an IRLZ44N MOSFET (or smaller compatible one)
  4. GPIO14 (Connect to the Gate of the IRLZ44N)

Then connect the -ve (black) of the fan to the Drain of the IRLZ44N. Optionally connect a 100uF cap and IN4001 Diode in parallel with the fan, the cap +ve and diode bar toward the red +ve of the fan.

Now we need to drive it using this python program:

import RPi.GPIO as GPIO
import time

# CPU temp?
def get_cpu_temp():
    tempc = 70
    fin = open("/sys/class/thermal/thermal_zone0/temp", "r")
    if (fin):
        line = fin.readline()
            tempc = 0.001 * int(line)
            tempc = 75

    return tempc

# Calculate required PWM
def calc_pwn(otemp):
    pwm_min = 30
    pwm_max = 100
    temp_min = 45
    temp_max = 60

    temp = otemp
    if (temp < temp_min):
        temp = temp_min
    elif (temp > temp_max):
        temp = temp_max

    ratio = (temp - temp_min) / (temp_max - temp_min)
    pwm = pwm_min + ratio * (pwm_max - pwm_min)

    desc = "Temp = %0.2fC, PWM = %0.2f%%" % (otemp, pwm)
    fout = open("/tmp/faninfo.txt", "w")
    if (fout):
        fout.write(desc + "\n")
    # print(desc)

    return pwm

# Run the PWM for the fan..
def fan_control():
    pwm = 1
    fan = 14
    fifolen = 5
    fifo = []

    GPIO.setup(fan, GPIO.OUT, initial=GPIO.LOW)

    # Create a PWM
    p = GPIO.PWM(fan, 40)

    # Full blast to unstick!!

    # Scan temperatures
    f = 0
    while (True):

        # Measure SOC
        temp = get_cpu_temp()

        # Fifo to smooth the fan speed changes
        fifo.insert(0, temp)
        count = len(fifo)
        if (count > fifolen):
            count -= 1

        # Average temp
        for i in range(1, count):
            temp += fifo[i]

        temp /= count

        # Set it!
        pwm  = calc_pwn(temp)
        p.ChangeDutyCycle(pwm)  # where 0.0 <= pwm <= 100.0


Once you are happy everything is working start it up on boot by adding it to /etc/rc.local using this line:

(sleep 1 && /usr/bin/python /usr/local/bin/pi4fan.py ) &

This should keep your Pi4 SOC at around 45°C at a quiet 45% PWM drive.
Check /tmp/faninfo.txt for info:

{Pi4} cat /tmp/faninfo.txt
Temp = 47.81C, PWM = 43.11%

Copyright © 2007-2023, CuteStudio
Page generated in 0.139s, Powered by Silk V1.3-0 from Cutestudio