Research

Global Ports

Over a year ago, James and Adnan attended Transmediale media arts festival in Berlin to meet up with old friends living in the city and introduce them to members of the Mazi project attending for the first time. One of the first panels Global Ports still resonates as we edge forward with Creeknet pilot in Deptford. Much like in Port of Hamburg, the PLA (Port of London Authority) conforms a hydrachy of power, governing access to the waterways of the city, monitoring shipping and controlling all but the the weather and tides.

For those who are dependent on the Thames and it’s tributaries for transport,  trade and residence, there are very few resources available to guide use and track changing conditions.  It’s the knowledge of the boating community and their interpretation of PLA bylaws that hold sway here. Resistance, skulks the waters edge, using forgotten inlets, overgrown steps and derelict locks, to retain river access and uphold liberties. Mooring rights and tidal rituals, ebb and flow along the river wall, entangled in mooring chains, revealed as the river bed is drained by tides.

The Thames river wall all the way into Deptford Creek is part of the UK coastline, it’s beaches are monitored and rubbish cleared. Material on the shore clusters much where it was dropped into the water so great collections of red brick, clay pipes, animal bones, oyster shells and drift wood colour the shorelines in alignment to forgotten industry. Warehouses and wharves are fast being replaced by multi-story condos, only a very few remain out of the grasp of developers such as the abandoned squatted restaurant on Odessa Street up river in Rotherhithe, where recent Minesweeper fundraiser was such a success.

The burning of the Minsweeper and subsequent loss of mooring access at Brookmarsh Yard in Greenwich, point to an inevitability that will end occupation of these reaches by  the many barges and boats currently resident. Lengthy negotiations and legal actions by boaters to retain land access and not often ended well.

Standard
Research

MAZI pilot – Creeknet

We set out on the second phase of neighbourhood engagement and activity around our Mazi pilot – Creeknet. It explores use of DIY networking methods and promotion of ‘offline‘ information systems, that express awareness, sustainability and determination for greater data autonomy.

To date, we have met with a wide range of local people living and working alongside Deptford Creek, each with a view on local issues and an intensity to shape outcomes in whatever form of public campaign or personal agenda they may fix on. Help us identify the tools for success in such situations and to foster the development of home grown options to introduce into the MAZI toolkit.

We begin a series of weekly meetings and workshops at venues up and down the creek this month, to channel some energies into discovery, discussion and expression on subjects closest to heart. The quality of lived environment tops that chart, as any local resident, worker or student will assert. Unbridled property speculation, deteriorating air quality and wealth disparity, contribute to the sense of dis-empowerment, isolation and anxiety for the future.

Much we have learned, as the storm of chaos around us builds, reminds us that we can never again take personal freedoms and privacy for granted. As of 30th December, the Investigatory Powers Act permits targeted interception of communications, bulk collection and interception of communications data by UK government and intelligence agencies.

Educating and informing ourselves on conditions of change are now critical steps for us to take for future health of communities, cultures and capital. Our faith in each other, open collaboration and social justice are at stake. Your insight, inventiveness and expertise are key to unlocking neighbourhood value and identifying solutions to act on locally.

Standard
Research

Installing MAZI on Quintessence

Adnan installs the MAZI box on the roof of Quintessence. So far we had been running the MAZI zone from our living room (inside the LEGO box). Now it goes out of the lego box into a weather proof casing.

This research project on the boat looks into the development of the boattr prototype in collaboration with MAZI (for “together” in Greek), a Horizon2020 research project. Boattr connects narrow boats to the ‘Internet-of-Things’ and allows for open wireless mesh-networking within the narrow boat community, by using affordable microcomputers. The main goal of this project is to provide technology and knowledge that aims to 1) empower those narrow boats who are in physical proximity, to shape their hybrid urban space, together, according to the specificities of the respective local environment, and 2) foster participation, conviviality, and location-based collective awareness of the canals. The boattr prototype will build on the MAZI toolkit and the capabilities offered by Do-It-Yourself networking infrastructures – low-cost off-the-shelf hardware and wireless technologies – that allow small communities or individuals to deploy local communication networks that are fully owned by local actors, including all generated data. These DIY networks could cover from a small square (e.g., using a Raspberry Pi) to a city neighbourhood (e.g., the Commotion Construction Kit used at the RedHook WiFi initiative) or even a whole city (e.g., guifi.net, awmn.net, freifunk.net), and in the case of boattr the UK canal network.
Interactive Dissemination over the MAZI webportal will offer a chance for personal interaction in academic, socio-economic (and possibly selected commercial) conferences, EU organised events and conferences and trade fairs and exhibitions, and most importantly with policy bodies, regulatory and funding bodies that decide on research and innovation in water and waste between EU countries. The interactive channel of dissemination is intended for target groups with a high level of information need and involvement and it therefore provides information tailored to highly targeted audiences (in the case of the boattr project the ‘narrow boat’ community). The interactive channel is expected to be the most efficient means for community building and have the highest impact on dissemination and exploitation.

