Building a Simple USB Flashlight
Overview
This tutorial will walk you through building a simple USB flashlight using tscircuit. We'll create a circuit that powers an LED from USB-C, controlled by a push button.
Objectives
A USB flashlight is a simple but practical project that demonstrates core circuit concepts:
- Power delivery - Using USB-C as a power source (5V VBUS)
- Current limiting - Protecting the LED with a resistor
- User interaction - Adding a push button for control
Bill of Materials
| Component | Value/Type | Purpose |
|---|---|---|
| USB-C Connector | SMD USB-C | Power input (5V) |
| Push Button | Through-hole | On/off control |
| LED | Red, 0603 | Light source |
| Resistor | 1kΩ, 0603 | Current limiting |
Circuit Design
Understanding the Circuit
The circuit operates on a simple principle:
- USB-C provides 5V power on the VBUS pins
- When the push button is pressed, current flows through the circuit
- The resistor limits current to protect the LED
- The LED illuminates when current passes through it
Step 1: USB-C Power Input
First, let's add the USB-C connector which will provide power to our circuit. The USB-C connector has multiple pins, but we only need VBUS (5V power) and GND.
Step 2: Adding the LED and Current-Limiting Resistor
LEDs require a current-limiting resistor to prevent damage. For a typical red LED with a forward voltage of ~2V and desired current of ~3mA:
Resistor calculation:
- USB voltage: 5V
- LED forward voltage: ~2V
- Desired current: ~3mA
- R = (5V - 2V) / 3mA = 1kΩ
Step 3: Adding the Push Button
The push button connects VBUS to the resistor when pressed, completing the circuit. When released, the circuit is open and the LED turns off.
Step 4: Complete Schematic
Now let's combine all components into the complete circuit:
PCB Layout
With the schematic complete, we can position components on the PCB. The layout is designed for a compact form factor:
- USB-C connector at the bottom for easy cable access
- Push button in the middle for ergonomic use
- LED at the top to project light forward
3D Preview
Here's the final 3D preview of the assembled board:
Ordering the PCB
You can order this PCB by exporting the fabrication files and uploading them to JLCPCB. Follow the instructions in Ordering Prototypes.
Modifications and Extensions
Consider these enhancements to customize your flashlight:
- Brighter LED: Use a white or high-brightness LED (adjust resistor accordingly)
- Multiple LEDs: Add more LEDs in parallel for increased brightness
- Different button: Use a latching switch for hands-free operation
- Battery power: Add a battery holder instead of USB-C for portable use