View All Posts
Want to keep up to date with the latest posts and videos? Subscribe to the newsletter
HELP SUPPORT MY WORK: If you're feeling flush then please stop by Patreon Or you can make a one off donation via ko-fi

Learn how to create a version 2 of an I2S stereo amplifier board using KiCad in this engaging tutorial. Find out how to set up design rules, import symbols and footprints, generate the PCB layout, and add wiring and custom board outlines.

Related Content

[0:00] I recently prototyped these I2S stereo amplifier boards using PCBWay.
[0:05] They work really well and I made a bluetooth speaker using them.
[0:07] But there’s a couple of improvements I want to make.
[0:10] The first is the size of the board.
[0:12] My original plan was to make them the same size as the Adafruit mono I2S amplifier.
[0:16] I’m not sure what happened, but somewhere in the excitement of PCB layout
[0:20] I ended up with much smaller boards.
[0:22] This has the knock on effect of things being a bit cramped.
[0:24] You can’t see the silk screen for the two speaker connections
[0:27] which is pretty poor for something that is supposed to be a nice friendly breakout board
[0:31] and the screw terminals are hanging off the edge of the board.
[0:33] Which frankly just looks a bit rubbish.
[0:35] Time to fix my mistakes and do a version 2.
[0:40] I’m going to take this opportunity to lear KiCad and see what it’s like.
[0:44] My first task is to learn how to pronounce it
[0:47] is KiCad or KeeCad - let me know in the comments.
[0:49] For now I’ll stick to KiCad as it’s easier for me to say.
[0:53] Why KiCad?
[0:54] Not only is it free
[0:56] it’s also open source.
[0:58] If there are any problems or things I really dislike about it, I can always dive into the code and try and fix them.
[1:02] It’s also very popular in the maker community
[1:05] and it’s good to learn new things
[1:07] I’ll let you know what I think of KiCad at the end of the video.
[1:12] I’ve already downloaded KiCad and installed it on my machine.
[1:15] I want to set it up with the right design rules and settings for PCBWay.
[1:20] On the PCBWay GitHub account there’s a link to a template project we can use.

[1:24] We can easily follow the instructions here. It’s pretty straightforward.
[1:27] We just create a templates folder and clone the repo into it
[1:31] With that done we just go to the KiCad preferences and update the paths
[1:34] so that the user templates path points at our new templates folder.
[1:38] Now, when we create a new project we can now select the PCBWay template.

[1:42] This should give us all the correct settings and DRC rules for PCBWay.
[1:47] To open up the schematic editor and start our design we just double click on this icon.
[1:52] I’ve made one change to the preferences that lets me use my trackpad to pan the design
[1:56] This makes navigation a lot easier
[1:59] as I can just use two finger swipes to move the canvas around. And I can pinch to zoom in and out.
[2:03] To place a symbol we either use this icon and click or use the ‘P’ keyboard shortcut.
[2:08] The first problem we have it that we don’t have a symbol for the MAX98357 in the symbol library.
[2:14] Let’s get that fixed.
[2:15] I’ve found the symbol on Octopart - so we just download it.
[2:18] I’ve created a libraries folder on my machine and unzipped the download into it
[2:22] I’m sure there will more symbols required over time.
[2:25] To add it to our symbol libraries we goto Preferences -> Manage Symbol Libraries.
[2:29] And then click the little folder icon to add our downloaded lib file.
[2:33] Going back to the schematic editor we can now find our symbol and place it.
[2:39] I’m just going to quickly recreate my original layout from EasyEDA
[2:43] I could just try and import it, but I want to learn how to use KiCad.
[2:47] I do have a complete video on the schematic for this project, but it is pretty straightforward.
[2:51] We need a 7 pin header for the input
[2:54] looking through the symbol library we can find a component for this by searching for Connectors.
[2:58] I’m going to use labels to hook things up to avoid wires going all over the place.

[3:02] You create a label using this menu icon
[3:05] and then just click where you want them.
[3:06] Double clicking lets you quickly modify the name.
[3:09] To rotate symbols use the “R” keyboard shortcut. Make sure you have the mouse pointer over the symbol you want to rotate.
[3:15] Similarly, we can duplicate using the “C” button
[3:18] again make sure the pointer is over the symbol you want to duplicate.
[3:22] To place the power ports we use this symbol and then click where we want the symbol.
[3:27] We can find and place the ground symbol we need.
[3:29] And we can also find and place the VCC symbol.
[3:31] To place a wire use the “W” keyboard shortcut.
[3:35] This does have some slightly weird behaviour where the wire starts wherever the cursor currently is
[3:39] but you get used to that after a while.
[3:41] Just place the cursor where you want the wire to start
[3:43] Once again I’m connecting up all the non connected pins to ground as I did in my previous layout.
[3:48] I also need a couple of decoupling capacitors
[3:51] so I’ll use the P key to place two generic capacitor symbols
[3:54] and hook them up to VCC and ground.
[3:56] The final thing we need is a screw terminal for the output.
[3:59] Once again it’s the P key and we just search through the component libary for screw terminals.
[4:04] And that’s the left channel done.
[4:06] We can just make a copy of this to create our right channel.
[4:09] If you just drag and select then you will start moving the components,
[4:12] so you need to shift+drag to make a copy.
[4:14] The right channel is the same as the left,
[4:16] but there’s now a resistor going to the SD line so the chip knows to only process the right channel.
[4:21] We’ve got a bunch of question marks on our components so I’ll just quickly fill these out.
[4:25] I’m not sure if this would be done automatically
[4:27] but I’ll do it now just to be sure.
[4:28] I’ll also put values on the symbols for the capacitors and the resistor.
[4:34] before we generate the PCB we need to assign footprints to our symbols
[4:39] KiCad works in a slightly different way from EasyEDA - the symbols are

[4:42] independent from footprints, so we need to assign a footprint for each component in our schematic.
[4:47] This is done from the Tools -> Assign Foorprints menu item.
[4:50] This is pretty straightforward for most of our components the

[4:52] filter works quite well and they have footprints for everything.
[4:55] However, we don’t have a footprint for the MAX98357 chips.
[4:59] We could use a standard footprint from the existing library
[5:02] but I’m going to use the specific foot print that we got from Octopart.
[5:05] To import the footprint we use the Preference -> Manage Footprint Libaries.
[5:09] We click on the folder icon and navigate to the folder that contains the footprint file.
[5:13] We can now go back to our schematic editor and finish off assigning our footprints.
[5:19] To convert the schematic to a PCB we need to generate the netlist.

[5:23] We do that using the netlist icon.
[5:25] We can now open up the PCB tool by double clicking on this icon and import the netlist.
[5:30] That’s brought in all our components ready to layout.
[5:34] I want to have a custom board outline that has curved corners
[5:38] and I’ve done some playing around and some research on KiCad
[5:42] and it seems the consensus is that to do any that to do anything more complex than basic rectangles
[5:46] you should use a different tool and generate a DXF file.
[5:49] So I’m going to use Fusion 360 to create a sketch of the board outline and give it rounded corners.
[5:54] I can then export this as a DXF file and import it for the board outline.
[5:58] What’s interesting is the construction lines from the sketch have also come through
[6:02] so maybe worth deleting them before doing the export from Fusion360
[6:09] To move components around you hover over them and hit the “M” key
[6:12] Rotate is the same as in the schematic editor - just use the “R” key.
[6:16] With our components in the correct positions,

[6:18] we can do the wiring up. To start a track push the “X” key. You can insert a via as

[6:23] you are drawing a wire using the “V” key and carry on drawing on the opposite layer.
[6:26] To quickly switch between layers you can use the “+” and “-“ key.

[6:30] I found this quite helpful when placing tracks on the back and front of the board.
[6:34] With the signal tracks all done I just need to add some thick

[6:36] tracks for the power and the speaker outputs. There’s a handy track width

[6:40] calculator built in that we can use to work out what size we need to use.
[6:44] We can add our new track width to the available options.
[6:46] And then add our wide tracks for the power and speaker connections.
[6:52] I’m going to add a copper pour connected to the ground net on both the top and bottom

[6:57] of the boards. This will give us some good thermal dissipation for the amplifier chips.
[7:00] The chips are very efficient, but let’s give them a bit more help.
[7:03] This works pretty well, the only thing I needed to change was the

[7:06] clearance to match the capabilities of PCBWay.
[7:08] I’ve also stitched the front and back ground pours together using vias.
[7:14] One of the things that I was keen to try out on

[7:16] KiCad was the 3D view of the PCB and in particular the 3D export.
[7:21] Opening up the 3D view it works nicely, but the models for the amplifier ICs are missing.
[7:25] To fix this we need open up the footprint properties and associate the 3D model.

[7:30] For some reason this didn’t work properly when we imported the footprint originally,

[7:33] but we just need to fix up the file paths.
[7:35] Back on the PCB we can now just update the footprints and our 3D model is fixed.
[7:42] The 3D export is one of the main reasons for me to start using KiCad - I 3D print

[7:47] a lot of boxes for my custom PCBs and having an accurate model is priceless.
[7:51] Exporting the step file and importing it into Fusion360

[7:55] seems to work really well. For my workflow this is a bit of game changer. Having an

[7:59] accurate model of your PCB along with the components on it makes desiging

[8:02] enclosures considerable easier - it should eliminate a lot of guesswork.
[8:08] The final thing to complete our PCB is the mounting holes. I need to move the screw terminals

[8:13] closer together to fit these on and hit a problem with the DRC - there’s a rule in the DRC around

