Same-day dispatch before 2 PM · Free delivery over ₹999 · GST invoices Get the appPrices incl. GST
Geekobot
Snap & SendNEWGeeko AIWhere's myOrder
Log in
Products
  • Projects
    • Component guidesHow parts work, with code you can run
    • Learning pathsFrom your first LED to your first robot
    • Workshops & eventsOnline sessions for makers and classes
    • ElectrolarkFree guided builds, simulator and certificates
    • Students & teachersStudent discount and classroom help
    • CommunityShare builds and ask other makers
    • CalculatorsOhm's law, LED resistor, 555 and 100+ more
    • Circuit builderWire parts and run the circuit, powered by Electrolark
    • Geeko AIAsk what to buy or how to wire it
    • Snap & SendPhotograph a part or list, we find it
    • Part finderAnswer a few questions, get the right part
    • Compatibility checkWill these two parts work together?
    • Compare partsSpecs side by side
    • Business & bulk ordersGST invoices, credit and volume prices
    • Request a quotationSend your list, get a quote
    • Classroom kitsPer-student kits and lab bundles
    • Gift cardsFor students, teams and events
  • Atal Tinkering Lab
BOM to cart
Geekobot

Components, kits and know-how for makers, students, engineers, labs and businesses across India.

Ask Geeko AIOrders, parts and projects, any timeEmail supportReply within 1 working dayGet the Geekobot appAdd it to your home screen, free

Follow us

Shop

  • Boards & SBCs
  • Sensors & Modules
  • IoT & Wireless
  • Drone & FPV
  • 3D Printing
  • Filaments & Resins
  • Motors & Drivers
  • Power & Batteries
  • Semiconductors
  • Passive
  • Displays & LEDs
  • Switches & Relays
  • Wires & Cables
  • Prototyping
  • Tools & Test
  • Robotics
  • STEM Kits
  • Atal Tinkering Lab
  • Mechanical Parts
  • Audio

Orders

  • Track your order
  • Help & support
  • Shipping and delivery
  • Refunds and cancellation
  • Contact us

Learn

  • Projects
  • Geeko AI project assistant
  • Learning paths
  • Guides
  • Calculators
  • Electrolark: free guided builds

Part tools

  • Part finder
  • Compare parts
  • Will it work with my board?

Institutions

  • Classroom kits
  • Atal Tinkering Lab
  • Students & teachers
  • Workshops & Events

Business

  • Business & education
  • Request a quotation
  • BOM bulk upload
  • Quick order by SKU

Company

  • About Geekobot
  • Community
  • Gift cards
  • Terms & conditions
  • Privacy policy
  • Product directory
  • Sitemap

© 2026 Geekobot, a trade name of OLatus Systems Private Limited. All rights reserved.

20, 1st Floor, Neeladri Complex, 10th Cross, Sampige Rd, 2nd Main, Malleshwaram, Bengaluru, Karnataka 560003 · GSTIN 29AACCO0462F1ZM

+91 91810 15607 · connect@geekobot.in · Monday to Saturday, 10 AM to 2 PM IST

UPI · CARDS · NETBANKING · GST INVOICES

ShopProjectsGeeko AIGuides
Compare 0 parts →
Log in

Shop by category

