Pyscada on Raspberry PI for Modbus RTU

Following on from my Pyscada 1-Wire posts this article covers the configuration of Pyscada for the purpose of reading, displaying and writing Modbus RTU data using a raspberry pi and a usb to RS485 interface. This article assumes the installation has been completed along the lines of PyScada on Raspberry PI for temperature monitoring with DS18B20 on 1-Wire – Part 1 – Software Installation. This article will describe the configuration and reading of the first data bit and word to demonstrate the starting point of a larger project. Once these first variables have been setup, my previous post on HMI components may be useful PyScada on Raspberry PI for temperature monitoring with DS18B20 on 1-Wire – Part 4 – PyScada HMI Configuration.


Hardware Arrangement

A Usb to Serial RS485 adapter has been connected between a Raspberry PI and a Schneider Electric Twido PLC. After connecting the USB to Serial adapter the linux address device can be located using the terminal commands.

cd /dev/

The result of these commands is to list the devices, my USB to Serial adapter identifies as /dev/ttyUSB0. We will need this address later for the Pyscada Configuration.

We now need look at the permissions of the /dev/ttyUSB0 device in detail, a serial device when connected is only setup for access by the dialout group.

cd /dev/
ls -l

This will give results that look something like this.

crw-rw—- 1 root dialout 188, 0 Jan 21 11:48 ttyUSB0

To add our pyscada user to this group run

sudo adduser pyscada dialout


Pyscada Modbus RTU Device Configuration

From the admin menu in the pyscada core section click add device and configure it as shown below.

2-Add Device

Back on the main menu under Pyscada Modbus Master/Client click add device.

2a-modbus menu

Configure the new device as shown below.

3-Set Modbus Device.PNG

The screenshot above shows my configuration, the content in the red box defines the serial device location, in this case we are using the local host ip address (i am unsure if this is actually used by the modbus RTU device but the form will not accept a blank ip address) and the port is defined as the path to the serial device as identified in the section above.

The unit number in the orange box is the modbus slave address of the remote device and the section in the green box defines our modbus network settings. In my case these have been setup to match the PLC configuration shown below.

3a-Modbus Twido

Pyscada Modbus RTU Variables

As with the 1-wire interface in the previous posts we first need to create generic pyscada core variables and connect them to modbus variables.

We will create two variables in this example, a word and a bit, both of which will be configured to be writable.

From the administration menu add two new variables configured as follows.




Back on the main menu under Pyscada Modbus Master/Client click add variable and setup the two modbus variables.

2a-modbus menu

The memory table from the PLC is shown below. The day of the week MW is at register 0 of the word table and the sequencemode bit is at coil 2.

5-Modbus Variable MW5-Modbus Variable M

The two modbus reads are configured as shown below.

5-Set Modbus Variable MW

5-Set Modbus Variable M

The device reads are now complete, in the event that the HMI performs a write function pyscada handles internally the change of read holding registers to a write holding registers etc.

From here my previous post on configuring HMI elements and creating displays can be used to create pages that will work with the modbus data source. PyScada on Raspberry PI for temperature monitoring with DS18B20 on 1-Wire – Part 4 – PyScada HMI Configuration.



PyScada on Raspberry PI for temperature monitoring with DS18B20 on 1-Wire – Part 4 – PyScada HMI Configuration

In this part of the series we will configure the PyScada HMI using the web interface.

PyScada HMI Structure.

The PyScada HMI has a display structure based on a hierarchy of:

  • Views – Collections of pages
  • Pages – Collections of widgets that make up a single page
  • Widgets – Objects that control the layout of the page and the position of the various HMI components
  • HMI components – The actual objects that make up the HMI, charts, control panels  or custom html panel

The following diagrams shows the relationship the various items using an example implementation.


The diagram below shows two separate views, the intention here is that the views group pages into two groups, one designed for operators and the other for engineers.


Pages and Widgets

