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
Designed a new case for this https://www.thingiverse.com/thing:2896640 .
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
- First create a mount point
sudo mkdir /mnt/disk1
- My drive was ntfs so
sudo apt-get install ntfs-3g -y
- Now connect the device and see if new device is shown under /dev look for something like sda1 (this can vary)
- Now Mount the device
sudo mount -o uid=pi,gid=pi /dev/sda1 /mnt/disk1
- And check you can read an write to drive by going into /mount/disk1
- Now we need to mount this drive every time Pi boots up
- 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
- So edited /boot/cmdline.txt and added rootdelay=5 to bottom of file .
- Get the UUID of drive by
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
- install client
- sudo apt-get install transmission-daemon
- Create the folders for download files
mkdir -p /mnt/disk1/Torrent_inprogress
mkdir -p /mnt/disk1/Torrent_complete
- To configure Transmission I used this page, they have a sample config file to start with for more configuration refer this page .
- Now configure Transmission to start with Pi
sudo update-rc.d transmission-daemon defaults
Step 5: Install and Config DLNA Server
- Install minidlna
sudo apt-get install minidlna
- Config minidlna
- I used this instructables to configure minidlna
- 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