Table of Contents

STL0

PREPARATION

INSTALL CUSTOM WIRINGPI

yourpi:~$ wget https://project-downloads.drogon.net/wiringpi-latest.deb

NOTE: domain say “dr-OH-gon”, it does NOT say “dragon”

yourpi:~$ sudo dpkg -i wiringpi-latest.deb

ACCESSING STL0 FROM YOUR PI

Since you can't make and run the program on lab 46, you will need to add, commit, and push it onto your repository with the hg commands, so that you can pull it onto your pi. Once you've successflly pushed everything onto the repository, go to your pi and use this command to pull it back:

hg pull;hg update

Once you've done that, you should be able to cd into the stl0 directory, where you can compile and run your program with the make and ./stl0 commands. If your breadboard is set up, and the stl0.c file is being applied to the right pin #, you might notice a change in the LED.

USING WIRINGPI: THE gpio TOOL

“gpio readall” will open up a table showing the physical pin layout of your pi. It will also tell you whether a pin is set to input or output, and whether the pin is turned on or off (V=0 shows the pin is off, v=1 shows the pin is on).

“gpio mode WIRINGPI_PIN# MODE” will change the mode of the designated pin. You must use the WiringPi pin number. Mode can either be in (input) or out (output).

“gpio write WIRINGPI_PIN# STATE” will change the ON/OFF state of a pin. 0=off and 1=on

USING WIRINGPI: SETTING MODE OF PINS

USING WIRINGPI: WRITING TO PINS

ELECTRICITY

VOLTAGE / VOLTS

Voltage is the electric potential between two points. Volts is the SI unit used for voltage. Voltage is often described as the “pressure” that pushes electricity. An analogy often used to describe the relationship between voltage, amperage, and resistance, is water in a hose. Voltage can be imagined as the water pressure, amperage can be imagined as the flow rate, and resistance is imagined as the thickness of the hose.

For circuit projects using a breadboard and Raspberry Pi, the typical voltages are 3.3V and 5V.

Input on any of the Raspberry Pi's GPIO pins should not be 5V. The Raspberry Pi is not 5V tolerant. This is confusing, as there are pins to output 5V, which is used to power external components.

GROUND

The ground “pin” is extremely important if connecting a circuit together. If done without a ground you can easily fry your breadboard or even kill an L.E.D light. Your ground pins are indicated by a GND next to the designated pin. For every power source connection, you must have a ground wire going to one of the Negative column.

AMPERAGE / AMPS

Amperage is a measure of the magnitude of electrical current.

RESISTANCE / OHMS

Resistance, or electrical resistance, is a measure of how difficult it is for current to flow. Resistance is measured in the SI unit Ohms. Resistors are components for implementing electrical resistance in a circuit. Resistance is equivalent to V/I, where V is voltage and I is current, derived from V=I*R.

DIGITAL ELECTRONICS

LIGHT EMITTING DIODE

RESISTOR

A resistor is a component that slows down the flow of electrons through an electrical circuit. The specified resistance value can be decoded by looking at the coloured bands that surround the body of the resistor.

SERIES CIRCUIT

COMPONENTS

BREADBOARD

A breadboard is a tool used for prototyping circuits without the need for soldering components onto a board. They typically come with detachable rails on the side, usually used (and marked) for power and ground. These red and blue marked strips are connected along the entire length of the columns. This allows you to power and ground multiple components easily.

Between these detachable rails are rows of 5 connected notches on either side of the divot in the middle. The 5 notches in each row are connected, allowing you to form circuits between attached components.

T-COBBLER / INTERFACE TO PI GPIO PINS

GPIO.0 is actually GPIO17 on your T-cobbler

To discover this, you can use the command

 gpio redall 

This will bring up a table of all the pins on the t-cobbler. On your t-cobbler, you will count the pins left to right starting at one, until you get to the pin you are using. Then, you will find the number your pin is at, then use the list to line it up with the wpi name. The Wpi name is the one we will be referring to whenever we need to write or indicate a pin in our code

LED

Brief Definition:

A light-emitting diode (LED) is a semiconductor device that emits light
when current flows through it.

Light-emitting diodes only allow electrical current to pass through them one way. The longer lead is the positive connection, and the shorter lead is the negative connection.

RESISTOR

A resistor is a component for implementing electrical resistance in a circuit. This is useful for lowering the flow of current across a circuit. By applying a resistor to a circuit with an LED, you could prevent the LED from burning out, or simply make it dimmer without needing to adjust voltage. Resistors have color coded bands on the body of them to indicate resistance in Ohms. For instance, 3 bands that are orange, orange, red, indicates a 330 Ohm resistor. The color coding is defined in the international standard IEC 60062.

TARGET CIRCUIT