In the diagram below the relationships formed on a single page are shown. This page for motors will contain four objects, a control panel and a chart each for two motors. When building pages the objects are laid out by containing them in widgets, the widget positions are defined by their position in a row/column relationship.


HMI Components

We can now discuss the three types of HMI components.


Simply graphs of the data recorded in PyScada for the points selected.


Control Panels

Again a hierarchy is applied here with a Control Panel being a collection of Control Items. A number of Control Items are available shown in the screenshot below:

Note: as the only devices I have connected to PyScada at the time of writing are the temperature sensors I do not have digital inputs to test the indicators below with. I hope the information below on the labels is not misleading.

Control Items

Label Blue

A blue text label that background changes colour based on the input variable (shown in deactivated state above).

Label Light Blue

A light blue text label that background changes colour based on the input variable (shown in deactivated state above).

Label OK

A green text label that background changes colour based on the input variable (shown in deactivated state above).

Label Warning

A yellow text label that background changes colour based on the input variable (shown in deactivated state above).

Label Alarm

A red text label that background changes colour based on the input variable (shown in deactivated state above).

Label Alarm Inverted

A red text label that background changes colour based on the input variable (shown in deactivated state above).

Control Element

A collection of displays and update buttons to set a value in the host device.

Display Value

A simple string based text display of the variable.

Custom HTML Panels

These will require a topic of their own due to the complexity but as an overview you can write your own HTML to be inserted into the page and have PyScada render some components. As a basic example the following table, note the temperature column is realtime measurements from PyScada.


This was generated using the code below

<th>Sensor Number</th>
<th>Sensor Location</th>
<td>Bedroom 1</td>
<td><span class="type-numeric var-Var-Temp-01">NaN</span></td>
<td>Bedroom 2</td>
<td><span class="type-numeric var-Var-Temp-02">NaN</span></td>
<td>Bedroom 3</td>
<td><span class="type-numeric var-Var-Temp-03">NaN</span></td>
<td>Lounge Room</td>
<td><span class="type-numeric var-Var-Temp-04">NaN</span></td>
<td><span class="type-numeric var-Var-Temp-05">NaN</span></td>
<td><span class="type-numeric var-Var-Temp-06">NaN</span></td>
<td>Front Door</td>
<td><span class="type-numeric var-Var-Temp-07">NaN</span></td>
<td>Old Kitchen</td>
<td><span class="type-numeric var-Var-Temp-08">NaN</span></td>
<td><span class="type-numeric var-Var-Temp-09">NaN</span></td>
<td><span class="type-numeric var-Var-Temp-10">NaN</span></td>

PyScada HMI Implementation.

Now that we have the basics of the PyScada system this section will build a HMI for monitoring our temperature sensors. The diagram of the PyScada implementation is shown below.


As shown in the diagram above we will create a single view containing one page. On this page will be three HMI components, a “Control Panel”, a “Custom HTML Panel” and a chart. To create this system we will work form the inside out, creating the three HMI components, setting up a new page then its contents using widget definition and finally defining a view to hold them all.

Control Panel – List of temperatures

Log into the web interface as described in Part 3 (Link) scroll down on the administration menu to find the HMI section.


Click the “Control Items – Add” button and create a display value for each of the 10 temperatures. The first one is shown below, the position field allows for control of the order when there is more than one of these used in a control panel.


I repeated this process for the other 9 variables to build a list of control items as shown below.


Now we can combine them into a Control Panel, from the administration menu choose “Control Panels – Add”


Create a new Control Panel and add all the DV-Temp-xx display values we just created to it.


Click save and that is our “Control Panel” complete.

Custom HTML Panel

This panel will be generated in the next post in this series, mostly because I have not written it yet but I expect it to be large enough to demand its own post. For now we will simply place a simple rectangle with a line in it using the code below.

