Raspberry Pi Compute Module

The Raspberry Pi Compute Module is a great step forward. It provides an easy way of using Raspberry Pi technology in commercial products which often require a customized physical format and I/O. This has been a problem in the past with other similar systems where they really were never intended for integration in real products. Now the Raspberry Pi provides a straightforward route to powerful commercial products with minimal NRE and risk compared to a full custom hardware design. Excellent!

Raspberry Pi I2C udev rules

Even when the I2C ports on the Raspberry Pi are enabled as described here, they are only accessible when running in supervisor mode, which is not terribly convenient. To fix that, it’s possible to add a udev rule to change the mode of the devices. The description here is borrowed from my friend at Jumpnow incidentally.

Create a file /etc/udev/rules.d/90-i2c.rules and add the line:

KERNEL=="i2c-[0-7]",MODE="0666"

Reboot the Pi and then the I2C ports will be accessible without having to run stuff with sudo.

Speeding up JPEG capture using the Raspberry Pi’s camera module and raspistill

PiCam

The Raspberry Pi with camera module is nice way of generating image and video data. However, I don’t know if this is a problem for everyone but I was only getting 2fps max out of raspistill in timelapse mode, even with a much smaller interval set. After some investigation, it seemed to be related to shutter delay. There is a way of speeding this up using the code below:

    {
        MMAL_PARAMETER_ZEROSHUTTERLAG_T shutter_config =
        {
            { MMAL_PARAMETER_ZERO_SHUTTER_LAG, sizeof(shutter_config) },
            .zero_shutter_lag_mode = 1,
            .concurrent_capture = 1
        };
        mmal_port_parameter_set(camera->control, &shutter_config.hdr);
    }

Add this code segment into the create_camera_component() function. The result is more like 8fps with my moderately overclocked Pi. Better than 2fps at least!

Using the scp command to copy files between Linux systems

scp is very handy for moving files between Linux systems, especially from desktops to embedded systems and vice versa. However, the syntax is always a challenge. For example, to copy a file from a remote system:

scp <username>@<machine>:<full path to file> .

would copy the specified file to the local directory. So for example:

scp pi@192.168.5.26:/home/pi/file fred

would copy some file called file into the local directory as a file called fred. The order can be reversed to send the file the other way.

It’s the ‘:’ that causes all the trouble…

Using Qt on the Raspberry Pi running Raspian

The Raspberry Pi Raspbian distribution is a pretty nice way to go. I am currently working on some stuff using Qt and the Raspberry Pi camera and decided that the easiest thing was to get things going natively. Raspbian comes with Qt4.8.2 so the easy way to get started was to do:

sudo apt-get install libqt4-dev qtcreator

Unfortunately, QtCreator does not find the toolchain for some reason. This has to be configured by hand. Go to Tools > Options and select Build & Run. Then, select the Tool Chains tab and click on the Add button. Select the GCC option. This will add some stuff to the dialog. The compiler path should be set to /usr/bin/g++ and the debugger to /usr/bin/gdb. This should complete setting up the tool chain.

Another problem I had was that it wanted to do a remote deployment. To change this, click on the Projects icon in the toolbar on the left of the QtCreator window and select the tab Run Settings. The deployment method should be set to No deployment. Do this by clicking on the Add button and selecting Deploy configuration. Click the Add button for the Run configuration and select Custom executable. On the Executable: line below, enter the relative path to the executable.

Then everything should pretty much work!

Using Git and GitHub with Embedded Linux Systems

I often need to clone a private Git repo from GitHub onto an embedded Linux system for native compilation. The only problem is that, to clone a private repo from GitHub, there must be a public key registered for each system. To do this for every embedded system is a total pain. However, a Linux machine that has the repo on it already can act as a local server very easily.

On the embedded system, clone the repo using this command:

git clone ssh://user@

For example,

git clone ssh://richard@192.168.10.2/home/richard/veryinterestingrepo

would clone the repo veryinterestingrepo from the directory /home/richard on the machine at 192.168.10.2 using user name richard. At some point Git will ask for the password for user richard. Once this is entered, the clone should work as expected. Pulls and pushes will work as normal as they use the remote from which the repo was cloned.