Introduction: Always ON Raspberry Pi DLNA Server and Torrent Client With Status LEDs

Tried to make one for myself and it's working perfectly. It's able to stream HD videos without any lag and the status LEDs gives me a quick status of it .

I have added the steps I took to put it together below .Please go through it ,if you are interested to build one .

Give it a try and let me know how it went .

Step 1: Increase Power Out on Usb Port for Hard Drive to Detect

My Pi wasn't detecting the hard drive, it wasn't spinning up so ..

sudo nano /boot/config.txt

insert below line at bottom of file

max_usb_current=1

found this here and it worked .

Step 2: Auto Mount Hard Drive on Boot

  1. First create a mount point
    • sudo mkdir /mnt/disk1

  2. My drive was ntfs so
    • sudo apt-get install ntfs-3g -y

  3. Now connect the device and see if new device is shown under /dev look for something like sda1 (this can vary)
  4. Now Mount the device
    • sudo mount -o uid=pi,gid=pi /dev/sda1 /mnt/disk1

  5. And check you can read an write to drive by going into /mount/disk1
  6. Now we need to mount this drive every time Pi boots up
    1. Get the UUID of drive by
      • sudo ls -l /dev/disk/by-uuid/ | grep sda1 | awk '{print $9}' (change sda1 one to your device name under /dev)

      • Now modify fstab and add below line to
        • sudo nano /etc/fstab

        • UUID="X" /mnt/usbstorage ntfs nofail,uid=pi,gid=pi 0 0 (replace "X" with UUID)

      • Unfortunately this didn't do the trick due to some factors so I googled and found this , which did the trick
        1. So edited /boot/cmdline.txt and added rootdelay=5 to bottom of file .

Step 3: Config Static IP (optional)

I will be accessing Pi remotely so fixing IP is useful for me

  • sudo vi /etc/network/interfaces

and modified eth0 to

iface eth0 inet static

address 192.168.1.3

netmask 255.255.255.0

network 192.168.1.0

broadcast 192.168.1.255

gateway 192.168.1.1

This might be different for you , so please update accordingly . Please refer to this page for more details .

Step 4: Install Transmission Torrent Client

  1. install client
    • sudo apt-get install transmission-daemon
  2. Create the folders for download files
    • mkdir -p /mnt/disk1/Torrent_inprogress

    • mkdir -p /mnt/disk1/Torrent_complete

  3. To configure Transmission I used this page, they have a sample config file to start with for more configuration refer this page .
  4. Now configure Transmission to start with Pi
    • sudo update-rc.d transmission-daemon defaults

Step 5: Install and Config DLNA Server

  1. Install minidlna
    • sudo apt-get install minidlna

  2. Config minidlna
    1. I used this instructables to configure minidlna
  3. Config minidlna to start with Pi
    • sudo update-rc.d minidlna defaults

Step 6: Connect the Status LEDs

1. Connecting LED is straight forward , don't forget the current limiting resistor . Please see the circuit diagram. Connect it to gpio pin in Pi instead of 5v and I am using a 220ohm resistor .

2. I use three of these for status , one for checking internet connection , two for torrent upload and download status .

3. I am using WiringPi to controll led from shell script and I have attached the script here also .

4. Copy the script to Pi, make it executable (chmod 755 check_status.sh)

5. Schedule it to run every minute on Cron.

  • edit crontab (crontab -e)
  • add this line to end (* * * * * /home/pi/check_status.sh>>/dev/null 2>&1)
  • save and exit

Comments

author
Lentin Joseph (author)2015-12-04

Nice tutorial :)

author

thank you

author
DIY Hacks and How Tos (author)2015-12-02

Nice. Using a Raspberry Pi for this would be way cheaper than buying something off the shelf.

author

True, and we can get it to work the way we want .