<canvas id="HouseCanvas" width="300" height="150"></canvas>
var c = document.getElementById("HouseCanvas");
var ctx = c.getContext("2d");

From the administration menu


Click the “Custom HTML Panels – Add” button and complete the form as shown below, I just added a single variable but for the moment we are not defining any references to the temperature.


This completes our placeholder Custom HTML panel.


This chart will show the historical data for all the 10 temperature sensors.

From the administration menu


Click the “Charts – Add” button and complete the form as shown below.


Click save and the chart configuration is complete.


Create a page to hold the widgets that assemble the page, from the administration menu


Click the “Pages – Add” button and name it as shown below.


Click save and then move on to the Widget configuration


Create the first widget, from the administration menu


Click the “Widgets – Add” button and name it as shown below.


Then complete the other two based on the details below.


We now have our page configured with three widgets containing items. Now we need to add a view to provide access to the page.


Create a view to hold the page, from the administration menu


Click the “Views – Add” button and name it as shown below (the other fields further down can be left as default)


Review the results

The configuration is now complete, head back to the main page and the new view should be visible.


Click on the “Home Temperatures” link to access our new page. This looks as expected however some tidy up is definitely required.


PyScada on Raspberry PI for temperature monitoring with DS18B20 on 1-Wire – Part 3 – PyScada Basic Configuration

In this part we will perform initial configuration of the 1-Wire devices into PyScada system and then create a simple interface for displaying our measurements. In the screenshots below you may notice the two different IP addresses, I have taken some of these screenshots from different instances but the content should be ok.

Logging in

From a web browser connect to the IP address of your Raspberry PI, click on the Admin button and login with the superuser password we created in part 1 of this series (Link)


After logging in you will be presented with the main menu looking something like this.


and continuing like this


Setup 1-wire inputs

PyScada has a model of abstraction in the devices and the variables. As a result we need to create a “Device” before connecting the “One wire device” to this generic device, similarly we need to create variables before connecting the 1-wire variables to them.

In the “PyScada Core” section at the top we need to add a device. Click the add button next to “Devices” and add the details similar to the screenshot below, note the polling interval setting can be adjusted to suit your requirements. Click “Save” and go back to the main menu by clicking “Home”


Now scrolling down the bottom of the main menu in the section “PyScada Onewire” click the Add “One Wire Devices” button to connect the actual 1-wire interface to the device we already created. Check the details in the screenshot below and click save, then back to the main menu again.


Now that we have the overarching devices configured we can configure the first actual sensor.  Back on the main menu in the PyScada Core section click Add next “Variables” and configure as shown below.


Then just like with the devices now head down to the PyScada OneWire variables section and click Add.


Click on the magnifying glass to select the variable we wish to connect the address to. Then set the address location to the serial number of the 1-wire device, in Part 2 (Link) in the “Software and first measurements” section we listed the 1-wire devices on my network as being.


To complete the setup we need to use the address field without the 28- at the front. The screenshot below shows the configuration for the third sensor on the list, which happens to be the one I marked as sensor 1.


I now repeated this process for all my sensors before moving on to the display elements, these will be covered in part 4 of this series.

PyScada on Raspberry PI for temperature monitoring with DS18B20 on 1-Wire – Part 2 – DS18B20 Hardware and Software

Following on from Part 1 (Link)  of this series, this post will cover the DS18B20 and 1-wire communication parts of this project.

Hardware Design

The DS18B20s are connected to the Raspberry PI based on the schematic below.

Using the Raspberry PI’s internal 3.3V Supply and GND pins we can power the DS18B20s on their VDD and GND pins respectively. The 1-wire network is a daisy chained system so we just tie all the DQ pins together. The final component is a single 4.7kOhm resistor that we connect across the 3.3V and Data line. The choice of GPIO4 for the 1-wire connection for the Rasberry PI is based on the default configuration of the 1-wire module.

The full details are available on the page at this (Link).

Current Considerations

