User Tools

Site Tools


Sidebar

projects

wcp1 (due 20240828)
wcp2 (due 20240904)
pct0 (bonus; due 20240905)
pct1 (bonus; due 20240905)
pct2 (due 20240905)
abc0 (due 20240906)
gtf0 (due 20240911)
pct3 (bonus; due 20240911)
wcp3 (due 20240911)
dtr0 (due 20240918)
pct4 (due 20240918)
wcp4 (due 20240918)
pct5 (bonus; due 20240926)
stl0 (due 20240926)
wcp5 (due 20240926)
gfo0 (due 20241002)
pct6 (due 20241002)
stl1 (due 20241002)
wcp6 (due 20241002)
pct7 (bonus; due 20241009)
stl2 (due 20241009)
wcp7 (due 20241009)
bwp1 (bonus; due 20241016)
pct8 (due 20241016)
ptb0 (due 20241016)
wcp8 (due 20241016)
pct9 (bonus; due 20241023)
ptb1 (due 20241023)
wcp9 (due 20241023)
gfo1 (due 20241030)
pctA (due 20241030)
ptb2 (due 20241030)
wcpA (due 20241030)
pctB (bonus; due 20241106)
wcpB (due 20241106)
wus0 (due 20241106)
pctC (due 20241113)
wcpC (due 20241113)
wus1 (due 20241113)
pctD (bonus; due 20241120)
wcpD (bonus; due 20241120)
wus2 (due 20241120)
bwp2 (bonus; due 20241204)
gfo2 (due 20241204)
pctE (bonus; due 20241204)
wcpE (bonus; due 20241204)
EoCE (due 20241216)
haas:fall2024:c4eng:projects:vcc2

Corning Community College

ENGR1050 C for Engineers

PROJECT: Voltage and Circuit Control (VCC2)

OBJECTIVE

To continue our exploration of interfacing electronics with our pi's, and writing a program that controls it, and collaboratively authoring and documenting the project and its specifications.

GRABIT

To assist with consistency across all implementations, data files for use with this project are available on lab46 via the grabit tool. Be sure to obtain it and ensure your implementation properly works with the provided data.

lab46:~/src/SEMESTER/DESIG$ grabit DESIG PROJECT

OVERVIEW

Your task is write a program that:

  • has 4 buttons:
    • 1 is a directional switch (up/down)
    • 3 are for individual red, green, and blue values
  • has 3 LEDs:
    • a multicolored LED that is lit via its 3 color components to some state
    • 2 indicator LEDs (one lights up when we are set to increase values, one, one for when we are set to decrease values)
  • program will receive input from the various buttons, lighting up various indicator LEDs and setting (via software PWM) the individual color RGB components of the multicolor LED.

Contributing to project documentation is also a core part of this project. If from reading the existing documentation or through your own exploring, you find something lacking, unclear, or outright missing, that is an opportunity to potentially contribute content.

You want the project documentation to provide you (as if coming in with no awareness of the project) with sufficient information so as to allow you to proceed. Asking questions on the discord is a great way of getting more information that you can use to add content.

EDIT

You will want to go here to edit and fill in the various sections of the document:

BACKGROUND

In vcc2 we will continue to build onto that baseline of knowledge that we have established from previous projects such as vcc0 and vcc1, to build an even more complex circuit. In this project we will combine different types of LEDs, buttons and switches to create multiple functions within a circuit. Circuit control, in its simplest form, is the application and removal of power. This can also be expressed as turning a circuit on and off or opening and closing a circuit.

ANALOG vs DIGITAL

You will use digital pin modes when dealing with signals that are either “on” or “off”, such as an LED, a switch, or another digital IC. Analog and digital signals are used to transmit information, usually through electric signals. In both these technologies, the information, such as any audio or video, is transformed into electric signals. The difference between analog and digital technologies is that in analog technology, information is translated into electric pulses of varying amplitude. In digital technology, translation of information is into binary format (zero or one) where each bit is representative of two distinct amplitudes.

