Sunday 21 September 2014

How to design a PCB using Cadsoft Eagle 7.1

In the previous post we discussed how to input a schematic diagram in Eagle.  Now we are going to design the printed circuit board to hold the components and provide the conductive tracks so that the circuit works permanently instead of a prototype like when using a breadboard.

How to input a schematic diagram using Eagle

Load up Eagle 7.1 and load up the light dark detector project


The PCB layout window will be displayed:


The PCB size and the components we chose from the schematic are displayed.  Before we begin placing the components onto the PCB and connecting tracks lets make the display easier to use and see.

I prefer when laying out a PCB to have a black background, it's easier on the eyes.  Click on the user menu at the top of the display and then on the 'User Interface' option.


Another window will be displayed providing various options.  Click on the radio button to select a black background and I also selected always vector font.  Then click the 'Ok' button:


Next lets make the connections between the components easier to see.  These are known as 'Airwires'. So called as they show that the components are to be connected together but are not connected by a conductive track but by 'Air'.  Click on the layers icon on the toolbar on the left and navigate to 'Unrouted' - layer 19 which is currently a gold colour.  


Click on the 'Change' button and change it to something bright and distinctive - I use bright pink!


Click the 'Ok' button when finished.  The last thing I tend to do when designing a PCB is apply a grid to the screen so that I know roughly how far apart components are and that the connections 'snap' to the components easily.  Click on the 'View' menu and select 'Grid':


A new window will appear displaying the grid properties:


We are going to change the scale from imperial (inches) to metric and then change the size of the grid to 0.635mm for normal squares and 0.3125 for the alternative size.  Finally click on the 'Display' radio button to 'On'.


Click on the 'Ok' button to apply the settings.  The reason for applying the above grid settings is that firstly I have more of an appreciation for metric units and mm - you can use inches if that suits you.  I chose the grid sizes as these are commonly used and apply to most components.  The pitch (space between the legs) of most components is 0.1 inches which is 1.27mm, I'm using a grid of half of that and half again as an alternative.  This means when we draw the lines for the tracks the pins from the components will immediately line up with the tracks.

The grid pattern cannot currently be seen as there is another setting that needs to be changed in order to make the grid visible.  Click on the 'Options' menu again and navigate to 'Set'.  A new window will be displayed, click on the black box relating to the colour of the grid when using a black background and choose something brighter.  I use a light grey.  Click on 'Ok' when ready to return to the main PCB editor window.  When you zoom in the grid should be visible, you can use the mouse wheel to zoom in and out.


We are now ready to start designing the PCB.  This is where we will arrange the components to suit our purposes, connect the tracks between them, decide the final size of the PCB and arrange the labelling so we know where to place each component and in what orientation.  This way populating the PCB will be very easy.

There are no hard and fast rules on PCB layout and design.  It is what suits your purposes and your specific situation.  Most designers decide to use the smallest most efficient layout.  Hopefully this means that the PCB is easy to make, populate and fit in a suitable enclosure (case).  It isn't always easy and there are often decisions to make which affect how the layout will proceed.  As there are not too many components in this example it won't be too difficult to do.  When there are more than 100 components it becomes much more complex and that is why a lot of electronics engineers will say that PCB layout is an much art as engineering.  I agree to a point....I always just make my designs work first and then apply the 'art' afterwards!  I don't consider myself to be particularly artistic however...

We are going to manually place the components on the PCB and then rotate them to suit before connecting tracks between them.  This is known as manually routing,  when designs get more complicated there are special functions within PCB design software to make it easier for the design engineer.  The most common one that is discussed is the 'autorouter' function.  I'm going to discuss autorouting in another post.

The screenshot below should should match what you have on your screen - not including the text or coloured rings:

  
If we zoom in and  look at the components we see the outlines of the packages of the components with some green circles.  These are the component 'footprints' we selected when the schematic was drawn.  The green circles are the holes the component legs will go through when the PCB is to be populated.  Press 'Alt +F2' in order to zoom out but fit all items to the screen.