When designing the system it was noted that the temperature sensors are powered by the Raspberry PI internal 3.3V supply. It was difficult to find definition of the maximum current rating of the 3.3V regulator. Some sources described the maximum demand from a GPIO point of view to be 50mA however others point out that the hardware has changed between revisions and that this is likely a very conservative number.

If we start with this 50mA number and head to the DS18B20 datasheet (Link) in the DC characteristics table the maximum active current is 1.5mA and the typical is 1mA. So considering the design above does not have anything else connected to the to the 3.3V bus and the likely conservative nature of the 50mA maximum we are looking at being able to calculate the maximum number of DS18B20 on our network using the formula below.

Number of Devices = \frac{50mA}{1.5mA} = 33

This is many more devices than I will be using so we can continue as planned.

Software testing and first measurements

In part 1 (Link) of this series we turned on 1-wire support in the raspi-config application. With the devices connected the setup is complete. Login to the Raspberry PI using SSH run the command below to access the folder where the 1-wire devices will be enumerated and then list everything in the directory.

cd /sys/devices/w1_bus_master1/

My results are below.


While there is a number of different items here rows 1-11 are the ones that we are interested in at the moment. At the time of writing I have 11 DS18B20 devices connected to the Raspberry PI and their unique serial numbers are listed starting with 28- and ending in ff. The 1-wire driver automatically searches the network and lists the devices found here by creating a folder for each device. If we now look inside the first devices folder using

cd /sys/devices/w1_bus_master1/28-0317019e43ff

We get the following results


Again there are a number of useful files here but the one we are interested in is called w1_slave. Run the cat command to read the file.

cat /sys/devices/w1_bus_master1/28-0317019e43ff/w1_slave


1e 01 4b 46 7f ff 0c 10 18 : crc=18 YES
1e 01 4b 46 7f ff 0c 10 18 t=17875

This file shows us the current reading by this sensor. The two components that are useful here are the crc=18 YES. Where the YES confirms that we have a valid reading and that it did not get corrupted in transit. The other t=17875 is the temperature measured in millidegree Celsius where the temperature in the room is 17.875 Degrees Celsius.

That’s the basic temperature measurements working nicely, the next part of this series will be about implementing PyScada for monitoring and logging.

PyScada on Raspberry PI for temperature monitoring with DS18B20 on 1-Wire – Part 1 – Software Installation

When looking for a temperature monitoring solution I considered a number of options but landed on the DS18B20 sensors in a TO-92 package (Datasheet Link). These nifty little sensors are cost effective and provide an accuracy of +-0.5 degrees over a range much wider than the temperature range in my house. These also provide a 1-wire interface that is compatible with the old Raspberry PI model B I have in the cupboard.

Initial operating system configuration

Starting with the RaspberryPI model B I went for the Rasbian Stretch lite iso (Download Link) and wrote it to an SD card using Etcher (Download Link). Connecting the RaspberryPI to a HDMI cable, usb keyboard and the freshly written SD card the system was ready for first boot.

After first power up the login with the default username and password


After login run the update commands to ensure that our operating system is up to date

sudo apt-get update
sudo apt-get dist-upgrade

Then perform some initial configuration using the raspi-config

 sudo raspi-config 


From this application perform the following configurations

Set the password to something unique instead of the default

Menu 1 - Change Password

Set the Localisation settings

Menu 4 - Localisation
Menu I1 - Change Locale
Set to en_AU UTF-8 UTF-8
Untick en_GB UTF-8
Set en_AU UTF-8 to default

Set the timezone

Menu 4 - Localisation
Menu I1 - Chage Timezone

Enable SSH so we can perform the remainder of the configuration from a remote PC

Menu 5 - Interfacing Option
Menu P2 - Enable SSH

Enable the 1-wire support

Menu 5 - Interfacing Option
Menu P7 - Enable 1-wire

