Monday, July 14, 2014

Copy Android Kindle books to PC

In my previous post I explained how to use ADB utility to copy files from Android phone to PC.
If you happened to use Kindle eBook reader on Android and wondered where it stores books bought in Amazon, then it's here:


File extension used by Amazon books is .prc
You can copy the file to PC using command like:

adb pull /sdcard/Android/data/ /tmp/

You can also push .prc books to Android similar way:

adb push /tmp/mybook.prc /sdcard/Android/data/

If you bought the book from Amazon then it will be secured with DRM. This is easy to remove, some people do it even though illegal.

Backup Android photos with ADB

During my vacation a few days ago my Android phone (Samsung Galaxy S1) crashed unexpectedly.
I can only imagine that the reason was too little free sdcard space, but I'm not sure.
It happened to me already the second time and the first time I fixed it so that I rebooted the phone in recovery mode (reboot with pressing POWER + VOLUME UP + MENU buttons) and did factory reset, obviously loosing all data which was not backed up on the phone.
I think it could work as well this time, but the problem is I had plenty of nice picks done on vacation on my phone and would like to rescue them :)

This is what I did:

  1. Reboot phone in recovery mode (as described previously)
  2. Connect phone to PC with USB
  3. Run adb tool to restore photos to PC

I am using Ubuntu on my PC but the following would work similar on other OS. The only thing you will probably need to change is path to the temp folder on PC.

  • Run adb as root so that you can mount your sdcard in next steps

# adb root

  • Mount sdcard. Maybe you don't' need this step and your sdcard is already mounted. Mine was not.

# adb shell

then in shell type:

# mount /sdcard

Now you can list content of sdcard

# ls /sdcard

Among files on the list I could see folder DCIM
This is where camera photos and films are saved so I grab this to my temp folder.

  • Copy photos and videos to temp folder on PC

First exit shell:

# exit

Then copy:

# adb pull /sdcard/DCIM /tmp

This can take some of your drive space so be prepared otherwise the command will exit with message:
"No space left on device"

Thursday, June 5, 2014

RaspBMC Remote Desktop

First of all, although possible to connect to setup remote desktop on RaspBMC it works awfully slow and probably does not bring a other usability than navigating through UI.
Video simply hangs so it's impossible to watch any.

These are the steps to set it up:
1.  Open your favorite text editor and save the script,

e.g. command : nano vncserver
and paste this script:


case $1 in
    if [ -f /var/run/ ] ; then
      echo "VNC server is already running"
      initctl stop xbmc
      sudo vnc_dispmanx 2>/dev/null &
      echo $! | sudo dd of=/var/run/
      initctl start xbmc
    if [ -f /var/run/ ] ; then
      sudo kill -TERM $(cat /var/run/
      sudo rm /var/run/
      echo "VNC server is not running"
    echo "Usage $0 start|stop"

2. chmod +x vncserver

3. sudo mv vncserver /usr/local/sbin

4. vncserver start
If you want to check if it's running, check if vnc_dispmanx has the default VNC port open (5900)
pi@raspbmc:~$ sudo netstat -lnptu |grep vnc
tcp        0      0  *               LISTEN      3687/vnc_dispmanx

tcp6       0      0 :::5900                 :::*                    LISTEN      3687/vnc_dispmanx

5. When you're done, you should turn it off, as it's quite CPU hungry: 

vncserver stop

Connecting with VNC viewerFrom Ubuntu you can use vncviewer:

sudo apt-get install vncviewer


Tuesday, January 7, 2014

Arduino LM35 termometer

In my previous post I described how to measure temperature with DS18B20 sensor. In this post I will show an alternative with LM35.

The source code with comments looks like this:
And the circuit like this (image borrowed from other interesting blog)

Additional explanation can be found in Arduino blog.

Arduino ds18b20 termometer

Waterproof DS18B20 Digital temperature sensor + extras

Recently I bought DS18B20 senson in waterproof sonda like that.
The purpose of it is to be able to measure water temerature in aquarium.
In broader scope I'd like to build in future a remote aquarium management kit with Arduino and Raspberry Pi, that would measure water parameters, record them and expose online, as well as manage light, feading, etc. remotely.

How to use DS18B20?

First you need to install 3rd party library of Dallas Temperature.
Download the zip from GitHub and extract in Arduino lib folder -
libraries can be installed as described here.
So i got:


I restart Arduino IDE and save program source:
Now lets connect circuit

The pullup resistor in most of tutorials is 4.7 KOhm but any from 2k to 5k should work. I tested my circuit with 4.9kOhm.