In order to start the layout we need to move the components onto the PCB. Left Click on the move icon in the tool bar and then left click on the resistor component R1:


This will select the component and then when you move the mouse pointer the component will move with it.  Place the resistor component onto the PCB area:


Repeat this process for all of the components, once complete you should see something similar to the screen below.  I turned the grid off to make things easier to see....


At this point I like to refer to the schematic diagram.  It makes it easier to see which components are connected together and in which order.  As I have said before there are no rules when designing a PCB.  The decisions are all in the designers hands and mind.  I like to start with the power supply section of the circuit which in this case is the battery.  With the move icon selected -  Click on the battery component and move it to the bottom left corner of the PCB.  Next right click the mouse button - this rotates the component.  Rotate the component until the positive connection is at the top and the entire component sits in the bottom left corner:


Next lets move and orientate the LDR component.  We want to place it somewhere sensible so that the light can shine on it but also in such a way that it is easy to connect to the positive terminal of the battery.  With the 'move' icon selected click on the LDR component and move it and orientate it so that it is easy to connect to the battery positive terminal:


 Now it is time to move the R1 component (330 Ohm resistor) to somewhere on the PCB that makes it easy to connect to the LDR and the 0V connection of the battery.  I put mine directly below the LDR but it could go anywhere as long as it is easy to connect the tracks and place the components without difficulty.


You may notice that there are lots of purple lines crossing the screen connecting the components in some sort of random pattern.  These are the unrouted 'Air wires' discussed earlier.  If you find the air wires annoying you can turn them off or have Eagle re-calculate them.  To turn them off click on the layers icon as before and navigate to layer 19 and unselect it.  To have Eagle re-calculate their path click on the 'Rats Nest' Icon on the bottom of the toolbar on the left side of the screen:

 
It will change the purple airwires to and calculate the shortest path for components to connect to each other. Move all of the rest of the components, using the schematic as a reference, until all of the airwires are easy to follow and do not cross each other.  This is possible on simple designs like this but not always.  I often click the 'ratsnest' icon when moving and placing components. Again there is no correct or incorrect way to place components.  Choose the most logical way to do it, rotate the components every which way until the airwires don't cross and there is a sensible amount of space between each component:


Hopefully your screen should look something similar to the screen above.  Now it is time to draw tracks between the components to connect them together.  Click on the 'Route manually' Icon and then click on the width drop down menu in top middle toolbar; we are going to select the track width.


I chose 1.27 mm as this means that the tracks are the same size as most of the components pads.  The tracks don't have to be this thick.  They need to be thick enough to carry the current flowing through them (18 mA).  There are online calculators for working out the current carrying capacity of PCB tracks however as a rule of thumb anything thicker than 0.5mm will be capable of carrying 100 mA without getting hot.  The thicker the track the more current carrying capacity and the easier it is to make the PCB.

Left click on the top pad of the battery - the pad will be highlighted and when you move the mouse a blue line will be drawn, this is the PCB track.  The pad the track has to connect to (the LDR) will also be highlighted. Move the mouse until the track covers the top pad on the LDR and then left click the mouse.  Congratulations you have just make your first PCB track connection.  This track is on the underside of the PCB (bottom layer).  If you wanted to place a track on the top layer then click on the layer icon on the top toolbar (highlighted) and then place a track as before.  It will be red in colour to show that the track is on the top layer.  If you want to remove a track click on the icon next to the route manually icon which is called 'Ripup'.  Then click on the track you would like to remove.


For this design there is no need to route tracks on both layers so I will be making this PCB single sided.  However for more complex designs it is often necessary to route tracks on several layers and interconnect them using 'vias' - special connections which join the routed tracks together.  You may also notice I have turned the grid back on.  I find it easy to route tracks with the grid on.

Now lets route all of the other tracks...its the same process as before.  Once complete it should look something like this:


Technically we could save here...generate the 'gerber' files and get a PCB made however we are wasting a lot of space on the PCB.  Anywhere we we can see black we are wasting valuable space or 'real estate' as it is sometimes referred to.  Lets stop wasting real estate and change our PCB dimensions. Left click on the 'move' icon and then click on the external PCB dimensions (white rectangle) and resize it:

 
I turned the grid off for the resizing as I found it hard to see what I was doing.

