In this post ( LED Colour by Potentiometer ), I’ll describe how to change the color of an anode RGB LED with a potentiometer. I’ll be using an Arduino UNO, and components from this RadioShack components kit. The motivation for this post was to have an LED change color in response to the reading from a thermistor next to my stove, but when I read about how I’d first need to calibrate the thermistor with some kind of thermometer, my motivation scurried under the sofa like a terrier in a thunderstorm. As a compromise I substituted the thermistor with a trim-pot, reasoning that a variable resistance was a variable resistance.

Components Used For LED Colour by Potentiometer :

  • 1 x Arduino Uno ( You can use other boards also )
  • 10 x Jumper Wires M-M
  • 1 x RGB LED
  • 3 x 10k resistor
  • 1 x Breadboard
  • 1 x Potentiometer

Description

Through this project, we can learn how input of potentiometer can control output at digital pins

Quick points

  • This is a basic program to check Board is working with any sensor (Potentiometer).
  • You have two types of RGB Led
    • Cathod as common
    • Anode as common

Min Required  – 20 mins

Procedure

  1. Take Breadboard
  2. Take RGB LED it will have one big leg (+) which is a positive and other 3 legs which is Negative. (this RGB as common anode based, and if the small leg is there which is negative it is RGB as the common cathode).
  3. Press that all legs and remember which one is a big one ( You can even bend big leg so it’s easy to identify for further reference.
  4. Now take 2 M-M jumper wires and potentiometer.
  5. Fix them to the connected line with RGB LED and potentiometer on breadboard  ( To understand more about Breadboard connection click here )
  6. Now Jumper wire connected to the Bigger leg which is positive will go to Arduino pin and Small legs which are Negative goes to the GND ( 3 GND is available in Arduino UNO).
  7. Check once again and connect resistors LED  to avoid any short circuit.
  8. Connect Arduino to your Laptop/PC by USB Cable. ( we use A to B USB cable for Arduino which is also used in printers )
  9. Open Arduino IDE ( You can download it from here or you can use online platform Arduino Web editor )
  10. Go to File > Examples > Basic > controlling LED color using potentiometer.
  11. Check program, save it and then upload it.
  12. You can change potentiometer  Value and see changes in LED colour.

Lines of Code –