About Python In this lab we are going to introduce the Python programming language that we are going to use to program our Raspberry Pi projects. Raspberry Pi The Raspberry Pi (RPi) is a credit card-sized computer that is relatively low cost, and has been used for a wide variety of projects. Many people have used RPis to be their media centre, and nearly as many have developed game consoles, which run emulators of old gaming systems and arcade machines (e. [Read More]
Raspberry Pi GPIO In this lab we are going to introduce the GPIO interface of the Raspberry Pi. What is GPIO? In one corner of the Raspberry Pi is a 40-pin expansion header. The pins are numbered from 1 to 40, with the even numbers on the outside edge of the board as shown below. Raspberry Pi 3 Model B+ GPIO expansion headers — By Gareth Halfacree from Bradford, UK (Raspberry Pi 3B+) [CC BY-SA 2. [Read More]
Binary number representation In this lab we are going to learn about binary numbers and its representation. Binary numbers The binary numeral system is a way to write numbers using only two digits: 0 and 1. These are used in computers as a series of “off” and “on” switches. In binary, each digit’s place value is twice as much as that of the next digit to the right (since each digit holds two values). [Read More]
Creating Circuits on the Breadboard - Part 1 In this lab we are going to experiment with gates and circuit design. We’ll use our understanding of gate behaviour to design a half adder and a full adder circuit, each of which will be implemented on the breadboard and interfaces with the Raspberry Pi. The 74xx Series The 74xx series of chips generally contain logic gates and other components. For example, the 7402 chip contains 4 NOR gates on a single 14-pin chip. [Read More]
Creating Circuits on the Breadboard - Part 2 Full Adders A full adder is a circuit that adds two binary digits, plus a carry in, producing a sum and a carry out bit. The carry bit is one (high) when the three bits add up to more than can be stored in a single digit. This happens when two or more of the input bits is one (high). Circuit Design The same process used for the half adder can be used to design the circuit for a full adder, starting with the truth table (which is filled out by hand, based on what we know about the behaviour of the circuit). [Read More]
Analog to Digital Conversion The Raspberry Pi computer does not have a way to read analog inputs. It’s a digital-only computer. Analog inputs are handy because many sensors are analog outputs, so we need a way to read that inputs. For that we are going to use an analog-to-digital converter, in our case the chip MCP3008. An analog-to-digital converter (ADC, A/D, or A to D) is a device that converts a continuous physical quantity (usually voltage) to a digital number that represents the quantity’s amplitude. [Read More]
Controlling a Servo from the Raspberry Pi A Servomotor, or servo, is a small device that has an output shaft. This shaft can be positioned to specific angular positions by sending the servo a coded signal. As long as the coded signal exists on the input line, the servo will maintain the angular position of the shaft. As the coded signal changes, the angular position of the shaft changes. Servos are extremely useful in practice. They may be used to operate remote-controlled toy cars, robots, or airplanes. [Read More]
Controlling a seven-segment display from the Raspberry Pi - Part 1 A seven-segment display (SSD), is a form of electronic display device for displaying decimal numerals. They are widely used in digital clocks, electronic meters, and other electronic devices for displaying numerical information. The seven elements of the display can be lit in different combinations to represent the Arabic numerals. The seven segments are arranged as a rectangle of two vertical segments on each side with one horizontal segment on the top, middle, and bottom. [Read More]
Controlling a seven-segment display from the Raspberry Pi - Part 2 Custom characters You can create your own character output on a per-segment basis. Each character is simply an 8-bit binary number, or two hexadecimal digits. The table below describes the hexadecimal and binary codes for each segment: Character Hexidecimal Binary 0x01 0000 0001 0x02 0000 0010 0x04 0000 0100 0x08 0000 1000 0x10 0001 0000 0x20 0010 0000 0x40 0100 0000 Decimal point 0x80 1000 0000 For example, to generate a capital H: [Read More]
ARM assembler in Raspberry Pi Machine language is built up from discrete statements or instructions implemented by a particular processor. ARM is a family of instruction set architectures for computer processors and is the one used by the processor of the Raspberry Pi. The machine language is interpreted by the computer in term of binary codes. Binary code is what a computer can run. It is composed of instructions, that are encoded in a binary representation (such encodings are documented in the ARM manuals). [Read More]