itek powered Raspberry Pi runs for over 7 hours

Summary

I tested a model B Raspberry Pi (512 MB) using an itek power bank (5600 mAh), with Internet enabled. It pinged my server every minute, and ran for about 7 hours 22 minutes.

Raspberry Pi & iTek battery pack
Raspberry Pi & itek battery pack

Set Up

  1. Raspberry Pi Model B (512 MB RAM), running latest updated Raspbian Wheezy build (with no additional background services running) on an 8 GB class 4 SD card
  2. itek power bank (5600mAh)
  3. Internet connectivity through Ethernet

I wrote a shell script to call a web based PHP script on my server. I set a cron to run this shell script every minute. What happens is the shell scripts passes the client side timestamp, and server writes it, along with sever side timestamp to a file.
The source code of both scripts is provided below.

#!/bin/bash

rawurlencode() {
local string="${1}"
local strlen=${#string}
local encoded=""
for (( pos=0 ; pos<strlen ; pos++ )); do
    c=${string:$pos:1}
    case "$c" in
        [-_.~a-zA-Z0-9] ) o="${c}" ;; * )  printf -v o '%%%02x' "'$c"
    esac
    encoded+="${o}"
    done
    echo "${encoded}"
}

CLIENT_TIME=`date +"%c"`
URL=http://example.com/ServerSideLoggerPHPScript.php?t=$(rawurlencode "$CLIENT_TIME")

/usr/bin/wget -qO- $URL &> /dev/null

Conclusion

  • The script started at 4:45:12 AM client time and ended at 12:07:01 PM client time. That’s almost 7 hours 22 minutes
  • The reason to attach the device to Internet was because I don’t see the point of testing a bare naked Raspbery Pi. Most real life applications would require network connectivity
  • That brings me to another realization: I should have used my WiFi adapter instead of Ethernet to test real world situation. I plan to do this soon.
  • I was fortunate not to lose Internet connectivity, but I should have logged the timestamp locally as well
  • 7 hours is all hunky dory but itek is a fairly heavy device, and takes eon to recharge. I don’t see it a very likely companion to my Raspberry, if I intend to shoot them in air sometime.

As mentioned, I’ll test the setup again with a WiFi adapter, and update the results.

9 Replies to “itek powered Raspberry Pi runs for over 7 hours”

  1. hey.. Bipin.. try doing a UPS thing… if mains go out, your battery should start powering your pi. How is that for an idea? 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *