MyRaspberryAndMe

Tinkering with Raspberry (and other things)

header


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


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


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

robot_header


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

robot_header


3 Comments

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


2 Comments

Quick Tip: Adding a directory to Python’s module search path

Over time I have written some Python modules/classes that I am using in more than one little project. As these are single files mostly, I did not bother about writing “real” modules with “setup.py” and all that stuff. I do not want to install these files in Python’s default library directory, either.

So I did what one should never ever do 🙂 I copied the files into the project directories as needed. This quickly gets out of hand if you are doing some updates to one of the classes. In order to get some robust structure into my workplace on the Raspberry Pi I did some research and reading about installing Python modules and came up with the most simple solution I can think of: adding my own directory to Python’s search path.

In the Python documentation everything I did can be found, of course. As I did miss it during several reads, I am posting my way of doing it here. To remind me and to, hopefully, help others.

First, a directory to put all the modules to be reused into needs to be created:

mkdir some_Directory_Name

Now we need to add an environment variable that gets set when you log in. Go to your home directory and edit the file “.profile”:

cd
nano .profile

At the end of the file add the following lines:

if [ -d "$HOME/Workplace/Python/MyModules" ] ; then
    export PYTHONPATH="$HOME/some_Directory_Name"
fi

That’s pretty all there is to do. The next time you log in the variable PYTHONPATH is set and used by Python. The if-statement checks for the existence of the given directory. The environment variable will only be created if the directory exists.

You can check this. Do not log out yet, but start Python and do the following (screenshot for better readability:

Bildschirmfoto 2013-12-04 um 14.57.10

This gives you the directories where Python looks for files when you are using the import-statement. Now to have our changes take effect, we could log out and in again, or we re-read the .profile with:

. ~/.profile

There needs to be a space between the first dot and the tilde character. If you are now starting Python again and do the exact same thing you should see your path somewhere in the output from sys.path:

Bildschirmfoto 2013-12-04 um 14.57.59

I have highlighted my personal search path in the above picture.

That’s all for this quick tip.

led_pcb_head


2 Comments

LED marquee – Teardown

Recently I saw an outdated (I thought) LED marquee sign in a thrift store. As these things make great tinkering objects I went inside and took a closer look. The sign looked fine and (tinkerer’s heaven) did have a serial port. Complete with RS232-to-USB adapter, remote control and power supply.

I did a quick research and decided to buy that thing. The technical data I found on the Internet were talking about up to 26 “pages” of text with 420 characters each, multiple effects and so on. Simply a must have…

led_sign

The most interesting thing was, of course, the serial port. The idea is to have multiple RSS feeds on display. The news, the weather and so on. Everything controlled from a Raspberry Pi.

To understand how I can interface with the sign I will (of course) open it and take look at the insides. I thought I make this a blog entry to let you participate in my findings and (hopefully) show you something about “reverse engineering” electronic devices.
Continue reading

komodo_head


Edit Source Code Remotely

Recently I caught myself juggling with 5 open terminal sessions simultaneously. Four windows were showing different source files from a project I am working on and the fifth terminal was the commandline from where I started compilation and ran the programs. This was really annoying because even on my 27″ monitor the terminal windows took all the space and I frequently had to change desktops and so on.

So the question arose: “Can’t this be done in a more efficent way?” Continue reading

rtc_headline


4 Comments

Real Time Clock (reloaded)

I could not stop thinking about the RTC and the Raspberry. In my personal setup, the RTC is not always connected to the Raspberry, so it would not make sense to throw away the fake hardware clock and rely on the RTC only. I needed a solution that was most flexible and with the smallest possible overhead.

The solution I came up with is to have a script check for the RTC on startup and create the device only when the RTC is there. This means tinkering around with “autostart” functionality and I am not going to edit rc.local, but do it the more correct and formal way. So if you want to learn how to run scripts on boot/reboot read on! Continue reading