[8:18] overlapping courtyards. The footprints for the connectors in KiCad have very generous

[8:22] courtyards which makes it hard to put the terminal blocks close together without breaking the rules.
[8:27] For my design I’m turning off these rules as they aren’t really relevant

[8:30] and I know the screw terminals will fit without any problems. It took a

[8:34] bit of poking around to find the option for this, but I found it eventually.
[8:37] Re-running the DRC we just need to fix up a track from when I moved the screw terminals.
[8:41] We’ve got our mounting holes and I can reload the model in Fusion360 to have a good look at it.
[8:49] Labelling the pins is a pretty mechanical process.

[8:51] Once again I’m labelling both top and bottom layers to make it easy to use.
[8:55] And I’m sticking my board label and revision number on the bottom of the board.
[8:59] I’m pretty happy with that, we’re good to go.
[9:04] To export the Gerber and drill files I’ve followed the instructions from the PCBWay website.
[9:09] You use the File->Plot menu option and select the required layers. For a two

[9:14] layer board we need the Top and Bottom copper layers and then the Solder Paste,

[9:18] Silk and Solder Mask for both layers. We also need the Edge Cuts to give our board outline.
[9:24] You need to make sure to check the “Use Protel Filename Extensions as well”
[9:29] You also need to generate the drill files so the

[9:31] PCB manufacturer knows where to make holes in your PCB.
[9:35] Follow the instructions on the PCBWay website and you should be ok.
[9:39] We just need to zip up the results of this export to have something we can submit to

[9:43] PCBWay. We can also use an online Gerber viewer to double check the results of the export.
[9:47] And it looks pretty good
[9:51] I’m going to be doing SMT assembly with PCBWay. So I need to create a Bill of Materials File
[9:56] We just go to File -> Farication Outputs and click on BOM

[10:00] file. This will create a CSV file that lists our components along with their designators.
[10:04] I’ve opened this file up in Excel along with the BOM file from my previous version that

[10:08] PCBWay sent me and the template Excel file that PCBWay suggest.
[10:12] Let’s try and get out file to match what PCBWay would like. The first thing I’m

[10:16] going to do is remove the mounting holes, pin header and terminal blocks.
[10:20] As the won’t be assembled by PCBWay. I’m not sure why the mounting holes are inclued.
[10:26] I’m going to get PCBWay to supply the components
[10:29] so I just need to let them know the manufacturer and the manufacturers code.
[10:33] Fortunately I can copy and paste these from the original BOM and I can look them up on LCSC
[10:41] We also need the footprint positions for our board, one thing that I did need to do was include

[10:46] footprints even if not marked for surface mount - if I didn’t do this my ICs we not

[10:50] included - hopefully this would have been caught by PCBWay before it got to manufacture,

[10:54] but I’m happy that I caught this error.
[10:58] With all the files generated,

[10:59] we’re now ready to submit the files to PCBWay and get our boards ordered.
[11:03] To do this we use the quick order process and upload our Gerber files. All the defaults

[11:07] should be fine for us and we can fill out the details for the SMT assembly.
[11:11] On the following screen we upload the BOM file

[11:14] and the position files. PCBWay will take our BOM and work out the costs for the parts and

[11:18] we’ll be good to go.
[11:21] After 12 hours or so
[11:23] I’ve received the final quote for the parts. PCBWay have filled in the costs.
[11:29] We can go onto LCSC and check the prices to

[11:32] see if they are reasonable and they all look pretty sensible.
[11:35] I’ve approved the order so we’ll see the fruits of our labour in a couple of weeks. I can’t

[11:38] wait to see how they come out. Fingers crossed we’ve not messed anything up!
[11:44] So, what do I think of KiCad having done an end to end project with it.
[11:48] I found it surprisingly pleasant to use. Symbol and footprint management is a bit confusing,

[11:52] it took a few tries to understand how to do it. But, this seems to

[11:55] be the case of all the software I’ve used
[11:58] they all seem to make symbol and footprint management amazingly complicated.
[12:01] The UI is a bit 90s, it doesn’t look that nice an there’s other software that looks nicer
[12:06] but it is functional. And the icons are fairly easy to understand
[12:09] There are a few quirks and weird things, but I got used to it pretty quickly.
[12:12] I give it a solid 8 out of 10 - I would recommend giving it a go.

HELP SUPPORT MY WORK: If you're feeling flush then please stop by Patreon Or you can make a one off donation via ko-fi
Want to keep up to date with the latest posts and videos? Subscribe to the newsletter
Blog Logo

Chris Greening

> Image


A collection of slightly mad projects, instructive/educational videos, and generally interesting stuff. Building projects around the Arduino and ESP32 platforms - we'll be exploring AI, Computer Vision, Audio, 3D Printing - it may get a bit eclectic...

View All Posts