Tag Archives: raspberry pi

How to Program an AVR/Arduino using the Raspberry Pi GPIO

In this tutorial I am going to show you how to program an AVR(ATmega328) and an Arduino UNO using the GPIO on the Raspberry Pi.

Adding an Arduino or an AVR to your projects will give you much greater flexibility.


Hook up the Raspberry Pi to the Arduino UNO or AVR.


The image below shows how to connect a Raspberry Pi 2 and an  Arduino UNO. click the image to make it larger


Raspberry Pi AVR BerryIMU

Continue reading How to Program an AVR/Arduino using the Raspberry Pi GPIO

Raspberry Pi controlling a LED cube with Python

The above LED cube [VoxCube] is being controlled via a Raspberry Pi, using python and the official Raspberry Pi display.

Buttons were setup using the Kivy. Kivy is a Python library which makes creating buttons and events with a touchscreen very easy.

Here is a very good guide on how to get Kivy setup on a Raspberry Pi.
Continue reading Raspberry Pi controlling a LED cube with Python

New Kickstarter – VoxCube – 8x8x8 RGB LED Cube for the Raspberry Pi

We have been busy over the last 6 months creating something special!
We have always liked the idea of LED cubes, however there was no easy way to drive these LED cubes with a Raspberry Pi…. until now.


VoxCube is an 8x8x8 RGB LED Cube which has been specifically designed for the Raspberry Pi, however it is also compatible with other microcontrollers. E.g. Arduino

Cubes can also be chained together, the image below is four VoxCubes being controller via a Raspberry Pi.

Four VoxCube Raspberry Pi LED


Head over to the Kickstarter page for more details.

Kickstarter LED cube



Super low cost VGA output for the Pi Zero • Hackaday.io

Here is a great post by mincepi which shows how to enable VGA output on a Pi Zero for less than $5

The vga666 by Gert is already a low cost VGA output option for the Pi. But we can do better with the Zero! We’ll use 16 bit output instead of 18 bit: this frees up the SPI and I2C ports with little loss in quality. The resistors can be soldered between the Zero and the adapter, making the PCB smaller and eliminating a connector. I’ve determined that 5% resistors are good enough: no need for higher cost 1% units. By not using the middle row of pins in the HD15 connector, we can straddle-mount it on the PCB edge. Finally, the connector can be male, so the Zero will connect to the monitor ChromeCast style: no VGA cable needed. (This connector could even be scrounged from an old VGA monitor cable for free!) If you order the boards from OSHPark, it will cost $4.95 for three copies. Enough resistors and connectors to build three will cost $5.92 from Digi-Key. That works out to $10.87 to build three, or $3.62 each!


Source: Super low cost VGA output for the Pi Zero • Hackaday.io


BerryIMU Raspberry Pi Gyroscope Accelerometer

Enable boot logging on the Raspberry Pi

When troubleshooting issues on a Raspberry Pi sometimes it is helpful to go back and look at the boot log, especially if you are running a headless (no monitor) Raspberry Pi.

Install bootlogd


pi@raspberrypi ~ $ sudo apt-get install bootlogd


You will be asked to restart services, select ‘Yes’.  And then reboot your Raspberry Pi

View Boot Log

From now on, if you wish to view the bootlog, you can use the command below to format it correctly;

pi@raspberrypi ~ $ sed 's/\^\[/\o33/g;s/\[1G\[/\[27G\[/' /var/log/boot

You will get the output as shown in the image at the top of this post.



How to Create an Inclinometer using a Raspberry Pi and an IMU

This guide covers how to use an Inertial Measurement Unit (IMU) with a Raspberry Pi to create an inclinometer, just like the type you will find in a 4WD.

A prerequisite for this guide is to have a gyro and accelerometer from an IMU already up and running on your Raspberry Pi. A guide to interfacing an IMU with a Raspberry Pi can be found here.

We will be covering some basic SDL which will be used to produce our graphics.


The IMU used in this guide is the BerryIMU.  However, other IMUs or accelerometers and gyroscopes can be used.. Eg  Pololu MinIMU, Adafruit IMU and Sparkfun IMUs

Continue reading How to Create an Inclinometer using a Raspberry Pi and an IMU

Create a Digital Compass with the Raspberry Pi – Part 1 – “The Basics”

This will be a multipart series on how to use a digital compass(magnetometer) with your Raspberry Pi.

The magnetometer used in these tutorials is a LSM9DS0 which is on a BerryIMU. We will also point out where some of the information can be found in the Datasheet for the LSM9DS0. This will help you understand how the LSM9DS0 works.


The math and logic in this series can also be used with other magnetometers or IMUs.

We will also go over how to do some basic communication on the i2c bus. As well as using SDL to display the compass heading as traditional compass as shown in the video above.

Git repository here
The code can be pulled down to your Raspberry Pi with;

pi@raspberrypi ~ $ git clone https://github.com/mwilliams03/BerryIMU.git

The code for this guide can be found under the compass_tutorial01_basics directory. 

Overview of a Compass

Raspberry Pi Compass
A traditional Magnetic compass (as opposed to a gyroscopic compass) consists of a small, lightweight magnet balanced on a nearly frictionless pivot point. The magnet is generally called a needle. The Earth’s Magnetic field will cause the needle to point to the North Pole.

To be more accurate, the needle points to the Magnetic North. The angle difference between true North and the Magnetic North is called declination. Declination is different in different locations. This angle varies depending on position on the Earth’s surface, and changes over time.

The strength of the earth’s magnetic field is about 0.5 to 0.6 gauss .

Continue reading Create a Digital Compass with the Raspberry Pi – Part 1 – “The Basics”

Matchbox-Desktop on the Raspberry Pi

Matchbox-desktop is a lightweight windows manager for embedded systems. It works great on a Raspberry Pi with one of the smaller TFTs attached. E.g. PiScreen, PiTFT , etc…

Matchbox-desktop is “finger friendly” and makes it easy to navigate while just using your fingers on the touchscreen.

Mathcbox-Desktop needs to be installed from source and via apt-get to get it going correctly, in this order;

pi@raspberrypi ~ $ sudo apt-get update
pi@raspberrypi ~ $ sudo apt-get install autoconf autogen intltool libtool libx11-dev libxext-dev libxft-dev libpng-dev libgconf2-dev libgtk2.0-dev libstartup-notification0-dev libdbus-glib-1-dev -y
pi@raspberrypi ~ $ git clone http://git.yoctoproject.org/cgit/cgit.cgi/libmatchbox/
pi@raspberrypi ~ $ git clone http://git.yoctoproject.org/cgit/cgit.cgi/matchbox-common/
pi@raspberrypi ~ $ git clone git://git.yoctoproject.org/matchbox-desktop
pi@raspberrypi ~ $ cd libmatchbox
pi@raspberrypi ~ $ ./autogen.sh
pi@raspberrypi ~ $ make
pi@raspberrypi ~ $ sudo make install
pi@raspberrypi ~ $ cd ../matchbox-common
pi@raspberrypi ~ $ ./autogen.sh
pi@raspberrypi ~ $ make
pi@raspberrypi ~ $ sudo make install
pi@raspberrypi ~ $ cd ../matchbox-desktop
pi@raspberrypi ~ $ ./autogen.sh
pi@raspberrypi ~ $ make
pi@raspberrypi ~ $ sudo make install
pi@raspberrypi ~ $ sudo apt-get install matchbox-desktop

To start matchbox-desktop

pi@raspberrypi ~ $ FRAMEBUFFER=/dev/fb1 xinit /usr/local/bin/matchbox-desktop

UPDATE: Matchbox-desktop doesn’t work with  newer Raspbian images. The last confirmed image it works on is 2014-06-20-wheezy-raspbian.img

To get matchbox-desktop working;
1. Burn the above img.
2. Follow the instructions above and matchbox-desktop will compile correctly.
3.Perform updates

pi@raspberrypi ~ $ sudo apt-get update
pi@raspberrypi ~ $ sudo rpi-update
pi@raspberrypi ~ $ sudo apt-get upgrade
pi@raspberrypi ~ $ sudo apt-get dist-upgrade
pi@raspberrypi ~ $ sudo apt-get install raspberrypi-ui-mods

4. Remove SPI from black-list
Open raspi-blacklist.conf

pi@raspberrypi ~ $ sudo nano /etc/modprobe.d/raspi-blacklist.conf

And place a hash ‘#’ in front of ‘blacklist spi-bcm2708’.

5.Configure drivers for any attached TFT.
6. Disable framebuffer driver option for /dev/fb0.
Open up the framebuffer conf file;

pi@raspberrypi ~ $ sudo nano /usr/share/X11/xorg.conf.d/99-fbturbo.conf

Comment out the line of text below;
Option "fbdev" "/dev/fb0"
This can be done by adding a hash (#) at the beginning of line.
#Option "fbdev" "/dev/fb0"

7. Now startmatchbox-desktop.

pi@raspberrypi ~ $ FRAMEBUFFER=/dev/fb1 xinit /usr/local/bin/matchbox-desktop