https://www.diffen.com/difference/Analog_vs_Digital

PULSE-WIDTH MODULATION

This is a method of reducing the average power produced by an electrical signal by effectively chopping it up into discrete parts. The average value of voltage fed to the load is controlled by turning the switch between supply and load on and off at a fast rate.

The longer the switch is on, the higher the total power is to the supplied to the object. PWMs are particularly suited for running inertial loads such as, which is not as easily affected by this discrete switching because their inertia causes them to react slowly.

This means that the switching frequency must be high enough to not affect the load, which means that the resultant wave must be perceived as smooth by the load.

ELECTRONICS

7 10k ohm resistors 3 buttons 1 switch 2 leds 1 rgb LED 1 220 ohm resistor to each LED including rgb LED (3 for rgb LED) 1k ohm to switch

PARTS

RGBLED

This LED is basically THREE LEDs packaged together, all sharing a ground. The Red-Green-Blue (RGB) is three LEDs in one. By controlling the intensities of each of the three component colors individually, you can create all of the colors of the rainbow. The RGB LED in your kit is a common-cathode RGB LED. Each of the three shorter legs controls an individual color (red, green or blue). The fourth, longer leg is a shared ground—-the common cathode. In contrast to standard individual LEDs, the cathode leg on a common-cathode RGB LED is longer than the other legs. (https://learn.sparkfun.com/tutorials/experiment-guide-for-the-johnny-five-inventors-kit/experiment-8-driving-an-rgb-led)

BUTTON

SWITCH

You will also want to utilize a switch, which looks like this:

Your kit should have come with a couple of them, you will need ONE. A switch is a component which controls the open-ness or closed-ness of an electric circuit. They allow control over current flow in a circuit (without having to actually get in there and manually cut or splice the wires). Switches are critical components in any circuit which requires user interaction or control.A switch can only exist in one of two states: open or closed.

The switch circuit will involve hooking up 3.3v to the center pin, putting a 1k resistor between the pin of the switch and the 3.3v source coming from the pi. And ONE of the other pins should then go through a 10k resistor into a GPIO pin on the pi (set to INPUT mode, just like the buttons).

This switch is going to control the DIRECTION of change- one way, it will be INCREASING in value. The other, it will be DECREASING.

 

pseudocode

AS LONG AS PROGRAM CONTINUES TO RUN:

    SHOULD THE DIRECTIONAL INDICATOR BE UP:
        LIGHT UP THE UP INDICATOR LIGHT
        TURN OFF THE DOWN INDICATOR LIGHT
        SET DIRECTION TO POSITIVE FIVE
    OTHERWISE:
        LIGHT UP THE DOWN INDICATOR LIGHT
        TURN OFF THE UP INDICATOR LIGHT
        SET DIRECTION TO NEGATIVE FIVE

    SHOULD THE RED BUTTON BE PRESSED:
        SET REDLEVEL TO REDLEVEL PLUS DIRECTION
        SHOULD REDLEVEL EXCEED ONE HUNDRED:
            RESET REDLEVEL TO ZERO
        SHOULD REDLEVEL FALL BELOW ZERO:
            RESET REDLEVEL TO ONE HUNDRED

    SHOULD THE GREEN BUTTON BE PRESSED:
        SET GREENLEVEL TO GREENLEVEL PLUS DIRECTION
        SHOULD GREENLEVEL EXCEED ONE HUNDRED:
            RESET GREENLEVEL TO ZERO
        SHOULD GREENLEVEL FALL BELOW ZERO:
            RESET GREENLEVEL TO ONE HUNDRED

    SHOULD THE BLUE BUTTON BE PRESSED:
        SET BLUELEVEL TO BLUELEVEL PLUS DIRECTION
        SHOULD BLUELEVEL EXCEED ONE HUNDRED:
            RESET BLUELEVEL TO ZERO
        SHOULD BLUELEVEL FALL BELOW ZERO:
            RESET BLUELEVEL TO ONE HUNDRED
    
    LIGHT UP RED COMPONENT OF RGBLED TO REDLEVEL
    LIGHT UP GREEN COMPONENT OF RGBLED TO GREENLEVEL
    LIGHT UP BLUE COMPONENT OF RGBLED TO BLUELEVEL

    DELAY EVER SO BRIEFLY

KEEP GOING

SUBMISSION

To be successful in this project, the following criteria (or their equivalent) must be met:

  • Project must be submit on time, by the deadline.
    • Late submissions will lose 33% credit per day, with the submission window closing on the 3rd day following the deadline.
  • All code must compile cleanly (no warnings or errors)
    • Compile with the -Wall and –std=gnu18 compiler flags
    • all requested functionality must conform to stated requirements (either on this document or in a comment banner in source code files themselves).
  • Executed programs must display in a manner similar to provided output
    • output formatted, where applicable, must match that of project requirements
  • Processing must be correct based on input given and output requested
  • Output, if applicable, must be correct based on values input
  • Code must be nicely and consistently indented
  • Code must be consistently written, to strive for readability from having a consistent style throughout
  • Code must be commented
    • Any “to be implemented” comments MUST be removed
      • these “to be implemented” comments, if still present at evaluation time, will result in points being deducted.
      • Sufficient comments explaining the point of provided logic MUST be present
  • No global variables (without instructor approval), no goto statements, no calling of main()!
  • Track/version the source code in your lab46 semester repository
  • Submit a copy of your source code to me using the submit tool (make submit on lab46 will do this) by the deadline.

Submit Tool Usage

Let's say you have completed work on the project, and are ready to submit, you would do the following (assuming you have a program called uom0.c):

lab46:~/src/SEMESTER/DESIG/PROJECT$ make submit

You should get some sort of confirmation indicating successful submission if all went according to plan. If not, check for typos and or locational mismatches.

RUBRIC

I'll be evaluating the project based on the following criteria:

78:vcc2:final tally of results (78/78)
*:vcc2:used grabit to obtain project by the Sunday prior to duedate [13/13]
*:vcc2:picture of unpowered breadboard to #desig for approval [7/7]
*:vcc2:picture of powered breadboard to #desig showing results [6/6]
*:vcc2:clean compile, no compiler messages [7/7]
*:vcc2:program conforms to project specifications [32/32]
*:vcc2:code tracked in lab46 semester repo [13/13]

Pertaining to the collaborative authoring of project documentation

  • each class member is to participate in the contribution of relevant information and formatting of the documentation
    • minimal member contributions consist of:
      • near the class average edits (a value of at least four productive edits)
      • near the average class content change average (a value of at least 256 bytes (absolute value of data content change))
      • near the class content contribution average (a value of at least 1kiB)
      • no adding in one commit then later removing in its entirety for the sake of satisfying edit requirements
    • adding and formatting data in an organized fashion, aiming to create an informative and readable document that anyone in the class can reference
    • content contributions will be factored into a documentation coefficient, a value multiplied against your actual project submission to influence the end result:
      • no contributions, co-efficient is 0.50
      • less than minimum contributions is 0.75
      • met minimum contribution threshold is 1.00

Additionally

  • Solutions not abiding by spirit of project will be subject to a 50% overall deduction
  • Solutions not utilizing descriptive why and how comments will be subject to a 25% overall deduction
  • Solutions not utilizing indentation to promote scope and clarity or otherwise maintaining consistency in code style and presentation will be subject to a 25% overall deduction
  • Solutions not organized and easy to read (assume a terminal at least 90 characters wide, 40 characters tall) are subject to a 25% overall deduction
haas/fall2024/c4eng/projects/vcc2.txt · Last modified: 2022/09/19 15:56 by 127.0.0.1