hrithik18k/night-light
This circuit employs a light-dependent resistor (LDR) and a transistor (Q1) to automatically turn on an LED in response to low ambient light levels.
- Version
- 1.0.1
- License
- unset
- Stars
- 0
dist/index.cjs
'use strict';
var jsxRuntime = require('react/jsx-runtime');
/**
* 5 V automatic night light.
*
* The LDR and R2 form a light sensor divider. In darkness the LDR resistance
* rises, SENSOR rises, and Q1 switches on the low-side LED load.
*/
function NightLight() {
return (jsxRuntime.jsxs("board", { width: "50mm", height: "30mm", layers: 2, children: [jsxRuntime.jsx("schematicsection", { name: "PowerInput", displayName: "5 V Power Input" }), jsxRuntime.jsx("schematicsection", { name: "LightSensor", displayName: "Light Sensor & Filter" }), jsxRuntime.jsx("schematicsection", { name: "TransistorSwitch", displayName: "Transistor Switch" }), jsxRuntime.jsx("schematicsection", { name: "LedLoad", displayName: "LED Load" }), jsxRuntime.jsx("pinheader", { name: "J1", pinCount: 2, gender: "male", pitch: "2.54mm", footprint: "pinrow2", pinLabels: ["VCC", "GND"], showSilkscreenPinLabels: true, schSectionName: "PowerInput", pcbX: -21, pcbY: 0, schX: -12, schY: 0 }), jsxRuntime.jsx("resistor", { name: "R5_LDR", resistance: "10k", footprint: "axial_p10mm", schSectionName: "LightSensor", pcbX: -11, pcbY: 8, schX: -4, schY: 6 }), jsxRuntime.jsx("resistor", { name: "R2", resistance: "100k", footprint: "0603", schSectionName: "LightSensor", pcbX: -5, pcbY: 2, schX: 0, schY: 2 }), jsxRuntime.jsx("capacitor", { name: "C1", capacitance: "100nF", footprint: "0603", schSectionName: "LightSensor", pcbX: 4, pcbY: 8, schX: 3, schY: 0, schRotation: 90 }), jsxRuntime.jsx("resistor", { name: "R1", resistance: "47k", footprint: "0603", schSectionName: "TransistorSwitch", pcbX: -1, pcbY: 0, schX: 4, schY: 4 }), jsxRuntime.jsx("resistor", { name: "R3", resistance: "100k", footprint: "0603", schSectionName: "TransistorSwitch", pcbX: 5, pcbY: 0, schX: 7, schY: 0 }), jsxRuntime.jsx("transistor", { name: "Q1", type: "npn", footprint: "sot23", schSectionName: "TransistorSwitch", pcbX: 10, pcbY: 0, schX: 10, schY: 0 }), jsxRuntime.jsx("resistor", { name: "R4", resistance: "330ohm", footprint: "0603", schSectionName: "LedLoad", pcbX: 15, pcbY: 7, schX: 14, schY: 0 }), jsxRuntime.jsx("led", { name: "LED1", color: "warm_white", footprint: "0603", schSectionName: "LedLoad", pcbX: 20, pcbY: 0, schX: 17, schY: 0 }), jsxRuntime.jsx("trace", { name: "power_input", from: "J1.VCC", to: "net.VCC" }), jsxRuntime.jsx("trace", { name: "ground_input", from: "J1.GND", to: "net.GND" }), jsxRuntime.jsx("trace", { name: "ldr_supply", from: "R5_LDR.pin1", to: "net.VCC" }), jsxRuntime.jsx("trace", { name: "ldr_sensor", from: "R5_LDR.pin2", to: "net.SENSOR" }), jsxRuntime.jsx("trace", { name: "threshold_sensor", from: "R2.pin1", to: "net.SENSOR" }), jsxRuntime.jsx("trace", { name: "threshold_ground", from: "R2.pin2", to: "net.GND" }), jsxRuntime.jsx("trace", { name: "filter_sensor", from: "C1.pin1", to: "net.SENSOR" }), jsxRuntime.jsx("trace", { name: "filter_ground", from: "C1.pin2", to: "net.GND" }), jsxRuntime.jsx("trace", { name: "base_drive", from: "R1.pin1", to: "net.SENSOR" }), jsxRuntime.jsx("trace", { name: "base_resistor", from: "R1.pin2", to: "net.BASE" }), jsxRuntime.jsx("trace", { name: "base_pulldown", from: "R3.pin1", to: "net.BASE" }), jsxRuntime.jsx("trace", { name: "pulldown_ground", from: "R3.pin2", to: "net.GND" }), jsxRuntime.jsx("trace", { name: "transistor_base", from: "Q1.base", to: "net.BASE" }), jsxRuntime.jsx("trace", { name: "transistor_emitter", from: "Q1.emitter", to: "net.GND" }), jsxRuntime.jsx("trace", { name: "transistor_collector", from: "Q1.collector", to: "net.LED_CATHODE" }), jsxRuntime.jsx("trace", { name: "led_supply", from: "R4.pin1", to: "net.VCC" }), jsxRuntime.jsx("trace", { name: "led_current_limit", from: "R4.pin2", to: "LED1.anode" }), jsxRuntime.jsx("trace", { name: "led_switch", from: "LED1.cathode", to: "net.LED_CATHODE" })] }));
}
module.exports = NightLight;