User Tools

Site Tools


haas:fall2020:common:projects:iwb0

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
haas:fall2020:common:projects:iwb0 [2020/09/14 12:26] – created wedgehaas:fall2020:common:projects:iwb0 [2020/09/14 12:35] (current) – [The Circuit to Construct] wedge
Line 1: Line 1:
 ======PROJECT====== ======PROJECT======
-PROJECT: Light Emitting Diodes (led2)+PROJECT: Input With Buttons (iwb0)
  
 =====Objective===== =====Objective=====
-To expand upon our previous effortsthrough wiring up a 10 LED block package and generating a "swoosh" pattern of lit LEDs with it on your pi. +In prior electronics projectswe played exclusively with output components, in the form of LEDs. Herewe introduce the use of a button, which provides input into the process.
- +
-We also further utilize time constraintstying project credit to your starting on the project before the deadline (so be sure to plan accordingly!)+
  
 =====Abstraction===== =====Abstraction=====
Line 16: Line 14:
 Please be sure to familiarize yourself with the following content in "[[https://publications.gbdirect.co.uk//c_book/|the C book]]": Please be sure to familiarize yourself with the following content in "[[https://publications.gbdirect.co.uk//c_book/|the C book]]":
  
-  * [[https://publications.gbdirect.co.uk//c_book/chapter5/|Chapter 5]]+  * [[https://publications.gbdirect.co.uk//c_book/chapter6/|Chapter 6]]
  
 =====Background===== =====Background=====
-For this project, you will be working with a C program using the wiringPi library on the Raspberry Pi, wiring up a 10 LED block package to your breadboard and witnessing your ability to control them via software.+For this project, you will be working with a C program using the wiringPi library on the Raspberry Pi, wiring up a circuit containing an LED and a button to your breadboard and witnessing your ability to access and control them via software.
  
 =====Input and Output via the GPIO pins on the pi===== =====Input and Output via the GPIO pins on the pi=====
Line 33: Line 31:
  
 <cli> <cli>
-yourpi:~/src/desig/led2$ gpio readall+yourpi:~/src/desig/iwb0$ gpio readall
  +-----+-----+---------+------+---+---Pi 4B--+---+------+---------+-----+-----+  +-----+-----+---------+------+---+---Pi 4B--+---+------+---------+-----+-----+
  | BCM | wPi |   Name  | Mode | V | Physical | V | Mode | Name    | wPi | BCM |  | BCM | wPi |   Name  | Mode | V | Physical | V | Mode | Name    | wPi | BCM |
Line 60: Line 58:
  | BCM | wPi |   Name  | Mode | V | Physical | V | Mode | Name    | wPi | BCM |  | BCM | wPi |   Name  | Mode | V | Physical | V | Mode | Name    | wPi | BCM |
  +-----+-----+---------+------+---+---Pi 4B--+---+------+---------+-----+-----+  +-----+-----+---------+------+---+---Pi 4B--+---+------+---------+-----+-----+
-yourpi:~/src/desig/led2$  
 </cli> </cli>
  
Line 82: Line 79:
  
 =====Wiring up our circuit===== =====Wiring up our circuit=====
-This circuit is basically an expansion upon the one you made last week. So the parts needed remains the sameonly expanding in the quantity of certain items as we expand the number of LEDs.+This circuit is basically an enhancement upon the one you made for the led0 project. So the parts needed has some similar itemsbut also some new ones.
  
-In this project, we will be hooking up a peripheral to some of our Raspberry Pi pins: light emitting diodes (LED) and supporting hardware, and then proceed to interface with them to control its state (of being ON or OFF).+In this project, we will be hooking up two different peripherals to some of our Raspberry Pi pins: light emitting diode (LED) and a button, and then proceed to interface with them to access and control its state (of being ON or OFF).
  
 You have likely encountered LEDs endlessly in your everyday life: commonly used as a "power light", which when lit, indicates the device is powered on, among many, MANY, **MANY** other applications. You have likely encountered LEDs endlessly in your everyday life: commonly used as a "power light", which when lit, indicates the device is powered on, among many, MANY, **MANY** other applications.
 +
 +You have also encountered buttons seemingly in just as ubiquitous a fashion: a button is essentially a switch, toggling something ON or OFF. A light switch is a prime example of this (although in our case, our button doesn't remain in the changed state- once we release it, like a keyboard key, it reverts to its default state).
  
 For this endeavour, you will need to obtain the following items out of the electronics kit you obtained for the class: For this endeavour, you will need to obtain the following items out of the electronics kit you obtained for the class:
  
-====(1) breadboard==== +{{ :haas:fall2020:common:projects:iwb0partslist.png |}}
-In your electronics kit, what will serve as the base, or mounting point for our electronic circuits, will be the solderless breadboard, which resembles the following: +
- +
-{{ :haas:fall2020:common:projects:breadboard.jpg |}} +
- +
-<WRAP round info>We will be inserting the metal legs of various components in various holes on the breadboard, to connect our circuit together.</WRAP> +
- +
-On the breadboard, there are 2 different pathways of connectivity. If you look along the top and bottom of the breadboard, do you see the red and blue strip running horizontal across the board? That means that ALL pins in that row are hooked together (all the pins along the blue line are hooked together with each other, all the pins along the red lines are hooked together with each other). We will be using that to to provide things like a common voltage (+) or a common ground (-) to components that need such things. +
- +
-In the middle of the breadboard, separated by the valley in the plastic molding, are columns of connected pins (unique columns, also separate from the other side of the valley). Each group of those 5 pins is hooked together. +
- +
-You'll notice occasional "by 5" counting off silkscreened on the breadboard, which can be used to try to keep things organized. +
- +
-Here's a logical diagram of the breadboard layout: +
- +
-{{ :haas:fall2020:common:projects:breadboardlogic.png?400 |}} +
-====(1) T-cobbler and data cable==== +
-In your kit should be a T-shaped device (known as the "T-cobbler" with some aspect of pin names silkscreened on it, and a 40-pin ribbon cable). Colors may vary, but essentially it looks like this: +
- +
-{{ :haas:fall2020:common:projects:tcobbler.jpg?400 |}} +
- +
-<WRAP info>Note that the T-cobbler, on top has a set of pins, enclosed in a plastic rectangle, shaped to fit the ribbon cable.</WRAP> +
- +
-<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> +
-====(1) 10 LED block package==== +
- +
-10 LEDs, all in one convenient package! +
- +
-{{ :haas:fall2020:common:projects:ledbar.png?400 |}} +
- +
-The package has a set of pins, which allow us to hook each LED up as we would if they were separate: +
- +
-{{ :haas:fall2020:common:projects:ledbarpins.png?400 |}} +
-====(10) 220 Ohm resistors==== +
-Your kit should come with 3-4 packs of differently rated resistors (220, 1K, and 10K). You want TEN of the lowest rated ones, the 220 ohm variety. One for each LED. You should see the value marked on the paper strip holding the legs of the resistors. +
- +
-{{ :haas:fall2020:common:projects:220ohm_resistor.jpg?400 |}} +
- +
-<WRAP round info>The color bands are important, not the body color itself. You resistor body may be beige, may be blue, but the color of the 4-5 rings is what is important. Here we have red (2), red (2), brown (x10); 22 * 10 = 220</WRAP> +
- +
-<WRAP round info>Unlike the LED, where the direction of connection matters, it does not matter which way you plug in a resistor. Its purpose is simply to resist.</WRAP> +
- +
-====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: +
- +
-{{ :haas:fall2020:common:projects:male_male_jumper.jpg?400 |}}+
  
 =====The Circuit to Construct===== =====The Circuit to Construct=====
-With those components, you will want to place them onto your breadboard, in a manner similar to last week'circuit, but obviously with a lot more going on. Here is the circuit diagram you are assembling:+With those components, you will want to place them onto your breadboard, in a manner similar to previous week'circuits, but obviously with something different going on. Here is the circuit diagram you are assembling:
  
-{{ :haas:fall2020:common:projects:ledbarcircuit.png?400 |}}+{{ :haas:fall2020:common:projects:iwb0circuit.png |}}
  
 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 to resistor to LED to pin "GPIO17/Physical pin 11/Wiring Pi pin 0" +<WRAP round info>Pay attention to the color bands of the resistorsWe are using two different kinds on this projectand mixing them up will result in erratic or nonfunctional results!</WRAP>
- +
-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 "common ground"+
-  * take note of which GPIO pin you are using, so can update the led2.c program+
  
-<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 (a focus on a clear view of the wires, and where they plug into the breadboard). There are MANY 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>+<WRAP round 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 (a focus on a clear view of the wires, and where they plug into the breadboard). There are MANY 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>
  
 =====Program===== =====Program=====
Line 172: Line 119:
 </cli> </cli>
  
-At which point you can change into the newly created and populated **led2** directory.+At which point you can change into the newly created and populated **iwb0** directory.
  
 ====Getting project resources from lab46 to your pi==== ====Getting project resources from lab46 to your pi====
Line 235: Line 182:
 *:iwb0:post picture of powered LEDs in layout to #desig [8/8]  *:iwb0:post picture of powered LEDs in layout to #desig [8/8] 
 *:iwb0:grabit on the code on lab46 by Sunday before deadline [4/4] *:iwb0:grabit on the code on lab46 by Sunday before deadline [4/4]
-*:iwb0:led2.c code adequately modified per project requirements [12/12] +*:iwb0:iwb0.c code adequately modified per project requirements [12/12] 
-*:iwb0:led2.c comments describing what is happening [8/8]+*:iwb0:iwb0.c comments describing what is happening [8/8]
 *:iwb0:updated code is pushed to lab46 repository [8/8] *:iwb0:updated code is pushed to lab46 repository [8/8]
 </code> </code>
haas/fall2020/common/projects/iwb0.1600086385.txt.gz · Last modified: 2020/09/14 12:26 by wedge