Labels

Linux (39) Thinkpads (4) lego (12) pi (20)

Monday, 23 December 2013

PERL implementation of Google Drive (cross-platform) designed for Linux [day 17 of 20-days-of-posts series]

PERL-pDrive

A PERL implementation of Google Drive for cross-platform

A work in progress.  

Currently the application can download all files in a Google Drive account and upload files listed in a list file.
move file on server
  • old path is cached; track by resourceID
  • need to move files
  • add hash of resourceIDs
upload cache config console mode service mode -- wrapper multiple accounts
phase 2
  • OAUTH1
  • OAUTH2
phase 3
  • google drive API / SDK m

cacheStreamer for XBMC [day 16 of 20-days-of-posts series]

Cache Streamer Video add-on for XBMC
Streams a file down to a local storage file, and streams while the file downloads.
Originally developed to fix a HTTPS streaming issue in XBMC on the Raspberry Pi.
Supports [Tested on]: All XBMC 12, 12.2, and 13 including Raspberry Pi, Linux, Windows, OS X, Android, Pivos, iOS (including ATV2)
Current Version: v0.1.0
  • first public release

tvScheduler for XBMC [day 15 of 20-days-of-posts series]

A tv scheduler add-on for XBMC
A video add-on for XBMC that enables playback of videos that are listed in a Google Spreadsheet.
Supports [Tested on]: All XBMC 12 and 12.2 including Linux, Windows, OS X, Raspberry Pi Android, Pivos, iOS (including ATV2)
The plugin uses the Google Spreadsheet API 3.
Getting Started: 1) download the .zip file 2) transfer the .zip file to XBMC 3) in Video Add-on, select Install from .zip
Before starting the add-on for the first time, either "Configure" or right click and select "Add-on Settings". Enter your fully-qualified Username (including @gmail.com or @domain) and Password.
FAQ:
Current Version: v0.1.0
  • first public release

Monoprice 7-port USB Hub for Raspberry Pi [day 14 of 20-days-of-posts series]

The Monoprice 7-port USB hub is Raspberry Pu friendly.

The hub is powered by a 2amp power brick.  The power brick is fairly slim -- in a power bar, it would prevent another brick being plugged into the plugs next to it, but it does provide enough clearing to allow someone to plug a power cable into adjacent plugs.  The hub will provide enough power (1amp) to power the Pi.  Unlike other high-powered USB hubs that I have tried, the hub will provide greater than 0.5amp to device connected to it even though there is no host connected to it.  This is critical.  A lot of other hubs I have tried, they will provide high-power to a USB device connected to the hub only if there is an established host connection to the hub.  Therefore, if you try to connect a Pi to the hub, it is not able to provide enough power to the Pi to start it up because there is no host connected to the hub.  The Pi needs to be powered up before it will establish a host connection with the hub.

With the Monoprice 7-port USB hub, the hub will provide enough power the usb connections to power the Pi up even before the host connection is established.  This is witnessed by a red light on the hub, which indicates it is powered on.  When the Pi itself is powered on and started, blue lights will turn on the hub to indicate connections of those devices to the host have been established.



The hub also prevents backpowering over the USB host connect.  This allow for a switch to actually work.  Without this ability, the power switch would be futile as the Pi would become powered on automatically via the host connection between the Pi and hub when the hub gets powered on.

The hub will provide 5 USB side connections and 2 USB top connections.

The hub can be disassembled.  The plastic case is easily removed.


 The board could be integrated in your Raspberry Pi case design, as I have in my headless Pi server.




Overview of power switch options for the Raspberry Pi [day 13 of 20-days-of-posts series]

A power switch was omitted in the design of the Raspberry Pi to keep costs down.  There was no easy interface provided to add one either, but there are many different options.  I had previously tackled the original topic in a previous post, comparing a few options, including building your circuit.

Challenge:  The Raspberry Pi always remains powered-on as long as there is power coming in on the micro-USB power line.  A shutdown/halt/poweroff command will shutdown the OS and leave the system in a powered on but idle state.  The power consumption would be unchanged between idle and active on the Raspberry Pi.  Further, to turn the system back on, the USB cable needs to be unplugged or the power supply needs to be unplugged (reset).

Ideally we need....

  • something that powers the raspberry pi off when it is shutdown (power consumption becomes negligible / < 0.5 W) [POWER OFF]
  • something that can trigger a clean software shutdown [CLEAN SHUTDOWN]

Over the past few months since the  original topic / post, I've covered the following options:
I've felt it was time to do a head-to-head comparison of the five options that were discussed in the previous posts.

Assumptions:

  • all values are in USD; shipping costs and taxes are excluded throughout 
  • measurements are based on a scale of 1 - 5
Build Your Own Circuit USB Big Red Button illuminated /
rocker-style
by Mausberry Circuits
WeMo Switch by Belkin RemotePi Board
by MSL Digital Solutions
Product Page n/a link illuminated switch
rocker switch
generic USB switch
custom switch
WeMo RemotePI
Price varies based on parts
($ 5 - $ 40)
$ 1 - $ 7 $ 14 - $ 16 $ 50 $ 24 - $ 27
Integration  bulky setup plug into free USB port
3 jumper wires hooked upto GPIO
plug Pi USB power plug into locks onto GPIO
Easy of Hardware Setup  1 / 5
- soldering required
5 / 5
- plug-and-play
- solder-free

4 / 5
- risk of causing damage if you place the cables on the wrong pins
- solder-free

5 / 5
plugs in
5 / 5
- plugs in, screws on
- solder-free
Easy of Software Setup 

1 / 5
- requires writing your own app
2 / 5
requires installing apt-get packages, compiling and provided C code
4 / 5
- run switch.sh install
- default script had issue causing crashing Pi, some modification needed to code
2 / 5
- requires phone app
- firmware and app buggy
4 / 5
- run irswitch.sh install
- program power button on remote
- setup lird.conf for remote
Reset Button
[hard reset]?
DEPENDS
if intercepts power source
NO iluminated switch NO
rocker switch YES
NO NO
Safe Shutdown? YES YES YES NO
(use some thought process around shutdowns)
YES
Power Consumption
[as measured by a kill-a-watt] 
negligible  negligible negligible 1.5 - 2.5 W
just as much power as the Pi!
negligible
Completely Powers off Pi? DEPENDS
if intercepts power source
NO YES YES YES
Powers Pi by GPIO, micro USB or USB (Pi rev B)n/a micro USB via micro USB micro USB or USB port (Pi rev B) GPIO via micro USB
Shutdown Scripts
device driverRaspBMC/Raspbian/Debian
OpenELEC
Arch
n/aOpenElec
RaspBMC
XBian
Major Selling Features - switches can be used for other purposes- switches can be used for other purposes - select models include reset switch
- rocker switch (left in on position) works with well WeMo to power on remotely
- power on Pi using different conditions
- remote power on / off / reboot
- includes IR receiver for XBMC
- only solution that can power on Pi via IR
Full Review previous post previous post previous post previous post previous post
My Sample Integration n/a n/a rocker switch
illuminated switch
n/a RemotePi

Illuminated and Rocker-style power switches for the Raspberry Pi


As previously discussed in in a post about power switch options for the Raspberry Pi, mausberrycircuits was identified as a source of several options.  Original a kickstarter campaign, the hobbiest sells various of his creations including power switches, custom switch PCB boards and car ignition boards all for the Raspberry Pi.   He will even work with your design requirements and alter the switch.



His power circuits is essentially a circuit board that is placed inline with the micro-USB power line, with two connections to the GPIO (1 input, 1 output).  A press of the button or a toggle of the switch takes the unit from off (complete power off for the raspberry pi) to on mode.  A shell script starts on bootup that passes a high/1 to the switch to instruct indicate the raspberry pi is on.  A low/0 signal passes from the switch to the raspberry pi to indicate the switch is neutral.  A toggle of the rocket switch to off or holding a press button switch for two seconds changes the output to high/1 which the polling script triggers a safe poweroff.  When the raspberry pi has finally fully shutdown, the GPIO goes from high/1 to low/0, which tells the switch the raspberry pi power can be cut safely.  The rocket-style switches also come with a reset button that can trigger a raspberry pi reset if it becomes frozen, etc -- something that normally would require to pull the power line.

The switch also detects software shutdowns invoked by the user (as the GPIO will toggle from high/1 to low/0, which the switch polls for).


Pros:

  • very small
  • may need some modification to your raspberry pi case
  • addresses the CLEAN SHUTDOWN and POWER OFF requirements fully.

Cons:

  • expensive but cheaper then any alternatives
  • everything fully assembled


I purchased a number of the switches from Mausberry Circuits.  The illuminated push button switch easily integrates into my lego design cases -- the added width is 1 lego block.

The illuminated switch integrated:

Here's what my case looked like before adding the switch:



I had to rip down the right-side wall to set it up.  But it is lego after all.  Time to integrate the switch into the case!



After:



The rocker-style switch integrated:


My original First Raspberry Pi Model B lego case revitalized [day 12 of 20-days-of-posts series]


My original lego case design case was previously discussed.  Since then, I've integrated an all-in-one LED, IR receiver and power switch board, plugged into the GPIO.  I decided to take this time to drastically improve on the original case design.


Intention: To be used for various purposes including as an XBMC media player,airplay server/client, a ASTC to wifi converter box, etc.  Need for both ethernet and wifi and access to a keyboard/trackball.


Equipment:
  • Raspberry Pi (model B -- memory: 512MB, 2 USB ports, ethernet)
  • RemotePi Board (previously reviewed)
  • class 10 SD card
  • micro USB (for power, plugged into TV <-> raspberry pi)
  • HDMI cable
Assumptions:
  • possible need for VIDEO port
  • possible need for AUDIO jack
  • no need for access to the i/o ports (camera port, GPIO pins, etc)
  • require a "window" for IR receiver
  • require a "window" for the power LED


Like with most of my lego projects, I don't provide full schematics and block lists.  My opinion is that if you have unused lego that you can use for a project like this, you make use of what you have, improvising as you go.

Front-side view: 

Before:


After:


A big transformation on the front side of the case.  The IR receiver is no longer snaked along to this view-point.  Therefore, it is no longer the front-side.

The IR window and onboard Pi LED window is replaced with a smaller transparent block that glows and presents better than the original.  The window door is replaced with a much shorter pair of "flag" doors, providing access to the VIDEO and AUDIO jack, keeping them "tucked away" when not in use and not negatively impacting the functionality of the case while in use.

The front of the unit no longer curves up, shortening the base of the unit by 1 lego block size. The height has been drastically reduced from s 4 +1/3rd lego blocks to 3 blocks without affecting any functionality. The bottom 1/3rd lego block size is now self-re-enforced grey layer.  The second 1/3rd lego block size black layer is gone, now that the base has better structure from a single layer.


Right-side view:

Before:

After:

I placed a white window block where the power switch's onboard LED is positioned, that gives the unit a nice glow when lit.  I placed an inset blue window piece for IR window.  The IR range provided by the window is adequate enough to get at least a 45 degree angle using the remote.  I moved up the blocks for the micro USB power port to line up with the new port.  I also added some support around the SD card as it was previously hanging out of the system.  It is now protected from being hit (and damaging the SD card port).


Back-side view:

Before:
After:


I had to get rid f the original HDMI top-swing door.  It required 2 + 2/3 lego blocks height.  With the shorter height, it was not possible to accommodate the door.  These "flag" doors are starting to become a favourite of mine, as they stay on better and they have a smaller footprint, adjust easier, and don't distract.  When not connected to a monitor/TV (for headless operation), the doors are swung down to prevent dust buildup.

Left-side view:

Before:


After:


The top-swing door over the ethernet port was shortened to accommodate the new height of the case. The door allows the port to be tucked away when not in use.  It sits perfectly flush to the unit, and with a change in the door swing mechanism the door doesn't become flimsy when open (easily falls off).

The LED windows have been eliminated since they are visible through the front-side view.

The unit is depicted with a wifi dongle and a wireless lenovo multimedia keyboard/trackpad dongle.


(this keyboard, which I owned for 1-2 years prior to owning the pi, but had yet found not a single purpose for it.  Now I find the keyboard a pure necessity )


Top view:

Before:



After:


The original base size was 13 by 10 blocks.  The new one is slightly smaller with a 13 by 9 blocks.  Had I implemented an illuminated switch instead of the RemotePi board, I would of had to increase the length from 13 to 14 as I had in previous cases.

A push-button power switch is accessible from the top of the unit.  Pressing down will either turn on the Raspberry Pi or safely shut it down (and power it off).

The GPIO access doors are gone.  Since we are using the GPIO for RemotePi board, there is no need for them.  If I ever receive my ordered Raspberry Pi camera, I may open up access to the camera port.