Shop all components
  • Boards & SBCs1,910 products
    • Alternative Single Board Computers
    • Arduino Ecosystem
    • FPGA & Logic Boards
    • Microcontroller & Wireless Boards
    View all
  • Sensors & Modules4,701 products
    • Biomedical & Heart Rate
    • Current, Voltage & Power
    • Force, Weight & Pressure
    • Gas, Weather & Environmental
    View all
  • IoT & Wireless2,314 products
    • RF Modules
    • RFID & NFC
    • Antennas & RF Accessories
    • Cameras & Smart Vision
    View all
  • Drone & FPV3,558 products
    • Flight Control & Navigation
    • FPV Video & Optics
    • Frames & Structural Parts
    • Motors & Propulsion
    View all
  • 3D Printing2,204 products
    • 3D Printers
    • 3D Scanners & Digitizers
    • Laser Engravers & Cutters
    • Material Management & Upgrades
    View all
  • Filaments & Resins1,472 products
    • Filaments
    • Photopolymer Resins
    View all
  • Motors & Drivers463 products
    • BLDC Motor Drivers
    • DC & Geared Motors
    • DC Motor Drivers
    • Linear Actuators & Solenoids
    View all
  • Power & Batteries557 products
    • Battery Holders & Connectors
    • Breadboard Power
    • Chargers & BMS
    • DC-DC Converters
    View all
  • Semiconductors295 products
    • Diodes & Rectifiers
    • Interface & RF Encoder ICs
    • Logic ICs (74xx)
    • Logic ICs (CD4000)
    View all
  • Passive67 products
    • Capacitors
    • Circuit Protection
    • Crystals & Oscillators
    • Inductors
    View all
  • Displays & LEDs572 products
    • 7-Segment & Dot Matrix
    • Addressable LEDs
    • Character LCDs
    • Graphic LCDs
    View all
  • Switches & Relays184 products
    • Keypads & Touch
    • Push Buttons & Tactile
    • Relay Modules
    • Relays
    View all
  • Wires & Cables233 products
    • Board-to-Wire Connectors
    • Crimp & Splice
    • Headers & Dupont
    • Heat Shrink & Sleeving
    View all
  • Prototyping101 products
    • Breadboards
    • Interface Modules
    • PCBs & Perfboards
    View all
  • Tools & Test717 products
    • Bench Power Supplies
    • Hand Tools
    • Measuring Tools
    • Meters & Testers
    View all
  • Robotics180 products
    • Humanoid & Legged Robots
    • Robot Chassis & Platforms
    • Robotic Arms & Grippers
    • Wheels & Casters
    View all
  • STEM Kits268 products
    • Arduino Learning Kits
    • Coding & IoT Kits
    • Early Coding (Ages 3-8)
    • Invention Kits
    View all
  • Atal Tinkering Lab196 products
    • Package 1: Electronics, Robotics, IoT and Sensors
    • Package 2: Rapid Prototyping Tools
    • Package 3: Mechanical, Electrical and Measurement Tools
    • Package 4: Power Supply, Accessories and Safety Equipment
    View all
  • Mechanical Parts212 products
    • Bearings
    • Brackets & Mounts
    • Couplers
    • Fasteners & Standoffs
    View all
  • Audio109 products
    • Amplifier Modules
    • Buzzers & Sirens
    • Speakers
    View all
  1. Home
  2. ›Guides
  3. ›Displays & LEDs
  4. ›LEDs Explained
Step 7 of 18 in Electronics from zeroPart of a learning path.
Next

Component guide · Beginner · 3 min read

LEDs Explained

Polarity, Forward Voltage and Resistor Values

By Geekobot Learning Team · Updated 24 Oct 2026

I'm using
Wiring, code and the Run it panels follow your board.
On this page
Short answerWhich leg of an LED is positive?LED resistor values for common suppliesDriving LEDs from microcontroller pinsDimming an LED with PWMTypes of LEDsTry itCommon mistakesFAQsParts and next steps
Short answer

An LED (light-emitting diode) lights when current flows from its longer leg (anode, +) to its shorter leg (cathode, -). It needs a series resistor to limit current: R = (supply voltage - LED forward voltage) / current. A red LED on 5 V at 15 mA needs about 200 Ω, so use 220 Ω. White and blue LEDs drop about 3 V, red about 2 V.

Key specs at a glance

Polarity
Long leg = anode (+), short leg / flat edge = cathode (-)
Typical current
5 mm LED: 10 to 20 mA (20 mA max for most)
Forward voltage
Red/yellow 1.8 to 2.2 V; green 2 to 3.2 V; blue/white 2.8 to 3.3 V
Resistor formula
R = (Vsupply - Vf) / I
Dimming
PWM from a microcontroller pin
01

Which leg of an LED is positive?

