diff --git a/docs/tutorials/building-a-simple-usb-flashlight.mdx b/docs/tutorials/building-a-simple-usb-flashlight.mdx index bdf3473..f851fcd 100644 --- a/docs/tutorials/building-a-simple-usb-flashlight.mdx +++ b/docs/tutorials/building-a-simple-usb-flashlight.mdx @@ -5,10 +5,30 @@ description: Learn how to build a simple USB-powered flashlight circuit using ts ## Overview -This tutorial will walk you through building a simple USB flashlight using -tscircuit. - -import TscircuitIframe from "@site/src/components/TscircuitIframe" +This tutorial will walk you through building a simple USB flashlight using +tscircuit. The circuit takes 5V from a USB-C connector, routes it through a +pushbutton, and lights an LED through a current-limiting resistor. + +import TscircuitIframe from "@site/src/components/TscircuitIframe" +import CircuitPreview from "@site/src/components/CircuitPreview" + +## What You Will Build + +The finished board has four parts: + +- a USB-C connector for power input +- a normally-open pushbutton for user control +- a resistor to limit LED current +- a red 0603 LED as the light source + +## Circuit Requirements + +This small flashlight needs to: + +- connect USB VBUS to the button input +- connect the button output to the LED through a resistor +- return the LED cathode to USB ground +- keep the board narrow enough to behave like a small USB accessory { ) } -`} /> +`} /> + +## Building the Circuit Step by Step + +### Step 1: Add the USB-C Power Input + +Start with a small board and place the USB-C connector near one end. The VBUS +pins provide the 5V rail and the GND pins provide the return path. + + ( + + + +) +`} /> + +### Step 2: Add the Pushbutton + +The pushbutton sits between USB VBUS and the resistor. Pressing it completes the +positive side of the LED circuit. + + ( + + + .pos", pin2: "net.VBUS" }} + pcbX={0} + pcbY={-1} + /> + + +) +`} /> + +### Step 3: Add the LED and Current-Limiting Resistor + +The resistor protects the LED by limiting current. A `1k` resistor is a safe, +conservative value for a small indicator-style USB flashlight. + + ( + + + .pos", pin2: "net.VBUS" }} + pcbX={0} + pcbY={-1} + /> + + + + + +) +`} /> + +## Final Notes + +Use the 3D preview to check that the connector, button, resistor, and LED are +spaced comfortably on the board. For a brighter flashlight, lower the resistor +value after checking the LED's current rating and the available USB power.