Potentio Indicator Uses RGB Neopixel


60

1

3

someone who likes electronics

In this article I will make a rotation indicator of the potentio meter using RGB Nano pixel ring.

So, how many revolutions made on the potentiometer will be displayed on the RGB ring

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Required Components

the components needed to make it :

  • Arduino Nano v.3
  • RGB RIng NeoPixels
  • Potentiometer
  • Jumper Wire
  • USB mini
  • Project Board

Step 2: Circuit Schema

Assemble all components in accordance with the drawdown scheme above.

Arduino to Potensio & RGB Ring

+5V ==> 3.Potensio & VCC

GND ==> 1.Potensio & GND

A0 ==> 2.Potensio

D12 ==> IN

Step 3: Programming

Copy the code below, and paste it into your sketch

<p>#include <br>#ifdef __AVR__
 #include  // Required for 16 MHz Adafruit Trinket
#endif</p><p>#define PIN 12
#define NUMPIXELS 16 </p><p>Adafruit_NeoPixel pixels(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);</p><p>#define DELAYVAL 10</p><p>void setup() {</p><p> #if defined(__AVR_ATtiny85__) && (F_CPU == 16000000)
  clock_prescale_set(clock_div_1);
#endif</p><p>pixels.begin();</p><p>pixels.setBrightness(10);
 
 Serial.begin(9600);
}</p><p>void loop() 
{
  pixels.clear();
  int val = analogRead(A0);
  val = map(val, 0, 1023, 0, 18);</p><p> 
  if(val == 1)
  {
    for(int i=0; i<1; i++)
    {
      pixels.setPixelColor(i, pixels.Color(0, 225, 0));
      delay(10);
    }
  }</p><p> if(val == 2)
  {
    for(int i=0; i<2; i++)
    {
      pixels.setPixelColor(i, pixels.Color(32, 225, 0));
      delay(10);
    }
  }</p><p>  if(val == 3)
  {
    for(int i=0; i<3; i++)
    {
      pixels.setPixelColor(i, pixels.Color(64, 225, 0));
      delay(10);
    }
  }</p><p>  if(val == 4)
  {
    for(int i=0; i<4; i++)
    {
      pixels.setPixelColor(i, pixels.Color(96, 225, 0));
      delay(10);
    }
  }</p><p>  if(val == 5)
  {
    for(int i=0; i<5; i++)
    {
      pixels.setPixelColor(i, pixels.Color(128, 225, 0));
      delay(10);
    }
  }</p><p>  if(val == 6)
  {
    for(int i=0; i<6; i++)
    {
      pixels.setPixelColor(i, pixels.Color(160, 225, 0));
      delay(10);
    }
  }</p><p>  if(val == 7)
  {
    for(int i=0; i<7; i++)
    {
      pixels.setPixelColor(i, pixels.Color(192, 225, 0));
      delay(10);
    }
  }</p><p>  if(val == 8)
  {
    for(int i=0; i<8; i++)
    {
      pixels.setPixelColor(i, pixels.Color(225, 225, 0));
      delay(10);
    }
  }</p><p>  if(val == 9)
  {
    for(int i=0; i<9; i++)
    {
      pixels.setPixelColor(i, pixels.Color(225, 225, 0));
      delay(10);
    }
  }</p><p>  if(val == 10)
  {
    for(int i=0; i<10; i++)
    {
      pixels.setPixelColor(i, pixels.Color(225, 192, 0));
      delay(10);
    }
  }</p><p>  if(val == 11)
  {
    for(int i=0; i<11; i++)
    {
      pixels.setPixelColor(i, pixels.Color(225, 160, 0));
      delay(10);
    }
  }</p><p>  if(val == 12)
  {
    for(int i=0; i<12; i++)
    {
      pixels.setPixelColor(i, pixels.Color(225, 128, 0));
      delay(10);
    }
  }</p><p>  if(val == 13)
  {
    for(int i=0; i<13; i++)
    {
      pixels.setPixelColor(i, pixels.Color(225, 96, 0));
      delay(10);
    }
  }</p><p>  if(val == 14)
  {
    for(int i=0; i<14; i++)
    {
      pixels.setPixelColor(i, pixels.Color(225, 64, 0));
      delay(10);
    }
  }</p><p>  if(val == 15)
  {
    for(int i=0; i<15; i++)
    {
      pixels.setPixelColor(i, pixels.Color(225, 32, 0));
      delay(10);
    }
  }</p><p>  if(val == 16)
  {
    for(int i=0; i<16; i++)
    {
      pixels.setPixelColor(i, pixels.Color(225, 0, 0));
      delay(10);
    }
  }</p><p>  if(val == 17)
  {
    for(int i=0; i<17; i++)
    {
      pixels.setPixelColor(i, pixels.Color(225, 0, 0));
      delay(10);
    }
  }</p><p>  if(val == 18)
  {
    for(int i=0; i<18; i++)
    {
      pixels.setPixelColor(i, pixels.Color(225, 0, 0));
      delay(10);
    }
  }
 
  pixels.show(); 
  
  delay(DELAYVAL);   
}</p>

Sketch file can be downloaded below:

Step 4: Result

For results can be seen in the video above.

So every time the potentiometer is rotated, the number and color of the LEDs on the ring will light up according to the number of turns done on the potentiometer.

Be the First to Share

    Recommendations

    • Instrument Contest

      Instrument Contest
    • Make it Glow Contest

      Make it Glow Contest
    • STEM Contest

      STEM Contest

    3 Discussions

    0
    None
    tytower

    5 weeks ago

    I could not find the "ino" file . Did you attach it?

    2 replies
    0
    None
    Sottongtytower

    Reply 4 weeks ago

    I'm sorry, I forgot to add it.
    now I have added the file. please check

    0
    None
    tytowerSottong

    Reply 4 weeks ago

    Good stuff thanks. Makes sure I don't get copy errors on trying to run the file. Good idea by the way . Can't wait to find a use for it at home here.