I don't like the footprint for the battery connector.  I never intended using one single AA battery to power the circuit which wouldn't work anyway.  I intended to solder some wires from a battery connector to two pads on the circuit board.  Lets change the package for the battery to something more suitable.  Right click on the battery footprint and select 'Replace'


The replace window will be displayed.  We need to search for a footprint that has two pads that is reasonably small and suitable for our purposes.  There are several to choose from.  I like to use screw connectors for this purpose.  Type 'screw' in the search box and see what appears:


These are all of the packages with the word 'screw' in their description.  I'm going to select the one highlighted.  It's a two terminal through hole screw terminal from Wago.  Any two terminal connector would do however.  Click 'Ok' to replace the battery terminal.  Unfortunately when you do this an error message is displayed:


This is because the symbol used in the schematic cannot be related to the new package we selected. In order to solve this problem we need to edit our schematic diagram.  We need to switch back to the schematic editor and change the symbol there.  Click on the 'switch to board' icon to return to the schematic editor:


In the schematic editor delete the battery symbol by clicking on the trashcan icon in the left toolbar, Then click on the battery symbol.


Next click on the 'Add' Icon and search for 'Screw' - select the wago screw terminal seen previously and place it on the schematic in the same place that the battery symbol was:


Switch back to the PCB editor and you can now see the screw terminal connector:


Click on the 'Move' Icon and then place the screw terminal package somewhere sensible next to R1 and the LDR.  After that click on the 'Route Manually' button and connect the tracks.  Remove any unwanted tracks using the 'Ripup' tool.


Now we should probably move all of the components and tracks to the bottom left of the PCB and then resize it as we still have a lot of unused 'real estate'.  Click on the 'Move' Icon and then click on the 'Group' Icon. Now Left click and drag a box around all of the components and tracks and the release the left mouse button:

 
The 'Move' icon will immediately be select as it was the previous tool used.  Right click on the components and select 'Move Group' and then move the components and tracks to the bottom left corner of the PCB.


Now lets resize the PCB to save on space and not waste 'real estate':


Now is probably a good time to save your work.  I tend to save my work as often as I can as I hate having to repeat things.  Other than that we should probably add some mounting holes.  Click on the 'Holes' tool and select a 3.2mm hole:


Click and place holes on the layout.  These holes are for mounting to.  I'm going with three separate holes in corners:


This next step is something that isn't strictly necessary but I like to add it as it saves on etching time and preserves etchant and adds benefit in that the circuit will make less radio noise.  It's called a 'ground plane' or 'copper pour'.  Click on the 'Polygon' tool on the left tool bar and then set the width to be 0.4064, also set Isolate to 0.4064:


Then click and draw a square around the outside edge of the PCB:


Click on the Command field and type 'name' and press 'enter':


Next click on the lower track connected to the screw connector and R1.  A window will appear.  Type GND into the box and click 'Ok'.  This changes the net name of the track to GND.  Now click on the dashed outline of the polygon for the ground plane and call that GND also.  This will connect the polygon to the track.


To complete the process click on the 'Ratsnest' tool.  This will display the ground plane:


I would now consider the PCB layout complete however we should probably add a label or two.  It is always a good idea to label the PCB so we know what it is and like any good artist we should sign our work!  Click on the 'Text' tool in the left toolbar and add a name to the PCB along with a description:


Place the labels somewhere suitable (where there is space) but not on the PCB.  The label will be oversized and on the wrong layer at the moment.  Click on the 'Info' Icon and then set the size, font and layer and unclick the mirror checkbox as shown in the image below,:


This should resize the label so you can then place it somewhere suitable on the PCB:


Save your work and take a break.  That is the PCB design complete!  The next post will discuss preparing a design for professional manufacture and creating an enclosure.

If you want to make a home made version of your design then the following previous post might be of interest:

How to make a PCB

That's all for now - take care, Langster!

How to input a schematic diagram using Cadsoft's Eagle 7.1

I'm getting a lot of requests for a tutorial on how to use Eagle to design printed circuit boards.  Not just on how to use the software but what drives the design decisions and how does this affect the results.

Eagle is a piece computer aided design software specifically written to enable electronics design engineers to design and develop printed circuit boards or PCBs.  Eagle is currently on version 7.1 of the software and is available cross platform - Windows, Linux and Mac.

The software can be downloaded from Cadsoft's website here:

Cadsoft's Download Page

For the purposes of this tutorial we will be concentrating on the latest iteration (Eagle 7.1) using Windows as the operating system.  The linux and Mac installations are a little more involved but should be fairly self explanatory.  I may go into more detail about those if requested.  I don't have a Mac so I can't help much there but I do use Ubuntu Linux so watch this space.

Run the downloaded executable file and install Eagle into the folder of choice.  Note - you will be presented with a warning dialogue box due the installation process being unsigned click 'Ok' and continue the process, there are no issues with installing the software.

The dreaded Microsoft Security Warning for an unsigned installer!
Next you will be presented with a 'Winzip Self Extractor' window.  Click 'Setup' and continue.  The self extraction process will unzip the files needed to install Eagle 7.1 to a temporary directory.

Winzip Self Extractor for the temporary installation files
Once the temporary files have extracted you will now be presented with the window below:


Click on the 'Next' button to carry on with the installation....there do seem to be a fair number of installation pages and steps for this software.


Agree to the licencing agreement which is fairly boilerplate stuff....I didn't read all of it in truth because it's really boring. I doubt I will void it as I will be using the free version.


I'm using the default install directory....feel free to use another location...just remember what it is!


Click 'Next' to start the installation process...


Once complete you will be prompted to decide which kind of licencing you will be applying.  I'm using the freeware version so I selected that option.  If you have a licence file you can obviously apply it or a 'Freemium' code, again if you have one.


Click 'Finish' to end the installation - any superfluous installation files will be removed by default.

A new red 'Eagle 7.10' Icon will have been added to the start bar.  Click on the Icon and load up the software.

You will presented with the following screen:


If like me, you have used Eagle previously there will already be an Eagle 'projects' folder present.  If you are new to eagle you will prompted with a request to create a folder for your projects in a location of your choice. Choose where to place the folder and carry on.

At this point it's time to really discuss what eagle is for and why electronics engineers, designers hobbyists and anyone with a passing interest in making electronic equipment use computer aided design software (CAD) and specifically PCB layout computer aided design software.

In the days before computers and CAD software were readily available on order to make an electronic circuit on a printed circuit board this meant drafting a schematic diagram on paper, deciding the mechanical dimensions of the final device and then choosing the type of components to be used before actually making the device. Making the device meant getting a piece of copper clad PCB, cutting it to size and deciding on the copper where the components were to be fitted and finally drawing tracks between the components using a special etch resist pen or special tape.  In order to do that we need to make several decisions relating to the questions below:
  • Which components are to be used and how many are there? 
  • What are the voltage and current ratings of those components and how much current does the circuit draw in use? 
  • How physically big are the components?
The first and third question dictates the size of the printed circuit board - we need enough space to fit all of the components on the board.  The second question dictates to some extent the size and type of components and the size and thickness of the interconnecting tracks or wires between the components.

Rather than go through the process of designing a circuit from scratch I'm going to make the assumption that people have a circuit they have prototyped and tested and now want to design and make a PCB.  I have written a post concerning the design of the circuit I'm using to discuss the techniques if people are interested here:

How to design a simple light dark detector

From the information in the above post we calculated that every component in the circuit must be capable of withstanding 107 mW of power flowing through them.

This information then allows us to choose the types of components we could use to physically build our circuit.  There are many different versions of electronic components with different characteristics and properties.  Lets choose ones which have the values we require or perform the function we want whilst still being able to withstand the 107 mW of power dissipated in them...

The light dark detector circuit mentioned uses semiconductor devices.  All of the information about these components can be found from their associated datasheets.  I've said it before but when doing anything with electronics the datasheet is one of the best places to start.  The light dark detector contains two NPN transistors (of the same type) and an LED.  We can get information concerning the transistors and the LED from their associated datasheet which is supplied by the manufacturer and available from any search engine.  If we read through the information we find that these components are rated for 107 mW of power dissipation.  The other information given in the datasheet is the physical size of the components - often called the package size or land pattern.  This is useful to know...there are often different packages provided in the PCB CAD software depending on the type of component and it's power dissipation.

Semiconductor components also use some designations relating to their physical size and the number of pins present.  The standard where these designations was compiled by an organisation called JEDEC - Joint Electron Device Engineering Council.  The organisation started in 1958 and is still going strong.  The standards are free and available for download online.  They have a wikipedia entry here:

JEDEC

Here are some of the standard JEDEC packages for semiconductors:

TO92 package - leaded component, normally a transistor but not always - D-shaped plastic package

TO-220 - leaded component with a tab, transistors or voltage regulators - rectangular shaped package

TO-3 - leaded component, high power transistors,  diamond shaped designed to mount directly to a heatsink

TO-263 or D-PAK - half leaded, half surface mount component, used for transistors, rectangular shaped with two short leads.  The third terminal is on the base of the component.

DIP - Dual inline package, normally used for integrated circuits, rectangular shaped package with short leads either side

SIP - Single inline package, normally used for resistor networks and integrated circuits similar to DIP, rectangular with a single row of short leads

SOIC - Small Outline Integrated Circuit - used for integrated circuits, very small rectangle with very short leads on either side, much smaller than DIP.

TSSOP - Thin Shrink Small Outline Package, similar to SOIC - even smaller surface mount device normally used for integrated circuits.

There are many many more packages available, the only way to learn them is to research and use them as needed.

Because our circuit's power dissipation is 107 mW we can afford to use smaller component packages without any consequence...lets use the T092 package for the transistors and a 5 mm LED package.  To be honest we could use any size components we liked as long as they perform the function we want and we have them to hand!

Next we need to choose a resistor type which is capable of withstanding 107 mW.  Resistors come in standard sizes and power ratings,  The most common power rating is 250 mW package or quarter watt.  There are also half watt resistors, 1 watt, 2 watt and various power ratings as required....the higher the power rating the physically larger the component is.  Usefully the datasheets give the dimensions of the parts so we have an idea of how physically big they are and how far apart the leads are - known as pitch.

Here are some images of these components:      


These types of packages with long wire legs are known as through hole components.  There are two distinct types - axial and radial. Axial components have wires coming from the sides (like the resistors). Radial components are circular and the wires come from the body of the component vertically.  The benefit of using through hole components is that they are easy to solder and use and are easy to obtain...

Through hole Components

There is another type of package for electronic components called 'surface mount'.  These types of components don't have long wire leads and are physically much smaller than the through hole type. They come in a huge variety of shapes and sizes.  They are more difficult to use because they are physically smaller but as a bonus they cost less and are used in all modern electronic circuits.

Surface mount Components

The equivalent surface mount components are shown below:


The LED and resistors use a specific package number known as 0805.  This number relates to their physical dimensions in imperial scale - length by width - 0.08 is the length in thousands of an inch and 0.05 is the width in thousands of an inch.  There are even smaller packages - 0603, 0402 and 0201.  There are also different acronyms for packages such as Melf, mini-melf, SOT-23 etc.  These all relate to different package sizes and types.  Its difficult to know them all.  I learn as I go and check the datasheets for the parts I intend to use...datasheets are to electronics design engineers as recipe books are to chefs!  The dimensions for 0805 packages and the SOT-23 package are below:


The mechanical information is useful as it gives the designer an idea of how much space each component will take up on the printed circuit board.  Luckily all of this information is already available in Eagle - that is why CAD design packages are so useful - they save the designer having to check this information and draw each component to scale...

From the previous post here is the sketched schematic diagram:


Let's input the schematic diagram into Eagle 7.1 and while we are doing that select the component packages we intend to use.  I'm going to show two versions of the circuit, one using through hole components and the other using surface mount 0805 packages and a SOT-23 package.

If we load up the EAGLE 7.1 we are presented with the following screen:


Click on the eagle folder menu and expand it - if like me you have used eagle previously there are lots of projects available...it not there will be nothing present.  Lets create a new project - click on the file menu and the new option followed by project.


I called mine light dark detector....it can be anything you like but I would suggest something that relates to the circuit function so you remember what it is...

Next click on the eagle folder and expand it and navigate to your newly created project.  Then right click on the icon and from the menu select 'new schematic'


A new window will appear which looks like this:


At this point its a good idea to save the file - again choose a sensible name so that it is easy to remember.  I chose light dark detector....

Next click on the 'add parts' icon on the tool bar on the toolbar on the left side of the window, it looks like a two pin electrical plug:


A new window will appear with a list of the available component libraries and a search field and some options - type frame into the search field and press enter...


The library contain all of the different types of available frames is displayed - select 'A4L-LOC' and click the 'OK' button.  This selects an A4 landscape frame with a title block in the right hand corner.  It makes our schematic look all 'professional'!!  I chose A4 because that is my standard paper size for my printer - there are plenty of other options.  Choose the size which suits your situation.


Place the frame in the schematic editor workspace at the 0,0 co-ordinate which is highlighted with a cross.


Press the 'escape' key on your keyboard to stop placing another frame object and return to the select parts window.  Press the 'cancel' button to close the add parts window and return to the schematic editor...If you look in the bottom right hand corner of the frame you should see the file name and the sheet number - cool huh!  I like to save the schematic at this point as it then refreshes the title block with the time and date:


It is now time to add the symbols for our circuit components.  We need to select 3x resistors, 1x 5mm LED, 2x T092 Transistors, a 5mm LED and a battery symbol.  Click on the add parts icon again in the tool bar.  All of the available libraries will then be displayed.  Inside these libraries are the symbols and the mechanical footprint sizes of all of the available parts.  This is what makes Eagle so useful - there are loads of libraries with all of the most popular components already available!  Lets search for a 1/4 W axial resistor, type resistor in the search box and press enter.  All of the libraries with resistors parts present in them will be displayed.  Scroll down the list until you locate the 'resistor' folder and then expand it and select the 'R-US_' sub folder and then finally select the R-US_0204/7 object.  This is a through hole package for a 1/4 watt resistor using the American style schematic symbol.  Even though I'm a shamelessly British I've always used the American symbol for resistors - don't know why and it doesn't really matter.  The IEC symbol is also available....In the top right of the screen it shows the schematic symbol in red and the package with rough dimensions.  If you were to scroll though the different library objects you will see all of the different package options and symbols for a resistor.  It's up to you to select the correct type and orientation for your project.  In this case as we are using a 1/4W through hole resistor I've selected a the correct package for a horizontal orientation when the component is mounted on the printed circuit board...


Now click on the 'OK' button and then click the left mouse button three times within the frame to place three resistors.  Then press the 'escape' key and click cancel.  The add parts window closes and we are presented with the schematic editor workspace containing a frame and three resistor symbols.

At this point I like to add the values for the components I've just entered.  There is no hard and fast reason to it's just something I like to do...I think it's better to ensure all of the information relating to the circuit is added before we start making connections.  On the schematic editor work space click on the 'value' icon on the toolbar on the left side, it's highlighted in the screenshot below:



Next click a resistor symbol...A 'value' dialogue box will appear where you can enter the value for the resistor:


Repeat the process for the other two resistors (330, and 1000) and then click on the add parts icon on the toolbar - it's time to add the rest of the components.  Lets do a search for an LDR...


Ah...no part name found.

OK let search for light dependent resistor...


Ah again....no part name found, disappointing -

OK -

Lets do a wildcard search for any parts with the word light present in it's description or name - type "*Light" in the search box (the test between the quotation marks...do not include the quote marks) and lets see what the wildcard search finds....

Yet again no match was found.  Not to worry this does happen, quite a lot unfortunately.  Because there are so many different electronic components available it is difficult to write and compile software that contains the schematic and dimensional information for every package.  We have two choices at this point.  We can use the eagle software to actually draw a schematic symbol for a light dependent resistor or we can search online for an external eagle library which already contains the schematic symbol and package information.  There are several hundred eagle libraries available and the cadsoft website has a download area where a great deal of these can be obtained.  The trick is knowing what to look for...

When I performed a google search for "LDR Eagle package" nothing useful really popped - apart from a link to my blog and the previous post <grin>...So let do something else.  Lets install some external eagle footprint and schematic symbols libraries.  Two electronic hobbyist component distributors making a big name for themselves (rightly so) are Sparkfun and Adafruit.  I often buy their products and make use of the information on their websites.  Something that they also do which is very cool and kind is they have shared the eagle footprint libraries for the components they use when designing their PCBS - they also use eagle!  Lets download the Sparkfun Eagle library and the Adafruit eagle library:

SparkFun Eagle Libraries github link

Adafruit Eagle Library github link

Now open a file browser and navigate the folder where your projects are stored, mine was:

C:\Users\Alex\Documents\eagle

Create a folder within this directory called 'ext_lbr' or something similar.  I used 'ext_lbr' because it's my shorthand for external libraries.  You could use anything you liked however make a note of the path and directory because we will need it...

C:\Users\Alex\Documents\eagle\ext_lbr - the path to your folder will be different...because your username probably won't be "Alex"

Copy the two zip files downloaded and extract their contents into this folder.  Only the files with the extension .lbr are needed.

Now return to eagle and click on the 'Project' Screen, then select the options menu followed by 'directories':


A new window will open displaying the current paths which Eagle associates with external files such as libraries, user language programs, design rule checks etc.  Enter the location of the folder we just created for external libraries or browse to it and click ok.  If you are going to type in the location remember to add a semi-colon to what is already present:


If you are going to type in the location remember to add a semi-colon to what is already present:


Click on OK and then return to the schematic editor window.  Save your work and then exit eagle and reload it...and then reload the light dark detector project.  We have now added some extra component libraries to Eagle.  What we now need to do is tell our schematic editor that we have added some new libraries and use them:

In the Schematic Editor click on the library menu and then click on 'Use':


Navigate to the 'ext_lbr' folder and select all of the files inside and click 'open':


 and if we now perform another search for *light we should get a few hits.  It takes a few moments to 'parse' the new libraries:

Here is what should appear:


There should now be several results present....navigate to the Sparkfun-Sensors folder and click on 'PHOTOCELL'.  Then select PHOTOCELLPTH and click OK.  The through hole version of an LDR will be added.  For completeness a CdS cell is another term used to describe an LDR - CdS stands for cadmium selenide which is the material that has the property of changing electrical resistance in the presence or absence of light...


Next assign a value to the LDR by clicking on the add value button as before.  A message will be displayed saying that the part has no definable value and do you want to define one...say yes although it is up to you...I prefer to add a component value so I typed '10k LDR':


Click OK and then click on the add parts icon again on the toolbar on the left side of the schematic editor and search for 'BC548'.  It should be found without too much difficulty....add two of these components and then press the escape key to return to the add part window.  This adds the symbol and package for a BC548 transistor using the TO-92 footprint.  

Now search for 'LED'.  Again plenty of results should appear, navigate to the Adafruit library and LED folder and then select the 5mm LED package and symbol and click 'OK'.  Place an LED on the schematic drawing and press escape...


Like with the transistors this adds the schematic symbol for a 5mm LED and the associated footprint.

Next for completeness we need to add a battery symbol.  So lets search for a battery symbol:


I selected an AA battery although it doesn't really matter, choose whichever symbol suits you.  I intend using a battery holder for my circuit and I'm only adding this symbol for completeness. Return to the schematic editor window by pressing the escape key and then assign a value to the battery (6V) and then click 'Ok'.

We now have all of the schematic symbols present with their associated values and are now ready to lay out the schematic and draw the connection lines.  Click on the 'Move' Icon from the toolbar on the left side of the screen:


Now click on each component and arrange them similarly to the sketch.  Most electronics engineers use the convention for schematic diagrams of inputs on the left and outputs on the right but there is no hard and fast rules on this.  Space each component apart so they can be clearly identified.  Place the battery and LDR (input) on the left side of the sheet and the LED (output) on the right side of the sheet.


Finally we need to add the connection lines or 'Nets'.  The normal convention is to use straight lines to connect each component.  Click on the 'Nets' Icon on the toolbar on the left side of the schematic editor:


Next click on one of the 'legs' of the battery symbol and a straight green line will appear.  Move the mouse pointer up vertically until a line of satisfactory length is present and then click the left mouse button.  You can then change the direction of the line from vertical to horizontal:


Extend the line and click the left mouse button as required until the resistor labelled R3 (330 Ohms) on the right of the diagram is connected to the battery.  You could connect to any of the resistors but I like to do the first component to the last component first so that it's then easy to connect the rest of the components.  There are no rules though...as long as all of the components are connected together as per the sketch our circuit and our PCB will work correctly.


Next connect R3 to LED1 and then LED1 to the top connection of transistor Q2.  Finally in a square sort of connection connect Q2 to the bottom connection of BAT1.  There should now be a green path of connections around the components:


You may also have noticed that I moved the Q1 transistor and the LDR and R1 to match the positioning shown in the sketch...

Next its time to connect all of the rest of the components as indicated in the sketch.  Click on the 'Nets' icon and connect everything up.  Once finished you should have a completed diagram which is similar to the sketch and the picture below:


At some point when making connections you will have been asked whether you wanted to 'Join Nets' together.  The correct answer is yes...its the software checking you meant to make a certain connection.

Finally before we create a PCB layout drawing file we should really ensure all of our connections drawn are correct electrically and we haven't missed anything out.  Click on the electrical rules check icon on the toolbar on the left side of the schematic editor window:


A window will appear in the bottom right corner of the schematic editor below is what mine looked like:
  

Any yellow exclamation mark symbols show a warning; the electrical rules checker is telling me that I connected the positive and negative terminals up to two specific 'Nets' and that the FRAME1 symbol used has no value associated with it and that the LED1 symbol used has no value associated with it.  At this point you as the user can choose to do something about these error messages or ignore them by 'approving' them.  I would ignore error messages at your peril and warning messages should also be checked and either 'fixed' or at least 'processed'.

The first warning relates to the battery positive connection being connected to the other components via the 'net' N$1.  If your schematic diagram matches the diagram above it is supposed to be connected.  Therefore we can approve that warning to remove it.  Click on the warning to and then the approve button to 'approve' it:


Click on the second warning and approve that also as it is similar to the first warning and relates to the battery negative terminal connection.

The next two warnings relate to the fact that the FRAME1 symbol and LED1 symbol have no value associated with them.  It isn't really necessary to add a value to the FRAME1 Symbol because it isn't an electronic component.  You could do if you wished to but I normally just approve this warning. The same can also be said the for LED1 warning although in this case I would add a value so that at least the schematic points to the size of LED we are going to use.  Right click on the LED1 symbol to add a value and then click processed on the ERC errors window.  Now close the ERC window. Now is an excellent time to save all of your hard work and to print out a copy of the schematic diagram!

Finally after all that we get to create a PCB - click on the 'Switch to board' ICON in the top middle toolbar of the schematic editor, you can also click on the file menu and navigate to 'Switch to Board':


The following dialogue box message will be displayed:


Click on the 'Yes' button and the PCB editor screen will be displayed.  At this point I like to save the files and print a copy of the schematic.  Keep hold of the printed copy as we will be referring to it later.  It's much easier to lay out a PCB with the schematic handy.  As this post has become really long I'm going to go through the PCB layout in the next post.

That's all for now - Langster!