Raspberry Pi – Advanced Intro

Review

Review Intermediate content

Inputs and Outputs

General Purpose Input-Output (GPIO)

The 3B+ and 4 have a 40 pin GPIO.

A reference is built into the terminal by typing the command “pinout”. Other exist as a graphical representation of GPIO

Physical Hardware Computing

Breadboard

A breadboard allows for connections between electronic hardware. The structure of the board creates temporary circuits.

LED

Using Light Emitting Diodes ( LED’s )are a great way to visualise the interactions between programming and hardware. Since they are a diode, the current will only flow one direction. They also require a resister to reduce the current flow from the RPi GPIO.

Resistor

Resistors resist current flow. Ohms Law E=IR controls the relation between current and resistance. Series resistance is the sum total of individual resistance values in parallel.

Capacitor

Capacitors hold a charge. The help stabalize the voltage in the circuit. Some types of capacitors have a polarity which must be taken into account when used.

LED Breadboard Activity

LED Blinking Light

Sensors

Light

Photoresistor‘s vary the resistance based on the amount of light. If placed in series with other resistors, the variable resistance value will add to the sum total.

LED Blinking Light + Photoresistor

If the blinking LED and the photoresistor circuits are added to the same breadboard, the current will flow through the path of least resistance.

from gpiozero import LED, Buzzer, LightSensor
from time import sleep
led = LED(27)
ldr = LightSensor(17)
while True:
a=ldr.value
led.on()
sleep(a)
led.off()
sleep(1)
print(a)

Connecting to the Raspberry Pi

There are several methods to connect with the Raspberry Pi.

Serial communication

Serial communication sends and receives data between devices. The USB ports are available for normal plug-and-play devices. The GIPO have specific pins for Universal Asynchronous Receiver-Transmitter (UART).

SSH – Remote Login

Secure Shell (SSH) is a secure method to enable remotely logging into the Raspberry Pi.

Application Programming Interface – API

API’s are predefined programs that can be called for functions. The “led.*”, “blink” and “sleep” are examples.

How do look up information about an API

The gpiozero website has great documentation about the API’s we used from them.

https://52.14.247.80/computing/raspberry-pi-introduction/
Index