TCS Pune

Arduino: LED and Digital GPIO

Practical lesson

Arduino: LED and Digital GPIO

Build the embedded-systems Hello World and understand safe GPIO current.

◷ 30 min

Parts and tools

  • Arduino Uno
  • LED
  • 220 Ω resistor
  • Breadboard and jumper wires

Lesson

Learning objective

Build the embedded-systems Hello World and understand safe GPIO current.

Procedure

  1. Review the circuit and confirm the board voltage.
  2. Build and inspect the wiring before applying power.
  3. Upload the example, observe the result and record your readings.
  4. Change one parameter, predict the result and test again.

Troubleshooting

Check power, ground, pin selection, polarity, compiler target and serial output. Use a multimeter or logic analyser where appropriate.

Advanced Practical Lab

Interactive circuit workspace

Download circuit
Circuit diagram
Circuit diagram for Arduino: LED and Digital GPIO
Breadboard wiring
Breadboard wiring for Arduino: LED and Digital GPIO

Pin-to-pin connections

Board pinComponent pinPurposeVoltage
Arduino D13220 Ω resistor inputLED control output5 V logic
Resistor outputLED anode (+)Current limitingApprox. 2 V LED drop
LED cathode (−)Arduino GNDReturn path0 V

Electrical safety warnings

  • Disconnect USB power before changing breadboard wiring.
  • Never connect an LED directly without a current-limiting resistor.
  • Observe LED polarity: the long lead is normally the anode (+).
  • Do not exceed the board's permitted GPIO current.
  • Ensure the development board and instrument share a common ground.

Measurement checkpoints

Multimeter

  1. With power disconnected, confirm there is no short between 5V and GND.
  2. Power the board and measure 5V relative to GND.
  3. Run the sketch and measure D13 in HIGH and LOW states.
  4. Measure directly across the LED while it is illuminated.

Expected readings

CheckpointExpectedToleranceInstrument
5V pin to GND5.0 V0.25 VMultimeter DC voltage
D13 HIGH to GND5.0 V0.4 VMultimeter DC voltage
Across red LED when ON1.8–2.2 V0.3 VMultimeter DC voltage
D13 output1 Hz square wave10%Oscilloscope

Oscilloscope references

SignalTest pointExpected waveform / frequency
D13 outputD13 relative to GND0–5 V square wave, approximately 1 Hz

Logic-analyser references

Bus / signalSettingsExpected result
Digital outputChannel 0 on D13, ground connectedAlternating HIGH/LOW every 500 ms

Troubleshooting decision path

LED does not illuminate

Check: Confirm LED polarity and D13 selection

Action: Reverse the LED if incorrect and verify the sketch pin

LED stays continuously ON

Check: Check uploaded loop and accidental 5V connection

Action: Rewire the resistor input to D13

Upload fails

Check: Check board, USB data cable and COM port

Action: Select the correct board/port and retry

Board resets or becomes hot

Check: Disconnect power and test for a short

Action: Correct wiring before reconnecting USB

Bill of materials

Download BOM CSV
QtyComponentValue / partNotes
1Arduino Uno compatible boardATmega328P5 V board
1LEDRed, 5 mmObserve polarity
1Resistor220 Ω, 0.25 WCurrent limiting
1BreadboardHalf size or largerSolderless
3Jumper wiresMale-to-maleConnections

Lab observation report

Log in to record measurements, upload evidence and submit this practical for approval.

Log in to submit

Example code

void setup(){ pinMode(LED_BUILTIN, OUTPUT); }
void loop(){ digitalWrite(LED_BUILTIN, HIGH); delay(500); digitalWrite(LED_BUILTIN, LOW); delay(500); }

Knowledge check

Why is a resistor used with an external LED?

Ready when you are

Need help with your laptop or computer?

Send us the model and fault details. Start your repair request online or contact TCS Pune directly.

WA