flowing LEDs

Idea and Design

Homework 3 required students to create a circuit using using both analog and digital components. One type of circuit I have always enjoyed is the led chaser. This circuit is an array of LEDs turning on and off in a predetermined manner. I decided to use a potentiometer to control the speed of the LEDs turning on and off. Below you can see the schematic of the circuit.

Figure 1. Potentiometer Driven LED Chaser Circuit

Figure 1. Potentiometer Driven LED Chaser Circuit

I decided to utilize all twelve digital out ports(pins 2-13) of the Arduino to drive 12 LEDS with the potentiometer’s wiper connected to the A0 port. After wiring, programming the Arduino, and some minor debugging of the code the circuit worked as expected.

Figure 2. Photo of the fully wired circuit.

Figure 2. Photo of the fully wired circuit.

As shown above, when the potentiometer is twisted clockwise the speed at which the LED’s turn on and off begins to increase until the potentiometer is fully turned and the LEDs start to look like they are just flickering. It was enjoyable using the potentiometer to make this circuit and I began thinking of other analog inputs to control the LEDs, like a IR sensor or force sensor.

I decided to attempt to add more functionality to the circuit by adding a push button and having a state where if the button was pressed then the potentiometer’s location would dictate which led was on. After spending some time on this I wasn’t able to reach full functionality.

Figure 3. Modified circuit with pushbutton added.

Figure 3. Modified circuit with pushbutton added.

This project got me thinking about different ways that these types of circuits could be used. Not just to drive LEDs but other larger more scalable projects.

Below you can see the code for the Chaser Circuit and additional, less functional circuit:


 * Morgan Mueller 
 * PCOMP Homework 3
 * Basic LED chaser circuit
int ledPin = 0;
int potPin = A0;
int btnSwitch = 2;
int chooseLED = 0;
int chooseLastLED = 0;

// set all LEDs and the button to their designated states
void setup() {
for (ledPin = 3; ledPin <14; ledPin++){
pinMode(ledPin, OUTPUT);
  //push button for second part of code
  pinMode(btnSwitch, INPUT);
  pinMode(chooseLED, OUTPUT);
  pinMode(chooseLastLED, OUTPUT);

void loop() {
  //if the button is not pressed then run the led chaser circuit
  if(digitalRead(btnSwitch) == LOW){
    //write the value of the ledPin
    for (ledPin = 3; ledPin < 14; ledPin++){
      //use a delay and mapping to read the value of the pot and map it to a time between 1000ms and 10ms
      //turn of the led

    //map the pot value to the current led position
    chooseLED = map(analogRead(potPin), 10, 1023, 3, 13);
      //check to see if the current state is = the last state 
      if(chooseLED != chooseLastLED){
    digitalWrite(chooseLastLED, LOW);
    //write to the current led state  

    //set the last led state to the current led state
    chooseLastLED = chooseLED;  


Elvin Yu and I worked on the labs together, including the digital input and analog input portions. Below are photos from the basic analog and digital input assignments. You can find the Arduino code for the projects here: