Install and Setup of Bit Torrent Sync (btsync) on Raspberry PI for Family Photo Sync

Note: This post is a work in progress and will become more detailed as I complete the project.

This post will guide you through the process of installing Bit Torrent Sync on a Raspberry PI for the purpose of syncing family photos between computers.

This system will include, Windows 7, Windows XP and Linux Mint clients with the initial server located on the Raspberry PI.

Installation of main instance on Raspberry PI

Login to the Raspberry PI via ssh and run the following commands, I am running RaspBMC (debian based).

Download the latest copy of bysync

pi@raspbmc:~$ wget

Extract the Tarball

 pi@raspbmc:~$ tar -xzf btsync_arm.tar.gz

When I tried to run ./btsync to execute the application I got the following error.

pi@raspbmc:~$ ./btsync
-bash: ./btsync: No such file or directory

To resolve this we need to symlink the following library

pi@raspbmc:~$ sudo ln -s /lib/arm-linux-gnueabihf/ /lib/

Now dump a copy of the default configuration file

pi@raspbmc:~$ ./btsync --dump-sample-config >> sync.conf

We now have a sync.conf file with the default settings.

Host Configuration

The following lines of the default configuration file require modification

“device_name”: “RaspberryPI-Craig”,
“listening_port” : 55555,

“storage_path” : “/home/user/DataFolder”,

“use_upnp” : false,

“listen” : “”,
“login” : “admin”,
“password” : “password”

To start btsync automatically get the init.d script from

Copy the text to /etc/init.d/btsync

Allow execution of init.d script with chmod +x btsync

Edit the init.d script to set the username

copy the btsync binary to /usr/bin/btsync

Autostart the init.d script with

sudo update-rc.d btsync defaults

If you reboot your raspberry pi it should not start btsync automatically.

Following the reboot you should be able to access the web interface of bysync using the username, password and web address defined in the configuration file.

My address was

From here you can create folder shares.

Network Configuration

On your router port forward the listening port to the raspberry pi.

The port you need is the one defined in the “Listening Port” in the configuration file.

I also needed to modify the raspbmc firewall to let external traffic into my listening port.

in /etc/network/if-up/secure-rmc look for the section with the lines that look like IP table configurations and add these two lines

iptables -A INPUT -p tcp --dport 55555 -i $IFACE -j ACCEPT
iptables -A INPUT -p udp --dport 55555 -i $IFACE -j ACCEPT

Client Configuration

From the servers web interface create a one time key.

Add this key to the client and you will be syncing.


BeagleBone SFTP issues with Demo Images

When using the demo images and attempting to use WinSCP or some other sftp application you may get an error like

“Cannot initialize SFTP protocol. Is the host running a SFTP server?” from WinSCP or

[SFTP] Host key accepted
[SFTP] Successfully authenticated
[SFTP] Error initialising sftp: Access denied. Authentication that can continue: publickey,password
Unable to connect”

from Notepad++

This is due to demo images not including the openssh-sftp-server package by default

To install login to the Beaglebone using SSH (via putty) and run

opkg update

opkg install openssh-sftp-server

Your WinSCP or Notepad++ or other SFTP application should now work nicely

BeagleBone Mux Settings – Lookup Table

Download links are below for full A3 printable tables showing the details of the BeagleBone multiplexer settings.
To configure the BeagleBone multiplexer under Angstrom from the command line use

echo 6 > /sys/kernel/debug/omap_mux/gpmc_a2


6 = Multiplexer Mode

gpmc_a2 = the Mode0 name of the pin you are trying to configure

Results in setting of Port 9 Pin 14 soe ehrpwm1A_mux1

Download links for Mux Lookup tables





Install BeagleBone C Build Environment and Write Hello World for BeagleBone Using C and a Makefile

All these instructions are to be run on the Beaglebone itself using putty.

Install the C Compiler, make and a few other bits and pieces with

opkg install task-native-sdk

Make a folder for your code by running

mkdir code

cd code

Now create a makefile using nano

nano Makefile

Paste the following code and then press ctrl+O and then ctrl+x

CC = gcc
CFLAGS = -Wall -g -O2
OBJECTS = main.o

