Portable Pi2 Media Player - Upto 2TB, 5hrs - bit perfect - JRiver Media Center

Mar 22, 2015 at 10:36 AM Thread Starter Post #1 of 19

Hiltonk

100+ Head-Fier
Joined
May 8, 2014
Posts
168
Likes
243
Hi All,
 
I've designed and built a new all aluminium case for the RPi2 B and wanted to check interest here in such a case if I were to sell the design and list of components online, or mass produce it as a completed unit and sell it. 

It started out as just a personal project as there isn't a case like this in the market and I thought maybe others would like it?
 
I designed and built it to run JRiver Media Center to have a portable bit perfect audio player that can run headless without any monitors etc. (JRiver has an experimental build for Arm out that I've been using which may also get video support in the future if they follow what's been done for the Linux build)
 
It would suite anyone wanting an all in one media player that has internal HDD and optional rechargeable battery.
 
It's not much bigger than a standard Pi case, however it has:
An internal lithium ion rechargeable battery with about 5-6hrs of charge. (maybe more I still haven't formally timed it, it's at least 5hrs)
A slot removable HDD up to 2TB 9.5mm (or SSD and will take the thinner 7.5mm drives too).
All the USB, Ethernet, HDMI and power ports on the rear.
Headphone/Lineout on the front. (ok I know the standard analog out isn't great but it's usable for non critical listening)
Power LED and switch on the front.
You can plug the HDD into a computer as a standard USB 3 Drive to load it up with content.
The HDD is removable through a slot without disassembling the case.
 
It's still in prototype stage but it's 95% complete and will have a few other changes in the final version;
More GPIO controls and buttons to control the media player.
Reboot and shutdown button.
Restart media player button.
Maybe an internal 2ch DAC if I can workout how to fit one.
A better heatsink and passive cooling design.
Battery LED charge/charging status.
Still a couple of cables to sort out for HDMI and a micro SD card ribbon extender to relocate the SD card so you can get to it without taking it apart.
Still have to finish the rear panel.
 
It's all aluminium to help dissipate the heat and to give that solid feeling you just cant get with plastic.
I'm going for the FiiO look and it actually looks pretty good even in it's raw aluminium state but it will be either painted or anodised black with a brushed metal finish.
 
I've been developing this for a few weeks since the RPi2 came out and it works well as a desktop media player or in the car, or just outside paired with a BT speaker or DLNA renderer. (or streaming bit perfect 96/24 FLAC to your iPhone/Android with JRemote via wifi personal hotspot or via a portable USB DAC such as the FiiO E17)
 
 
So what are peoples thoughts??  Would you buy one completely assembled, or as a kit, or the specs and plan to build it yourself?
Demo

 

 
 
 

 

 

 

 
Mar 22, 2015 at 11:02 AM Post #2 of 19
Congrats and your project is looking good. I believe this is the JRiver Media Center for Pi2?
 
http://yabb.jriver.com/interact/index.php?topic=96049.0
http://yabb.jriver.com/interact/index.php?board=35.0
 

 
Maybe you could consider demonstrating how Pi2 is held by GRID-IT! organizers, then we could pack other toys such as an external DAC/amp or power bank etc.
 
http://www.cocooninnovations.com/grid.php
 
Here's an example with Chord Hugo and the original Raspberry Pi
 
http://www.post76.com/x2/forum.php?mod=viewthread&tid=183654
 

 
It's inevitable that some RFI will be generated by Pi2 and such noise would affect the SQ in general. Is there room to stick HOZOX sheets or tapes inside the case so that RFI could be absorbed?
 

 
http://www.molex.com/molex/products/family?channel=products&chanName=family&key=hozex
http://www.mouser.com/search/refine.aspx?Ntk=P_MarCom&Ntt=112337168
http://www.mouser.com/new/molex/molex-hozox-emi/
 
Thanks a lot and I wish you great success with this promising project.
 
Mar 22, 2015 at 11:11 AM Post #3 of 19
  Congrats and your project is looking good. I believe this is the JRiver Media Center for Pi2?
 
http://yabb.jriver.com/interact/index.php?topic=96049.0
http://yabb.jriver.com/interact/index.php?board=35.0
 

 
 
 
Thanks a lot and I wish you great success with this promising project.

 
Yes that's the one.
There's room for a couple thin layers of material inside. Im looking at using a thermal barrier film between the battery and the CPU to keep the battery from absorbing the direct heat from the CPU and making a heatsink that transfers the CPU heat directly to the case.
 
