Skip to main content

Dark Detecting Nightlight

Lesson Overview#

Lesson 3 PCB fully assembled

In this lesson you’ll learn how to build a nightlight that illuminates when it gets dark. You'll also learn about the light-dependent resistor, the component that makes this design possible. And, you'll get your first taste of a Patchr quiz — don't worry, no need to study, you're sure to ace it.

Lesson 3 Bill of Materials

Take a look at the BOM and you're likely to see a few familiar components.

You've no doubt used a switch before and probably have hundreds of LEDs illuminating your life.

The transistor and the light-dependent resistor are more specialized components. Each BOM entry includes a link to the Patchr Glossary that gives more in depth information about each component.

Light-Dependent Resistor

The star of this circuit is the light-dependent resistor (LDR). LDRs are not polarized and may be inserted into a circuit without regard for orientation. You can really think of them just like a normal resistor, but that their resistance will change based on the ambient light.

An illustration of a Photoresistor schematic symbol

When light shines on the LDR, the resistance of the LDR decreases.

As you might imagine, being able to design a device that responds to light levels is a very powerful ability.

Night Light Schematic#

Take a look at the schematic for the lesson and see if you can determine how each component affects the circuit before reading the explanation. It's OK if you're not sure what all the components do.

Lesson 3 Schematic: How is the LDR being used in the circuit?

Nightlight customization begins with the board shape. In this step you can create a custom board shape using the built-in drawing tools found in the left toolbar or you can upload a custom SVG file from your computer using the toolbar on the right of the screen.

Board Shape Design#

Regardless of which customization tool you decide to use, there are a few things to keep in mind while designing.

  • The custom board cannot exceed 100x100mm. The design window shows this with light red shading and OUT OF BOUNDS text. If your shape exceeds the boundary, you will get an error notification and be unable to advance to the next step in the design process.

  • The white area inside the red shading denotes the space you have to work with for your board shape.

  • The dotted red lines that make a small rectangle indicate the minimum size your board can be — if you made your board any smaller than this area, you would not be able to layout your components or route them.

Zooming & Moving#

  • Zooming in and out can be done with the icons in the left toolbar or by using your mouse's scroll wheel.

  • To reorient your design workspace, hold the right mouse button down and drag the workspace to your desired location.

  • To move your custom board shape, click on the Move Selected tool in the left hand toolbox. Then click and drag your shape to the location you want.

Built-In Drawing Tools#

The toolbox on the left of the screen features the draw polygon path, draw freehand path, draw rectangle, and draw circle tools. These tools allow for simple shape customization within Patchr.

Once you have a shape drawn, you can use the tools on the right side of the screen to scale up or down your shape and rotate it.

When you are happy with your custom board shape, click on the NEXT > button to advance to the layout step.

Uploading an SVG File#

To really get the most out of board shape customization, you can upload single-path SVG files into the editor.

  1. First ensure your SVG is using a single path.
  2. Click on the Choose File button under the Upload SVG heading in the righthand side toolbar.
  3. Assuming your SVG is compatible, you should see your custom board shape in the editor. You may need to use the scaling and rotation tools — also in the righthand side toolbar — to tweak the placement and size of your SVG.
  4. Once you're happy with the size and shape of your custom board, click the NEXT > button to advance to the layout step.

Note that SVG files are a specialized type of image file which are made up of vector coordinates. If you're new to vector files and vector drawing, check out Inkscape, which is a popular free and open source vector drawing program.

Component Placement#

Lesson 3 Layout

Layout Considerations#

Before you do any placement of components, consider a few things you know about how the circuit works and how the circuit will be used.

  • What placements allow for easy battery insertion and removal?

  • Where could you place the switch so it's easy to turn on and off?

  • Keep in mind what components need to be electrically connected to each other. Consider placing those closer together in your layout to make routing that much easier.

Lesson 3 Schematic

Routing#

Lesson 3 Routing Guide

Routing is the act of drawing copper traces between components on a PCB to create a circuit. When routing, you'll want to refer to your schematic as you work. The schematic shows you what components need to be connected. However, that doesn't always mean copy the exact shape of the routes between them.

Lesson 3 Schematic

In fact, most of the time the traces that you route between components will have completely different shapes than the schematic, and that's OK.

Routing Tips#

  • When positioning a route between components, make sure that the route you are creating doesn't block the way for other routes needed for nearby components. You may find your layout of a component wasn't ideal and you want to move it, just click < BACK and make the layout adjustment.

  • Start by routing your power and ground traces.

  • Focus on components that use multiple traces, since they will require more complex routing.

Verifying the Routes#

Once you've put down all your routes, click NEXT>. As soon as you click, the Patchr Editor will verify that your routes do not violate any of the design rules like no overlapping routes. If all the routes look good, the Editor will let you advance to the Silkscreen step.

Silkscreen#

A silkscreen layer is typically used for marking where components go and adding company logos and product names to a PCB.

You'll find the drawing tools in the tool bar to the left of your screen.

Reference designators are also commonly used on silk screens and are especially helpful when you have two similar components with different values.

For example you have two resistors in a project, but each resistor has a different value. To help keep things straight, one resistor would be called R1 and the other R2. You'll see these reference designators again during the assembly instructions. For now, it's enough to be aware of them and how helpful they can be.

Submit Your Design#

Once you have your PCB looking the way you want. Click NEXT > and your board will head to your teacher for review before manufacturing.

Congratulations, your first custom PCB is almost ready to be manufactured, and then shipped to you for soldering!