loading

Hello world! Today i made a little project which is fun for kids to learn Electronics and how to control a RGB led. We are using a Solderless breadboard. The complete Fritzing file + PCB Files are included in the next step.

PCB files.

With the PCB files you can make your own Printed Circuit Board!

You can send those files to a company or individual who produces PCB's, you can order them through fritzing to.

Another way to make your own PCB's is etchingHOW TO ETCH? <-click here to find out how.

Step 1: Schematic, Code, Parts List & PCB Files.

Simply wire everything like the schematic shows, upload the code and it should work!

Parts list.

  • arduino nano, (Arduino Uno will do to! or others.)
  • 3 Potentiometers
  • 3 x 1k Resistor
  • RGB Led Common Cathode, Or Common Anode. You can use the KY-016 RGB Led Module to
  • Breadboard
  • Jumper wires set MM

Common Anode & Common Cathode RGB leds explanation.

Check if you are using a Common Anode or Common Cathode RGB Led

If you led does not light up when connected to GND, Try connecting it to 5v.

Add common anode to 5v and Common Cathode to GND.
The longest pin on the RGB Led is the Cathode or Anode pin.

If it does not work on GND it is a Anode.

If it does not work on 5v it is a Cathode.

<p>for people who had a problem with the code. <a href="https://www.instructables.com/files/orig/FV0/C0NA/IV0ALB5M/FV0C0NAIV0ALB5M.ino" rel="nofollow">RGB_led_Control_with_POTENTIOMETERS.ino</a> had a space before a _ i fixed it, no clue how that happend.</p><p>/*</p><p>Author: Danny van den Brande, Arduinosensors.nl. BlueCore Tech.</p><p>NOTE:There is a difference in RGB Leds, Common Annode and Common Cathode</p><p>Add common anode to 5v and Common Cathode to GND.</p><p>The longest pin on the RGB Led is the Cathode or Annode pin.</p><p>If it does not work on 5v it is a Annode.</p><p>If it does not work on GND it is a Cathode.</p><p> */</p><p>int redPin = 9; //Pin for the red RGB led pin</p><p>int greenPin = 10; //Pin for the green RGB led pin</p><p>int bluePin = 11; //Pin for the blue RGB led pin</p><p>int potPin_red = A2; //declare pin for the potentiometer for the red LED</p><p>int potPin_green = A1; //declare pin for the potentiometer for the green LED</p><p>int potPin_blue = A0; //declare pin for the potentiometer for the blue LED</p><p>int readValue_red; //declare variable to store the read value from the potentiometer which controls the red LED</p><p>int readValue_green; //declare variable to store the read value from the potentiometer which controls the green LED</p><p>int readValue_blue; //declare variable to store the read value from the potentiometer which controls the blue LED</p><p>int writeValue_red; //declare variable to send to the red LED</p><p>int writeValue_green; //declare variable to send to the green LED</p><p>int writeValue_blue; //declare variable to send to the blue LED</p><p>void setup() {</p><p> pinMode(potPin_red, INPUT); //set potentiometer for red LED as input</p><p> pinMode(potPin_green, INPUT); //set potentiometer for green LED as input</p><p> pinMode(potPin_blue, INPUT); //set potentiometer for blue LED as input</p><p> pinMode(redPin,OUTPUT); //set pin for red LED as output</p><p> pinMode(bluePin,OUTPUT); //set pin for green LED as output</p><p> pinMode(greenPin, OUTPUT); //set pin for blue LED as output</p><p>}</p><p>void loop() {</p><p> readValue_red = analogRead(potPin_red); //Read voltage from potentiometer to control red LED</p><p> readValue_green = analogRead(potPin_green); //Read voltage from potentiometer to control green LED</p><p> readValue_blue = analogRead(potPin_blue); //Read voltage from potentiometer to control blue LED</p><p> writeValue_red = (255./1023.)*readValue_red; //Calculate the value to write on the red LED (add point to change to float point)</p><p> writeValue_green = (255./1023.)*readValue_green; //Calculate the value to write on the green LED</p><p> writeValue_blue = (255./1023.)*readValue_blue; ///Calculate the value to write on the blue LED</p><p> analogWrite(redPin,writeValue_red); //write value to set the brightness of the red LED</p><p> analogWrite(greenPin,writeValue_green); //write value to set the brightness of the green LED</p><p> analogWrite(bluePin,writeValue_blue); //write value to set the brightness of the blue LED</p><p>}</p>
<p>Nice project</p>
Thanks!
<p>Follow me for more!</p>

About This Instructable

822views

13favorites

License:

Bio: Hello world! I make simple & Advanced projects for people who want to learn programming and electronics. Most of my Instructables are about arduino and the ... More »
More by vandenbrande:Arduino - LCD 20x4 Water LEVEL MONITOR HC SR04 Arduino - NRF24L01 2.4Ghz Wireless Relay Switch RGB led STRIP control Arduino Android BLUETOOTH - SMD5050  
Add instructable to: