This article is based on my previous article 16×2 LCD Module Control Using Python and 16×2 LCD Module Control With Backlight Switch. 20×4 LCD modules are relatively easy and cheap to obtain. They have the same 16 pin interface as the 16×2 modules but still only require 6 GPIO pins on your Pi (an extra pin is required for the backlight switch). These modules are compatible with the Hitachi HD44780 LCD controller. There are plenty available on eBay with a variety of backlight colours to choose from.
Following on from my article about controlling a 16×2 LCD module with Python and a Raspberry Pi I decided to make a few enhancements. These included : Adding a 10Kohm variable resistor to adjust the contrast Adding a 5Kohm variable resistor to adjust the backlight brightness Adding a transistor to allow the backlight to be switched on and off Allowing left, centred and right justified text
Once you’ve played with LEDs, switches and stepper motors the next natural step is 16×2 alphanumeric LCD modules. These modules are cheap (less than $10) and easy to interface to the Raspberry Pi. They have 16 connections but you only need to use 6 GPIO pins on your Pi. Most of the 16×2 modules available are compatible with the Hitachi HD44780 LCD controller. This allows you to buy almost any device and be sure it is going to work in much the same way as any other. There are loads to choose from on eBay with different coloured backlights. The…
The RPi.GPIO Python library allows you to easily configure and read-write the input/output pins on the Pi’s GPIO header within a Python script. This article is an updated version to take into account changes in the RPi.GPIO library and the release of the Raspbian SD card image.
Having played with LEDs, switches and buzzers I felt the natural next step was playing with a stepper motor or two. Unlike conventional electric motors, stepper motors allow you to rotate the axis in precise increments. This makes them useful in all sorts of Raspberry Pi projects. Basic Stepper Motor There is a huge selection of stepper motors to buy but I decided to experiment with a 28BJY-48 with ULN2003 control board. The reasons I chose this device where : It is cheapRuns on 5VEasy to interface to the Pi’s GPIO headerSmall but relatively powerfulWidely available from both overseas and…
The most obvious application for a Raspberry Pi is re-creating the sliding red lights found on “KITT” from Knight Rider or the Cylons in Battestar Galactica. This can all be done with pure electronics but that doesn’t involve any programming and therefore isn’t as cool. So here is a brief description of my “running lights” project. It may be overkill to throw an entire computer at such a task but it served a number of purposes : good introduction to Python GPIO programming good introduction to Raspberry Pi GPIO interfacing good practice at soldering, wiring, testing and constructing an electronic…
It can sometimes be useful to obtain the MAC address of your Raspberry Pi’s network interfaces. The “Media Access Control” address is a unique identifier given to all networked devices. The address is different for all Pi’s and can be used to identify your device. Think of it as a digital fingerprint. There is a separate MAC address for Ethernet and WiFi interfaces. There are a number of ways to identify them using the command line or using Python code. Below are some quick examples you can use to find the MAC address.
I decided to attach some speakers to my Raspberry Pi. I didn’t want to spend much so I picked up a pair of stereo speakers from my local Poundworld. They cost £1 exactly. They aren’t exactly the sort of speakers you would hook up to your HiFi system but for experimenting you can’t beat the value. They have a 3.5mm jack which plugs into the Pi’s analog audio connector.
The Raspberry Pi is powered by an ARM SOC (System On a Chip) running at 700MHz. It is possible to increase this speed in order to squeeze some extra processing power out of the CPU. It is also possible to increase the speed of the Graphics Processing Unit (GPU) and the onboard RAM. The default speeds are : CPU – 700MHz RAM – 400MHz GPU – 250MHz
The circuit below shows to turn an LED on and off using a Raspberry Pi GPIO pin configured as an output. It uses the output pin to turn on a transistor which allows the LED to draw current from the 5V supply. The following header pins are required : Header Pin 2 : 5V Header Pin 6 : Ground Header Pin 11 : GPIO The Header Pins are defined in my Raspberry Pi Header Pin page. You can use whatever GPIO pin you like but I used pin 11 for my tests.
The Raspberry header is the key to its ability to interface with the real world. The Pi either uses a 40-pin or 26-pin depending on the model and it is important to understand how those pins are arranged and labelled. The GPIO header provides the following power and interface options : 3.3V (on 2 pins)5V (on 2 pins)Ground (on 8 pins)General purpose input and outputPWM (pulse width modulation)I2CI2SSPISerial These allow a massive range of sensors, motors, LEDs and accessories to be connected to the Pi.
In order to make my Raspberry a bit easier to handle and give it a bit of weight I decided to make a temporary case. It needed to be complete in five minutes, cost nothing and allow for a certain amount of redesign. Which left only one solution : LEGO. Here are some photos of my Raspberry Pi LEGO case. Due to the ever present threat of global terrorism a security patrol formed a ring of steel during construction.
If you are running the Raspbian operating system you may want to have your Pi auto-login. This may be particularly useful if you are using your Pi to perform a specific operation where you don’t want to login using a keyboard when it is turned on. You may also want the LXDE desktop to auto run on bootup. The steps below will explain how this can be done :
Here are some initial photos of my two Raspberry Pi Model B’s. One from RS and the other from Farnell Element 14. They are named “Tango” & “Cash” and have matching SanDisk Ultra 8GB Class 6 SD cards. At the moment they prefer Debian Squeeze but who knows what the future may hold? At some point I will create some cases either from cardboard or LEGO if I can sneak some out of my son’s collection.
The default images provided for the Raspberry Pi are usually 2GB and this results in wasted space on larger SD cards. When the image is written to your card three partitions are created. A boot partition, a Linux system partition and a swap file partition. They are sized to fit on a 2GB SD card and the additional space on larger cards is unallocated and unusable. This procedure explains how you can allocate that spare space and use the full capacity of your SD card. This involves moving the swap partition to the end of the card and then increasing…
This tutorial explains how to enable SSH on the Raspberry Pi. There are a number of methods you can use. Secure Shell or SSH is a network protocol that allows you to run commands on a remote device. In the case of the Raspberry Pi can you execute commands over your network from another device such as a PC or laptop. This allows you to control the Pi without attaching a keyboard, mouse or even a monitor. If configured correctly you can use SSH to communicate with your Pi over the internet.
The RPi.GPIO Python library allows you to easily configure and read-write the input/output pins on the Pi’s GPIO header within a Python script. Thankfully this library is now including in the standard Raspbian image available from the Foundations Download Page. If you are using a fresh image you don’t need to install it but I’ve kept the instructions here in case you ever want to try a manually installation.
My first attempt at Python programming was a script to send email. This is something I planned to use in a future applications so I thought it was a good first step.
By default the Raspberry Pi has its hostname set to “raspberrypi”. This appears as part of the command prompt when you open a terminal window. It only takes a few minutes and you’ve got a choice of two methods. I sometimes change the hostname so that when I list devices on my home network I can easily identify any Raspberry Pis I’ve got connected amongst all the phones, tablets and PCs.
The Pi has a number of connectors that allow you to power it and connect various peripherals. This is fairly straightforward for people familiar with the connectors and cables required to use them. For the benefit of anyone who isn’t familiar with HDMI, DVI, USB, audio or MicroUSB cables I have created the following visual guide to help you find cables and adapters you may have sitting in a drawer gathering dust. Pi Connector Suggested Cable Description Audio 3.5mm Jack A 3.5mm jack plug to 3.5mm jack plug cable would allow you to connect the Pi’s audio output to a…
Here you will find mechanical drawings for all models of the Raspberry Pi including the Pi 3, Pi 2, Pi Zero, Pi Zero W, B+ and A+ as well as the original Pi Model B. The drawings show the position of major components with dimensions.
As explained in the Raspberry Pi Initial Hardware Setup there are some bits of equipment that you need to get started. This page covers some of the other items you can connect to the Pi to get the most out of this amazing piece of technology. Using USB there is a large range of existing USB devices ready to enhance your Raspberry Pi projects and you may already have access to some of them.