Category: Software

  • LED debugging the stereowrap hardware

    I found out earlier that 5V is not enough to drive the shutter glasses. With my breadboard setup for stereowrap, I fed 12V to the op amps from an external source. Now that I moved the thing to a strip board, I added a step up converter that generates 12V from the 5V available on the USB port. I used an LT1301 which comes with an application note for exactly my use case. It was easy to implement and worked from the first try.

    Then I temporarily switched from an arduino duemillanove to a leo stick. Although it’s a tiny clone which plugs directly into an USB port, it still seemed like a bit of an overkill. I thought of using one of the AtTiny’s for that project. As I was not too familiar with these yet, I first did a hello world blinking LED’s. Soon after, I learned that neither the Attiny45 nor the AtTiny85 have a hardware UART. Well, I thought, there is an arduino software serial library. Arduino libraries are generally very easy to use in the IDE. But as I programmed the chip directly this time I wanted to stay within CodeBlocks/CMake and use the arduino library from here. (more…)

  • payment slip reader

    Probably the first time I got in contact with one of the pen style payment slip readers, was when I was working for TCG. They only come with drivers for Windows and in the meantime also for Mac. I contacted their support more than once, asking for a linux driver. No success so far. So I decided to get one cheap from ricardo.ch (similar to ebay.com). I was really lucky, and got one that makes noise when shaking for CHF 5. A new one would cost more than CHF 200. They have a very effective way of making sure people buy new ones from time to time. They just don’t release drivers for the older devices on newer versions of Windows. Well, that happens a lot in the Windows world, that people are forced to buy new devices. So there are a lot of devices floating around on ricardo.ch which only run on WindowsXP 32bit. Mine is one of those, but since I want to use it on linux that should be no problem.

    When I first plugged it in, the USB id was recognized correctly:

    $ lsusb
    ...
    Bus 002 Device 010: ID 0a93:0002 C Technologies AB C-Pen 10

    But that was about it.

    Trying to capture the communication on the USB port worked nicely with WireShark under ubuntu. But as I had no driver for it, there was not much communication to monitor. So I had to capture on a Windows box. Not so easy in a Windows-free zone. I have a VMWare virtual machine on my harddisk that I used some time ago to maintain an ancient project. But the outdated WMWare-Player could not run with my current installation. I had to upgrade it. It compiled the kernel modules with some minor help. But then the VM wouldn’t boot. I suspect, they changed the hardware they emulate. That would be no problem with linux, but Windows has real trouble with changing hardware. That was the same reason, I could not migrate that VM to VirtualBox some years ago. So, I installed a new Windows VM with VirtualBox. But now I could not figure out how to make the USB device accessible to the guest OS. The next try was qemu. It’s not as point and clicky as the other two products, but it’s really powerful and comes with loads of features. I grow to like it ever more. (more…)

  • cmake with MSVC

    I have used cmake for a couple of years with my hobby projects, and I love it. It is a cross platform meta build system. Like with Qt, people tend to first think that “cross platform” is the main feature. But like with Qt it’s actually one great feature amongst many others. It brings so many advantages that I can’t even list them all here.  Since last week, we also use it for PointLine at work. While the process is straightforward on linux, there are some things worth mentioning when using it on Windows.

    Finding External libraries

    Cmake has lots of finder scripts for commonly used libraries, and they work great in most cases. But we want to have multiple versions of the same libraries side by side, and depending on the version of PointLine we develop for, use the appropriate versions of the libraries. To be precise, not just the libraries, but also the headers and debug symbols need to be present in different versions. And we want to be able to debug different versions of our product using different versions of the libraries, simultaneously on the same machine. (more…)

  • software defined radio on the cheap with a DVB stick

    I think I first learned about software defined radio a few years ago on the chaosradio podcast. I was totally excited about the idea, and immediately installed gnuradio not only on my computers, but at times also on the smartphone. The USRP has been on my wishlist ever since. That’s the hardware device most commonly used with gnuradio. The downside was the price tag. While the approx $ 1’000 are not much compared to commercial solutions, it was too much for just another project to toy around, and I didn’t have an idea for a project where I must have one so far.

    Then in last February (2012), I read on a blog post that was probably linked from hacker news that somebody found out that a cheap DVB tuner USB stick could be used as an SDR receiver. That was exactly what I’ve been waiting for the past few years, except that a device with TX would be even cooler. Immediately I went to the local electronics shops with a compatibility list. But in most shops they had no clue, and they couldn’t even find out what chipset was in the devices they sold. In a more professional shop they tried to find out the chipset, and they had a device that looked very similar to one on the compatibility list. But it didn’t work. So, I ordered one directly from china. It took almost two months to get here, but then it took another two month before I really started experimenting with it beyond checking if I could sample something to the harddisk. Here is some background information. (more…)

  • The cheapest netbook

    When I read this blog post telling that there are netbooks available from china for $65, where it is possible to install a proper linux distro, I knew I must have one. Yes, the specs are lowest end, but even more so is the price. It has a WonderMedia 8650 system on a chip. That’s an ARM CPU running at 800 MHz with 256MB RAM. These chips are normally used for low end tablets, and you see that with other things. The netbook has a 7 inch screen with 800*480 pixels and runs Android 2.2. So the device could be described as a tablet with a keyboard, touchpad, wifi, ethernet and three USB host ports, but no touchscreen, accelerometer, GPS, camera nor bluetooth.

    From AliExpress, I ordered a device that seemed to be the same as mentioned in the blog. (more…)

  • machine learning class

    Another one of these incredibly interesting online classes came to an end. Machine learning was one of the first two classes that started last fall. As I thought to make AI and ML in parallel would be too much, I decided for AI with the intention to make ML later. The second round of ML was announced for January, but actually started in April. Andrew Ng from Stanford, who some people call a rock star in ML, thought the class. The videos were longer than what I was used to, and I downloaded them to my Android to watch them in the train to work. The homework consisted of review questions and work assignments for octave. The last time I did something with MatLab was more than ten years ago, and I remembered nothing of it.

    The class started with gradient descent and logistic regression. And almost everything that followed was compared against and related to them.

    I had some prior experience in ML, but no formal training. At TCG I learned the basics from a co worker. Then I implemented a document classification engine using an SVM. I read many books on the topic. Later I develpoed a prediction system for good days and locations for paragliding, again using an SVM as well as an evolutionary optimization. (more…)

  • Raspberry Pi – at last

    The raspberry pi, for those living under a rock, is the $25 linux pc that was announced big almost a year ago. It has a 700Mhz ARM CPU, 256MB RAM and an OpenGL ES capable GPU. To enable hardware hacking it comes with lots of GPIO pins. All in all about the performance of a premium smart phone from three years ago. But at $25 !!! The primary focus are school children, and the foundation wants to bring the fun on computing back to the children. Like every geek who read about it, I couldn’t wait to get one. First, the launch was scheduled for September or October, then postponed to February. The foundation decided they would outsource the shipping to some big electronics companies. They told them that a lot of people would try to get one of the first 10’000 boards, but still they weren’t prepared at all. The websites of the pi foundation as well as farnell and rs components were down the entire day. I got up earlier that day, hoping to be amongst the lucky ones. Later I signed up for a pre order somewhere in the queue for an upcoming batch. As with the first batch, each person could still order only one board. Then about a month ago, I received a mail indicating that it was time to place the order. And today I finally received it. (more…)

  • Correcting the date in the EXIF meta data of a jpeg image

    Lots of cameras have a wrong date configured. Mine is even worse: It has a dead internal battery, so it looses the date and time every time I turn it off. When you take a picture, the wrong date is saved to the meta data tags of the resulting photographs. Afterwards, you import them with a photo management tool such as shotwell, and they show up in the wrong place. Sorting doesn’t give you a chronological order. So I was looking for a simple tool to fix the embedded dates. I found exiv2. To install it, type:

    sudo apt-get install exiv2

    Strangely, it seems to allow only shifting the timestamp and not explicitly setting it. But that’s ok, it is probably the more common case. To adjust the timestamp from 25.7.2009 to 17.6.2012 execute the following:

    exiv2 ad -Y3 -O-1 -D-8 ~/Pictures/2009/07/GOPR050*.JPG

    Update 06.09.2020:

    Turns out it is also possible to set the date on images that had no EXIF data, although the command is a bit more verbose:

    exiv2 -v -M"set Exif.Photo.DateTimeOriginal 2020:09:05 07:17:00" 09/RunAndFly4.jpg

     

  • installing ros on a bifferboard

    I wanted the robot arm to be a bit autonomous from the computer, and I thought the bifferboard should be powerful enough to drive it. So I wanted to install ROS onto it. My bifferboard runs debian squeeze, and that means it’s not just a matter of installing the packages as with ubuntu. There is a dedicated wiki page about installing ROS on debian, so I was of the opinion that it can’t be that hard.  Actually, I once tried to install ros electric already when the bifferboard was still running debian lenny, and I ran into an infinite loop. I was full of hope that this bug had been fixed now with the release of debian squeeze and ros fuerte. But in fact, the first infinite loop was even earlier this time. And after circumventing an issue in pip with the help of a pip dev, I ran into the one I experienced earlier. I was able to find a workaround this time and reported the issue to pyyaml. The bifferboard has no FPU, and from what I can observe in python no inf and strange handling of nan. (more…)

  • recovering files from a repurposed harddrive

    Recently, I was searching for a bunch of photographs on all of my harddisks, and couldn’t find them. I know they had been there on the old notebook and on the old computer, and I thought I had copied them over. I could also not find them on any of my backup harddisks. Neither could I find any of the backup DVD’s containing the files that I was searching.

    So I wanted to see if I could salvage them from an old hard-disk that I formatted and re-purposed. Actually, I installed a new operating system on that harddrive, but didn’t use it a lot. So, with regular tools that query the filesystem directly, you wouldn’t find a trace. From an eposide of hak5 I remembered that scalpel is a tool for just that. Scalpel is a data forensics tool, that scraps through all the blocks of a raw harddisk, searching for headers and footers of known file formats. This works fine as long as the blocks belonging to a file are arranged linearly, which is not always the case. So I did a quick read up on how it works, and gave it a try.

    Here is a good tutorial.

    Basically, all I had to do is un-commenting the line with the jpg header definition, and run scalpel on the raw device file (e.g. /dev/sdc1 ) while providing an output folder. That way, thousands of jpeg’s were restored. Lots of them were corrupted due to them not being linearly distributed on the disk. But still lots of files were usable. I’m still looking for the backup DVD’s, but at least I have a fall-back now.

    Update 30. July 2014:

    If the partition is still intact, testdisk might lead to better results.