

Night light
night light circuit using photoresistor
- Size
- 17.8 × 22.9 mm
- Copper layers
- 2
- Thickness
- 1.6 mm
- Parts
- 5
- Nets
- 5
- Pads
- 11
- Tracks, vias
- 18, 0
- Routed
- Yes
- KiCad
- KiCad 7 (file 20221018)
- Created
- 30 Nov 2023
- Updated
- 4 Apr 2024
Overview
Night light is an open-source printed circuit board by vivian-dai, from the vivian-dai/night-light repository on GitHub, published under the MIT licence. It is a 2-layer board of 17.8 × 22.9 mm with 5 parts on 5 nets, routed with 18 tracks and 0 vias.
Its parts include 3 resistors, 1 diode and 1 transistor.
README
README.mdnight-light
I thought I should have some hardware projects on my Github so I decided to start with a fairly simple one. This is a night light that lights up when it's dark enough.
3D Render
Components List
- 330 ohm resistor
- 100k ohm resistor
- BC547 (NPN transistor)
- photoresistor
- LED
- power source
Creation Process

Above is the final schematic for this circuit. There are two parts to it, first is the right side which uses an NPN transistor as a switch. The left side is a voltage divider.
LED Math
These calculations were done to figure out the required resistance for the LED.
Typically, the forward voltage of an LED is between 1.8 and 3.3 volts
-- Wikipedia
The specific LED I was using has a forward voltage drop of around 2V and needs about 10mA for it to function optimally. Using Ohm's law, we can calculate the required resistance.
$$ R = \frac{V_{power} - V_{forward}}{I} = \frac{6 - 2}{0.01} = 400 $$
I don't have a 400 ohm resistor. 330 is close enough (alternatively 470 would work too but I don't have that either).
Transistor as Switch
When looking at the datasheet for the transistor I used, it says the minimum voltage to turn the base on is 580mV. This means as long as a value greater than 580mV is passing through the base, there will be a current flowing from the collector to the emitter.
Voltage Divider Math
The formula for voltage dividers can be found with a quick search.
Above is an image from Wikipedia. Wikipedia also gives us the formula for a voltage divider as
$$ V_{out} = V_{in}\frac{R_2}{R_1 + R_2} $$
In the schematics I drew up, $R_2$ of the voltage divider formula is the photoresistor and $R_1$ from the formula is the 100k resistor. This was determined by knowing the resistance of a photoresistor increases as it gets darker and when it's darker, we want more voltage. Since we want voltage and resistance to be porportional, the photoresistor should be $R_2$. I took a multimeter and measured the value of the photoresistor under normal light conditions. It was about 10k. We know $V_{in}$ is 6V and we want $V_{out}$ to be 0.58V so we now need to solve for the value of $R_1$.
$$V_{out} = V_{in}\frac{R_2}{R_1 + R_2}$$
$$0.58 = 6\frac{10}{10 + R_1}$$
$$5.8 + 0.58R_1 = 60$$
$$0.58R_1 = 54.2$$
$$R_1 \approx 93.4$$
I don't have a 93.4k resistor so I used an 100k resistor.
Parts
5| Qty | Value | Footprint | References |
|---|---|---|---|
| 1 | 100k | Resistor_THT:R_Axial_DIN0204_L3.6mm_D1.6mm_P5.08mm_Horizontal | R2 |
| 1 | 330 | Resistor_THT:R_Axial_DIN0204_L3.6mm_D1.6mm_P5.08mm_Horizontal | R3 |
| 1 | LED | LED_THT:LED_D1.8mm_W3.3mm_H2.4mm | D1 |
| 1 | NPN | Package_TO_SOT_THT:NEC_Molded_7x4x9mm | Q1 |
| 1 | R_Photo | OptoDevice:R_LDR_4.9x4.2mm_P2.54mm_Vertical | R1 |
Similar boards
- 2 layers98 × 27 mm

- 2 layers21 × 33 mm

24g2usb pico2w
joypad-ai/joypad-os
Universal controller firmware for building adapters, dongles, and custom controllers.
5 parts1.7kApache-2.0 - 2 layers53.2 × 59.6 mm

A10 OLinuXino Lime Rev B SHIELD TEMPLATE
OLIMEX/OLINUXINO
OLINUXINO is Open Source / Open Hardware, low cost from EUR 24 Linux Industrial grade Single Board Computer capable to operate -25+85C
5 parts1.5k - 2 layers30 × 11 mm

Main control board servo tester
jamro/tiny-engineer
A small desktop robot that brings an AI coding assistant to life, physically acting out when it reads files, thinks, writes code, and finishes work.
5 parts1.1k - 2 layers78.8 × 35.3 mm

KiCadTest
hackclub/OnBoard
💡 Join 1,000 teenagers and make your first PCB with a $100 grant!
5 parts915 - 2 layers50 × 23 mm

- 2 layers43.2 × 28.5 mm

- 2 layers20.3 × 15.2 mm

L0 light sensor
Luos-io/luos_engine
Open-source and real-time orchestrator for cyber-physical-systems, to easily design, test and deploy embedded applications and digital twins.
5 parts546MIT
Questions
How big is the Night light PCB?
It measures 17.8 × 22.9 mm and has 2 copper layers, 1.6 mm thick.
What parts does the Night light use?
5 parts. The full list of its parts is on this page, with links to each part's symbol and footprint where PCBKit's library has them.
Where can I download the Night light KiCad files?
From the vivian-dai/night-light repository on GitHub, at the commit this page was made from: the board is night-light/night-light.kicad_pcb and its schematic night-light/night-light.kicad_sch. PCBKit opens the board in the browser, with nothing to install.
Can I use the Night light design in my own project?
Its repository publishes it under the MIT licence: you may reuse it on that licence's terms (keep the author's notice, and for a copyleft licence share your changes alike).