This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
haas:fall2020:common:projects:led1 [2020/08/27 16:19] – created wedge | haas:fall2020:common:projects:led1 [2021/09/05 14:01] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
======PROJECT====== | ======PROJECT====== | ||
- | PROJECT: Light Emitting Diodes (led0) | + | PROJECT: Light Emitting Diodes (led1) |
=====Objective===== | =====Objective===== | ||
- | To create a program that generates a unique pattern of lit LEDs on your pi based on constraints | + | To expand upon our previous efforts, through wiring up additional |
- | We also further utilize | + | We also further utilize time constraints, |
=====Abstraction===== | =====Abstraction===== | ||
Line 16: | Line 16: | ||
Please be sure to familiarize yourself with the following content in " | Please be sure to familiarize yourself with the following content in " | ||
- | * [[https:// | + | * [[https:// |
=====Background===== | =====Background===== | ||
- | For this project, you will be writing | + | For this project, you will be working with a C program using the wiringPi library on the Raspberry Pi, wiring up a set of four red LEDs to your breadboard and witnessing your ability to control |
=====Input and Output via the GPIO pins on the pi===== | =====Input and Output via the GPIO pins on the pi===== | ||
Line 33: | Line 33: | ||
<cli> | <cli> | ||
- | yourpi: | + | yourpi: |
| | ||
| BCM | wPi | | | BCM | wPi | | ||
Line 60: | Line 60: | ||
| BCM | wPi | | | BCM | wPi | | ||
| | ||
- | yourpi: | + | yourpi: |
</ | </ | ||
Line 81: | Line 81: | ||
It may seem a bit bewildering or overwhelming at first, but like anything, time and exposure will ensure it becomes increasingly second nature. | It may seem a bit bewildering or overwhelming at first, but like anything, time and exposure will ensure it becomes increasingly second nature. | ||
- | =====Wiring up our first circuit===== | + | =====Wiring up our circuit===== |
- | Here we are, about to embark on our first foray into mixing with hardware and software. | + | This circuit is basically an expansion upon the one you made last week. So the parts needed remains the same, only expanding in the quantity of certain items as we expand the number of LEDs. |
- | In this project, we will be hooking up a peripheral to a couple | + | In this project, we will be hooking up a peripheral to some of our Raspberry Pi pins: light emitting |
You have likely encountered LEDs endlessly in your everyday life: commonly used as a "power light", | You have likely encountered LEDs endlessly in your everyday life: commonly used as a "power light", | ||
Line 106: | Line 106: | ||
{{ : | {{ : | ||
+ | |||
+ | Here's a good video overview of the functionality of a breadboard: | ||
+ | |||
+ | * https:// | ||
====(1) T-cobbler and data cable==== | ====(1) T-cobbler and data cable==== | ||
In your kit should be a T-shaped device (known as the " | In your kit should be a T-shaped device (known as the " | ||
Line 114: | Line 118: | ||
<WRAP info>The plastic rectangle should have a notch cut out from it, and notice that the ribbon cable connector has a notch included in it. That is a key to indicate how you need to connect the ribbon cable into the T-cobbler</ | <WRAP info>The plastic rectangle should have a notch cut out from it, and notice that the ribbon cable connector has a notch included in it. That is a key to indicate how you need to connect the ribbon cable into the T-cobbler</ | ||
- | ====(1) red LED==== | + | ====(4) red LEDs==== |
- | You have a few LEDs included in your kit, some of notably different colours. Go for one of the distinctly red looking ones, resembling the following: | + | You have a few LEDs included in your kit, some of notably different colours. Go for four of the distinctly red-looking ones, resembling the following: |
{{ : | {{ : | ||
Line 123: | Line 127: | ||
The longer leg is the positive side of the LED, called the “anode, | The longer leg is the positive side of the LED, called the “anode, | ||
- | ====(1) 220 Ohm resistor==== | + | ====(4) 220 Ohm resistors==== |
- | Your kit should come with 3-4 packs of differently rated resistors (220, 1K, and 10K). You want ONE of the lowest rated ones, the 220 ohm variety. You should see the value marked on the paper strip holding the legs of the resistors. | + | Your kit should come with 3-4 packs of differently rated resistors (220, 1K, and 10K). You want FOUR of the lowest rated ones, the 220 ohm variety. You should see the value marked on the paper strip holding the legs of the resistors. |
{{ : | {{ : | ||
Line 131: | Line 135: | ||
<WRAP round info> | <WRAP round info> | ||
+ | |||
====male to male jumper wire, as needed==== | ====male to male jumper wire, as needed==== | ||
As a final piece of equipment you will need, locate and have a few male-to-male jumper wires handy for use in our circuit: | As a final piece of equipment you will need, locate and have a few male-to-male jumper wires handy for use in our circuit: | ||
Line 137: | Line 142: | ||
=====The Circuit to Construct===== | =====The Circuit to Construct===== | ||
- | With those components, you will want to place them onto your breadboard | + | With those components, you will want to place them onto your breadboard, expanding upon last week's circuit (picture of last week's circuit provided): |
{{ : | {{ : | ||
Line 143: | Line 148: | ||
Take note of how everything is being plugged in, and what connection on the T-cobbler is being utilized. | Take note of how everything is being plugged in, and what connection on the T-cobbler is being utilized. | ||
- | Notice how the circuit runs from ground | + | Notice how the circuit runs from ground to LED to resistor |
+ | |||
+ | Please keep in mind: | ||
+ | |||
+ | * EACH LED needs to be interfaced with a unique GPIO pin | ||
+ | * EACH LED needs a corresponding resistor (no sharing!) Forgetting to use the resistor can lead to damage to the LED! | ||
+ | * ground connections can be shared (we call this " | ||
+ | * take note of which GPIO pin you are using, so can update the led1.c program | ||
- | Before you seek to actually test your circuit, please get verification to proceed from the class channel on discord by posting a clear picture of everything. There are MANY moving parts, and especially as we have our first exposure, it is best to insert as many quality control checks as possible to ensure the greatest chances of mistakes are mitigated. | + | <WRAP info>Before you seek to actually test your circuit, please get verification to proceed from the class channel on discord by posting a clear picture of everything. There are MANY moving parts, and especially as we have our first exposure, it is best to insert as many quality control checks as possible to ensure the greatest chances of mistakes are mitigated.</ |
+ | <WRAP info>It may be clarifying if you arranged your four LEDs in a row, from right to left, in order of your GPIO pins you've plugged into.</ | ||
====Testing connectivity==== | ====Testing connectivity==== | ||
To verify whether everything is hooked up correctly (including the correct positioning of the LED), please try the following: | To verify whether everything is hooked up correctly (including the correct positioning of the LED), please try the following: | ||
Line 164: | Line 177: | ||
<cli> | <cli> | ||
- | yourpi: | + | yourpi: |
</ | </ | ||
Line 180: | Line 193: | ||
<cli> | <cli> | ||
- | yourpi: | + | yourpi: |
- | yourpi: | + | yourpi: |
</ | </ | ||
Line 188: | Line 201: | ||
If you get no activity out of the LED, try reversing it and try again. | If you get no activity out of the LED, try reversing it and try again. | ||
+ | With an expanded set of LED circuits, be sure to test the operation of each one. | ||
=====Program===== | =====Program===== | ||
- | It is your task to compile, run, and understand a program to interface with an LED (light emitting | + | It is your task to compile, run, expand upon, and understand a program to interface with a set of LEDs (light emitting |
- | The program files provided for this project are complete. You merely have to get it on your pi, compile it, and run it, with the appropriate circuitry hooked up to the specified places. You will want to make sure you UNDERSTAND what is going on. | + | The program files provided for this project are, while not complete, minimally functional. You merely have to get it on your pi, compile it, and run it, and expand it with the appropriate circuitry hooked up to the specified places. You will want to make sure you UNDERSTAND what is going on. So be sure to ASK QUESTIONS, and do so EARLY enough so that you aren't in a mad dash to make the deadline. |
In future projects you will start implementing more logic to attain further functionality. | In future projects you will start implementing more logic to attain further functionality. | ||
Line 199: | Line 213: | ||
<cli> | <cli> | ||
- | lab46: | + | lab46: |
- | make: Entering directory '/ | + | make: Entering directory '/ |
- | '/ | + | '/ |
- | '/ | + | '/ |
- | make: Leaving directory '/ | + | make: Leaving directory '/ |
lab46: | lab46: | ||
</ | </ | ||
- | At which point you can change into the newly created and populated **led0** directory. | + | At which point you can change into the newly created and populated **led1** directory. |
====Getting project resources from lab46 to your pi==== | ====Getting project resources from lab46 to your pi==== | ||
Line 227: | Line 241: | ||
===Installing wiringpi=== | ===Installing wiringpi=== | ||
+ | <WRAP info> | ||
+ | |||
An exception to the usual package installation process, especially for those with a Raspberry Pi model 4B: when you install **wiringpi** the usual way, we may end up with errors when proceeding further, such as the following: | An exception to the usual package installation process, especially for those with a Raspberry Pi model 4B: when you install **wiringpi** the usual way, we may end up with errors when proceeding further, such as the following: | ||
<cli> | <cli> | ||
- | yourpi: | + | yourpi: |
Oops - unable to determine board type... model: 17 | Oops - unable to determine board type... model: 17 | ||
</ | </ | ||
Line 237: | Line 253: | ||
<cli> | <cli> | ||
- | yourpi: | + | yourpi: |
... | ... | ||
- | yourpi: | + | yourpi: |
... | ... | ||
- | yourpi: | + | yourpi: |
</ | </ | ||
Line 271: | Line 287: | ||
<cli> | <cli> | ||
- | lab46: | + | lab46: |
- | Submitting desig project "led0": | + | Submitting desig project "led1": |
- | -> led0.c(OK) | + | -> led1.c(OK) |
SUCCESSFULLY SUBMITTED | SUCCESSFULLY SUBMITTED | ||
Line 283: | Line 299: | ||
< | < | ||
- | 26:led0:final tally of results (26/26) | + | 39:led1:final tally of results (39/39) |
- | *:led0:post picture of unpowered layout to #desig and get approval [6/6] | + | *:led1:post picture of unpowered layout to #desig and get approval [6/6] |
- | *:led0:post picture to #desig by Sunday before deadline [4/4] | + | *:led1:post picture to #desig by Sunday before deadline [6/6] |
- | *:led0:post picture of powered | + | *:led1:post picture of powered |
- | *:led0:grabit the code on lab46 by Sunday before deadline [4/4] | + | *:led1: |
- | *:led0:code is pushed to lab46 repository [6/6] | + | *: |
+ | *: | ||
+ | *:led1:updated | ||
</ | </ | ||
Line 296: | Line 314: | ||
* Solutions not utilizing indentation to promote scope and clarity will be subject to a 25% overall deduction | * Solutions not utilizing indentation to promote scope and clarity will be subject to a 25% overall deduction | ||
* Solutions not organized and easy to read are subject to a 25% overall deduction | * Solutions not organized and easy to read are subject to a 25% overall deduction | ||
+ |