Tinkering with Raspberry (and other things)


Owncloud – Good bye (for now)

Sorry I have been quite for a while, but real life starts to kick in. I changed from freelance projects to a permanent position and that leaves less time for tinkering. (Less home office, more work).

So what is this about discarding Owncloud?

As you may have read I used a Raspberry Pi with lighttpd and Owncloud to manage my own Caldav and Carddav server. This worked fine and reliable until some days ago. I suddenly could not ssh into my server any more and experienced random but numerous synchronization errors. Attaching a monitor and keyboard to check what had happened (never ever put a machine into a shelf in a way that you can’t easily attach a monitor/keyboard…) was the only way to access it.
The log files didn’t produce anything helpful so I checked for the ssh daemon (again: OK) and for better access opted to shut the machine down and do further investigations on my workbench. That was a great mistake…

After shutting down and rebooting all I got was a kernel panic, a corrupt file system and a non-working system. I tried to repair the filesystem on my Linux machine, using fsck. No success, the filesystem was damaged beyond repair. I took a new SD-card and copied a backup of my owncloud installation on it, to get my server up and running again. This worked. For exactly 9 hours. Then I had the exact same boot messages and the exact same corrupt filesystem.

I’m not giving up easily, so I took a third SD card (different manufacturer, different size, different speed class), did the backup thing again and, believe it or not, after one day this card’s filesystem has been corrupted, too.

At the moment I have no idea whatsoever, why my Raspberry Pi “eats” filesystems. On the other hand I need to have my contacts and appointments synced on a handful of devices, so I am in the need of a working caldav/carddav server. That is why I returned to Google. Yes, I know and I am not comfortable with that solution either. But until I have resolved that filesystem issue there seems to be no other way.

Funnily enough (no, not really), my second Raspberry Pi when running Owncloud with lighttpd is corrupting the filesystem at the same speed…

So I now suspect that something in my installation is issuing way too many read/write cycles that quickly “wear out” the SD card. I need to do some further testing on this but that is the only thing I can of think of as the cause.

If anyone of you has experienced the same filesystem corruptions on a Raspberry Pi that is supposed to be running 24/7 please use the comments section for tips and tricks or your findings. Perhaps together we may solve that issue.



132 LED-matrix with AS1130 and Python

The AMS AG (austriamicrosystems) does have a neat little (literally) chip called AS1130 on the market. This chip is able to drive 132 LEDs, arranged in a 12×11 cross-plexed matrix. It can store up to 36 individual frames (pictures) and up to 6 patterns for blinking and PWM control of every single LED in every single frame. The frames can be displayed as still images or as a movie, the chip even scrolls the frames without the need for doing any calculations on the controlling computer side.
I could not find any Python code for that chip so I dived into the datasheet and wrote my own driver. As always, the sources are available via GitHub. Here is a short video demonstrating the capabilities of that chip. I had to use some paper to shield the ultra-bright LEDs or the camera would have recorded just a bright white spot…

Continue reading

Pi-Hicle final – motor-control and autonomous driving

So this is going to be the final part of the “Pi-Hicle” series (here are Part 1, Part 2, Part 3, Part 4). There is some good news and some bad news… But first a video of the vehicle moving:

The good news is that the BigTrak is in fact runnning on its own, avoiding obstacles with its three IR sensors. The bad news is that I have discarded the Raspberry Pi for this project. The vehicle is controlled by an Arduino mini now and there won’t be a Raspberry Pi in it in the near future. Now why this?

  1. I fell in love with the BigTrak and I simply can’t make any more holes in it, let alone ripping the keyboard off
  2. My plan to decrease the speed gradually as obstacles are detected does not work. There is not enough torque to move the wheels when the speed goes below 60% (and that is still too fast indoors, at least at my home)
  3. With the vehicle moving that fast a video camera is obsolete, one wouldn’t get a clear picture of anything (and I don’t have pets to annoy…)

So I am going to share the last steps in making this project. This involves mounting the sensors and putting everything together and the simple, yet working, code for making the BigTrak drive. Continue reading


Owncloud 6 + lighttpd 1.4.31 + Raspberry Pi (Wheezy)

This workaround patches lighttpd to “understand” the HTTP_PATCH method so Owncloud 6 can be used on a Raspberry Pi running Wheezy.