MAZI is a confirmed (accepted) Horizon2020 research project with which Coventry University could potentially partner up by supporting the boattr research project. MAZI will run until 2019, allowing for future development and deployment of the boattr prototype (once established by the end of 2016 or beginning of 2017). Having acquired a partner status with the MAZI project will allow for boattr to disseminate and promote its activities, via the partners’ networks of databases, if applicable to some partners in their countries including accessing networks in other international regions. The MAZI consortium members have considerable experience in marketing such events and projects both directly and through leading international events, disseminating information to targeted audiences through both online and off-line channels, and recruiting qualified participants to the brainstorming, networking workshops and international conferences. In summary: 1) Roadmap and Recommendations, White Paper and Continuity Plan, Brainstorming reports, results of the clustering activities and the documentation presented in events will all be made available through the MAZI portal. 2) MAZI partners will use their databases for targeted mail-shots to inform EU researchers about project activities and workshops, events and conferences; 3) Articles, email announcements and electronic newsletters will be carried out to maximise visibility of the boattr objectives, results and developments.

The boattr DIY infrastructures offer a unique rich set of special characteristics and affordances for offering local services to the narrow boat community, outside the public Internet: the ownership and control of the whole design process that promotes independence and grassroots innovation rather than loss of control and fear of data shadows; the de facto physical proximity of those connected without the need for disclosing private location information, such as GPS coordinates, to third parties; the easy and inclusive access through the use of a local captive portal launched automatically when one joins the network; the option for anonymous interactions; and the materiality of the network itself. The prototype will integrate existing FLOSS software, from very simple applications to sophisticated distributed solutions (like those under development by the P2Pvalue project, mobile sensing devices, and recent developments in open data and open hardware), allowing it to be appropriated by different non-expert users according to their respective context and use case; it will offer a wide unique variety of customization options.

The boattr project already receives in kind contributions from Deckspace medialab in form of access to the medialab’s server farm (on root level); from the MAZI project in the form of access to the MAZI toolkit, databases & network; and privately in the form of access to two narrow boats as case study for the boattr prototype. Other funding opportunities to be pursued are Horizon2020 (CAPS), Leverhulme Trust, as well as the Heritage Lottery Fund. Ideally the boattr/MAZI project would partner up with the Canal and River Trust, a charity, which is entrusted to care for 2,000 miles of waterways in England and Wales, which are often over 200 years old (an enormous network of bridges, embankments, towpaths, aqueducts, docks and reservoirs and more). The waterways provide an unfenced, ‘no turnstiles’ opportunity to interact with history and nature next to soothing water.

Standard
Research

boattr meets MAZI

Our media lab Deckspace SPC has started collaborating on a Horizon2020 research project titled MAZI. We are installing the MAZI toolkit on Quintessence in order to work with the bargee community. SPC’s main project within this research collaboration is Creeknet.

The mazizone will first live in our living room. The mazizone will be used as a boattr log & research journal (using WordPress),  as well as local sharing device (using NextCloud) & the MAZI guest book, allowing the community of neighbors around Quintessence to share the boattr know-how. Ideally those mazizones could also mesh with each other (but therefore the Raspberry Pi would need two Antennas). Something to add onto the ToDo list of MAZI.

The code for the mazizone can be found on GitHub.

MAZI backend

The MAZI Backend has been designed and developed in order to handle low-level communication between the MAZI toolkit’s hardware and the MAZI Portal. Moreover, it can be used by developers or advanced MAZI toolkit users to configure a MAZI Zone or build one from scratch. You can find below a guide on how to execute these scripts from the command line in order to modify your MAZI Zone.

In case you are using one of the MAZI Zone images, you can find the back-end scripts in the following folder

cd /root/back-end

Also, you can clone this repository into a Raspbian image to build a MAZI Zone from scratch, check here for more info.

Prerequirements

Install the following packages:

$ apt-get install python-pip
$ pip install speedtest-cli
$ apt-get install sshpass
$ apt-get install jq
$ apt-get intsall sqlite3
$ apt-get install batctl
$ echo "batman-adv" >> /etc/modules