all: $(OBJECTS)
$(CC) $(CFLAGS) $(OBJECTS) -o main

Now create the C source file by running

nano main.c

Paste the following code and then press ctrl+O and then ctrl+x

#include <stdio.h>
#include <string.h>
#include <stdlib.h>

int main (int argc, char **argv)
printf (“Hello from BeagleBone”);
return 0;

To compile your new application run

make all

To run your application



Setup Time Service to Set the Clock on Angstrom BeagleBone

If you run the “date” command and see a date not far from Jan 1 2000 then you will need to set the date.

Update your Package List

opkg update

Get the ntp Package

opkg install ntp ntpdate

Remove the file that describes your local time

rm /etc/localtime

Add a symlink between the file that describes your timezone in the timezones folder to the localtime file.

If you do not live in the sydney nsw timezone you may need to look around in the /usr/share/zoneinfo folder for your timezone.

ln -s /usr/share/zoneinfo/Australia/Sydney /etc/localtime

Now we need to stop the ntpd service so we can request a manual update

/etc/init.d/ntpd stop

Now request the manual update


Confirm the correct time with the “date” command

Restart the ntp daemon with

/etc/init.d/ntpd start


  • Add insructions to start the service automatically on boot. If someone knows how to autostart an Angstrom Service please let me know.

How To Build Custom Angstrom Build for BeagleBone with Ubuntu or Debian

This guide details the process of building a systemd image from the Angstrom source on a ubuntu or debian host.

For the steps below I have used Debian 6.0.4 via a net install

Install Debian 6.0.4 net install choosing only Standard system utilites

From root command prompt run

sudo apt-get install openssh-server

This will allow us to access the machine remotely via ssh

Following instructions on

Install the mandatory packages as root

sudo apt-get install sed wget cvs subversion git-core coreutils unzip texi2html texinfo docbook-utils gawk python-pysqlite2 diffstat help2man make gcc build-essential g++ desktop-file-utils chrpath dosfstools kpartx

Logout as root and return to regular user

Following instructions on in the section down the bottom on “how to reproduce”

Run the following commands

git clone git://

EDIT: I had trouble with this line since I posted this so I have since been using “git clone”

cd setup-scripts
./ config beaglebone/

MACHINE=beaglebone ./ bitbake systemd-image

When the build completes the files of interest will be stored in.

cd ~/setup-scripts/build/tmp-angstrom_2010_x-eglibc/deploy/images/beaglebone/

Insert the BeagleBone SD Card into the debian host.

Run dmesg

you should see the last few lines look like this
[28915.028000] mmc0: new SDHC card at address 1234
[28915.675869] mmcblk0: mmc0:1234 SA04G 3.63 GiB
[28915.675912] mmcblk0: p1 p2
The above notes show that we have an SD card mounted at /dev/mmc/blk0

We now want to format the SD card using the script file here

First get the script on the debian host


Rename the file

mv mkcard.txt

Login as root


Make the file executable

chmod +x

Run the script to format the SD card

./ /dev/mmcblk0

If this is runs nicely then write the Angstrom image to the BeagleBone SD card using
Create a place to mount the new file systems

cd /mnt/

mkdir boot

mkdir Angstrom

Mount the File systems

mount -t vfat /dev/mmcblk0p1 /mnt/boot/

mount /dev/mmcblk0p2 /mnt/Angstrom/

Now using df -h we can see the file systems are mounted and empty

Filesystem Size Used Avail Use% Mounted on

/dev/sda1 226G 9.3G 205G 5% /

tmpfs 1013M 0 1013M 0% /lib/init/rw

udev 1009M 212K 1009M 1% /dev

tmpfs 1013M 0 1013M 0% /dev/shm

/dev/mmcblk0p1 70M 512 70M 1% /mnt/boot

/dev/mmcblk0p2 3.6G 72M 3.3G 3% /mnt/Angstrom

Change directory back to the location of our build

cd /home/craig/setup-scripts/build/tmp-angstrom_2010_x-eglibc/deploy/images/beaglebone/

Copy the boot files to the first partition

cp u-boot.img /mnt/boot/