I am using a dedicated Raspberry Pi with Owncloud and lighttpd for my contatcs and calendar entries. This works fine with Android (with the cardDAVSync and calDAVSync apps) and out of the box with any iOS devices using caldav and carddav.

Recently I upgraded from Owncloud 5 to version 6, mostly because I wanted the new automatic birthday calendar feature. Then I realized that I was not able to change any entries. Creating and deleting entries worked fine, only updating/changing was affected. After some digging around I found an entry in the owncloud forums and a short remark in the installation instructions (for version 5. Not in the version 6 instructions…) reading:

Note for Lighttpd users on Debian stable (wheezy):
Recent versions of Owncloud make use of the HTTP PATCH feature, which was 
added to Lighttpd at version 1.4.32 while Debian stable only ships 1.4.31.
The patch is simple, however, and easy to integrate if you’re willing to 
build your own package.

There are instructions for patching lighttpd on Debian so I thought that this should work on the Raspberry Pi also. Well, it did not. I ended up with a completely screwed system and (even worse) an incompatible libc-version which made some more fiddling necessary. I cannot guarantee that I didn’t something wrong, but I found a workaround that is working flawlessly on my system.

This workaround involves some modifications to source files and building a debian install package. It also assumes that you have a working and properly configured lighttpd and Owncloud installation on your system! If you have never compiled/built software on a linux machine please be warned. I can not be held responsible if anything goes wrong and you end up with a non-working Raspberry Pi. That said, here’s what we are going to do:

  • make backups of all lighttpd configuration files
  • get the lighttpd 1.4.31 sources and patch them
  • build a .deb-package from the source
  • install patched lighttpd package over existing installation using dpkg
  • copy some missing files from saved backup to new locations

If you are still with me at this point, keep on reading… Continue reading


Pi-Hicle part 4 – Sensor Phalanx

I finally had the time to do some more work on my Raspberry Pi controlled Big Trak. So this is all about sensing the environment, well, avoiding obstacles, that is.

My idea is to have the vehicle measure the distance to any obstacles in front and to both sides. If it can’t move any further in forward direction, it will be turned in the direction (left or right) where there is the biggest distance to any obstacles. Very simple but that should be very effective. And it gives the impression of “real autonomy”, because the vehicle will turn in different directions to avoid a collision.

To get this done I ordered three Sharp GP2Y0A02YK0F distance sensors. They are well documented and used by many people out there, so I thought they should do for me, too. The sensors translate the distance into a voltage, so there is an analog value to be mapped to the distance. There is a data sheet with a nice graph showing the expected output voltage oder distance. According to the specifications the sensor has a range of 20 to 150 cm. That quickly proved to be a little too optimistic… Continue reading


Pi-Hicle part 3 – Big Trak autopsy and findings

This part is about the internals of the 2010 model “Big Trak”. I intend to use this toy as a base for my raspberry Pi powered vehicle. In part 1 of this series I covered the basic idea of my “Pi-Hicle” and recreated the Big Trak logic in Python. Part 2 was about displaying the programmed path on a display. Now I am lucky, because the “best girlfriend ever” gave me a real 2010 Big Trak for christmas. She even made a label, reading “Present for disassembly”. So I am doing nothing wrong here…