Mar 22, 2015 at 11:27 AM Post #4 of 19
A Great idea! Currently playing around with a Pi2 so I am definitely interested. I am fine with an assembled unit or a kit (as long as no soldering is involved..).
 
Mar 29, 2015 at 6:07 AM Post #6 of 19
Not much to report.  The Pi2 and case has been working really well the last week.  I'm getting between 5-7hrs out of the battery and it doesn't get too hot even after 4hrs of continuous play.
 
I did rewire power yesterday so now it has uninterrupted power capability.  I can have the power plugged in, switch to battery and vice versa, without powering down. 
This is handy in the mobile context where I use it at home, in the car and in the office.  When ever I've got power available I can switch over to mains and charge the battery and then go back to battery.  It's not automated yet but it can be with a little more work. For the moment I still have to remember to switch the battery on or off, but it's great to have the portability with continuous playback.
 
I've got really short 10cm/4" USB 3 HDD cables and SATA to USB dongles on the way for the HDD which will tidy the back ports a little more. They should arrive mid week.
This week I'll finalise the design for the LED's, RTC, switches and power circuit.  I've decided to leave the playback controls out for now as I've been using JRemote to control it just fine and I've never missed having controls on the case.

I'll still include a discrete minimalist shutdown button and restart MC20 button though.  The power LEDs will indicate whether it's on mains or battery and there'll be battery level indicators too.
 
Oh and I milled the lip off the back of the case now so the HDD can slide in and out without having to take the unit apart.

 
Apr 12, 2015 at 10:27 PM Post #7 of 19
Still waiting on a few more small pieces of the puzzle but the new powersupply works really well.
The internals are very nearly finished now.
I don't get any power brownouts at all any more with the new power circuit and I can plug and unplug the power without rebooting and it automatically charges when plugged in.
I got a new 4A 5V powerpack shipped with the internal power circuit with an inline switch too. :)
I finished working on my GPIO control scripts and have a single button to restartMC, reboot and shutdown. The LED shows when its finished booting and turns off to show when it safe to turn off the main power switch.
 
I have it all assembled and working and will make a new video demo tomorrow.
 
Things left to do:
A couple better smaller switches.
A better smaller LED.
Fit the realtime clock somewhere.
Fit a battery level indicator somewhere.
Still waiting on my super thin HDMI cable.
Still waiting on delivery of some super short micro USB3 HDD cables.
Make a back panel.
Smaller rubber feet.
A paint job.
 
PS. I'm using this several hours every day in the car and in the office and it hasn't missed a beat going between the office and the car without having to reboot.
I love it!
 
 
 

 
 
 

 
Apr 13, 2015 at 7:24 AM Post #8 of 19
Here's the new look with combined switch and Blue LED ring.

 

 

Here's the rather crowded looking internal shot with most of the wiring done. 

 
 

 
 
Only a few things left to do.
I have to fit and wire the RTC and battery indicator and there's still some space left believe it or not!  I may even be able to fit an I2C DAC with analog out.
Im still waiting on my HDMI cable.  :(
 
I like the switch with the blue circle led so much Im going to replace the power switch and green LED with another combined green LED main power switch.
 
Please excuse the bluetac holding things in place. It is a prototype after all. :)
 
Apr 14, 2015 at 9:20 AM Post #10 of 19
I went with red LED main power switch, I didn't like the colour of the green. It's slightly recessed as it's an instant momentary on/off power button that I don't want to accidently turn it off.
In the final prototype I'll recess the blue LED switch the same as the red one, though that's not as important as you have to hold the centre button for at least 2 secs to trigger anything.
 
The photos don't do it justice, they're a really nice crisp blue and red.
 
Power on and still booting up

 
 
Booted up

 
May 5, 2015 at 12:29 PM Post #13 of 19
Some overdue updates - been busy learning scripting.
 
 
I got the sparkfun Lipo fuel gauge working with the Adafruit_I2C scripts on the Pi with the Adafruit USB charger. Should work with the Solar charger too.
It was pretty simple. Hook up the fuel gauge SDA (data) and SCL (clock) to Pi pins 3 (SDA) and 5 (SCL).
Charger Battery terminals connected to the JST on the fuel gauge.
 
Here it is measuring a very slow charge while the Pi is running with an almost flat battery.
First without power plugged in you can see it discharge and then with power plugged in, very slowly charging.
 