The longer leg is the anode (+). The shorter leg is the cathode (-), and the LED's rim has a flat edge on the cathode side. Inside a clear LED, the larger metal piece is usually the cathode. If an LED does not light, try reversing it; a brief reverse connection at 5 V with a resistor will not damage it.

02

LED resistor values for common supplies

Using R = (Vsupply - Vf) / I, rounded up to standard values:

SupplyRed (2.0 V) at 15 mAGreen (3.0 V) at 15 mABlue/white (3.1 V) at 15 mA
3.3 V100 Ω22 Ω (or run at 10 mA with 33 Ω)22 Ω
5 V220 Ω150 Ω150 Ω
9 V470 Ω470 Ω470 Ω
12 V680 Ω620 Ω680 Ω
3.3 V
Red (2.0 V) at 15 mA:
100 Ω
Green (3.0 V) at 15 mA:
22 Ω (or run at 10 mA with 33 Ω)
Blue/white (3.1 V) at 15 mA:
22 Ω
5 V
Red (2.0 V) at 15 mA:
220 Ω
Green (3.0 V) at 15 mA:
150 Ω
Blue/white (3.1 V) at 15 mA:
150 Ω
9 V
Red (2.0 V) at 15 mA:
470 Ω
Green (3.0 V) at 15 mA:
470 Ω
Blue/white (3.1 V) at 15 mA:
470 Ω
12 V
Red (2.0 V) at 15 mA:
680 Ω
Green (3.0 V) at 15 mA:
620 Ω
Blue/white (3.1 V) at 15 mA:
680 Ω
03

Driving LEDs from microcontroller pins

  • ✓Arduino Uno R3: up to 20 mA per pin is fine.
  • ✓Arduino Uno R4, ESP32, Pico: keep each pin to about 8 to 12 mA. Use 330 Ω to 1 kΩ for indicator LEDs; modern LEDs are bright even at 2 to 5 mA.
  • ✓For many LEDs or high-power LEDs, switch them with a transistor or MOSFET, or use addressable LEDs.
04

Dimming an LED with PWM

Microcontrollers dim LEDs by switching them on and off hundreds of times a second (PWM). The duty cycle sets brightness.

Fade an LED on a PWM pin · Arduino C++Verify & upload in Electrolark
const int LED = 9;   // a PWM pin (~)

void setup() { pinMode(LED, OUTPUT); }

void loop() {
  for (int b = 0; b <= 255; b++) { analogWrite(LED, b); delay(5); }
  for (int b = 255; b >= 0; b--) { analogWrite(LED, b); delay(5); }
}
05

Types of LEDs

TypeWhat it isNotes
3 mm / 5 mm indicatorStandard through-hole LED10 to 20 mA, needs a resistor
RGB (common cathode or anode)Three LEDs in one packageNeeds one resistor per colour
Addressable (WS2812B)RGB LED with built-in controllerOne data pin for many LEDs
1 W / 3 W power LEDHigh-brightness emitterNeeds a constant-current driver and heatsink
IR LEDInfrared emitterRemote controls, obstacle sensors
3 mm / 5 mm indicator
What it is:
Standard through-hole LED
Notes:
10 to 20 mA, needs a resistor
RGB (common cathode or anode)
What it is:
Three LEDs in one package
Notes:
Needs one resistor per colour
Addressable (WS2812B)
What it is:
RGB LED with built-in controller
Notes:
One data pin for many LEDs
1 W / 3 W power LED
What it is:
High-brightness emitter
Notes:
Needs a constant-current driver and heatsink
IR LED
What it is:
Infrared emitter
Notes:
Remote controls, obstacle sensors
06

Try it: LED resistor calculator

Change the values and the diagram and results update as you type.

07

Common mistakes to avoid

  • !Connecting an LED without a resistor; it burns out or damages the pin.
  • !Sharing one resistor between LEDs in parallel; one LED hogs the current.
  • !Running high-power LEDs from a resistor and a battery instead of a constant-current driver.
  • !Wiring a common-anode RGB LED as common-cathode; the colours invert or nothing lights.
  • !Exceeding the current limit of ESP32 or Pico pins with bright LEDs.
