Skip to content

Hezzeki/RaspberryPiControlExamples

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 

Repository files navigation

Control examples for the raspberry Pi (3b+ in my case). There are many included languages.

Most of these examples will be hardware control example’s following: Freenove Starter kit. But there will also be a section on self-hosting a website out of a raspberry pi.

The names of the sections here correspond to folders in the project space.

Inside the RaspberryPi I mkdir a directory called “Projects”, this is the root of my code. Projects has libs (which i download) and then proj_n which match the below projects. Each proj_n has a file called lang.txt which contains the language used to write this project.

Before every session we run:

sudo apt update && \
sudo apt upgrade

Regarding GPIO visit this site for a mapping or on the pi run “gpio readall”, which can be done after the C step.

Notes on the electronics:

LED

  • Longer leg: +
  • Shorter leg: -
  • Diode, which only work if current is flowing in the correct direction: (Arrow with bar) positive going into arrow.
  • Range Table:
    LEDVoltageMax CurrentRecommended
    Red1.9-2.2V20mA10mA
    Green2.9-3.4V10mA5mA
    Blue2.9-3.4V10mA5mA

Resistor

Represented with a squiggle. Remember V = IR “Voltage equals Current times Resistance”, Ohm’s law.

NEVER connect two poles (power/+ and GND/-) of a power supply with anything of low Resistance this will short the circuit, likely damaging everything.

Resistors are non-polar, so the orientation in a circuit does not matter.

Breadboard

How to use a breadboard or alternatively.

Breadboards are indexed by rows of numbers and columns of letters. They are connected with the relation: For each row grouped columns are connected, i.e. A-E and F-J are connected and for the Red/Blue lines the length tells how connected they are, they are not connected to the opposite side lines.

The buses/rails are detailed below: The blue (black sometimes) line is the ground / negative bus.

The red line is the positive, and any breaks indicate possible multiple voltage sources.

Additional notes on compiling!

WiringPi

C

This library is required and for C can be found here. Within the Pi do:

git clone https://github.com/WiringPi/WiringPi.git
cd WiringPi
./build
# Test the installation
gpio -v

Additionally, you must adjust the Makefile to find WiringPi. Here is an example of adjusting the Makefile:

# Include the wiring Pi Lib
gcc ... -lwiringPi ...

proj_1)

Required Items

  • GPIO Extension Shield and Cable
  • BreadBoard
  • LED
  • 220 $Ω$ resistor (Red-Red-Black-Black-Brown)
  • 2 Wires

Physical Setup

  1. The GPIO Extension((1..20dg))
  2. LED(+(27e),-(26e))
  3. $220Ω$(23a, 27a ~ 27e)
  4. Wire(IO17/6b, 23b ~ 23a)
  5. Wire(GND/20c, 26c ~ -(26e))

Software

In proj_1 run “make” then ./blink. Run make help for more options.

About

Control examples of a workflow on a Raspberry Pi

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published