(fast paced music) - On the last episode, we created a schematic symbol
for our 555 badge project. This time we'll be using
that symbol and connecting it to parts we find in other
libraries to make out full circuit This is an important step in
the board creating process as we need to tell
KiCad how our components are connected together. Schematic capture also
known as schematic entry is the process by which the
designer, us in this case, creates the circuit
diagram in the Cad program. We'll be using KiCad's
EE Schema for this part. Often, PCB layup programs
aren't really good at helping you design
circuits but some are starting to include simulation programs
also known as SPICE programs. While we're glossing over the
whole circuit design part, our fading LED circuit was
based on a flashing LED example from 555 timercircuits.com. This program is LT-SPICE. A free circuit simulation program. A transistor was added
to allow more current to flow through two LEDs and a large 100 microfarad capacitor was connected to the transistor's base. This causes the voltage
on the positive side of the capacitor to now
slowly rise and fall which in turn means a
slow increase and decrease of current flowing into
the transistor's base. If we run the simulation and measure the current flowing through the LEDs, we can see how they will, in theory, slowly increase and
decrease in brightness. I won't go into the
details of using LT-SPICE but if you're curious,
Sparkfun has a very good tutorial on getting started with it. Once the circuit has been simulated, I like to build it on a
bread board to make sure everything works in reality. Sometimes, the simulator
doesn't catch all the little variations in parts,
capacitors and wires and so on. Here, we're see the
LEDs fading as expected. Now that we've proven
that the circuit works, I like to re-draw it on
some engineering paper to organize the parts in
a way that's easy to read before entering into EE Schema. Open KiCard and you'll be greeted by the familiar project manager window. Click tools run EE schema to start the schematic capture program. You should see a red colored
border with numbers and letters On very complex schematics, it can be handy to refer to sections. For example you might say there's an issue with the filter design in b4 and other engineers could
locate that section easily. The bottom right contains some fields that provide information
about the schematic which can be very helpful
if you have several pages or different versions
printed out on your desk. It's always a good idea
to fill this part out in case you ever want
to share your schematic or keep track of changes. To do that go to file, page settings. In the window that pops up,
click the three arrow button to copy today's date into the date field. You can use whatever
versioning system you like but I like to use a simple
incrementing numbering system. So I'll write v01 here. I'll write the same v01
on the PCB somewhere so I know that it's based on
this particular schematic. If I ever make changes to the hardware, I'll change the schematic in
PCB to V02 then V03 and so on. We'll write the title as 5 5 5 badge and leave the company line blank. The comment lines are a
good way to write things like the author and license. For some reason the comment
lines appear backwards so we'll write author your name
in the fourth comment line. We want people to be
able to use this board for other purposes so we'll
have it be open source under the Creative Commons license. write license cc-by 4.0 in the third line and creativecommons.org slash
licenses slash bi slash 4.0 slash in the second. Click OK and you should
see the title block filled out with your information. Click place component to go
into the place component mode. Notice that your cursor changes
to a sort of pen symbol. Click anywhere in the schematic sheet to open the part chooser. Expand our custom 555
badge library, select 7555 and you should see the
symbol that we created in the last episode up here. Click OK and the symbol
should appear on your cursor. Click somewhere in the
middle of the schematic sheet to drop the component. As in the library editor
you can hover your mouse over the part and press
the M key to move the part. With the part on your cursor,
you can press R to rotate it. You can click to place the
component in a new location or press the Escape key to cancel. Instead of using the place drop down menu to pick a part every time, you can also click the place
component button on the right or just press the A key to
bring up the component chooser. Let's go ahead and add
all of our resistors. In addition to our 555
badge library that we made, you can also browse through
all of the libraries that come default with KiCad. These have some very useful components so it can be handy to
look through here first. Expand the device library,
scroll down and click on R. This is our basic resistor
component in KiCad. Click OK. Click to place the first resistor above and to the left of the discharge pin. Click again to bring up the
component chooser window. Remember, we're still in
the place component mode. R should already be selected
since it was the last component we chose so just click OK or press Enter. Place this resistor a few grid
marks down from the first one Click again. Make sure R is selected and
click OK to get a third resistor With the resistor on your cursor, press the R key to rotate it. With this resistor horizontal, place it down into the
right of the out pin. My goal is to place all of the components in the general area of
where they need to go based on my hand-drawn schematic. Usually I'll have this
schematic on my desk so I can reference it easily
but that's a little hard to do with this screen capture
program so I'll just overlay a picture of it so you
can reference it too. Continue placing all seven resistors. Don't worry about exact placement. We can fix that later. These are great generic resistors but it can be handy to show their values. Hover over the first
resistor and right-click. If you're asked to choose
between a field value and component, select the component. In the pop-up menu select
edit component and value. Where it says text replace R
with the value of our resistor which is 22K in this case. Don't worry about adding the ohm symbol. Most schematics assume
the units for resistors. Click OK. A faster way of doing this
is to hover your mouse over the resistor and
press the V key for value. Do this for the second resistor and change its value to 330K. Repeat this process for
the rest of the resistors referring to the example circuit
diagram for resistor values Once you're done, press the A key to bring up our part chooser again. We want to add our two capacitors next. Instead of trying to browse through all the components in the library, we can also use the search
function to make life easier. Type C in the filter and you should see a selection of capacitors appear. C is a regular unpolarized
capacitor but we don't want that. Our 10 and 100 micro farad
values will be too big for most ceramic type capacitors
so we'll rely on polarized electrolytic capacitors which
means we'll want to show that they're polarized in the schematic. CP means capacitor polarized. KiCad's default is to have the
positive bar of the capacitor be hollow but I'm not a fan of that look. The curved negative bar is
what I learned in school so I'll go with that. It's really a matter
of personal preference as to how you want your schematic to look so choose whichever you like. I'll place the first capacitor
just below the 330k resistor. Note that the positive
side should be facing up as we'll connect the negative
side to ground eventually. Place a second capacitor in
parallel with the 100k resistor Give the first capacitor
a value of 10 microfarads and the second a value of 100 microfarads. All components that
have some kind of value and aren't resistors
should have the units shown which is why we write
an F for the capacitors. Press A to open the component
chooser and search for LED. Select the first LED option and press OK. Rotate it so that the current
will flow down through the LED and place it below one
of the 100 ohm resistors. Because the LED symbol
shows that it's an LED and not just a diode,
thanks to the little arrows, having led as the value
is a little redundant. It's often helpful to change the value to the color of the LED we want. So press V over the LED and
change the text from led to red You can also copy components
so that you can keep the value and other attributes
you might have assigned. Hover your mouse over the
LED and press the C key. A new LED will appear on your cursor. Click to place it below
the other 100 ohm resistor. Press A to open the component chooser. We want to transistor but
here's the tricky part. Depending on the type and manufacturer some of the pins might be swapped. So we need to know what
transistor we want to use before putting one in our schematic. The 2N3 904 is a very common
and very cheap NPN bipolar Junction transistor that will work just fine with our circuit. If we look at the data sheet
we can note that the pins go emitter base collector with
the flat edge facing up. Back in our component chooser,
we can search for 2N3 904 and see that the pins line up with the one from the datasheet emitter base collector. Select it and click OK and
place it so that the base lines up with the 10k resistor. We're almost done but
there's a slight problem. KiCad doesn't have a battery
holder or slide switch that we need for our board. The good news is that
Digi-key has it in their KiCad library so let's go download that. This is another example of
where that messy, chaotic nature of board layout comes into play. You'll be going along making
your schematic and then say, realize that KiCad didn't
have the part you need in the default library
so you either consider making your own or you start
going through third-party libraries all the while
checking Digi-key site to see if they have the
part you need in stock. To keep these videos
rolling, let's assume for now that you've already identified
the specific battery holder and switch that you need. Head to github.com slash
digi-key slash digi-key dash KiCad dash library. Click clone or download
and click download zip. Find where you downloaded
that file and unzip it. Go into that folder and copy the digi-key KiCad library master directory. Go to where you're keeping
your KiCad project files which is documents KiCad for me. Create a new folder called libraries. This is a good place to keep libraries that we download from the internet or any larger custom
libraries we might make for sharing among projects. Paste the digi-key library
directory in there. If you navigate into
digi-keys library folder, you'll see that it's made
up of a symbols directory which is a collection of
schematic symbol libraries and a dot pretty folder which is a library for a lot of footprints in KiCad. Back in EE schema we need
to import the digi-key library that we just downloaded. Click preferences component libraries. In the component library
files section click add. Navigate to the key symbols
folder in your KiCad library's directory and select DK
battery holders clips contacts and click open. Click add again, navigate to
the digi-key symbols folder, select DK slide switches and click OK. Scroll down in the library files section to verify that both libraries were added. Click OK. Press A to add a component. Scroll down and you'll see
that both digi-key libraries were added as DK batteries
holders clips contacts and DK slide switches. Expand the battery library, select BS 7 which is the coin cell
battery holder we'll be using and click OK. Rotate it so that the
positive pin is facing up and place the part to the
left of the 330k resistor. Press A again and expand the
DK slide switches library. Select the eg 1218. This is the three terminal single-pole double-throw switch that we'll use. Click OK. Rotate it so that pin 3 is facing down and place the part just
above the battery symbol. We could wire everything up now to make our completed
schematic but something that makes things easier to read is flags. Flags have the effect of
connecting things together without having to look
at wires on the screen. It just makes things cleaner. Any node that has a flag
with a name is automatically connected to all other nodes
with that same flag and name. Most commonly you'll see power and ground flags on schematics. I know, I know. Ground should only be reserved
for things that are connected to earth ground but calling
the common return path in a circuit is now
just accepted as ground. So we'll just keep
using that term for now. Bring up the component chooser
and search for G and D. Select the G and D power
flag symbol and click OK. Place it below the 10
micro farad capacitor. Hover over it and press C to copy it to the other ground nodes
as per the example diagram. Open the component, choose
it and search for VCC which is a commonly used
power flag for schematics. Place a VCC flag next to
the common pin on the switch as this is what will allow
us to connect and disconnect battery power to the rest of the circuit. Copy the flag to the other
power flag locations. Note that I like to leave
at least one grid space between components as it
prevents confusion about whether something is connected or not when we go to add wiress. Turned to wire select place wire, click to start a wire from
the left-most ground flag and then click again to connect it to the negative battery pin. This tells KiCad that we
intend for the negative battery terminal to be connected to
all the other ground node pins such as to the negative
pin on the two capacitors. Click to start another
wire from the battery's positive terminal and connected
to pin 3 of the switch. Another way to add a
wire is to use the W key. Hover your mouse over the
end of pin two of the switch and press W. A wire will automatically start from here. If the wire isn't touching a second pin, you can click to add a 90-degree
bend which I'll do here so that I can connect it to the VCC flag. Continue connecting wires to our parts as shown in the hand-drawn
circuit diagram. Note that some pins should
be left unconnected. Like pin 5 on the 7555 timer. When you're done take a step
back and look at your work pat yourself on the back for finishing the first major step
toward making your board. Don't forget to save your
schematic by clicking file, save schematic project and
then close out of EE schema. It always feels good to
get the circuit drawn up in schematic capture. We're almost ready to move
on to the board layout part but first we need to see how
to create custom foot prints before associating those footprints with our schematic symbols. That will come on the next
episode so stay tuned. (fast paced music)