I installed the Adafruit I2C scripts and libraries and the fuel.py script from here> https://bitbucket.org/widefido/fuel/src
 
 
Code:
pi@raspberrypi ~/Adafruit-Raspberry-Pi-Python-Code/Adafruit_I2C $ sudo python fuel.py
 estimated time left: 0h 0m 0s (1.27%)
 estimated time left: 0h 0m 0s (1.21%)
 estimated time left: 0h 0m 0s (1.17%)
 estimated time left: 0h 0m 0s (1.12%)
 estimated time left: 0h 0m 0s (1.12%)
 estimated time left: 0h 0m 0s (1.12%)
 estimated time left: 0h 0m 0s (1.12%)
 estimated time left: 0h 0m 0s (1.10%)
 estimated time left: 0h 0m 0s (1.10%)
 estimated time left: 0h 0m 0s (1.10%)
 estimated time left: 0h 0m 0s (1.08%)
 estimated time left: 0h 0m 0s (1.05%)
 estimated time left: 0h 0m 0s (1.07%) **charging**
 estimated time left: 0h 0m 0s (1.07%)
 estimated time left: 0h 0m 0s (1.08%) **charging**
 estimated time left: 0h 0m 0s (1.08%)
 estimated time left: 0h 0m 0s (1.10%) **charging**
 estimated time left: 0h 0m 0s (1.10%)
 estimated time left: 0h 0m 0s (1.12%) **charging**
 estimated time left: 0h 0m 0s (1.12%)
 estimated time left: 0h 0m 0s (1.12%)
 estimated time left: 0h 0m 0s (1.13%) **charging**
 estimated time left: 0h 0m 0s (1.13%)
 estimated time left: 0h 0m 0s (1.13%)
 estimated time left: 0h 0m 0s (1.15%) **charging**
 estimated time left: 0h 0m 0s (1.15%)
 estimated time left: 0h 0m 0s (1.15%)
 estimated time left: 0h 0m 0s (1.15%)
 estimated time left: 0h 0m 0s (1.17%) **charging**
 estimated time left: 0h 0m 0s (1.17%)
 estimated time left: 0h 0m 0s (1.17%)
 estimated time left: 0h 0m 0s (1.18%) **charging**
 estimated time left: 0h 0m 0s (1.18%)
 estimated time left: 0h 0m 0s (1.18%)
 estimated time left: 0h 0m 0s (1.18%)
 estimated time left: 0h 0m 0s (1.18%)
 estimated time left: 0h 0m 0s (1.20%) **charging**
 estimated time left: 0h 0m 0s (1.20%)
 estimated time left: 0h 0m 0s (1.20%)
 estimated time left: 0h 0m 0s (1.20%)
 estimated time left: 0h 0m 0s (1.20%)
 estimated time left: 0h 0m 0s (1.20%)
 estimated time left: 0h 0m 0s (1.21%) **charging**
 estimated time left: 0h 0m 0s (1.21%)
 estimated time left: 0h 0m 0s (1.21%)
 estimated time left: 0h 0m 0s (1.21%)
 estimated time left: 0h 0m 0s (1.21%)
 estimated time left: 0h 0m 0s (1.21%)
 estimated time left: 0h 0m 0s (1.21%)
 estimated time left: 0h 0m 0s (1.21%)
 estimated time left: 0h 0m 0s (1.21%)
 estimated time left: 0h 0m 0s (1.21%)
 estimated time left: 0h 0m 0s (1.21%)
 estimated time left: 0h 0m 0s (1.21%)
 

 
May 5, 2015 at 12:29 PM Post #14 of 19
I got the battery shutdown script working!
 
I didn't even need to use a GPIO it's all scripted to take the measurements from the fuel gauge board over the I2C bus.  I've even got it all running in just one script now.
 
Because I can take accurate battery measurements now I can script actions at any voltage and I can trigger different led flashes for low battery and critical battery as well as the shutdown.

That's next. :) (along with play and pause toggle on the main button)
 
 
------
pi@raspberrypi ~ $ sudo ./gpio.py
Battery OK: 3.8119 volts
Battery OK: 3.8119 volts
Battery OK: 3.8119 volts
Battery Lo: 3.7045 volts - Checking for 20 seconds: 0
Battery Lo: 3.7045 volts - Checking for 20 seconds: 1
Battery Lo: 3.7045 volts - Checking for 20 seconds: 2
Battery Lo: 3.7032 volts - Checking for 20 seconds: 3
Battery Lo: 3.7032 volts - Checking for 20 seconds: 4
Battery Lo: 3.6996 volts - Checking for 20 seconds: 5
Battery Lo: 3.702 volts - Checking for 20 seconds: 6
Battery Lo: 3.702 volts - Checking for 20 seconds: 7
Battery Lo: 3.702 volts - Checking for 20 seconds: 8
Battery Lo: 3.702 volts - Checking for 20 seconds: 9
Battery Lo: 3.702 volts - Checking for 20 seconds: 10
Battery Lo: 3.702 volts - Checking for 20 seconds: 11
Battery Lo: 3.702 volts - Checking for 20 seconds: 12
Battery Lo: 3.7008 volts - Checking for 20 seconds: 13
Battery Lo: 3.7008 volts - Checking for 20 seconds: 14
Battery Lo: 3.7008 volts - Checking for 20 seconds: 15
Battery Lo: 3.6996 volts - Checking for 20 seconds: 16
Battery Lo: 3.6996 volts - Checking for 20 seconds: 17
Battery Lo: 3.6996 volts - Checking for 20 seconds: 18
Battery Lo: 3.6996 volts - Checking for 20 seconds: 19
Battery Lo: 3.6996 volts - Checking for 20 seconds: 20
Battery Low For More Than 20 Seconds Shutting Down:
Broadcast message from root@raspberrypi (Tue May  5 20:45:17 2015):
System halted by Low Battery Alert
The system is going down for system halt NOW!
Battery Lo: 3.6996 volts - Checking for 20 seconds: 21
Battery Low For More Than 20 Seconds Shutting Down:
Broadcast message from root@raspberrypi (Tue May  5 20:45:18 2015):
System halted by Low Battery Alert
The system is going down for system halt NOW!
Battery Lo: 3.6605 volts - Checking for 20 seconds: 22
Battery Low For More Than 20 Seconds Shutting Down:
Broadcast message from root@raspberrypi (Tue May  5 20:45:19 2015):
System halted by Low Battery Alert
The system is going down for system halt NOW!
---------
 
 
Here's the cleaned up script with the battery monitor set for 3.2v - my scripting is getting a little tidier. :)
 
 
Code:
#!/usr/bin/env python2.7
 from time import sleep
 import os
 import subprocess
 import RPi.GPIO as GPIO
 import fuel
 BUTTON1 = 17 # GPIO channel 17 - RestartMC/Shutdown/Reboot
 LED1 = 26 # GPIO channel 26 - Power LED
 #BATTERY1 = 23 # GPIO channel 23 - Low Battery
 POWEROFF1 = 22 # GPIO channel 22 - Power off kill switch
 
 GPIO.setmode(GPIO.BCM)
 GPIO.setup(BUTTON1, GPIO.IN, pull_up_down=GPIO.PUD_UP)
 GPIO.setup(LED1, GPIO.OUT, pull_up_down=GPIO.PUD_UP)
 GPIO.output(LED1, 1)
 GPIO.setup(BATTERY1, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
 GPIO.setup(POWEROFF1, GPIO.OUT, pull_up_down=GPIO.PUD_DOWN)
 fuel.writeAlertThreshold(5)
 
 def button_action(BUTTON1):
     print('Button press = negative edge detected on Button %s'%BUTTON1)
     button_press_timer = 0
     while True:
             if (GPIO.input(BUTTON1) == False) : # while button is still pressed down
                 button_press_timer += 1 # keep counting until button is released
             else: # button is released, figure out for how long
                 if (button_press_timer > 7) : # pressed for > 7 seconds
                     print "long press > 7 : ", button_press_timer
                     # do what you need to do before halting
       subprocess.call(['sudo reboot &'], shell=True)
                 elif (button_press_timer > 3 < 7) : # pressed for > 3 < 7 seconds
                     print "medium press > 3 < 7 : ", button_press_timer
                     # do what you need to do before rebooting
       subprocess.call(['./RestartMC20.sh & echo "Killing MC20" &'], shell=True)
                 elif (button_press_timer > 1 < 3) : # press for > 1 < 3 seconds
                     print "short press > 1 < 3 : ", button_press_timer
                     # do what you need to do before restarting mediacenter20
       subprocess.call(['shutdown -h now "System halted by GPIO action" &'], shell=True)
   button_press_timer = 0
             sleep(1)
 def battery_monitor():
     batt_timer = 0
     while True:
       if (fuel.readVCell()) >= 3.2: #check battery voltage
                 #print("Battery OK: {0} volts".format(fuel.readVCell()))
                 batt_timer = 0
      else: # batt is low
             print "Battery Low: {0} volts".format(fuel.readVCell()), "- Checking for 20 seconds: {0}".format(batt_timer)
          batt_timer += 1 # keep counting
             if (batt_timer > 20) : # batt low for > 20 seconds
           print "Battery Low For More Than 20 Seconds - Shutting Down: "
                 subprocess.call(['shutdown -h now "System halted by Low Battery Alert" &'], shell=True)
          sleep(1) 
 GPIO.add_event_detect(BUTTON1, GPIO.FALLING, callback=button_action, bouncetime=200)
 #GPIO.add_event_detect(BATTERY1, GPIO.FALLING, callback=battery_monitor, bouncetime=200)
 try:
     while True:
         sleep(5)# sleep and do the battery monitor loop
         battery_monitor()
 except KeyboardInterrupt:
     GPIO.cleanup()       # clean up GPIO on CTRL+C exit
 GPIO.cleanup()           # clean up GPIO on normal exit
 
May 5, 2015 at 12:30 PM Post #15 of 19
AND Got my Play/Pause button working. :)
 