Guide

mazi-antenna.sh

The mazi-antenna.sh script has been created in order to manage an external USB adapter that is connected to the Raspberry Pi. This script is able to check if a USB adapter is connected to the Raspberry Pi. In addition, you can discover the available networks in range and connect to one of them. Finally, you can disconnect the USB adapter from the connected Wi-Fi network.

Usage:

sudo sh mazi-antenna.sh  [options]
[options]
-i,--interface              Set the interface
-a,--active                 Shows the SSID of the interface  
-s,--ssid                   Sets the SSID of the Wi-Fi network
-p,--password               Sets the password of the Wi-Fi network
-l,--list                   Displays a list of the available Wi-Fi networks in range
-h,--hidden                 Connect to hidden Wi-Fi network
-d,--disconnect             Disconnect the USB adapter from Wi-Fi network

mazi-wifi.sh

The mazi-wifi.sh script is responsible for creating the Wi-Fi Access Point on the Raspberry Pi. With this script, you can also modify the settings of your Wi-Fi Access Point.

Usage:

sudo sh mazi-wifiap.sh  [options]
 [options]
-i,--interface               Set the interface
-s,--ssid                    Sets the name of the Wi-Fi network
-c,--channel                 Sets the Wi-Fi channel
-p,--password                Sets the Wi-Fi password
-w,--wpa  [OFF/off]          Turns off wireless network security

You can simply start (or restart the Wi-Fi Access Point if it is already started) without passing any argument.

sudo sh mazi-wifiap.sh

mazi-resetpswd.sh

In case you have forgotten your MAZI Portal administrator password, this script enables its recovery. Once you run the mazi-resetpswd.sh, the password changes back to the default “1234” and then you can access the MAZI Portal and change it through the first-contact page.

Usage:

sudo sh mazi-resetpswd.sh

mazi-sense.sh

The mazi-sense.sh script has been created in order to manage various sensors connected to the Raspberry Pi. This script can detect the connected sensor devices and consequently collect measurements periodically with a specific duration and interval between measurements. In addition, it can store these measurements in a local or remote database and check the status of the storage procedure, as well.

Usage:

sudo bash mazi-sense.sh [SenseName] [Options] [SensorOptions]

[SenseName]
-n,--name                    The name of the sensor

[Options]
-s , --store                 Stores the measurements in the database
-d , --duration              Duration in seconds to take a measurements
-i , --interval              Seconds between periodic measurements
-a , --available             Displays the status of the available sensors
-D,--domain                  Sets a remote server domain (default is localhost)
--status                     Displays the status of store process

[SensorOptions]
-t , --temperature            Get the Temperature
-h , --humidity               Get the Humidity
-p , --pressure               Get the current pressure in Millibars
-m , --magnetometer           Get the direction of North
-g , --gyroscope              Get a dictionary object indexed by the strings x, y and z
                              The values are Floats representing the angle of the axis in degrees
-ac , --accelerometer         Get a dictionary object indexed by the strings x, y and z
                              The values are Floats representing the acceleration intensity of the axis in Gs

mazi-app.sh

The mazi-app.sh script enables the control of the status of the installed applications such as the Etherpad, the Guestbook, the LimeSurvey and the Interview-archive. You can start, stop or display the status of the above applications.

Usage:

sudo sh mazi-app.sh  [options] <application>

[options]
-a, --action [start,stop,status] <application>    Controls the status of the installed applications

mazi-domain.sh

The mazi-domain.sh script enables the modification of the MAZI Portal’s domain and the change of the splash page.

Usage:

sudo sh mazi-domain.sh [options]
[options]
-d,--domain              Sets a new network domain of the portal
-s,--splash              Sets a new splash page

mazi-internet.sh

The mazi-internet.sh script is able to modify the mode of your Wi-Fi Access Point – currently – between offline and online as the managed mode has not been implemented yet. In the offline mode, clients of the Wi-Fi Access Point have not access to the Internet and are permanently redirected to the Portal splash page. In the online mode, the Raspberry Pi provides Internet access through either the Ethernet cable or an external USB Wi-Fi adapter.

Usage:

sudo sh internet.sh [options]
[options]
-m,--mode  [offline/online/managed]   Sets the mode of the Wi-Fi Access Point

mazi-current.sh