There are numerous resources out there about disassembling the Big Trak models, so I won’t cover this. Locate the screws and pay attention for those hidden under the grey rear bumper, then lift the top carefully and continue. David Cook from “The Robotroom” ( has extensive material about the original 198x Big Trak. For the new series of Big Traks you can find modding instructions with lots of pictures at srimech’s blog and some analysis of the circuits at the “Singleton Miller Wiki“. I am going to concentrate on my additional findings in this blog post. Nevertheless, here’s a quick overview where the screws are located. Blue arrows are “visible” screws, the red arrows point to where the additional screws are hidden under the bumper thingie:


Continue reading

Quick Tip: crontab and python

Often running a python script via crontab does not work as expected. The most common problem is with permissions, I am sure everybody is aware of.

Here are some other reasons why calling a python program from crontab may fail:

  1. The last line in the crontab file needs to be a newline
  2. Scripts called from within crontab may not contain a “.” (dot) character. This is weird and almost unknown to most users.
  3. crontab scripts may not have all PATH environments you have while testing your python program


So what to do about it? Here’s an easy solution:

Suppose you have added an import-path to your python installation like I did in this quick-tip. We are going to “wrap” the call to “” in a bash script and name that script “ourprogram_starter”. No dots, crontab is happy. In this script we export the PATH variable so that crontab and the “ourprogram_starter” can find all our custom modules.

export PYTHONPATH="$HOME/some_Directory_Name"
python /full/path/to/

Make sure that this file is executable and you’re good to go. Now crontab can call this script which sets all needed environment variables and then calls the python program.


Pi-Hicle part 2 – Programming Movement And Display Path On Screen

In part one everything was about getting that legacy touch screen to work. Now it’s time to re-live my childhood. I am going to include the logic that will move my Pi-Hicle around.

In case you didn’t read the first part, here’s a short video demonstrating the GUI and screen output. The path can be programmed and will be displayed on screen with triangles showing the Pi-Hicle’s heading.

orientationThe original Big Trak was able to hold 16 instructions in its memory. Sixteen! With the Raspberry Pi as a brain this number is significantly higher, although not really needed. The programming was done with a touch pad where one could select the direction (forward, back, left, right), wait and fire. Every command was followed by one or two digits, telling the vehicle how many units of its own length to move. The numbers after the “left” and “right” instructions were used to program a turn if xx degrees. To make things easy for us children, the angle to move was scaled according to an analogue clock. 15 meant 90 degrees, 30 was 180 etc.

From the image it is clear that “Right-45” would have exactly the same effect as “Left-15”, although the vehicle would be rotating in the opposite direction. Continue reading


Pi-Hicle part 1 – Touch Screen support

So here’s the first real part of the “Pi-Hicle” series. As the final goal is to control my vehicle from a touch screen, getting that to work is the first task.

The touch screen I have lying around is a 4DSystems μLCD-32PT type. ulcd_backIt is controlled via a serial port and that means: 4 cables only.

Have a look at the dimensions. This thing is a 3.2″ LCD and the control board is not bigger than the screen. The processor on this display supports a lot of commands for graphics primitives, like drawing lines, circles etc. You can even select from 4 different font sizes.

It is equipped with a micro SD-card reader from which it can display graphics files and even play wav-sounds. My display is the “SGC” type, that means “Serial Graphics Client”. So the display only serves as a client, meaning that all calculations need to be done by the controlling program. For real-time updating of complex graphics or such things this may be a major drawback, but I won’t need that.

Controlling the display

As the display itself is more or less “dumb”, let alone being a “legacy product”, there are no libraries around which I could have used. Some time ago I found a CPP library for an Arduino but it seems that this library (supporting my old display) is no more. So I started from scratch with only the technical manual and the description of all supported functions and began coding.

My python class does not support the complete command set, I concentrated on the things I am going to need. And I do not need low-level support for reading/writing the SD-card slot. Continue reading

1 Comment

New Project: The “Pi-Hicle” – What is is about

Well, sooner or later it had to be. I am going to build a vehicle that is controlled from my Raspberry Pi. I know, there are tons of such projects out there, but this simply is a must. And I think I am doing things a little different…

This blog post is meant as a short “introduction” on why and what. The actual documentation of my efforts will go in blog posts with a “Pi-Hicle Part xx – some description” title.

bigtrakThe idea started the instant I saw a “Big Trak” toy vehicle in a shop. Back in around 1980-1982, I can’t remember exactly the year, this was the toy of dreams. I wanted one for christmas but then I met a new boy at school who was deeply in electronics (we were about 13-14 years old and he was repairing TVs and even built an 30-channel analogue mixer!). His bigger brother had an ZX-81 and we spent every afternoon programming that thing. So I opted for my own ZX-81 for christmas, the “Big Trak” was history.
Fast forward more than 30 years: The “Big Trak” is back in shops. I am still tinkering with electronics and, even better, I can buy my own christmas presents… Hooray!

So the plan is this: take a Raspberry Pi to control a vehicle. The keypad on the “Big Trak” will be exchanged for a touch-screen. The actual driving – and later environmental sensing – will be done by an Arduino. This way if I do something wrong, it’s just a new Arduino for 10 bucks, not a 40 bucks Raspberry Pi.

Continue reading