Updated main script

Code:
#!/usr/bin/env python2.7
 from time import sleep
 import os
 import subprocess
 import RPi.GPIO as GPIO
 import fuel
 BUTTON1 = 17 # GPIO channel 17 - RestartMC/Shutdown/Reboot
 LED1 = 26 # GPIO channel 26 - Power LED
 #BATTERY1 = 23 # GPIO channel 23 - Low Battery
 POWEROFF1 = 22 # GPIO channel 22 - Power off kill switch
 GPIO.setmode(GPIO.BCM)
 GPIO.setup(BUTTON1, GPIO.IN, pull_up_down=GPIO.PUD_UP)
 GPIO.setup(LED1, GPIO.OUT, pull_up_down=GPIO.PUD_UP)
 GPIO.output(LED1, 1)
 #GPIO.setup(BATTERY1, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
 GPIO.setup(POWEROFF1, GPIO.OUT, pull_up_down=GPIO.PUD_DOWN)
 fuel.writeAlertThreshold(5)
 
 def button_action(BUTTON1):
     print('Button press = negative edge detected on Button %s'%BUTTON1)
     button_press_timer = 0
     while True:
             if (GPIO.input(BUTTON1) == False) : # while button is still pressed down
                 button_press_timer += 1 # keep counting until button is released
             else: # button is released, figure out for how long
                 if (button_press_timer > 7) : # pressed for > 7 seconds
                     print "long press > 7 : ", button_press_timer
       subprocess.call(['sudo reboot &'], shell=True)
                 elif (button_press_timer > 4 < 7) : # pressed for > 4 < 7 seconds
                     print "medium press > 4 < 7 : ", button_press_timer
       subprocess.call(['./RestartMC20.sh & echo "Killing MC20" &'], shell=True)
                 elif (button_press_timer > 2 <= 3) : # press for > 2 <=3 seconds
                     print "short press > 2 < 3= : ", button_press_timer
       subprocess.call(['shutdown -h now "System halted by GPIO action" &'], shell=True)
   elif (button_press_timer > 0 < 2) : # pressed for  1 second
                     print "quick press > 0 < 2 : ", button_press_timer
                     subprocess.call(['./xdotoolplay.sh'])
   button_press_timer = 0
             sleep(1)
 def battery_monitor():
     batt_timer = 0
     while True:
       if (fuel.readVCell()) >= 3.2: #check battery voltage
                 #print("Battery OK: {0} volts".format(fuel.readVCell()))
                 batt_timer = 0
      else: # batt is low
             print "Battery Low: {0} volts".format(fuel.readVCell()), "- Checking for 20 seconds: {0}".format(batt_timer)
          batt_timer += 1 # keep counting
             if (batt_timer > 20) : # batt low for > 20 seconds
           print "Battery Low For More Than 20 Seconds - Shutting Down: "
                 subprocess.call(['shutdown -h now "System halted by Low Battery Alert" &'], shell=True)
          sleep(1) 
 GPIO.add_event_detect(BUTTON1, GPIO.FALLING, callback=button_action, bouncetime=200)
 ##GPIO.add_event_detect(BATTERY1, GPIO.FALLING, callback=battery_monitor, bouncetime=200)
 try:
     while True:
         sleep(5)# sleep and do the battery monitor loop
         battery_monitor()
 except KeyboardInterrupt:
     GPIO.cleanup()       # clean up GPIO on CTRL+C exit
 GPIO.cleanup()           # clean up GPIO on normal exit
 
 
the play/pause script using xdotool
 
 
Code:
#! /bin/bash
 sudo su -c "DISPLAY=:0 xdotool key XF86AudioPlay" pi
 

Users who are viewing this thread

Back
Top