The mazi-current.sh script displays the settings of the Wi-Fi Access Point that has been created in this MAZI Zone. You can view information such as the name, the password and the channel of the Wi-Fi Access Point. You can also see the domain you are using for the portal page, as well as the active interface that broadcasts the Wi-Fi Access Point – in case you have plugged in an OpenWRT router. Finally, this script informs you about the mode of your Wi-Fi Access Point (offline, online, managed).

Usage:

sudo sh mazi-current.sh  [options]
[options]
-i,--interface  [wifi|internet..]  Shows the interface that used for AP or for internet connection respectively
                wifi               Interface for Access Point
                internet           Interface for internet connection
                mesh               Interface for mesh network
                all                Shows all available interfaces
-c,--channel                       Shows the Wi-Fi channel in use
-m,--mode                          Shows the mode of the Wi-Fi network
-p,--password                      Shows the password of the Wi-Fi network
-s,-ssid                           Shows the name onan f the Wi-Fi network
-d,--domain                        Shows the network domain of the MAZI Portal
-w,--wifi                          Shows the device that broadcasts the Wi-Fi AP (pi or OpenWRT router)

mazi-router.sh

The mazi-router.sh script is used for the management of the OpenWrt Router connected to this MAZI Zone. After connecting an OpenWrt Router this script is able to detect it and control the status of the connection, (activate/deactivate).

Usage:

sudo sh mazi-router.sh [options]
[options]
-s,--status                  Displays if the OpenWRT router exists 
-a,--activate                Activates	the	OpenWRT	router	as	the	Wi-Fi	AP	of	this	MAZI	Zon
-d,--deactivate              Disconnects the router and restores the initial settings of the Raspberry pi built-in Wi-Fi module

mazi-stat.sh

The mazi-stat.sh script enables the observation of system activity data of the Raspberry Pi such as the CPU temperature, the CPU usage, the RAM usage, the Storage usage, the Download/Upload speed and the number of users connected to the Wi-Fi network. You can also see information about the SD card such as capacity and whether or not the filesystem has been expanded. Another functionality is the storage of these data in a local or remote database. In addition, you have the ability to flush these data from the database in case you do not need them.

Usage:

sudo sh mazi-stat.sh [options]
[options]
-t,--temp                             Displays the CPU core temperature
-u,--users                            Displays the number of connected users
-c,--cpu                              Displays the CPU usage
-r,--ram                              Displays the RAM usage
-s,--storage                          Displays the card storage in use 
--sd                                  Displays information about the SD card
-n,--network                          Displays the Download/Upload speed
-d,--domain                           Set a remote server domain (default is localhost)
--status                              Shows the status of store process
--store [enable,disable,flush]        Controls the status of the storage process

mazi-appstat.sh

The mazi-appstat.sh script enables the collection of statistical data from the applications installed on the Raspberry Pi and the storage of these data in a local or remote database. In addition, you have the ability to flush these data from the database in case you do not need them. At the moment, you can collect data from the following applications, Guestbook, Etherpad and Framadate.

Usage:

sudo sh mazi-appstat.sh [Application name] [options]

[Application name]
-n,--name                            The name of the application

[options]
--store [enable,disable,flush]       Controls the status of the storage process
--status                             Shows the status of storage process 
-d,--domain                          Sets the server domain to be used for storage (default is localhost)

mazi-mesh.sh

With mazi-mesh.sh script you can expand the range of the Wi-Fi Access Point by creating a mesh network. To be able to create a mesh network, you must have more than one Raspberry Pi devices. One of these should be chosen as a gateway while the others as nodes. The Raspberry Pi that was chosen as a gateway is the main node of our topology, as it hosts the Portal of the MAZI toolkit, forwards internet in the mesh network and provides IP to the other nodes and their clients through the DHCP server. The Raspberry Pi that was chosen as a node is a relay of our mesh network, it redirects its clients to the gateway. Finally, you can restore the initial settings with the portal mode.

Usage:

sudo bash mazi-mesh.sh [Mode] [Options]

[Mode]
  gateway                      Operates as a gateway node
  node                         Operates as a relay node
  portal                       Restore to the Portal settings

[gateway Options]
  -i, --interface              Set the interface of the mesh network
  -s, --ssid                   Set the name of the mesh network

[node Options]
  -i, --interface              Set the interface of the mesh network
  -s, --ssid                   Set the name of the mesh network

DIY networking can serve two complementary objectives:

1) to improve Internet connectivity in a certain region or local area

2) to support local interactions and services.