cp MLO /mnt/boot/

cp uImage-3.2-r5b+gitr09e9651bcf2ee8d86685f2a8075bc6557b1d3b91-beaglebone-20120311054152.bin /mnt/boot


Rename the uImage to just uImage

mv /mnt/boot/uImage-3.2-r5b+gitr09e9651bcf2ee8d86685f2a8075bc6557b1d3b91-beaglebone-20120311054152.bin /mnt/boot/uImage

Copy the root filesystem from the tarball we created earlier to the second partition

tar -xjv -C /mnt/Angstrom/ -f Angstrom-systemd-image-eglibc-ipk-v2012.03-core-beaglebone.rootfs.tar.bz2

Unmount the SD card

umount /mnt/boot

umount /mnt/Angstrom

Your SD card is now ready for booting.

Remove the SD card from the Debian host
Remove all cables from BeagleBone
Insert SD card into BeagleBone
Plug in Ethernet cable to BeagleBone
Plug in power adapter.

The LEDs on the BeagleBone should flash as the device is booting.

Once it has booted it should show up in your routers DHCP Client list with the hostname “beaglebone”

You should now have access to the BeagleBone via an SSH client.
Using the username “root” password “root”

To change the root password use the passwd command.

Now you have a systemd image running on your BeagleBone

Autono-mow – The DIY Autonomous Lawnmower – Day 2

Day 2 of robot lawnmower resulted in the second drive motor and wheel being added and “Better” electrical on/off system implemented.

This new electrical system allowed Forward/Off control of each motor.

The following video shows a test run without any extra weight.

Download Day2-UnloadedMP4

The following video shows a similar test run with a calibrated weight added to represent the extra load that will be imposed on the mower with cutting drive, battery, etc.

Download Day2-LoadedMP4

Autono-mow – The DIY Autonomous Lawnmower – Day 1

Work began today on my Autonomous robotic lawnmower.

The intention is that this robot should be able to mow the lawn in my back yard without major human interaction.

The mechanical works began today with an old Rover mower having the back wheels removed and new rear drive wheel added. Driven by EK Ford Falcon windscreen wiper motors.

The Mower for Modification

The video below shows only one wheel added and being powered by a 12v sealed lead acid motorbike battery. As can be seen in the video the battery is connected directly to the motor terminals.

Download Video – Day1-Bump Test

Atmega128 UART / RS232 test code

This bunch of code can be used to test UART or RS232 (depending on your circuit).

I use as a windows terminal.

Compile and flash this code and your microcontroller will tell you that its running via UART. You can then send it a request (ending with a character return) and it will respond with the baud rate register value (just used as an example).

The archives below have all the source code that you will need to get basic UART running on your ATmega128.



Key based authentication for tortoisesvn with ssh

To checkout using ssh and key authentication with tortoise start by installing both tortoisesvn and putty (using windows installer)
Get Putty here

Get Tortoisesvn here

Run puttygen

Start Menu

Click Generate and wave the mouse around in the box


Generating your public and private keys

Fill in the Red boxes, copy and paste the text in the blue box and then save your private key somewhere safe.

Now take the string you have copied and pasted and insert it as a line in the text file on server


you may then have to change the permissions on this file using

chmod 700 ~/.ssh/authorized_keys

Now run Putty from the start menu like in the first image

and configure it as shown in the next few images.


SSH auth settings

Click the auth item under ssh and browse to your private key location


Set the auto login username

Set the auto login username


Save your session

Set your hostname, name your session and click save.

Now click open and you will be authenticated with your key plus your pass phrase.

If you want to have your pass phrase remembered each time you can now run Pageant from the start menu and add your private key and pass phrase.

This will run in the background and automatically sign you in when putty needs authentication details.

You should now be able to test it by running putty and double clicking on the saved session.

You should now be logged in to the remote terminal.

You can now checkout using the a checkout url similar to this

Where the svnsession in the red box is the name of your saved session.

When checking out you are now challenged for your key pass phrase.


Note: For those who wish to have this passphrase remembered for that login session simply grab your private key file and drop it into your start menu startup folder and on boot you will be prompted for your passphrase and you will remain logged in.