PDF-Schnittmuster zusammenfügen

vintage sewing patterns

Manchmal is es nötig aus vielen einzelnen PDF-Seiten eine große ganze zusammenzufügen. Das ist z.B. nötig wenn man ein Schnittmuser auf vielen Seiten verteilt ist, aber man den ganzen Plan ausdrucken will.

Dafür gibt es einige Methoden z.B. ein shell script mit Hilfe von [pdftk CLI] und [imagemagick], jedoch nur unter Linux / OSX. Beide Programme gäbe es auch als Windows Versionen jedoch mit GUI und daher eine anstrengende „Klickerei“ auf Dauer, also alles andere als einfach und deshalb hier eine einfachere Methode um PDFs zusammenzufügen.

LaTeX Variante

Für diese Methode benötigt man das Ausgangs-PDF (mit den einzelnen Schnittmuster-Seiten) und Zugang zu LaTeX. Dafür benötigt man jedoch keine Installation man kann dies online sehr einfach machen.


Raspberry Pi + TI Sensortag + Plotly

In the last post (Raspberry Pi 2 TI Sensortag) I recapped the possibility to use Raspberry Pi to connect with BLE to a TI Sensortag using the bluepy-library.

A logical next step is to push the data to the „cloud“.

First register under https://plot.ly/ go to settings and note your API Key and your tokens (create two).

To use it with the Raspberry Pi ssh into it (or use a terminal) and install the prerequistes:
sudo apt-get install python-dev
sudo apt-get install python-pip
sudo pip install rpi.gpio
sudo pip install plotly

The next step is to create a script which uploads the streaming data plot.ly, it is heaviliy based on this intructable from plotlygraphs:

import plotly.plotly as py
from plotly.graph_objs import Scatter, Layout, Figure, Data
import time
import datetime
import sensortag

username = 'your_username'
api_key = 'your_api_key'
stream_token1 = 'one_unique_token'
stream_token2 = 'another_unique_token'

py.sign_in(username, api_key)

trace1 = Scatter(
    name='Ambient Temp.',
trace2 = Scatter(
    name='IR Temp.',

layout = Layout(
    title='Raspberry Pi Streaming Sensor Data',

data = Data([trace1,trace2])
fig = Figure(data=data, layout=layout)

print(py.plot(fig, filename='Raspberry Pi Streaming Example Values'))

# activate sensortag
intervall = 20 # seconds
print "Push button on sensortag"
tag = sensortag.SensorTag('BC:6A:29:AC:53:D1')


i = 0
stream1 = py.Stream(stream_token1)

stream2 = py.Stream(stream_token2)

#the main sensor reading loop
while True:
    sensor_data = tag.IRtemperature.read()
    now = datetime.datetime.now()
    stream1.write({'x': now, 'y': sensor_data[0]})
    stream2.write({'x': now, 'y': sensor_data[1]})
    i += 1
        # wait for new measurement
    if i > 100:


The result looks somthing like this.

Raspberry Pi 2 BLE TI Sensor Tag

Install necessary packages:
sudo apt-get install bluez-utils libopenobex1 build-essential libglib2.0-dev libdbus-1-dev

Restart the bluetooth service
sudo service bluetooth restart

Scan for BLE enabled devices connected to the Raspberry Pi:
hciconfig --all

hci0: Type: BR/EDR Bus: USB
BD Address: 00:1A:7D:DA:71:0C ACL MTU: 310:10 SCO MTU: 64:8

Scan for BLE devices:
sudo hcitool lescan

BC:6A:29:AC:53:D1 SensorTag
F4:F9:51:C7:4C:23 (unknown)
BC:6A:29:AC:53:D1 (unknown)
BC:6A:29:AC:53:D1 SensorTag
BC:6A:29:AC:53:D1 (unknown)

It shows two devices, but we are only interrested in the Sensor Tag. The adress is BC:6A:29:AC:53:D1 (this address may be different with each device).
So we know bluetooth is working and the mac address of the sensor tag.

Next step is to download/install the great bluepy library from Ian Harvey:
git clone https://github.com/IanHarvey/bluepy.git
cd bluepy/bluepy

To read now sensor data from the sensortag, use the example script sensortag.py:
usage: sensortag.py [-h] [-n COUNT] [-t T] [-T] [-A] [-H] [-M] [-B] [-G] [-K]

positional arguments:
host MAC of BT device

optional arguments:
-h, --help show this help message and exit
-n COUNT Number of times to loop data
-t T time between polling
-T, --temperature
-A, --accelerometer
-H, --humidity
-M, --magnetometer
-B, --barometer
-G, --gyroscope
-K, --keypress

I.e. to read the temperature five times in an interval of 0.5 seconds we use:
python sensortag.py BC:6A:29:AC:53:D1 -n 5 -t 0.5 -T
then press the button on the side of the sensortag
Connecting to BC:6A:29:AC:53:D1
('Temp: ', (31.71875, 30.4396374686782))
('Temp: ', (31.75, 28.29441505369789))
('Temp: ', (31.71875, 27.21886394070981))
('Temp: ', (31.71875, 27.21886394070981))
('Temp: ', (31.71875, 28.54570004702458))

It is also possible (without any changes to the sensortag.py-script) to use it as a python script:
import time
import sensortag

tag = sensortag.SensorTag('BC:6A:29:AC:53:D1')

for i in range(5):
print tag.IRtemperature.read()
del tag

One remark if you want to import the module from another folder I recommend adding to the __init__.py file the line:
from . import *
Than it is possible to import the package with realtive importing like:
from bluepy.bluepy import sensortag

Recover Data from HTerm

Last week I had the task to logg XBee data with my laptop using the really great terminal program HTerm. After the crucial data arrived the program hang up and was unresponsive.

The first aid was to make a screenshot, but this recovers only the latest data but not the whole log.

Without closing the unresponsive window I opened the task manager went to applications and searched for HTerm. Then choosed the option showing the process. The next step is to „Create Dump file“ (or „Abbilddatei“).

To regain access to your data you have to search the dump file for your data. In my case I searched for GPS data lines starting with „$GPS“. So I wrote a little python script scanning all lines for this specific string and saving everything in a new log-file.

# -*- coding: utf-8 -*-
"""Recovery of data from HTerm
@author: michael russwurm

from __future__ import print_function

# open dump file
log_file = open("HTerm.dmp",'rb') 
recovered_data = open("recovered_data.log",'w')
for line in log_file:
    line = line.strip()
    if ('$GPS') in line:
        print (line)
    #else: # for debugging
input("Press Enter to exit.")

pyrocket – Amateur Rocket Simulation Script

A small little python script for simulation of an ameteur rocket.


It is a one dimensional simulation (acceleration, velocity and altitude), which considers drag changing temperature and density over altitude, changing mass and thrust.

Example Output of Amateur Rocket
Example Output of Amateur Rocket

It also simulates the optimum spearation time for two stage rockets. This is kind of arbitrary cause it is alway (except the drag difference is really huge) always best to use the inertia of the accelerated mass as long as possible in an unpropelled state to work against the drag.

One additional gimnick is the necessary angle of an autotracking device separated from the launchpad.

Rotary Encoder Disks with Matplotlib

Did you ever needed a quick way to make your own rotary encoder disks?

Here a quick way to make the graphics. Afterwards only a printer and scissors are necessary.

First import the packages numpy and matplotlib

import matplotlib.pylab as plt
import numpy as np

And now define the outer and inner diameter as well as the number of lines:

di = 300.e-3# inner diameter
da = 340.e-3 # outer diameter
lpr = 720. # lines per 360°

And here comes the rest:

fig, ax = plt.subplots(1,1, subplot_kw=dict(polar=True))
theta = np.linspace(0.,2*np.pi,lpr+1)
radii=np.empty(lpr+1); radii.fill((da-di)/2)
dis=np.empty(lpr+1); dis.fill(di/2)
ax.bar(theta, radii, width=np.radians(360/(2*lpr)), bottom=dis,
           color='black', edgecolor = 'none', linewidth  = 0.)

It is a polar plot with bars, separeted from inner diameter to outer diameter. Important is to suppress any lines which disturb your signals (suppress tick and labels).

And here is an example output:

Rotary Encoder Disk
Rotary Encoder Disk

Only thing what’s left is to print and build.

Install Anaconda and IPython (notebook) in Ubuntu

Sometimes it is either hard to remember or there are many way to fulfill a certain goal. During my (re-)setup of my laptop with Ubuntu 12.04 I had to install IPython with its notebook capabilities.

The first step is to download the recent anaconda package from:
Either the 32 or 64 bit version. Next make it executable either by right click on the downloaded file and choose „Properties“ then the tab „Permissions“ or with an editor

sudo chmod +x Anaconda-1.x.x-Linux-xxx_xx.sh


Next start the installation by typing


. Choose the recommended options. (Be careful not to hit the enter key to often at beginning otherwise it kicks you out.)

This installs the necessary files, but we need to add the directory to the PATH. Therefore we change the the profile configuration by

gedit ~/.profile

and change the line




. Afterwards only safe the file. EDIT: It is also possible to restart or logout / login to update the PATH.

Next -but not strictly necessary- it is always favorable to update the existing files. To do this we can use the anaconda built in conda repository management system.

conda update ipython

Now you’re read to start the IPython notebook everywhere (although it is recommended to start it always from the same directory, otherwise it isn’t possible to open the old files directly with the notebook manager).

 ipython notebook