DIY networks can be seen as “organic”: they are created by local communities, reflect local culture, and the data they use can be generated and consumed in the same place. DIY networks can also bring people together, face-to-face, instead of keeping them online all the time. 

Since these types of networks are owned and operated by individuals, significant coordination can be required around various issues: from purely technical, like the underlying networking protocols, to more social and political, like the design of the applications running on the network and the governance of the whole ecosystem (access and resource allocation, cost recovery, community support, conflict resolution, etc.). For such interactions to be productive and fruitful, one should carefully distinguish between the two main roles of a community network, Internet access vs.  local services, and their possible combinations. 

The MAZI project is exploring the important reasons why such networks should also be promoted as infrastructure for hosting local services, built and used by local communities.

Further Reading

Antoniadis, P. Apostol, I. Gaved, M. Smyth, M. Unteidig, A. (2015) DIY networking as a facilitator for interdisciplinary research on the hybrid city. Hybrid City Conference, Athens, September 17-19th.

Smyth, M., Helgason, I. (2015). Life at the Local Scale: An alternative perspective on the urban. In: Hybrid Cities – Data to the People. Athens, Greece. DOI: 10.13140/RG.2.1.3740.2083

Antoniadis, P.  Apostol, I. The right(s) to the hybrid city and the role of DIY networking. Journal of Community Informatics, special issue on Community Informatics and Urban Planning, vol. 10, 2014. [publisher

Antoniadis, P. Ott, J. and Passarella, A. (eds.) Do It Yourself Networking: an interdisciplinary perspective. Dagstuhl reports, 4(1): 125-151, June 2014. [publisher]

Creeknet, is one of four project pilots being operated as part of the MAZI initiative which will bring together components for a neighborhood network toolkit. This will feature a guide for those establishing or improving on open wireless and offline collaborative systems, advising on cost effective hardware and open source software solutions, whilst refining tactics and tutorials.

To help co-ordinate and explore the many options, we worked with MAZI partner University of Thessaly, Greece, to establish a suite of software to test and use in our local networks. Etherpad is a collaborative writing tool and OwnCloud is a document and media management system. UTH role is to co-ordinate and consolidate toolkit components and the first prototype, on a RaspberryPi disk image is available for testing featuring these and small selection of complimentary applications. In the simplest mode, presents a ‘stand alone’ wireless access point running webserver and other local services to promote working together. Without internet connection, any requests for webpages are redirected to local webpages listing services and describing options.

During recent workshop at the Prinzessinnengarten in Berlin, we heard about progress of MAZI pilot ‘Common Ground‘ during launch of Neighborhood Academy building in the garden. Their prototype ‘interview station’ enables one 2 one interview recording and publishing process. Completed interviews are published directly to their offline server prototype  for review and comment by those visiting the garden academy. The same combination of powerful software options and offline network server was in use during the recent Unmonastery at Kokkinopolis, a two week meeting in the Olympus mountains in Greece where it was first tested by them for communal exchange and interaction.

Kraftwerk1 housing cooperative in Zurich is working with Nethood to identify suitable evolutionary path away from their proprietary cloud information system. Their inspirational living model has been a great success and with growth of cooperative housing across Switzerland there is increasing interest in mapping of methods and monitoring of progress not least at Inura.

The ‘Creeknet’ pilot began in April 2016 describing first impressions and identified groups from the local area whom SPC have worked with in the past, to propose key issues and ideas to explore.There are many aspects to consider, changes to the built environment here are continuing at a rapid rate, some groups are being sidelined with conditions for living and working in the area facing disruptive challenges as well as opportunities.

Our role as advocate for user owned and operated information infrastructures is well known in the area. SPC worked with individuals, neighborhoods and local businesses from 2001 on a series of DIY low tech network projects, last represented by OWN, the open wireless network established 2008. Today the effects of population churn, rise of portable computing, concerns for personal security as well as long term exposure to the elements have reduced the operational status of OWN to a shadow of it’s former self.

The afterglow of positive experiences gained over eight years is now being rekindled with the prospect of renewed offline network development, expressing a passion for the ‘local’, celebrating neighborhood news and wider collaboration. The access to broadband provided by OWN in the area, needs re-doubling if it is to serve the co-ordination demands of MAZI ‘offline’ network development and monitoring of process. This process is now underway with new connections being upgraded between Deckspace in Greenwich and Minesweeper on the creek. From there we will continue to redistribute access to locations of activity nearby.

Monumental civil engineering and relentless apartment block building is underway throughout the area, bringing changes to the environment for everyone. For some it will mean the end of affordable rents for both domestic and workspaces. For others, this area of London is where overheads are still comparatively low. It will certainly result in increased traffic, noise and pressure on services, a transformation in the mix of people and expectations.

Pollution concerns over quality of water, air and electrosmog, processing of rubbish and recycling urgently seek answers. The Creekside Centre and other Deptford Creek groups are already working on the creeknet MAZI pilot to build on existing relationships and operate more effective information sharing and neighborhood network solutions. With these issues in mind early installations will include a range of passive environmental sensing of sound, light and radio.

The opportunity for social interaction in the area is limited to the few publicly accessible parks, pathways and the remaining pubs alongside west and eastern banks of the creek. A few new public areas have being created which have yet to be understood and adopted. For example the new footbridge at the mouth of the Deptford Creek, completes

Standard
Research

Boattr Bridge Update

The next stage after the cat5 bridge is to add P82B96 buffers on the i2c lines and a level converter. This will add some more resilience and make possible longer runs of i2c cables.

references

http://www.ti.com/lit/ds/symlink/p82b96.pdf

https://pidome.wordpress.com/manual-howtos/pidome-hardware/i%C2%B2c-bus-extender-for-the-raspberry-pi/

Standard
Research

Dashboard Update

After some fiddling with dashing there is a dashboard that we find useful…

What we have is four temperatures, battery volts, 4G data allowanceremaining, solar panel production and amphours information for the last 24 hours.

You can see there that we do not make enough energy from the sun. What you can not see is that the generator is running once a day to make up for the lack of sun. The current censor for it is on order and then we will be able to add the Amphours produced from fossil fuel.

Smd Soldering

Solder smd ICs

Standard
Research

Wireless Access Point

Setting a wireless access point for the beaglebone black

It should be easy if we get the right usb dongle. So far we have tried 2 different realtek types and they fail miserable with the existing open kernel drivers. Not going to compile crap kernel modules and use hacked ancient versions of hostap, thanks

Our last purchase which is a “TP-Link TL-WN722N” should hopefully be an atheros chipset which we always had great experiences with.

Well the previous two we bought were supposed to be atheros but only until version 3. The ones we received where version 4…

If this works it will be great. It also has external antenna connection.

 ***UPDATE***
 And it does work out of the box ...



setup

Assuming that a bridge is setup already with the wired interface in it and something like dnsmasq is serving ip addresses all needed for it to work is:

1
aptitude install  hostapd  haveged firmware-atheros

Haveged is a daemon that helps providing entropy for our wpa ap.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
  egrep -v '(^#|^\s*$)' /etc/hostapd/hostapd.conf
  interface=wlan0
  bridge=br0
  driver=nl80211
  ctrl_interface=/var/run/hostapd
  ssid=boat
  hw_mode=g
  channel=1
  wpa=2 # This sets the security settings to WPA2
  wpa_passphrase=hackme
  wpa_key_mgmt=WPA-PSK
  wpa_pairwise=TKIP
  rsn_pairwise=CCMP
  beacon_int=100 # This sets how often the WiFi will send a beacon out.
  auth_algs=3
  wmm_enabled=1

Start the services

1
2
service haveged start
service hostapd start

We also need a couple of iptables rules for NAT:

1
2
3
4
5
6
7
8
9
10
11
12
#!bin/bash
iptables -t nat -F
iptables -F
echo 1 > /proc/sys/net/ipv4/ip_forward
LAN='br0'
WAN='usb0'
iptables -t nat -A POSTROUTING -o $WAN -j MASQUERADE
iptables -A FORWARD -i usb0 -o $LAN -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -A FORWARD -i $LAN -o $WAN -j ACCEPT

ip route del default
dhclient $WAN

The $WAN interface could be anything that the internet is plugged in. In our case a 4g usb dongle on usb0. We add this to /etc/rc.local before the exit 0 line at the end if it exists.

1
2
3
...
sh /root/bin//masq.sh
...
Standard
Research

MMKamp14

Anton spent three weeks in Croatia near the city of Gračac in a very beautiful region participating in MMKAmp. This is an international camp on the theme “Future Environments” for people interested in ecology, autonomy, sustainability, low impact living, technology and DIY culture.

The heart of the camp was a hand made geodecic dome with solar panels and satellite internet.

It was also the first opportunity to test my boattr mobile box in the field there and Anton was quite pleased about the results.

Apart from being very usefull keeping all electronics and laptop charged in the middle of nowhere (Anton could only use the laptop 2 hours a day but this is not bad at all), Anton also did some small improvements in the code and the construction and finally got to show it to people for the first time.

Standard
Research

Boattr – what is it?

A hardware/software research project into the management of off-grid, autonomous sites. It collects and processes data from enviromental sensors and provides remote monitoring, control and automation.

Optionally it can also provide a host of other peripheral services that can run on the small embedded computer (wireless AP, internet connectivity, vpn remote access, tor gateway, file storage etc)

why was it made?

Since living off-grid Anton realised that he was lacking good information about the energy consumption and production, battery health and the various other subsystems of the boat.

One part of the project is about being able to better understand how those systems work by collecting, analysing and visualising their data.

The other interesting aspect is using realtime information from the sensors as well as historical data to make clever decisions and respond to external changes.

It seems that there was no free software based solution to fit my needs so Anton decided to Do It.

collecting data

At this point boattr has current, voltage, temperature and water pressure sensors. Data is collected from the sensors and stored in a db every minute. We can create real time graphs as well as mine the database for other historical data.

The heart of the system is a beaglebone black ARM embedded computer running Debian. Most of the sensors are analog and connected via a 10 channel ADC => I2c IC.

The temperature sensors are using the 1wire interface and one can read more details about the 1wire setup

Current sensing using the bidarectional allegro acs714 hall effect sensors using the breakout board from pololu

Voltage using a simple voltage divider

the software

The software part of boattr is made of a ruby module with two classes, Sensors and Data and the puppet provisioning code. The Sensors class contains all the functionality to obtain the results from the the various different sensors connected to the system.Data is responsible for processing resulting data, saving and sending to other places.

Here is an example of a box called ‘brain01’ on the boat retrieving data from the sensors, sending them to the database and real time graphs.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#/root/boattr/boat.rb
require '/root/boattr/sensors.rb'
hostname = Socket.gethostname
p hostname

brain01 = {
  'description' => 'analog/i2c from brain01',
  'basename'    => 'boat',
  'i2cAddress'  => 0x28,
  'i2cBus'      => '/dev/i2c-1',
  'couchdb'     => 'localhost',
  'dashboard'   => 'localhost',
  'graphite'   => '10.70.60.1',
}

sensors=Boattr::Sensors.new(brain01)

brain01_sensors =
  [ sensors.current('solar',0),
    sensors.current('generator',1),
    sensors.current('lights',2),
    sensors.current('pumps',3),
    sensors.current('ring',4),
    sensors.current('fridge',5),
    sensors.voltage('batteries',6),
    sensors.waterlevel('tank',7),
    sensors.temperature('out','10-000802964c0d'),
    sensors.temperature('in','10-0008029674ee'),
    sensors.temperature('cylinder','10-000802961f0d'),
    sensors.temperature('stove','10-00080296978d'),
    sensors.temperature('canal','28-000004ee99a8'),
]


Boattr::Data.new(brain01).to_db(brain01_sensors)
Boattr::Data.new(brain01).to_graphite(brain01_sensors)

A cron job will run the above code every minute saving json formatted documents on an instance of couchdb as well as real time graphs using graphite.

Puppet is used to configure the system, install packages, configuration files and cronjobs:

node definition for a box called brain02 linenos:false
1
2
3
4
5
6
7
8
9
10
11
12
13
node brain02  {
  $subnet     = '192.168.8'
  $domain     = 'camp'
  $ip         = "${subnet}.99"
  $br_iface   = 'br0'
  $wifi_iface = 'wlan0'
  $ssid      = $::hostname

  class { 'dnsmasq':  subnet => $subnet, interface => $interface }
  class { 'network::ap' :  ssid => $ssid, wifi_iface => $wifi_iface }
  class { 'network::interfaces' :  }
  class { 'couchdb': }
}

The graphs look like this:

dashing is in the works.

The code is available on github

#boattr Some sort of project to manage off-grid systems

#provisioning

At the moment we need a BeagleBone Black (BBB) with debian. Recent revisions (the ones with 4GB eMMC ) come with debian as default. If you have an older one you will have to install it yourself.

Connect to the BBB with ssh. We assume You have debian wheezy already installed. For the following steps you have to be root. Make sure there is internet connectivity as well.

##change the hostname replace name in /etc/hostname and /etc/hosts. A restart is required after this step or before running puppet below.

##Install puppet git and librarian

apt-get update
apt-get install puppet git librarian-puppet

##clone the repo

cd /root/
git clone git://github.com/galp/boattr.git
cd boattr

##Install the required puppet modules with librarian

librarian-puppet install

##customise puppet

Have a look in provision/default.pp. You can either modify the ‘default’ node definition in this file or copy one of the blocks that looks more suitable to a different file called $HOSTNAME.pp in the same directory. Change the node name in the file along with anything else required. Make sure the fully quilified dns names much.

##run puppet to provision all the components

Run puppet like below pointing to the right file.

puppet apply --modulepath="/root/boattr/provision/modules/:/etc/puppet/modules/"  --hiera_config="/root/boattr/hiera/hiera.yaml" --verbose  provision/default.pp

It might take a few runs until all dependencies are resolved and you should have all the components installed.

boattr setup

config file

Boattr in this context is the ruby program that runs every minute collecting data from sensors, analyzing and sending to db and dashboard among other things.

There is a configuration file that we need to edit. This file is located at /root/boattr/config.yml. By default it does not exists so we can use the config_sample.yml as a starting point.

cp /root/boattr/config_sample.yml /root/boattr/config.yml

Standard
Research

Installation of Boattr on Quintessence

Anton and Adnan installed the boattr microcomputer on Quintessence. Now there are two boattr boxes on the UK Waterways (Blue Morn & Quintessence). boattr runs on a beagle bone black.

The Construction of a Boattr Box

 

Powered Usb Hub for Beagle Bone Black

Another long term todo item ticked today. Adding a powered usb hub to brains , having only one port which was permanent taken by the 4g modem was not very helpful.

Now we can have 4g modem, 3g phone, usb interface for permanently connected stereo hydrophone, wireless and an external hard disk.

Our previous attempt to do so ended up with a fried hub , beaglebone and wireless dongle when accidentally wired the usb hub power to 12v instead of 5V.

Yesterday Anton popped to maplins and got a 4 port cerulian usb hub. Plugged it in and it didn’t work. Anton was very suprised that something as simple as a usb hub would not work. After searching on the internet Anton found that this is a known issue.

The solution is to open the hub and cut the red cable therefore stopping the hub from providing power to the beaglebone.

All working now it seems. Great stuff.

And the installation of the boattr box on Quintessence (using a beagle bone micromputer and a 4G phone, all connected over a USB hub and WiFi access point):

One Wire Network

With boattr we use Dallas 1-wire microlan for a network of temperature sensors. With this post we will make an attempt to document it. Not trying to explain what 1-wire is as it is documented elsewhere on the internet.

1-wire is a very simple communications protocol for sensors. The beaglebone black has two i2c devices ( /dev/i2c-0 and /dev/i2c-1 ) and we are using ‘/dev/i2c-1’. In order to get it to work we will have to add a custom device tree. We did this by reading this very helpfull blog post

For debian the dtc -O dtb -o BB-W1-00A0.dtbo -b 0 -@ BB-W1-00A0.dts command fails because a patch is missing. The easiest way to get around this is to download a patched version from here and use that instead.

  • Copy paste the code in the dts file
  • Compile with dtc command above
  • Copy resulting dtbo file to /lib/firmware
  • Add ‘’‘echo BB-W1:00A0 > /sys/devices/bone_capemgr.9/slots’‘’ to /etc/rc.local
  • Restart

( All the above should be done by puppet for boattr)

The information from the sensors appear in special files under /sys/bus/w1/devices/$ID/w1_slave. Reading /sys/bus/w1/devices/$ID/w1_slave gives as the temperature value in C.

Each sensor has a unique 64bit id that we can use to address it :

 

1
2
3
4
5
sensors.temperature('out','10-000802964c0d'),
sensors.temperature('in','10-0008029674ee'),
sensors.temperature('cylinder','10-000802961f0d'),
sensors.temperature('stove','10-00080296978d'),
sensors.temperature('canal','28-000004ee99a8'),

The temperature method looks like this :

1
2
3
4
5
6
7
8
9
10
11
12
def temperature(name,address)
  @name     = name
  @address  = address
  @basedir  = '/sys/bus/w1/devices/'
  if @@OWdevices.include?(@address) then
    file = File.open("#{@basedir}/#{address}/w1_slave",'r')
    if file.readline().include?('YES') then ## Is CRC valid in the first line? lets read the second and extract the temp
      @temp = file.readline().split()[-1].split('=')[-1].to_i/1000.0
      return { 'name' => @name, 'address' => @address, 'type' => 'temp', 'value' => @temp.round(3) }
    end
  end
end

Hardware

The sensor used is the DS18S20 datasheet.

Standard