Skip to content

Analog Input and Digital Output - Your First Program

Overview

Design a program and physical circuit that uses analog input to control a digital output. You will first simulate the circuit, then build it on a breadboard.

Before You Start

Complete the earlier Tinkercad circuit simulation activities and be ready to use a potentiometer and upload an Arduino sketch. Those simulation activities are prerequisites even though they are not part of these six labs.

Materials

  • Computer with Tinkercad and Arduino IDE
  • Arduino Uno R3 and USB cable
  • Breadboard, potentiometer, and jumper wires

Safety

Disconnect power before rewiring

Unplug Arduino USB and disconnect or switch off every other supply before changing wires. Check polarity and connections before restoring power.

Wiring approval is required

Do not connect the Arduino and breadboard to USB or other power until Mr. Willis has checked them. Powering the circuit before approval results in a zero for this lab.

You've got it when…

  • The potentiometer changes the built-in LED blink rate in simulation and on the physical Arduino.
  • Your screenshot shows both simulated circuit and code; your photograph shows the working physical circuit.

Collaboration & AI

Compare observations and troubleshoot with classmates. Each student must understand the wiring or design and prepare their own submission.

AI — AIAS Level 1, No AI: Complete the code or design yourself without AI assistance. AI Assessment Scale


Simulate Your Circuit

  1. In Tinkercad Circuits, create a circuit with an Arduino Uno and a potentiometer. Use the Arduino Pinout to identify an analog input, 5V, GND, and the built-in LED on pin 13.

  2. Write a program that makes the built-in LED blink more rapidly as you turn the potentiometer knob. Test the full range of knob positions in the simulator.

    Programming hints

    In setup():

    • Use pinMode() to set the LED pin to OUTPUT.
    • No pin-mode setup is needed to read an analog input.
    • Serial output is optional, but can help you see readings while debugging.

    In loop():

    • analogRead() converts an Uno analog-input voltage to a number from 0 through 1023.
    • map() converts one number range to another. Choose delays that keep the blinking visible.
    • delay() pauses for a number of milliseconds; 1000 milliseconds is one second.
    • digitalWrite() sets an Uno output to HIGH (about 5 V) or LOW (about 0 V).

Build and Test

  1. Disconnect the physical Arduino from USB and all other power. Reproduce your simulated circuit on a breadboard.

  2. Have Mr. Willis check your wiring before connecting USB or any other power.

  3. After approval, connect the Arduino and copy your simulator code into the Arduino IDE. Select your board and port, upload the program, and test the knob across its range. Confirm that the physical LED's blink rate changes as it did in the simulation.

  4. Capture a screenshot showing both the simulator circuit and code, and take a photograph of your working physical circuit.

Turn It In

  1. Submit the following images:
  • Simulator screenshot showing circuit and code
  • Photograph of the working physical circuit

How It's Graded

One score from 0–4 covers the required work and evidence. Verification may be shown during the lab; the required uploads are listed above.

Score Evidence
4 Excellent Simulator and physical circuit both vary the LED blink rate correctly across the knob range; both required images are clear and complete.
3 Above Average The circuit and images are complete and working, with only minor errors or omissions in clarity or verification.
2 Average The circuit and images have significant gaps, errors, or missing evidence.
1 Below Average The required work is largely incomplete or nonfunctional, with little usable evidence.
0 Failing No submission or no evidence of the required work.

The wiring-approval safety rule above also applies: powering the physical circuit before approval results in a zero.


Converted from the original lab.