Select finish to complete the configuration
On reboot note the “My IP Address is” line on the boot screen, we will need this to remotely login to the raspberry pi

Remotely Connect the Raspberry PI

To connect to the Raspberry PI remotely we will use the SSH server we enabled in the previous section. My preferred SSH client for Windows is putty (Download Link)

Run putty and all we need to set is the IP Address of the Raspberry PI and click open. This will provide a remote command prompt to complete the installation of PyScada and the testing of our 1-wire network.

Installation and configuration of PyScada

These instructions are based on the instructions at however these instructions cover a wide range of linux distributions and hardware and I struggled to get the correct combination for the Raspberry PI.

Create a user dedicated to the PyScada application

sudo -i
sudo useradd -r pyscada
sudo mkdir -p /var/www/pyscada/http
sudo chown -R pyscada:pyscada /var/www/pyscada
sudo mkdir -p /home/pyscada
sudo chown -R pyscada:pyscada /home/pyscada
sudo ln -s /var/www/pyscada/ ~/www_pyscada

Install the dependencies, PyScada and then create the django project

sudo apt-get -y install python-pip libhdf5-dev python-dev nginx gunicorn
sudo pip install cython
sudo pip install numpy
sudo export HDF5_DIR=/usr/lib/arm-linux-gnueabihf/hdf5/serial/
sudo pip install h5py
sudo pip install
cd /var/www/pyscada/
sudo -u pyscada django-admin startproject PyScadaServer

Edit the configuration files

sudo nano /var/www/pyscada/PyScadaServer/PyScadaServer/

Set the file to the following:

"""PyScadaServer URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  url(r'^$', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  url(r'^$', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.conf.urls import url, include
    2. Add a URL to urlpatterns:  url(r'^blog/', include('blog.urls'))
from django.conf.urls import url, include
from django.contrib import admin

urlpatterns = [
    url(r'^', include('pyscada.hmi.urls')),
sudo nano /var/www/pyscada/PyScadaServer/PyScadaServer/

Edit the file to the following:

Add this to the top

# -*- coding: utf-8 -*-


DEBUG = False





Add this to the bottom

STATIC_ROOT = '/var/www/pyscada/http/static/'

MEDIA_URL = '/media/'

MEDIA_ROOT = '/var/www/pyscada/http/media/'

# PyScada settings

# email settings
EMAIL_PREFIX = 'PREFIX' # Mail subject will be "PREFIX subjecttext"

# meta informations about the plant site
        'name':'A SHORT NAME',
        'description':'A SHORT DESCRIPTION',

# export properties

The file at the end should look something like mine below (note the secret key will be different)

# -*- coding: utf-8 -*-

Django settings for PyScadaServer project.

Generated by 'django-admin startproject' using Django 1.11.5.

For more information on this file, see

For the full list of settings and their values, see

import os

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

# Quick-start development settings - unsuitable for production
# See

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '8*5gy8$$e8&+cka+&a1lz!#_)s*#zooz6d!+7!f*j%z+uxx376'

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = False


# Application definition



ROOT_URLCONF = 'PyScadaServer.urls'

        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [],
        'APP_DIRS': True,
        'OPTIONS': {
            'context_processors': [

WSGI_APPLICATION = 'PyScadaServer.wsgi.application'

# Database

    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),

# Password validation

        'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
        'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
        'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
        'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',

# Internationalization



USE_I18N = True

USE_L10N = True

USE_TZ = True

# Static files (CSS, JavaScript, Images)

STATIC_URL = '/static/'

STATIC_ROOT = '/var/www/pyscada/http/static/'

MEDIA_URL = '/media/'

MEDIA_ROOT = '/var/www/pyscada/http/media/'

# PyScada settings

# email settings
EMAIL_PREFIX = 'PREFIX' # Mail subject will be "PREFIX subjecttext"

# meta informations about the plant site
        'name':'A SHORT NAME',
        'description':'A SHORT DESCRIPTION',

# export properties

Configure the PyScada Installation

Build the basic instance of PyScada

cd /var/www/pyscada/PyScadaServer
sudo -u pyscada python migrate
sudo -u pyscada python collectstatic
sudo -u pyscada python loaddata color
sudo -u pyscada python loaddata units

Create the admin user within PyScada

sudo -u pyscada python createsuperuser

Note your username and password you will need this later to login

Configure nginx

Get the nginx configuration from the PyScada source

sudo wget -O /etc/nginx/sites-available/pyscada.conf
sudo nano /etc/nginx/sites-available/pyscada.conf

My version is below, the only item I set is the server_name to the IP address of my Raspberry PI.

# pyscada.conf

# the upstream component nginx needs to connect to
upstream app_server {
        server unix:/tmp/gunicorn.sock fail_timeout=0; # for a file socket
        #server fail_timeout=0; # for a file socket

# configuration of the server
server {

        listen 80 default;     # the port your site will be served on
        server_name;      # substitute your machine's IP address or                                                                                                                                                              FQDN
        charset utf-8;
        keepalive_timeout 5;
        client_max_body_size 75M;   # max upload size, adjust to taste

        # Django media
        location /media  {
                alias /var/www/pyscada/http/media;  # your Django project's medi                                                                                                                                                             a files - amend as required

        location /static {
                alias /var/www/pyscada/http/static; # your Django project's stat                                                                                                                                                             ic files - amend as required
        location / {
            # checks for static file, if not found proxy to app
            try_files $uri @proxy_to_app;

        location @proxy_to_app {
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header Host $http_host;
            proxy_redirect off;

            proxy_pass   http://app_server;

Activate the PyScada nginx site, remove the default one, start the nginx service on boot and restart the service.

sudo ln -s /etc/nginx/sites-available/pyscada.conf /etc/nginx/sites-enabled/
sudo rm /etc/nginx/sites-enabled/default
sudo systemctl enable nginx.service
sudo systemctl restart nginx

Download the other systemd services from PyScada and activate them.

sudo wget -O /lib/systemd/system/pyscada_daq.service
sudo wget -O /lib/systemd/system/pyscada_event.service
sudo wget -O /lib/systemd/system/pyscada_mail.service
sudo wget -O /lib/systemd/system/pyscada_export.service
sudo wget -O /lib/systemd/system/gunicorn.socket
sudo wget -O /lib/systemd/system/gunicorn.service
# enable the services
sudo systemctl enable gunicorn
sudo systemctl enable pyscada_daq
sudo systemctl enable pyscada_event
sudo systemctl enable pyscada_mail
sudo systemctl enable pyscada_export

I had issues with the service files provided so in each of them I needed to make the following change.

In each of these files


Use the following commands

sudo nano /lib/systemd/system/pyscada_daq.service
sudo nano /lib/systemd/system/pyscada_event.service
sudo nano /lib/systemd/system/pyscada_mail.service
sudo nano /lib/systemd/system/pyscada_export.service
sudo nano /lib/systemd/system/gunicorn.service

Replace the line

replace all the %u with pyscada or the username you intend to use

Then I needed to reduce the number or guincorn workers as the load was too high for my little Raspberry PI.

sudo nano /lib/systemd/system/gunicorn.service

Edit the line

ExecStart=/usr/bin/gunicorn --pid /tmp/ --workers 8 PyScadaServer.wsgi:application


ExecStart=/usr/bin/gunicorn --pid /tmp/ --workers 3 PyScadaServer.wsgi:application

From here restart the Raspberry PI and give it a few minutes to catch up and that is the end of the initial configuration. From a web browser we can now connect to the IP Address of the Raspberry PI and access the web based configuration interface.


In the next post we will look at connecting and testing the 1-wire network to the Raspberry PI and after that the setup of PyScada. Click here (Link) for part 2 of this series.

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.