Makerspace - Potentiometer Challenge

1. Project:

In this week’s challenge, our goal was to use the potentiometer in our Arduino kit to create blinking speed controller for our LED and then modify our circuit and code to create a dimmer switch for our LED.

My potentiometer looked slightly different from the ones in the tutorials. However, the same principle applied: two poles of the potentiometer connected to high (5V) and low (0V) voltage and the potentiometer acted as a variable resistor (or voltage divider) providing a set voltage between 0 and 5V to the middle pin, depending on the position to which the dial was turned.

2. Code:

The following code can be used to control either the brightness or the blink speed of an LED, depending on the circuit design used with the code. 

  • When the positive side of the LED is connected to Pin 13, the potentiometer controls the blink speed. 
  • When the positive side of the LED is connected to the variable output of the potentiometer, the potentiometer controls the brightness of the LED.


3. Circuit Design:

For the following circuit design, the potentiometer functions as a blink speed controller. Turning the knob on the potentiometer will change the blink speed from every 1.023 seconds (slow) to every 0.001 seconds (fast).

Video of Circuit for Potentiometer as Blink Speed Controller (0:29)

For the following circuit design, I added functionality to my circuit. Here, the potentiometer functions also as a dimmer. Turning the knob on the potentiometer will determine how bright the LED shines from 5V (bright) to 0V (off).

Video of Circuit for Potentiometer as Dimmer (0:35)

4. Electronic Diagram:

The following electronic diagrams were taken from my design journal.

For the following circuit design, the potentiometer functions as a dimmer. Turning the knob on the potentiometer will determine how bright the LED shines from 5V (bright) to 0V (off).




Electronic Diagram for Potentiometer as Dimmer (bright to off)

For the following circuit design, the potentiometer functions as a blink speed controller. Turning the knob on the potentiometer will change the blink speed from every 1.023 seconds (slow) to every 0.001 seconds (fast)

Electronic Diagram for Potentiometer as Blink Speed Controller (fast blink to slow blink)

5. Video of Project:

Playing with Potentiometers and LEDs (2:54)

6. Explanation of Project:

I started this week by completing some of the blinking light challenges from last week that I couldn't because of a manufacturing error with my Arduino board. Thankfully, my new board works perfectly and I had it up and running within seconds of unpacking it!

I started by reading the template code for using the potentiometer as a blink speed controller, built that project, then modified the circuit so that the potentiometer functioned as a dimmer dial (see videos above). Then, I started playing around with the extension challenges. 

The analog pins on my board in input only, while the digital pins can be inputs or outputs. In testing, I discovered that I could not use an analog pin as an output or "analogWrite".

Extension Challenges:

1. Can you control 2 lights with the same brightness or same blink rate? YES! The easiest way I found to do this was by placing the LEDs in parallel. (See video above.)

2a. Can you control 2 lights with one potentiometer but have them controlled so that as one light gets dim, the other gets bright? YES! See video below. For alternating dimming, I connected one LED to the positive terminal and the variable pin of the potentiometer and the other LED to the negative terminal and the variable pin of the potentiometer. (See video above). 

2b. Can you control 2 lights with one potentiometer but have them controlled so that as one blinks fast while the other blinks slow? YES! For alternating dimming, I connected one LED to the positive terminal and the variable pin of the potentiometer and the other LED to the negative terminal and the variable pin of the potentiometer. (See video above). Blinking fast and slow was harder. I accomplished this through code manipulation. I included imbedded while loops that made one LED blink at 4X the speed of my other LED. There's probably a better solution, but, in researching, I discovered that the Arduino coding doesn't allow simultaneous loops to run, so I couldn't control the blink speeds independently and had to rely on using a multiplier (2X, 3X, 4X, etc.) rather than just setting each blink speed independently.


Code for One Potentiometer with Two Different LED Blink Rates

3 (Bonus Personal Challenge!). Is it possible to create a circuit where the potentiometer controls both the blink speed AND the brightness of a single LED? YES! First I tried just connecting Pin 13 to the high side of the potentiometer. However, this did NOT work! Whenever Pin 13 wrote LOW, the potentiometer output voltage would drop to zero, thus throwing off the analog input signal for used to calculate the blink speed. I overcame this by using the potentiometer output as a voltage divider. I used the difference between the positive terminal (5V) and the potentiometer variable output as my analog signal to the board. THEN, I used the difference between the potentiometer variable output and PIN 13 as my LED voltage. This allowed me to control both my blink speed and brightness of a single LED with a single potentiometer. 

Electronic diagram for Potentiometer as both Dimmer and Blink Speed Controller

7. Reflection:

I had a lot of fun playing with circuits this week because some of the challenges were more easily solved with code, while others (like making two LEDs blink or dim at the same rate) were more easily solved by changing the circuit (wiring the LEDs in parallel) than changing the code (writing code for a new digital output pin to control a second LED). I think being able to distinguish where code changes vs circuitry changes will be more advantageous and then knowing how to experiment and describe those concepts to students will be a valuable take-away for me. 

8. Applications:

I would love to be able to make challenges like this more accessible to younger kids. I was chatting with a engineering friend about my homework this week, and he lamented that they didn't have Arduinos for the magnetic circuitry kits he used as a younger kid and how much smarter he'd be now if he had earlier access to the programming. Maybe this is a product I could help create for our future young learners!! 

Side Note: In terms of "real-world applications", after completing this assignment, I went to Home Depot and picked up some dimmer switches to install in our conference rooms at work, because those rooms are WAY too bright in the early morning and late evening. So I will be applying my knowledge of potentiometers to real-world applications very shortly!

Comments

Popular posts from this blog

Web 2.0: Continuing the Journey

Online Learning: Course Management Systems

Online Learning: Wielding Wiki's