IoT Part 5: Schematic and PCB Design

This topic will contain a table of contents

PCB Design Workshop

Autodesk Eagle

PCB Background information

PCB

Before you start designing a PCB it is mandatory to have a little bit of background information about a PCB. A PCB (printed circuit Board) houses electrical components and facilitates the electrical connection between components.

The PCB consist of a few different layers.

  • Substrate
    The substrate is made of glass fiber and is the structural layer of the PCB.

  • Copper
    There is a copper layer on top of the fiberglass. This copper layer creates the electrical connections between components. Copper can be on both sides of the PCB than you refer to it as a 2-layer PCB. This could be as many af 16 layers or more.

  • Soldermask
    This is the layer that covers up the copper layer. The solder mask gives the PCB its color. Green is the most common color but there are many more colors available. The solder mask isolates the copper against insidental short circuits. It also makes sure that solder can only be placed and flow on the wanted spots.

  • Silkscreen
    This layer shows text and outlines of components, symbols and logos. It is most common to see a white silkscreen.

Components

There are two main different types of components. That can be mounted on to a PCB

  • THT (Through hole)

  • SMD (Surface mounted device)

The main difference is that the through hole components mounts by leads that feed trough the PCB and solder from the bottom of the PCB as you can see above. SMD components mount on top of the PCB and need to be soldered from the same side. THT is oldest and most basic technique, components are relatively big and are easy to solder. The downside to THT is that components take up more space on the board.

SMD is the latest technique and used in basically every commercial computer and mobile phone. SMD components are usually a lot smaller than THT components and therefore harder to handle and solder on the a PCB. The big advantage is that components take up way less space. SMD components are mostly placed and soldered by automated machinery (pick and place) due to there extremely small size.

Design Steps

  1. Schematic diagram design
    The first step when creating a PCB design is making the schematic diagram. This diagram contains the information about the components used and how they are connected to each other. A schematic diagram uses Symbols instead of real-world representations of components.

  2. Board layout design
    After the schematic diagram is created the board layout needs to be made. In this step you go from a representation of the circuit to a real-world version of it.

  3. check design with manufacturer specifications
    This is an really important step when you are actually going to let a company produce your PCB design. Your design needs to be checked on manufactuability. Autodesk Eagle has an buildin function that can do so.

  4. export needed files for manufacturer
    In the final step you will have to export the design. Your PCB manufacturer probably want to have certain Gerber files. Eagle needs to create them using the right settings. These settings are often provided by the manufacturer in the form of a file that Eagle’s ‘CAM Engine’ can use. When these files are created you can send them to the manufacturer and they will produce your PCB.

Keep in mind that they only produce the PCB so you will have to solder on the components by hand.

Installing Autodesk Eagle

Autodesk Eagle software

Download and install the software

Schematic diagram design

We always start by making a schematic design. The schematic design contains the components used and the way they are connected to each other. The diagram consists of symbols rather than realistic pictures.

Project

Start by making a new project

  • Click: File → New → Project
  • Give the project a logical name. You can always change the name later by right clicking on the name and click ‘rename’

Schematic diagram

Next we have to create a new schematic diagram.

  • Click: File → New → Schematic
  • Click: File → Save as
  • Give the file a logical name and click: ‘save’

Add components

Now we need to add components to the schematic.

  • Click: Edit → Add… (or the correspondent icon in the left toolbar )\ 46x48

A popup screen should appear. This is the place where all your components are listed. You can scroll through the components or search by name and description. Now let’s add the first component to our diagram.

  • Search for “LED5MM”
  • Click: ‘OK’ to add it to the schematic
  • You can now rotate the component by right clicking. Left click to place the component.

Here you can see a schematic symbol (left) and the package (right) of the chosen component. The package is the physical representation of the component and will be on the board design later.

  • Search for ‘vcc’ and place the power symbol
  • Search for ‘gnd’ and place the ground symbol
  • Search for ’R-EU_0204/7’ and add it.

When you want to move a symbol after you have placed it you can do so by clicking

‘Edit → Move (or the correspondent icon in the left toolbar)’.

Deleting objects can be done with the

‘Edit → Delete(or the correspondent icon in the left toolbar)’.

Connecting components

You now need to connect the symbols together.

  • Click: Draw → Net (or the correspondent icon in the left toolbar \ 41x48)

