Recitation 2 – Arduino Basics

Materials

  • 1 * Arduino Kit and its contents, including:
  • 1 * Breadboard
  • 1 * Arduino Uno
  • 1 * Buzzer
  • 1 * Push-Button Switch
  • 1 * LDR
  • 220 ohm Resistors
  • LEDs
  • 10K ohm Variable Resistors (Potentiometers)
  • 1 * USB A to B Cable
  • Jumper Cables (Hook-up Wires)

Exercise 1

These challenges will require you to build a circuit, write and Arduino sketch (code), and upload that sketch to your Arduino Uno. You may build your circuits based on the provided schematics and cheat sheet below. For both Part A and B, as you build your circuits, take pictures and write about your process . You can use the documentation lighting stations to take pictures or film the the finished circuit working. Record notes about the building process for each circuit, such as problems that you encountered, and how you fixed them. Reflect on the final outcome: Did the circuit work at the end? If not, why didn’t it? What needs to be altered for the circuit to work?

 

PART A (individual):

Step 1: Using a Pushbutton

Build a circuit based on the diagram below. When you have finished building this circuit, write a sketch that blinks an LED when the pushbutton is pressed. You may reference Arduino> File> Examples> Digital> Button for help writing the sketch. Remember that to make your sketch consistent with your circuit, you need to double check the pin numbers.

Step 2- Blinking an LED using a Pushbutton

Using the circuit you just assembled, write a sketch that blinks an LED when the pushbutton is pressed. You may reference to  Arduino> File> Examples> Digital> Button and Arduino> File> Examples> 0.1Basics> Blink for help writing the sketch.

 

Step 3: Fading an LED with a Pushbutton

Using the same circuit as the previous step, modify your Arduino sketch so that the LED fades when the pushbutton is pressed. You may reference Arduino> File> Examples> Basics> Fade for help writing the sketch.

 

Step 4: Make your own Circuit!

Build a circuit that can power at least 3 LEDs. Then write a sketch that blinks and/or fades these LEDs in a unique way. How the LEDs blink or fade is entirely up to you, but they should do so in an original sequence. Upload this sketch to your Arduino and record the results.

When you have completed this circuit, draw a schematic representation of what you made and take a picture. Upload your schematic along with the other documentation for this exercise.

 

PART B (in pairs):

Step 1: Fading an LED with a Potentiometer

Build a circuit based on the diagram below. When you have finished building this circuit, write a sketch that fades the LED in relation to the Analog values from the potentiometer. You may reference Arduino> File> Examples> Analog> AnalogInOutSerial for help writing the sketch.

 

Step 2: Multiple Outputs with Multiple Inputs

Now that you know how to create a project with multiple inputs and outputs, build a circuit that has at least three LEDs (buzzers optional) and three potentiometers. Write a sketch that has each of your inputs control an output (Outputs can be digital, analog, or some combination).

When you have completed this task, draw a schematic of the circuit your built and upload it to the blog along with the other documentation.

 

Exercise 2

Instructions:

Working individually, answer the following questions and post them to the documentation blog along with your work from Exercise 1.

  1. During the assembly of the circuits, we used many electronic components as inputs and outputs. Which components do you recognize in the city?
  2. If you have 100000 LEDs of any brightness and color at your disposal, what would you make and where would you put it?
  3. Which reflections about the nature of interaction can you make about the Figure I.1 in the Physical Computing reading?

 

Personal Assessment

(Not to be posted to the blog, only for your own reference)

Note: To answer these questions, you may refer to this weeks readings about, microcontrollers, digital input and output, analog input, and analog output, as well as Getting Started with Arduino. You can also take a look at the Arduino Reference page for further understanding.

Arduino Hardware

  • What is a development board? Why is the Arduino Uno a development board?
  • What is a microcontroller? What does a microcontroller do?
  • How many Digital Input/Output Pins does the Arduino Uno have? Which pins are they? What do they do?
  • How many Pulse Width Modulation (PWM) pins does the Arduino Uno have? Which pins are they? What do they do?
  • How many Analog Input Pins does the Arduino Uno have? Which pins are they? What do they do?

Arduino Software

  • What does “IDE” stand for? What software is used to write Arduino code and upload sketches to the Arduino?
  • What is the “setup()” function? What does the code within the setup() function do (i.e. What happens to code written within the setup() function?) ?
  • What is the “loop()” function? What does the loop() function do?
  • How do you “comment” within the Arduino IDE? Why is it good to comment within your code?
  • What does the “pinMode()” function do?
  • What does the  “digitalRead()”  function do? What does the “analogRead()” function do? How are they different?
  • What does the  “digitalWrite()”  function do? What does the  “analogWrite()” function do? How are they different?
  • What does the “delay()” function do?

Leave a Reply