Skip to main content

Arduino Color Mixer

This tutorial is pretty easy and requires a little Arduino and electronics knowledge, if you're not familiar with Arduino, I'll include links to guide you through the tutorial.

In this tutorial we'll generate all the possible colors that you can see with just a twist. It will also make you see through the RGB color model and understanding how today's displays work.

We'll also use Arduino analog Input / Ouput ( referred to as I/O later in tutorial ) and will learn how to read and write analog voltages on Arduino pins.







Step 1: What You Need?

1 x USB Type-B Cable 
3 x 5k Ohm Potentiometers
3 x 330 Ohm Resistors
1 x RGB LED or RGB Module 
Optional
Cable Cover
Arduino Compatible UNO Ultimate Starter Kit / Learning Kit
USB To Power Jack Cable



Don't have components? Don't worry. Just click the component's name. 


Step 2: Connecting The Pot.

The pot will be our voltage divider circuit, where Vout is the Arduino pin.
Voltage Divider Circuit

In a nutshell, it transforms a adjustable amount of the voltage (changes by twisting the rotor) to the Arduino analog input pin ( Vout ) this link explains the topic even further.


Pot Voltage Divider 


Connect the pot as illustrated in the image, connecting the outer terminals on either 5v or GND doesn't matter at all, the most important connection is the middle terminal, which goes to the analog input pins.

You obtain the 5v and GND from the Arduino pins.

I'm using the Orange for the 5v ( instead of Red ) to make easier to differentiate between power and signal lines.




Repeat this connection for the 3 pots for each color.

I want to keep the connections as tidy as possible so I'll connect the pot for the Red color on A0, Green on A1 and Blue on A2.



Step 3: Connecting The RGB LED.

The RGB LED uses the same concept of the conventional LED (diode) the magic happens because it contains 3 LEDS beside each other, when the light from those LEDs fall on your retina they represent different colors because you view them as a single combined color.


Since we have 256 value for each PWM output and 3 pins that represent Red Green Blue, we have a total of 256 * 256 * 256 colors which is 16,777,216 colors (almost 17 Million).



The RGB Led is connected the same way you'd connect a normal LED but you repeat the work 3 times.

NOTE: Don't forget to connect the 330 Ohm resistor because I made this mistake and got my Red LED burnt out electricity won't do much work to get an LED burnt, so take care.


Step 4: Upload The Code.

 
The code of the Arduino does those simple tasks in a sequential manner.

In the Setup

  • Set the mode of 3 analog input pins to input
  • Set the mode of 3 pwm (analog output) pins to output

In the Loop
  • Read the value of the pot. using analogRead function
  • Map the value from the analog pin to a matching PWM value using the map
  • function
  • Write the PWM value to the analog pin using analogWrite function


Step 5: Test Your Circuit.


Now you have the ultimate color generator with 17M colors! congrats!!


http://news.chivindo.com/676/arduino-color-mixer.html

Comments

Popular posts from this blog

BT-BASIC commands used

8.10     Some of the most frequently used BT-BASIC commands used are: msi                               Changes default working directory. Mass storage is            Same as “msi” cat                               Catalogs (list)the node names in the specified directory.             get                               Brings the contents of a file into the system workspace.        ...

Perhitungan & Cara Merubah Kumparan Blender Dari 220 V Menjadi 12 V

          Seperti yang telah dijelaskan pada buku “menggulung motor listrik arus bolak-balik, servis peralatan listrik rumah tangga kelompok penggerak dan perbaikan peralatan listrik pertukangan”, bahwa motor penggerak yang digunakan pada perlatan listrik rumah tangga dan pertukangan seperti blender, mixer, bor tembak, gerinda dsb menggunakan jenis motor universal. Motor universal adalah jenis motor listrik yang dapat disuplai dengan sumber listrik arus bolak-balik (AC) dan arus searah (DC). Jadi peralatan-peralatan listrik rumah tangga dan pertukangan tersebut yang biasanya kita suplai dengan sumber listrik AC dari PLN atau Genset sebesar 220 V sebenarnya dapat juga kita suplai dengan sumber listrik DC yang tentunya tegangan juga harus sama yakni 220 V.           Yang menjadi permasalahan bagaimana kalau peralatan listrik rumah tangga atau pertukangan tersebut, sebagai contoh misalkan blender yang ingin digunakan atau dioper...

BT-BASIC command line

8.8       At the BT-BASIC command line type the command  msi  and the directory path, then press the “ENTER” key on the keyboard.  Example:                   msi ‘/hp3070/boards/aspect/main’ 8.9       At the BT-BASIC command line type the command  get ‘testplan’ and press the   ENTER” key on the keyboard.  You should now see the body of the testplan file displayed in the work space of the BT-BASIC window. 8.10     Some of the most frequently used BT-BASIC commands used are:

Autodesk SketchBook Pro 2021 Full Version

BAGAS31 – Sesuai dengan namanya, Autodesk SketchBook Pro 2021 Full Version ini merupakan software digital sketching atau drawing terbaik yang bisa kamu gunakan. Pada versi terbaru kali ini, ada beberapa penambahan fitur yang sangat efektif. Dengan fitur baru tersebut, diharapkan mampu meningkatkan proses sketching maupun drawing kamu. Autodesk SketchBook sendiri sudah bisa kamu dapatkan secara gratis melalui website resminya. Namun untuk kamu yang mau download versi Autodesk Sketchbook Pro, maka bisa langsung download melalui link yang sudah saya sediakan di bawah ini. Download Autodesk SketchBook Pro 2021 Full Version Screenshot: System Requirements: Windows 10 2.5 – 2.9 GHz of Intel or AMD CPU 4 GB of Memory 256 MB Graphics card with OpenGL 2.0 support We recommend that you use a pressure-sensitive tablet and pen for basic features Download: Autodesk SketchBook Pro 2021 Full Version [ FileUp ][ Uptobox ][ UsersDrive ] Jamu Only [ File...

Testhead

4.3         Testhead The testhead is that portion of the tester that supports the PIN, ASRU and Controller cards.   The testhead is divided into two BANKS and each BANK is divided into two MODULES, see figure 2 below.  Bank 1 contains modules 0 and 1, bank 2 contains modules 2 and 3.  The test fixtures are placed on the banks of the tester and locked down for board testing.  The testhead cards interface to the test fixture through the spring loaded pogo pin “nails” at the top edge on each of these card types. 4.4       Support Bay The support bay is a stand-alone cabinet that houses the power supplies for the Unit Under Test.  This bay also houses the test station power distribution unit and test station controller on earlier models. 4.5       Emergency Shutdown Switch The emergency shutdown switch is the large red button located at the lower left corne...

Kelebihan dan Kekurangan Saluran Listrik Jenis Saluran Udara dan Saluran Bawah Tanah

Berdasarkan pemasangannya,   saluran distribusi dibagi menjadi dua kategori, yaitu : saluran udara (overhead line) merupakan sistem penyaluran tenaga listrik melalui kawat penghantar yang ditompang pada tiang listrik. Sedangkan saluran bawah tanah (underground cable) merupakan sistem penyaluran tenaga listrik melalui kabel-kabel yang ditanamkan di dalam tanah. 1.    Saluran Bawah Tanah (Underground Lines) Saluran distribusi yang menyalurkan energi listrik melalui kabel yang ditanam didalam tanah. Kategori saluran distribusi seperti ini adalah yang favorite untuk pemasangan di dalam kota, karena berada didalam tanah, maka tidak mengganggu keindahan kota dan juga tidak mudah terjadi gangguan akibat kondisi cuaca atau kondisi alam. Namun juga memilik kekurangan, yaitu mahalnya biaya investasi dan sulitnya menentukan titik gangguan dan perbaikannya. Kedua cara penyaluran memiliki keuntungan dan kerugian masing-masing. Keuntungan yang dapat diperoleh dari suatu jaringan bawah...