I recently prototyped these
I2S stereo amplifier boards using PCBWay. They work really well and
I made a bluetooth speaker using them. But there's a couple of
improvements I want to make. The first is the size of the board. My original plan was to make them the same size as the Adafruit mono I2S
amplifier. I'm not sure what happened, but somewhere in the excitement of PCB
layout I ended up with much smaller boards. This has the knock on effect of things
being a bit cramped. You can't see the silk screen for the two speaker connections which is pretty poor for something that is supposed to be a nice friendly breakout board and the screw terminals are
hanging off the edge of the board. Which frankly just looks a bit rubbish. Time to fix my mistakes and do a version 2. I'm going to take this opportunity
to lear KiCad and see what it's like. My first task is to learn how to pronounce it is KiCad or KeeCad - let me know in the comments. For now I'll stick to KiCad as it's easier for me to say. Why KiCad? Not only is it free it's also open source. If there are any problems or things I really dislike about it, I can always dive into the code and try and fix them. It's also very popular in the
maker community and it's good to learn new things I'll let you know what I think
of KiCad at the end of the video. I've already downloaded KiCad
and installed it on my machine. I want to set it up with the right
design rules and settings for PCBWay. On the PCBWay GitHub account there's a
link to a template project we can use. We can easily follow the instructions
here. It's pretty straightforward. We just create a templates
folder and clone the repo into it With that done we just go to the
KiCad preferences and update the paths so that the user templates path
points at our new templates folder. Now, when we create a new project we
can now select the PCBWay template. This should give us all the correct
settings and DRC rules for PCBWay. To open up the schematic editor and start
our design we just double click on this icon. I've made one change to the preferences that lets me use my trackpad to pan the design This makes navigation a lot easier as I can just use two finger swipes to move the canvas around.
And I can pinch to zoom in and out. To place a symbol we either use this icon and click or use the 'P' keyboard shortcut. The first problem we have it
that we don't have a symbol for the MAX98357 in the symbol
library. Let's get that fixed. I've found the symbol on Octopart - so we just download it. I've created a libraries folder on my machine and unzipped the download into it I'm sure there will more symbols required over time. To add it to our symbol libraries we goto Preferences -> Manage Symbol Libraries. And then click the little folder icon
to add our downloaded lib file. Going back to the schematic editor we
can now find our symbol and place it. I'm just going to quickly recreate
my original layout from EasyEDA I could just try and import it, but
I want to learn how to use KiCad. I do have a complete video on the schematic for
this project, but it is pretty straightforward. We need a 7 pin header for the input looking through the symbol library we can find a component for this by searching for Connectors. I'm going to use labels to hook things up
to avoid wires going all over the place. You create a label using this
menu icon and then just click where you want them. Double clicking
lets you quickly modify the name. To rotate symbols use the "R" keyboard shortcut. Make sure you have the mouse pointer over the symbol you want to rotate. Similarly, we can duplicate using
the "C" button again make sure the pointer is over the symbol you want to duplicate. To place the power ports we use this symbol and then click where we want the symbol. We can find and place the ground symbol we need. And we can also find and place the VCC symbol. To place a wire use the "W" keyboard shortcut. This does have some slightly weird behaviour where the wire starts wherever the cursor currently
is but you get used to that after a while. Just place the cursor where you want the wire to start Once again I'm connecting up all the non connected
pins to ground as I did in my previous layout. I also need a couple of decoupling capacitors so I'll use the P key to place two generic capacitor symbols and hook them up to VCC and ground. The final thing we need is a screw terminal for the output. Once again it's the P key and we just search through the component libary for screw terminals. And that's the left channel done. We can just make a copy of this to create our right channel. If you just drag and select then you will start moving the components, so you need to shift+drag to make a copy. The right channel is the same as the left, but there's now a resistor going to the SD line so the chip knows to only
process the right channel. We've got a bunch of question marks on our components so I'll just quickly fill these out. I'm not sure if this would be done automatically but I'll do it now just to be sure. I'll also put values on the symbols for the capacitors and the resistor. before we generate the PCB we need to assign footprints to our symbols KiCad works in a slightly different
way from EasyEDA - the symbols are independent from footprints, so we need to assign
a footprint for each component in our schematic. This is done from the Tools ->
Assign Foorprints menu item. This is pretty straightforward
for most of our components the filter works quite well and they
have footprints for everything. However, we don't have a footprint for the MAX98357 chips. We could use a standard footprint from the existing library but I'm going to use the specific foot print that we got from Octopart. To import the footprint we use the Preference
-> Manage Footprint Libaries. We click on the folder icon and navigate to the folder
that contains the footprint file. We can now go back to our schematic editor and finish off assigning our footprints. To convert the schematic to a PCB
we need to generate the netlist. We do that using the netlist icon. We can now open up the PCB tool by double clicking on this icon and import the netlist. That's brought in all our components ready to layout. I want to have a custom board outline that has curved corners and I've done some playing around and some research on KiCad and it seems the consensus is that to do any that to do anything more complex than basic rectangles you should use a
different tool and generate a DXF file. So I'm going to use Fusion 360 to create a sketch of the board outline and give it rounded corners. I can then export this as a
DXF file and import it for the board outline. What's interesting is the construction lines from the sketch have also come through so maybe worth deleting them before doing the export from Fusion360 To move components around you
hover over them and hit the "M" key Rotate is the same as in the
schematic editor - just use the "R" key. With our components in the correct positions, we can do the wiring up. To start a track
push the "X" key. You can insert a via as you are drawing a wire using the "V" key
and carry on drawing on the opposite layer. To quickly switch between layers
you can use the "+" and "-" key. I found this quite helpful when placing
tracks on the back and front of the board. With the signal tracks all done
I just need to add some thick tracks for the power and the speaker
outputs. There's a handy track width calculator built in that we can use
to work out what size we need to use. We can add our new track width
to the available options. And then add our wide tracks for
the power and speaker connections. I'm going to add a copper pour connected to
the ground net on both the top and bottom of the boards. This will give us some good
thermal dissipation for the amplifier chips. The chips are very efficient, but let's give them a bit more help. This works pretty well, the only
thing I needed to change was the clearance to match the capabilities of PCBWay. I've also stitched the front and back
ground pours together using vias. One of the things that I was keen to try out on KiCad was the 3D view of the PCB
and in particular the 3D export. Opening up the 3D view it works nicely, but
the models for the amplifier ICs are missing. To fix this we need open up the footprint
properties and associate the 3D model. For some reason this didn't work properly
when we imported the footprint originally, but we just need to fix up the file paths. Back on the PCB we can now just update
the footprints and our 3D model is fixed. The 3D export is one of the main reasons
for me to start using KiCad - I 3D print a lot of boxes for my custom PCBs and
having an accurate model is priceless. Exporting the step file and
importing it into Fusion360 seems to work really well. For my workflow
this is a bit of game changer. Having an accurate model of your PCB along with
the components on it makes desiging enclosures considerable easier - it
should eliminate a lot of guesswork. The final thing to complete our PCB is the
mounting holes. I need to move the screw terminals closer together to fit these on and hit a problem
with the DRC - there's a rule in the DRC around overlapping courtyards. The footprints for
the connectors in KiCad have very generous courtyards which makes it hard to put the terminal
blocks close together without breaking the rules. For my design I'm turning off these
rules as they aren't really relevant and I know the screw terminals will
fit without any problems. It took a bit of poking around to find the option
for this, but I found it eventually. Re-running the DRC we just need to fix up a
track from when I moved the screw terminals. We've got our mounting holes and I can reload
the model in Fusion360 to have a good look at it. Labelling the pins is a pretty mechanical process. Once again I'm labelling both top and
bottom layers to make it easy to use. And I'm sticking my board label and
revision number on the bottom of the board. I'm pretty happy with that, we're good to go. To export the Gerber and drill files I've
followed the instructions from the PCBWay website. You use the File->Plot menu option and
select the required layers. For a two layer board we need the Top and Bottom
copper layers and then the Solder Paste, Silk and Solder Mask for both layers. We also
need the Edge Cuts to give our board outline. You need to make sure to check the "Use
Protel Filename Extensions as well" You also need to generate the drill files so the PCB manufacturer knows where
to make holes in your PCB. Follow the instructions on the
PCBWay website and you should be ok. We just need to zip up the results of this
export to have something we can submit to PCBWay. We can also use an online Gerber viewer
to double check the results of the export. And it looks pretty good I'm going to be doing SMT assembly with PCBWay. So I need to create a Bill of Materials File We just go to File -> Farication Outputs and click on BOM file. This will create a CSV file that lists
our components along with their designators. I've opened this file up in Excel along with
the BOM file from my previous version that PCBWay sent me and the template
Excel file that PCBWay suggest. Let's try and get out file to match what
PCBWay would like. The first thing I'm going to do is remove the mounting holes, pin header and terminal blocks. As the won't be assembled by PCBWay. I'm not sure why the mounting holes are inclued. I'm going to get PCBWay to supply the components so I just need to let them know the manufacturer and the manufacturers code. Fortunately I can
copy and paste these from the original BOM and I can look them up on LCSC We also need the footprint positions for our board, one thing that I did need to do was include footprints even if not marked for surface
mount - if I didn't do this my ICs we not included - hopefully this would have been
caught by PCBWay before it got to manufacture, but I'm happy that I caught this error. With all the files generated, we're now ready to submit the files
to PCBWay and get our boards ordered. To do this we use the quick order process and
upload our Gerber files. All the defaults should be fine for us and we can fill
out the details for the SMT assembly. On the following screen we upload the BOM file and the position files. PCBWay will take our
BOM and work out the costs for the parts and we'll be good to go. After 12 hours or so I've received the final quote for the
parts. PCBWay have filled in the costs. We can go onto LCSC and check the prices to see if they are reasonable and
they all look pretty sensible. I've approved the order so we'll see the fruits of
our labour in a couple of weeks. I can't wait to see how they come out. Fingers
crossed we've not messed anything up! So, what do I think of KiCad having
done an end to end project with it. I found it surprisingly pleasant to use. Symbol
and footprint management is a bit confusing, it took a few tries to understand
how to do it. But, this seems to be the case of all the software I've
used they all seem to make symbol and footprint management amazingly complicated. The UI is a bit 90s, it doesn't look that nice an there's other software that looks nicer but it is functional. And the icons are fairly easy to understand There are a few quirks and weird things,
but I got used to it pretty quickly. I give it a solid 8 out of 10 -
I would recommend giving it a go.