MyRaspberryAndMe

Tinkering with Raspberry (and other things)


Elevator Information Display using two ILI9341 TFTs

It has been a long time since my last post, well, I have been busy and had significantly less time for tinkering.

But back again. Take an old elevator panel, two displays and a Raspberry Pi and transform it into a home information system.

Ingredients and Original Idea

  • A really old but massive elevator panel with all the original wiring, the buttons and even the led-matrix displays.
  • A Raspberry Pi (of course)
  • Two ILI9341 2.2″ TFT panels
  • Adafruit’s python library for ILI9341

My original idea was to reuse the LED-matrix from the old panels to display some information. This unfortunately was not possible as these are not ‘normal’ matrix displays but do have some sort of logic built in. Applying a voltage on the terminals (in the middle of the picture) does display the preprogrammed floor numbers in the display. Well, this is not a big issue, TFT displays are much cooler.
Here is an image of the unaltered elevator panel:original elevator panel

Continue reading

Advertisements


Making an eGalax/Pollin touchscreen work with tslib

Some months ago I found a cheap 7″ LCD screen with a resistive touch-panel. Searching the internet gave me some hope that the screen would work perfectly with my RaspberryPi. And alas, it did. Under XWindows, which I wasn’t going to use on the project I had in mind when buying the touch-display. So the search began and lastet. There’s lots of information out there about eGalax-touchscreens, most of it stating that one needs to compile a custom kernel, hack into some outdated driver software and so on.

After some investigation it became clear that the information available is mostly outdated, as the newer Raspbian images do recognize the touchscreen without compiling a custom kernel. So I started on my own and tried to get the screen working not with XWindows, but directly with the framebuffer. Continue reading


1 Comment

GPRS/GSM via Serial (again)

I recently stumbled over a cheap GPRS/GSM shield made for the Arduino platform, of course on ebay, of course from China. As it was priced at a very reasonable 20 EUR (25 USD), I thought I’d go with the risk and order from China. Several weeks later it finally arrived and, I couldn’t believe that at first, worked out of the box.

This is how it looks. If you get interested in one of these gadgets, just search for “GSM Arduino” on ebay, that should do the trick.

P1010427

It’s a SIM900 based design and has a real time clock (plus buffer battery) on the back. A full description of all the possible AT-commands can be found here. It is basically the same shield that can be bought from Seedstudio, but much cheaper. A description with some sample sourcecode (that is working!) can be found at the Geeetech-Wiki pages. Continue reading


10 Comments

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.


2 Comments

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


5 Comments

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


4 Comments

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


2 Comments

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” (www.robotroom.com) 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:

chassis_bot

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 “ourprogram.py” 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.

#!/bin/bash
export PYTHONPATH="$HOME/some_Directory_Name"
python /full/path/to/ourprogram.py

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.


3 Comments

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