limchengwei
Published © CC BY

Addressable through hole LEDs

Thank you JLCPCB for sponsoring this project. Please order your PCB at jlcpcb.com/RAT

IntermediateWork in progress3 hours480
Addressable through hole LEDs

Things used in this project

Hardware components

JLCPCB Customized PCB
JLCPCB Customized PCB
×1
Arduino Nano R3
Arduino Nano R3
×1
PL9823 RGB Through hole LED 8mm
×32
Single Turn Potentiometer- 10k ohms
Single Turn Potentiometer- 10k ohms
×6
Female Header 15 Position 1 Row (2.54mm)
×2
DIP Switch 2 Pin Through Hole
×1
Through Hole Resistor, 51 ohm
Through Hole Resistor, 51 ohm
×32
Capacitor 100 nF
Capacitor 100 nF
×32

Software apps and online services

Arduino IDE
Arduino IDE

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)
Solder Wire, Lead Free
Solder Wire, Lead Free

Story

Read more

Schematics

Addressable through hole LEDs Schematic PDF

Addressable through hole LEDs Schematic

Addressable through hole LEDs PCB

Addressable through hole LEDs Gerber

Code

Addressable through hole LEDs code

Arduino
#include <FastLED.h>

#define NUM_STRIPS 2
#define NUM_LEDS_PER_STRIP 16
CRGB leds[NUM_STRIPS][NUM_LEDS_PER_STRIP];

#define Pot_H A0
#define Pot_S A1
#define Pot_V A2
#define Pot_R A3
#define Pot_G A4
#define Pot_B A5

int i, j;

void setup()
{
  pinMode (Pot_H, INPUT);
  pinMode (Pot_S, INPUT);
  pinMode (Pot_V, INPUT);
  pinMode (Pot_R, INPUT);
  pinMode (Pot_G, INPUT);
  pinMode (Pot_B, INPUT);
  FastLED.addLeds<PL9823, 2, RGB>(leds[0], NUM_LEDS_PER_STRIP);   //GRB
  FastLED.addLeds<PL9823, 3, RGB>(leds[1], NUM_LEDS_PER_STRIP);   //GRB
}

void loop()
{
  int Pot_H_val = map(analogRead(Pot_H), 0, 1023, 0, 255);
  int Pot_S_val = map(analogRead(Pot_S), 0, 1023, 0, 255);
  int Pot_V_val = map(analogRead(Pot_V), 0, 1023, 0, 255);
  
  int Pot_R_val = map(analogRead(Pot_R), 0, 1023, 0, 255);
  int Pot_G_val = map(analogRead(Pot_G), 0, 1023, 0, 255);
  int Pot_B_val = map(analogRead(Pot_B), 0, 1023, 0, 255);

  for (i=0; i<16; i++)
  {
    leds[0][i] = CHSV(Pot_H_val, Pot_S_val, Pot_V_val);
    FastLED.show();
  }
  for (j=0; j<16; j++)
  {
    leds[1][j] = CRGB(Pot_G_val, Pot_R_val, Pot_B_val);
    FastLED.show();
  }
  delay (10);
}

Credits

limchengwei

limchengwei

24 projects • 4 followers

Comments