In this issue, we show you how to design a PCB to make a simple squarewave generator, and explain export methods to make the PCB at home or by a PCB manufacturer.
In Part 1, we showed you how to create a very basic PCB using EAGLE to get you accustomed to how the program functions. This month, we are going to up the tempo just a little with a slightly more complex circuit with a few more parts.
Rather than design something without a purpose. we will show you how you can make a useful square wave generator you can use on your workbench. Perfect for the hobbyist when learning and testing basic digital electronics circuits.
Once we have designed our circuit, we will show you how to output the board files to send off to a PCB manufacturer or to etch at home. In our next issue, we’ll teach you the toner transfer method and how to use ferric chloride to etch the copper.
ABOUT THE CIRCUIT
This circuit will be able to output a square wave from about 0.4Hz to 1KHz with a 60.7% duty cycle at full speed, and close to 50% at the lowest. We have included some screenshots from our oscilloscope to show you how our circuit performed. The yellow trace is the clock pulse and the blue trace is the trigger pin.
This simple circuit utilises the venerable 555 timer in the astable multivibrator configuration. It will output around 200mA so it’s perfect for providing a clock pulse for basic TTL logic circuits like gates and shift registers, etc.
The circuit is designed to take an input voltage between 4.5V to 12V and will output an adjustable square wave close to the input voltage. To adjust the frequency of the wave you simply adjust the potentiometer.
The output LED is connected via an NPN BJT to reduce the current draw from the 555, allowing core current for whatever circuitry you’re connecting this too.
Note: The LED will pulse with the clock pulses and is very handy at lower frequencies as it shows you when the clock is high. However, once the frequency exceeds around 30Hz the LED will appear to be constantly illuminated due to the persistence of vision.
THE SCHEMATIC
In Part 1 we took you step by step to choose the components for the circuit, Seeing that you are familiar with this process, you can go ahead and pick the parts you are going to use for this circuit. We will, however, include a Schematic, along with the bill of materials (BOM) that we used on our PCB.
If you’re going to build the project, it is imperative that you print out the board onto standard A4 paper and verify that the component footprints used match the components you have on hand.
The passive components can all be found in the standard RCL library included in EAGLE.
The LEDs and 555 timer are from the Sparkfun libraries we installed in the last issue.
The TO92 2N2222 BJT comes from the Adafruit library that we installed last issue.
The potentiometer comes from the pot library in EAGLE.
The screw terminals J1 and J2 come from the Wurth_Connectors library, which should be in the standard EAGLE, however, if you’re struggling to find them you can download the libraries for Wurth components from here:
Note: The Wurth website allows you to search for the specific component. Simply type the component’s code into their search box to download the specific part. To install the library, follow the same procedure as described in the last issue.
BOARD DIMENSIONS
Once you have created your schematic, switch to the board designer by clicking File > Switch to board.
We had a small piece of single-sided copper clad board in the workshop that we could etch. If you do not have any on hand, you can purchase from most electronics retailers.
Our board measures about 50mm x 80mm, so we need to change the dimensions of the dimension layer to fit this limitation. We could make the board smaller and simply trim the board to size using a jigsaw or the score and snap method, but for simplicity, we’ve used the entire piece.
There are various ways to adjust the dimension indicator in EAGLE. One way is to right-click the side and manually enter the coordinates of each side. This can be time consuming though because you need to manually change all four sides.
We prefer to move and drag the dimension box to suit the desired size, however, to do this we need to add some dimensions to the work area, so we know what size to make the dimension box. To do this, click on the dimension button in the Command Toolbar.
Left-click of the origin crosshair on the bottom left of the dimension cube to select that as the starting position. You then drag the mouse along the bottom of the cube until it reads the desired dimension. In our case, 80mm.
Note: It may not be possible to get the very specific dimension you’re after as the dimension tool needs to snap to the grid.
Once you have the desired dimension you can click again to set that point. Repeat the same procedure for the y-axis and when done it should look like this.
You can now reposition the dimensions by using the move tool found in the Command Toolbar.
Your workspace should now look like this.
You can now use the Delete button from the Command Toolbar to remove the dimension labels as they won’t be used again.
You can now start laying out the PCB.
LAYOUT THE PCB
In this tutorial, we will show you how to change the design rules to suit the etching at home manufacturing method.
By default, EAGLE ensures that there is sufficient room between traces and pads to prevent short circuits. This default setting, however, is for professionally manufactured PCBs. If you plan to etch your PCB, leaving the program on this default setting can lead to issues, especially when using a ground plane (more on that later).
To change the Design Rules Check parameter click File > Design rules.
Select the Clearance tab.
By default, these settings are set to 6mil, which means about 150-micron gap between traces or traces and pads, etc. This is quite a big gap if you’re getting the PCB manufactured professionally but will be challenging to etch at home, especially if you’re new to the process.
To give ourselves the best possible chance we will increase the clearances to 15mil or 380-microns.
Note: Ignore the Via setting as we will only be producing a single sided board.
You can now place all of the components into the area inside the dimension’s boundary. While doing this, pay attention to the air wires and try and place connected components as close as practical together. You also need to make sure the design is logical. For example, make sure the power LED is next to the power input jack and that the output LED is next to the output. Also, consider the function. It’s best to keep the potentiometer out on its own, for example, as it will make it more noticeable and easier to access.
Note: Our PCB design example is many times bigger than it logically needs to be. If you’re getting a PCB manufactured you should reduce the size, which in turn will reduce the cost per unit.
GROUND PLANE OR NOT?
A ground plane fills all of the PCB area which is not used and connects it to the circuit’s common ground. The ground plane can help reduce electrical noise and interference caused by ground loops, and help prevent cross-talk with adjacent signals. This becomes very important when dealing with RF frequencies such as you would find around the crystal oscillator of your microcontroller project. Ground planes are also incredibly useful when using the ADC of your microcontroller in a project. They will significantly decrease the noise and thus, increase the accuracy of the reading. This becomes even more obvious when you’re powering your project via inherently noisy switchmode power supplies.
There is really no downside to using a ground plane unless you’re dealing with very high frequency designs, in which case, the added capacitance from the ground plane can become an issue. In a very simple circuit like ours with a maximum frequency of 1000Hz, the circuit isn’t likely to have a noticeable benefit from a ground plane. However, it makes the PCB process simpler to add a ground plane to our design, as it removes the need to run ground traces.
If you choose not to use a ground plane, you need to make all of the connections that you see here.
The black areas in this image show us the parts of the copper surface that will be etched away. This introduces another great reason why you should use a ground plane. Etching this much copper from your PCB will very quickly saturate your etching solution and reduce its effectiveness. It will also make the time to etch the board much longer. By adding a ground plane, you significantly reduce the amount of copper that needs to be removed.
To create a ground plane, select Polygon from the Command Toolbar and then select the bottom layer.
This will allow you to draw a shape onto the work area that you can name as any signal. Click in the top left corner and move the mouse to the top right corner and click again. Repeat this until you have a square around the entire design.
Note: It’s very important that the object is a closed object, and that the end point and starting point is the same. Once the polygon is a closed shape the polygon will turn into a dashed line and you will be prompted to name the signal ("GND" in our example).
Press the Ratsnest button.
Your PCB design should now have a flood fill with this newly created ground signal.
As you can see here, the amount of copper that we need to remove in the etching process is much less, however, you may notice there is still a black area shown in the lower right. We can optimise the design to remove as much of this as practical by simply either rearranging traces and/or components as shown here.
This tiny change will prolong the useful life of your etchant and mean the PCB will etch quicker.
You can now use the Text button from the Command Toolbar to add a name to the PCB so you will know exactly what this board does later down the track.
Enter a description of the board into the text box and select OK.
Note: To add a new line you hold shift and press enter.
Next, place this text outside of the PCB area. If you place it inside the PCB it makes it more difficult to resize and move. On a home etched PCB you don’t get the benefit of silkscreen, so any important information needs to be etched into the copper itself.
Right-click the origin crosshair of the text box and select Properties. This will allow you to adjust the font, size, spacing, etc.
In our example. we made the size 100, verified that the text was on the bottom layer and had an 8% ratio.
It’s also important you ensure the mirror option is checked. Failure to do this will mean the text is reversed and make it difficult to read.
Note: In EAGLE, the view of the bottom layer is as if you’re looking through the PCB. If the text for the bottom layer is not mirrored in the EAGLE view you need to mirror it.
When satisfied with the size and appearance of the text you can use the move button to place the text onto the PCB. When happy with the position use the Ratsnest button from the Command Toolbar once more to modify the ground plane to make the text visible.
You may want to repeat this process to display important information such as the 4.5V – 12V DC input or the 0.5Hz to 1KHz output etc. It’s also a good idea to include a board revision number just in case you change the design at some point.
CHECKING THE DESIGN
Once you have finished laying out a PCB design, it’s important to check that the design conforms to the design rules we set earlier. To do this, you can simply click the errors button in the Command Toolbar.
We didn’t have any issues in the design so let’s create one. Let’s force a trace to crossover or touch another trace, creating an undesired short circuit.
Let’s drag net 3 (N$3) over net 7 (N$7), as shown here.
The work area will try and warn us of this issue by creating a hatched area as you can clearly see here. However, if we were creating a PCB with much finer traces or much more complex it’s possible to miss such an error.
The error checker will search the design and help to identify any potential issues. It will find things like Airwires (Unconnected traces), clearance issues and overlaps (which we just created). More importantly, it shows you where the issue is, allowing you to rectify it immediately.
Note: EAGLE can at times provide great warnings of impending disaster but not provide enough detail on what kind of disaster.!It simply highlights what may be an issue and you need to resolve yourself.
CREATING THE PCB
There are numerous ways to produce a PCB from etching one at home to getting a board produced by a PCB manufacturer. We will show you how to export the data a professional board manufacturer needs in order to create your PCB, and next month, we will show you how you can take your design and etch the board at home if that's what you would prefer.
Parts Required: | Jaycar | ||
---|---|---|---|
2 x 10µF Electrolytic Capacitors (C1 & C2) | RE6066 | ||
2 x 0.1µF Monolythic Capacitors or similar (C3 & C4) | RG5125 | ||
1 x Red 5mm LED* (D1) | ZD0150 | ||
1 x Blue 5mm LED* (D3) | ZD0185 | ||
1 x 555 Timer (IC1) | ZL3555 | ||
2 x 2-Way Screw Terminal Blocks (J1 & J2) | HM3172 | ||
1 x 2.2k Resistor* (R1) | RR0580 | ||
1 x 4.7k Resistor* (R2) | RR0588 | ||
2 x 470 Resistors* (R3 & R4) | RR0564 | ||
1 x 200k Multiturn Trimpot* (R5) | - | ||
1 x 1k Resistor* (R6) | RR0572 | ||
1 x 2N2222 NPN Transistor (T1) | ZT2298 |
* Quantity shown, may be sold in packs.
EXPORT FOR A PCB MANUFACTURER
An easy option is to have your board professionally made by a PCB manufacturer. This saves you the trouble of handling etching chemicals, however, it will mean you need to wait for the board to be made and sent to you. You can find PCB manufacturers in Australia, such as LINTEK, and there are also some overseas alternatives.
To send the necessary board files, you simply export the Gerber files from EAGLE. These Gerber files contain all of the required information for the computer aided manufacturing (CAM) process.
It is important to note, that before you send your files to the board house, it’s generally a good idea to read through their design guide recommendations. These recommendations will generally give the minimum trace size, minimum clearances, minimum hole sizes, etc. Whilst it’s highly likely a respectable board house will identify that your design is not within their specs and ask you to modify, it’s not a guarantee.
In a simple single-sided design such as ours with standard hole sizes and massive clearances, it is unlikely to not be within a modern PCB manufactures capability, although it is something you need to be aware of. Extracting the Gerber files from the most recent version of EAGLE is very simple (before the newer editions, extracting Gerber’s in EAGLE was not straightforward).
Simply select File > CAM Processor from the menu. This brings up a pop-up window with a lot of options to set. We will go through the important ones.
Firstly, make sure Export as ZIP is ticked, which will provide all of the Gerber files in a nicely zipped up folder for you to email or upload to the board manufacturer.
Secondly, go through each of the output files and ensure that the important layers are included.
Under Gerber you will see the list of layers.
- TOP COPPER: Refers to the areas of the top layer which will be covered in copper.
- BOTTOM COPPER: Refers to the areas of the bottom layer which will be covered with copper.
- PROFILE: Shows the area of the board which will have milling or cutouts, etc.
- SOLDERMASK TOP AND BOTTOM: Shows the areas which will be covered by solder mask on the respective layer.
- SILKSCREEN TOP AND BOTTOM: Shows the areas covered by silkscreen on their respective layers.
Select each of the Gerber outputs and verify that the information you want is included in the correct layers. You will see the layers shown in the panel on the right when you choose each layer.
In our example. the layers are all fine, however, if you go to Silkscreen Top you may notice that, by default, the component values layer is not included.
Having component values and other important information printed on the PCB as it makes it much easier when building and testing the circuit. To include this layer, select the Edit Layers button.
Scroll down and select layer 27 Tvalues and click OK. This will add the top values layer to the top silkscreen Gerber, resulting in the values being printed on the PCB silkscreen as shown here.
As you can see, however, the value to capacitor C1 is not positioned correctly and is overlapping the Top place layer. Whilst only cosmetic, in this case, you should go back into the PCB designer and modify the design to rectify this.
Once you’re satisfied that the Gerber view for each layer represents the desired PCB you can click the process job button down in the bottom right corner. This will prompt you to choose the location to export the zipped Gerber files. Once saved, you will get confirmation that the Gerbers were exported successfully.
Note: We recommend you always double-check the output file in a web-based Gerber viewer to ensure the export is absolutely correct. Whilst we have never identified an error in the Gerber creation process, the last thing you want to do is send off your Gerber’s only to find that there was an issue in the creation, or more embarrassingly, you sent the wrong file (not that we have ever done that of course).
If you’re happy with the online Gerber viewer, send the zip to your favourite board manufacturer and you’re done.
Etching A PCB At Home:
An alternative to getting a PCB manufactured from a board house is to etch the PCB at home. There are many ways to do this using a myriad of different etchant chemicals. In our next issue, we will describe how to etch a PCB using the toner transfer method and use ferric chloride to etch away the copper.
BUILDING THE SQUAREWAVE GENERATOR
We have included a parts list if you intend to make the squarewave generator circuit we have described.
Note: These are suggested components based on the circuit we designed and prototyped on a breadboard before commencing our design. You will need to ensure the footprint of the components you purchase match the footprints you are assigning to your board’s design.