Now the led is connected to the so called ‘VCC’ Net. In the schematic everything with the same Net name is connected to each other. So you can connect components to each other without a green line connecting them like you see in the schematic above. Of Course later on in the board design they will be physically connected by a so called trace.

Now to finish this schematic we need to add a connector so that the ‘VCC’ and ‘GND’ can be connected to an actual powersource like a battery.

  • Add a 2 pin connector to the schematic, Search for ‘C-GRID-02-70553’
  • Add two Net wires to the connector, just like you see below

We now need to connect the connector to ‘VCC’ and ‘GND’. This is done by changing the Net name of the green Net wire to the Net name you want to connect it to.

  • Click: Draw → Label
  • Click on the green Net wires to review the current Net names like you see below

We now need to change the Net names to ‘VCC’ and ‘GND’

  • Click: Edit → Name
  • Click on the Net you want to change the name of
  • Change the name
  • Click: ‘OK’

That’s it you have just created your first basic schematic diagram. The next step will be creating the Board layout. This will be the physical representation of the schematic diagram.

Board layout design

When you are done with the schematic diagram it is time to turn the diagram into a real-world design of the PCB. In this step you are going to design the physical layout of all the components on the board.

Creating a board layout

when designing the board layout it is important to keep manufacturability in mind. So give components enough space so that you can easily solder the individual components to the board.

  • Click: File → Switch to board

Placing the components

You are now in the board view. Here you can place the the components on the board. Use

the move tool to move the components on the board.

  • Click: Edit → Move
  • Move the components on to the black area

PCB Border

The black area represents the PCB surface and the orange line the border of the PCB. When you take a look at the current board design, you’ll see that the PCB is a bit big for the amount of components on it. You can change the size of the board with the same move tool you used to place the components on the board.

  • Click: Edit → Move
  • Change the size of the board so that it fits the components better

If you want you can give the corners a radius.

  • Click: Edit → Miter
  • Change the radius to whatever you want ([Mil] is the unit used, try 200)
  • Click on the corners you want to apply the radius to

Adding mounting holes

You may want to mount your PCB. For example in an exposure. In order to mount the PCB you need some holes.

  • Click: Draw → Hole
  • Change the size of the hole to whatever you want ([Mil] is the unit used)
  • Place the holes where you want them on your board by left clicking

Using a grid

It can be quite useful to use a grid in order to align parts. Using a grid can also give you a better sense of size. To make the grid visible:

  • Click: View → Grid…
  • Under Display select ‘On’
  • Change the grid size to your convenience. Default settings should work fine. Keep in mind that on most standard components the pin spacing is 2.54mm (100 Mil)

Ground plane

In most cases you want to use a ground plane in your PCB design. This means that the underside of the PCB will be a entirely connected to Ground (GND). You will have to draw a polygon where you want the ground plane to be. In most cases around the border of the PCB. And connect it to the GND Net.

  • Click: Draw → Polygon

  • Change ‘1 Top’ in the upper right of the screen to ‘16 Bottom’ since we want our ground plane on the underside of the PCB.

  • Draw around the border of the PCB. You can make your polygon a little bit bigger than your PCB.

You can see that the polygon is a little bit bigger than the PCB. The next step would be to connect the PCB to the GND Net.

  • Click: Edit → Name
  • Change the name to ‘GND’
  • Click: ‘Ok’

Auto route

In the board design you can see that the components are connected by really thin yellow wires. These are here to make cleare what needs to be connected to what. The actual connection still has to be made. This can be done by hand or done automatically. For now we use the automatic function called ‘Auto route’

Autoroute will connect all the components to each other with traces. it fill automatically optimize the different solutions it found for connecting.

  • Click: Tools → autorouter…
  • Set the effort to ‘Medium’ (The higher the effort the more eagle will optimise the wiring job)
  • Click: ‘Continue’

  • Click: ‘Start’

Let it run till the process is completed. Here you can see that eagle has chosen Optimize8 as the TopRouter. This means that eagle thinks this version of the wiring job is the best one. You can see the different wiring jobs by clicking on the other optimizers. Once you are happy with the routing job.

  • Click: ‘End Job’

The result is a PCB with connected components. The blue part in is the ground plane we made earlier the blue color means it is on the bottom side if the PCB. The red wires are the physical traces (connections) on the top side of the board. In conclusion the red and blue will be a copper layer once te PCB is produced.

Design rules

It is possible to design everything in eagle just how you like it. For example: It is possible to place components extremely close together or have traces really close to each other so that they almost touch and it can’t be manufactured anymore. This is due to the tolerance of the machines used by the manufacturer. To make sure that what you design is manufacturable most manufacturers have a ‘Design rule’ file available as a download on there site.

Now you get a list with all the warnings and or errors. If everything is fine your design can be manufactured.

Ripup

When you made a mistake or added new components to your schematic that you want to include in your design you need to undo the routing job we did in the ‘Auto route’ step.

  • Click: Edit → Group
  • Select the whole board
  • Click: Edit → Ripup
  • Right click on the board and click on ‘Ripup: Group’

Silk screen

The grey text and outline of the components will be printed on the PCB during manufacturing. This layer is called the silk screen. This layer of paint can help you remember which component goes where on the board. You can also add text to your board.

  • Click: Draw → Tekst
  • Type the text you want on the board
  • change the layer you want to put the text on to ‘tPlace’
  • If you want the text on the bottom of the PCB change the layer to ‘bPlace’

I added a “Test” text my pcb design

Different trace widths (Net Classes)

When you route the board eagle is going to connect the components together using copper traces. The width of these traces determines the amount of current that can flow through that trace. The default width eagles uses is good enough for signals and low current applications like led’s and so on. If you want to have a certain trace that needs to carry more current you may want to widen the traces width. You can do so by making a new Net Class.

  • Click: Edit → Net classes…
  • Add a new class Name and define the trace Width you want to use
  • Click: ‘OK’

  • Go to your schematic diagram
  • Right click on the connection/net (Green wire)
  • Change the Net class to the one you just created
  • Redo the auto route

Export files for manufacturer

In order to manufacture your PCB design the manufacturer needs a few files. In this example we are going to use the ‘Eagle cam file’ from Elecow, they have an online custom PCB order service. Have a look at their site.

https://www.elecrow.com

The following process is dependant on your PCB manufacturer of choice. We are going to use Elecrow as our manufacturer. This process may vary if you use a different PCB manufacturer.

Download the ‘Eagle Cam file’ from this page. This is also the page where you can order your PCB. Read carefully.

  • Go to the Eagle board file window

  • Click: File → CAM Processor

  • Change the Job file, choose the cam file from Elecrow. Also check the Export as ZIP checkbox! image

  • Click: ‘Process Job’

  • The Gerber files are now created and are in the project folder you made at the beginning. Usually /Documents/eagle/thenameofyourproject/

Have a look at the page where you can order your PCB on the Elecrow site. There you can see which files they need to receive. You can Zip those files and upload them on the ordering page. Now proceed the ordering process and you are done.

Adding New Component Libraries (And continue PCB design for IoT smart plant)

Sometimes the component you are looking for is not in the part library. In case of the IoT workshop the main component is the ESP32. In order to be able to add this component we first need to add it to our eagle libraries.

  • Download the esp32.lbr library
    ESP32-DEVKITC_1000mil.lbr (17.1 KB)

  • Click ‘Library’ → ‘Open Library Manager’

  • Click ‘In Use’

  • Click ‘Browse…’

  • Locate the just downloaded library

  • you should now be able to search for esp32 when adding an component

  • Use the ESP32_DEVKIT_V1 since that is the version of the ESP32 that you have.

  • Now do the same thing for the SparkFun-Sensors Library (we need that one for the LDR Component)
    https://drive.google.com/uc?export=download&id=1PLQlhYOpFV4072dgZtztfLvpmZ151qkQ

  • You should now be able to search for Photocellpth and add the LDR to your schematic.

  • For the resistor that connects to the LDR we advice you use the R-EU_0207/10

Now some components like the motor driver and the ground moisture sensor don’t go onto the PCB. But they need to be connected to the esp32 via a connector or a pin header where you can solder wires to.

  • For the connector/pin header add the SparkFun-Sensor Library
    SparkFun-Connectors

  • You should now be able to search for CONN_03 or CONN_02 of whatever size pin header you need.

The Relay can be added while you are creating your Board