08

Frequently asked questions

What resistor should I use for an LED on 5 V?

220 Ω for red, yellow and orange LEDs, and 150 Ω for green, blue and white, giving about 15 mA. Use 330 Ω to 1 kΩ if you only need an indicator.

Can I connect an LED directly to 3.3 V?

Not safely without a resistor, even though the voltage is close to the LED's forward voltage. Small changes cause large current changes. Use 68 to 100 Ω for red or 22 to 33 Ω for blue/white.

How do I know if an LED is burnt out?

Use the diode test setting on a multimeter: a working LED glows faintly and shows its forward voltage in one direction only.

Can I run several LEDs in series?

Yes, if the supply is higher than their total forward voltage. Three red LEDs (6 V total) on 12 V at 15 mA need (12 - 6) / 0.015 = 400 Ω, so use 390 or 470 Ω.

Why does my LED flicker on camera?

PWM dimming switches the LED on and off; a camera can pick this up. Raise the PWM frequency or use a constant-current dimming driver.

Parts for this guide

  • Resistor Assortment Kit (30 Values)
    ₹33View
  • Solderless Breadboard
    ₹68View
  • WS2812B Addressable RGB LED Strip (60 LEDs/m)
    ₹2,800View
Shop LEDs & IndicatorsShop 7-Segment & Dot Matrix

Calculators

LED resistor calculatorLED strip power calculator

Terms in this guide

Forward voltageThe voltage a diode or LED drops when conducting: about 0.7 V for silicon diodes, 1.8 to 3.3 V for LEDs.Ohm's lawV = I x R: voltage equals current times resistance.PWMPulse-width modulation: switching a signal on and off quickly so its average sets brightness, speed or position.Duty cycleThe percentage of time a PWM signal is high. 50% duty is on half the time.Anode and cathodeThe anode is the positive terminal of a diode or LED and the cathode the negative. Current flows from anode to cathode.

Projects that use it

Put this into practice: 367 step-by-step builds in our project library use parts from this guide.

Beginner · 1 hourLPG gas leak alarmView projectBeginner · 45 minutesFlame detector fire alarmView projectBeginner · 1 hourPIR intruder alarmView project
Browse all 367 projects

Keep learning

Component guideBeginnerResistors ExplainedWhat resistors do, how to read 4- and 5-band colour codes and SMD codes, Ohm's law, power ratings, standard values and uses: LEDs, pull-ups, dividers.4 min read · Passive ComponentsHow-toIntermediateWS2812B Addressable LEDs (NeoPixel)WS2812B LEDs (often called NeoPixels) contain a red, green and blue LED plus a tiny controller, so each LED on a strip can be set to any colour from one data pin.3 min read · Displays & LEDsHow-toIntermediateTransistors and MOSFETs as SwitchesA transistor lets a small microcontroller signal switch a much larger current.4 min read · Semiconductors & ICsHow-toBeginnerHow to Use a BreadboardA solderless breadboard lets you build circuits by pushing parts and wires into holes, with no soldering.3 min read · Prototyping & Wiring

Sources

  • Kingbright and Everlight 5 mm LED datasheets
  • Arduino analogWrite() reference

Written by the Geekobot team from manufacturer datasheets. Always check the datasheet for the exact part and variant you buy.

On this page
Short answerWhich leg of an LED is positive?LED resistor values for common suppliesDriving LEDs from microcontroller pinsDimming an LED with PWMTypes of LEDsTry itCommon mistakesFAQsParts and next steps
Need a hand?Ask Geeko AI which part fits your project, or talk to the Geekobot team.Ask Geeko AIHelp & support

Parts for this guide3 items · ₹2,901

Resistor Assortment Kit (30 Values) · Solderless Breadboard · WS2812B Addressable RGB LED Strip (60 LEDs/m)

Run itChange the inputs and watch the output
LED on pin 9 OFF
0analogWrite

A simulation of the sketch above, so you know what to expect. Real readings vary with your parts and wiring.

Ask the Community

Ask a question