Link Search Menu Expand Document

Intro to Arduino

Table of Contents

  1. Intro to Output
    1. Lesson 1: Turning on an LED
    2. Lesson 2: Blinking an LED
    3. Lesson 3: Serial debugging
    4. Lesson 4: Fading an LED
    5. Lesson 5: Blinking an LED Part 2
    6. Lesson 6: RGB LEDs
    7. Lesson 7: Crossfading RGB LEDs
    8. Lesson 8: Rate Blinking Multiple LEDs
  2. Intro to Input
    1. Lesson 1: Using buttons
    2. Lesson 2: Button piano
    3. Lesson 3: Debouncing switches
    4. Lesson 4: Potentiometers
    5. Lesson 5: Force-sensitive resistors

Welcome đź‘‹ to the second module in your Physical Computing journey: Introduction to Microcontrollers (using Arduino).

Although you can begin your journey here, we strongly recommend that you complete the first module on Intro to Electronics first. This will allow you to have a more deep understanding of the content. We will refer back to content from the first module.

There are many Arduino resources online, many good, some bad. Our two favorites are, perhaps, Adafruit’s 18-Step Guide and Jeremy Blum’s Exploring Arduino: Tools and Techniques for Engineering Wizardry, 2nd Edition, Wiley, 2020. See our Resources page for more.

Our lessons are different both in approach and scope. They are based on years of experience in teaching physical computing—to design students, computer scientists, and engineers at the undergraduate and graduate level—and attempts to address common confusions head-on.

Thus, while other resources start with digital/analog input (or quickly intermix input and output), we’ve found that it’s easier to start with output. For novices, input is simply harder—it requires an understanding (or at least an awareness) of concepts like pull-down resistors, voltage dividers, and that a microcontroller reads voltages rather than current or resistance.

So, our lessons start and stick with output to solidify understanding of how you to programmatically control microcontroller pins before adding in input—where the fun, of course, really starts! Moreover, most resources—at least those we are aware of—strike a different balance between depth and breadth. We love Adafruit’s tutorials but they tend towards step-by-step construction recipes rather than explaining why or how things work. As a college-level resource, we attempt to provide a deeper understanding at a cost of complexity and longer lessons. But we think it’s worth it.

Let the fun begin!

These tutorials are interactive and designed to be completed in order. All Arduino code is open source and in this GitHub repository.

Intro to Output

Lesson 1: Turning on an LED

Introduces the Arduino power and ground pins, powering an initial LED circuit with a current limiting resistor, and plugging components into the Arduino.

Lesson 2: Blinking an LED

Introduces the Arduino IDE and the ability to programmatically control Arduino GPIO pins to turn an LED on and off via digitalWrite.

Lesson 3: Serial debugging

Introduces some basic debugging approaches for Arduino, with a specific focus on Serial.print.

Lesson 4: Fading an LED

Demonstrates how to gradually fade an LED on and off by using analogWrite

Lesson 5: Blinking an LED Part 2

Introduces the concept of using Arduino GPIO pins as either current sources or sinks by hooking up two LED circuit configurations: one circuit with the LED cathode towards GND and another with the LED anode towards GND.

Lesson 6: RGB LEDs

Introduces RGB LEDs, using both common anode and cathode versions, and independently controlling brightness and hue.

Lesson 7: Crossfading RGB LEDs

Shows how to fade between RGB colors using analogWrite, to use the HSL colorspace to more easily (and independently) control hue and brightness, and to use and load local C/C++ libraries

Lesson 8: Rate Blinking Multiple LEDs

In this lesson, we will learn how to blink multiple LEDs at different rates and build our first C/C++ class, which will greatly simplify our code and, as an added bonus, reduce its size by eliminating code redundancy.

Intro to Input

Lesson 1: Using buttons

Introduces buttons (aka momentary switches), digital input, using Arduino’s digitalRead function, and pull-up and pull-down resistors.

Lesson 2: Button piano

In this lesson, we are going to make a simple five-key piano with tactile buttons wired with internal pull-up resistors and a piezo buzzer.

Lesson 3: Debouncing switches

In this lesson, we’ll learn about “contact bouncing” and how to “debounce” to make our digital input more reliable.

Lesson 4: Potentiometers

This lesson introduces potentiometers and rheostats, analog input, and using Arduino’s analogRead function. Also shows how to use Tinkercad to prototype and test circuits in an online simulator and how to use a multimeter to measure current.

Lesson 5: Force-sensitive resistors

Introduces force-sensitive resistors (FSRs), how to use two-legged variable resistors with microcontrollers (including FSRs), and how to make a force-piano. Very Jedi-like!