 Yeah, I'm gonna quickly talk about I guess circuit board design from a hobbyist's perspective Since we only have 30 minutes. Let's get right to it. Yeah, my name is Sebastian roll and I run a small consulting company in Norway But on the side I do a little bit of hardware design together with my friends it's nothing special but We like to create small things that we can use in Conjunction with Python workshops So we teach people micro Python by having them something tangible that they can work with during the workshops So I hope to share a little bit about my experiences. I would call myself an entry level hardware designer But hopefully there's something to gather in terms of information the agenda will be that we'll be looking at How to get the components that you want How to figure out which components you want and how to get them from a distributor? We'll look into PCB design itself the assembly process and Sometimes it doesn't go as you hope so that's where the experience points comes in so We definitely learned a lot along the way okay, so starting out with a The topic of how you connect components to the microcontroller in our case we used microcontrollers You see here a very simple device where you have a presence detector a little buzzer and a Tail which is a temperature sensor. These are all connected directly through jumper wires to the microcontroller So that might be the as easy as it gets it could be useful for some circumstances, but Mostly not you'll just end up in trouble. So The next step is to use a breadboard to connect things together. This is great for Some types of workshops some educational purposes. We have tried using that but it turns out that way too much time is spent on connecting these for the attendees and Even worse than that if something does not work as they wanted to work It's very difficult for them to know if it's a problem with their microcontroller or any of the connections or maybe their code So we decided we wanted to have something So they could skip the assembly process during the workshops, but it does have its use cases It's very Configurable and if you do make a mistake Like you put the jumper cable wire in the wrong spot. You can always fix that mistake easily so this is one device that we started out with it's a Box with some input devices like to push buttons there. It has an analog stick a display in the middle and a microphone below it I used this in presentations to demo and It was a real nightmare because this is what it looked like on the inside You have a breadboard on the white breadboard on the left there it was Very difficult if a wire came loose To even spot that it came loose and trying to get it back in was was very difficult So this just wouldn't work long term So the next step is to try something called a proto board So you have on top there is strip something called a strip board, but the idea there is that you sold or the connections together Which leads to a much more robust device You have more permanent connections It can be very good if you have like one off projects that you want to make a single one or something You might not need to go to PCB design them But it can be laborious if you have a lot of components that you want to connect And it can be hard to undo mistakes as well because you have lots of solder everywhere Here is one example where we use the proto board So this was a music game that we had with touch sensors And some LEDs to signal when you're supposed to touch the sensors for different ones for eight different ones and You also had some music playing using an mp3 module and You can see that in this case you have some nice screw terminals that we've soldered on to the proto board The motherboard itself can be connected Through some female pins So in this case we found this to be a nice a nice use case for a proto board, but when we decided to make this Device for workshops. We had to make about 10 of these We found out quickly that it takes a lot of time It take maybe one to two hours to solder these each one of these and You hand up with kind of some of the same Issues that we had with the breadboard It did work a much better, but we wanted to see can we go take this even further So we ended up looking into this PCB thing Can we design our own PCB printed circuit board? one advantage of Being able to do that is that It works well and if you want small scale if you only want a couple of PCBs They're really cheap to order so you can get five small PCBs for two dollars if you Know where to get them and it's also very easy to scale up to bigger production if you have the design finished up The connections between the components are embedded onto the PCB we call them traces You are able to have much denser In terms of components next to each other you can use smaller components But it has a slight learning curve and the second potential issue is that you order this from a Supplier possibly a Chinese supplier. It might take you two weeks until you get the PCB in your hands And that's when you find out you have a mistake in your design so you have to fix the mistake in your design and order a new one Takes two more weeks and that's when you find the second mistake in your design So that's something to be aware of is to give yourself enough time To get it right and also if you're the thorough person to or if you're not the thorough person to be a little bit thorough when you look at your design before you order it Yeah, so a PCB consists of a substrate which is plastic material I think which gives it material strength and rigidity and it has one or more conducting layers in copper and On each side you have something called a solder mask which protects the copper layer but it also exposes copper where you need to place your components and On top of that again, you have the silk stream screen where you can basically print labels write Custom stuff Anything you want really Yeah, so you want to build yourself a Printed circuit board with components You first need to figure out which components you'd like to have And then you want to figure out how to use that component. So maybe Testing it out on its own is a good idea Then you move on to designing the PCB and you order and assemble it So I guess you can split it into three parts. You have the manufacturers you have the distributors and also the aggregators I Interactly interact mostly with the distributors. So I've used LCSC, which is a Chinese distributor I like their prices a lot If I want to get if I have more urgent need for my components in terms of shipping I use arrow, but you guys are free to use whichever you want One good thing is that they've recently become much more aware of the hobbyist market segment. So You're able to buy one or a few of the components And get decent shipping rates and stuff like that. I Would also recommend aggregators Like Octo part and fine chips what you do there is you just Search for the component that you want and it will give you a list of suppliers that have it available and their respective prices So that's good to know Okay, so here we have a an environment sensor from Bosch called the BME 280 it Reads the temperature and the humidity and the air pressure from the environment I found a data sheet the data sheet for the sensor and you will if you look for a connection Diagram or a typical application circuit You will find a schematic of how it's supposed to be set up And to the right here, you can see a sensor module So basically someone took this BME 280 and designed a very small Circuit board for you to be able to to connect to it through like a breadboard or a proto board So that can be handy to get a hold of You connect to it you make sure it works The way you want it to work that you understand the device the component properly You know how to use it. That's a very good idea and Then a quick shout out to micro Python since this is a Python conference. I Love using micro Python. It's Python for micro controllers Here we are using five lines of code to extract the the data the values from the sensor Yeah, I can not quickly note that line number two there where you import B in BME 280 This is the driver of the of the sensor and it's just a Python class So you're just importing a Python class and instantiating it Using this I to see this is a protocol all this stuff. I would just recommend you look up on your own It's actually fairly straightforward to to learn. All right, then we move on to designing the PCB itself You need a so-called EDA tool electronic design automation tool so if you want to go like the corporate route they The big companies they spend a lot of money on licenses for these tools and they're very I bet they're very good, but I haven't had the chance to use them So I list now three free variants three tools Which are all good. I think but the one I've used the most is kai-kat at the bottom. So I guess that's where my recommendation goes Now When you want to design a printed circuit board, there are a couple of steps that you do The first step is that you draw a schematic like a symbolic Schematic diagram of your PCB and then for each component that you placed in your schematic You assign a footprint for that component. So basically how it will look like in the physical world Then you draw the layout of the PCB. So now you're at the stage where you draw a physical physical two-dimensional two-dimensional layout And then finally you order the PCB and the components and you assemble and test it and hopefully everything works Probably not though Yeah, drawing the schematic looks like this I can show you quickly I think So here I have kai-kat open. I'm gonna open the schematic editor So this is the schematic that I'm going to show you This contains the entirety of the Gaming pad that I showed you in a previous slide. So maybe the PCB final version of this workshop controller and In the middle here, you will see the connections to the microcontroller And let's just quickly zoom into the BME 280 Yeah so it looks Pretty similar to the data sheets that was provided you can start by placing a symbol and You can search up BME 280. It's a popular components You have libraries of thousands of components. You add that to your diagram and then you start play placing Connections of where it's supposed to go these guys So Number five should go to ground Here you can see number four should go to something called I to see a CK so that that is the clock and This is the data pin So basically you want the clock and the data pin to go to the microcontroller So you just add a label and you give that label a name I to see a CK And then on the microcontroller you give it the same name on pin 27 I to see a CK so now the program will know that you're supposed to connect these things physically through a trace using a trace Okay now that Yeah, this is another example of the similarity between the data sheet and what we have in our design software Okay Next we assign component footprints, so Footprints are like the the landing zone of your components So it defines I guess the physical layout of the connection points for your components so This is what it will look like for the BME 280 I don't know how many different sizes This mod this sensor has but if you're looking at for example a capacitor or a resistor They have multiple different sizes for the same Yeah value, so you need to specify the footprint for those as well now how we do that in our program is tools and Assign footprints So we are looking at you too here That's what we gave the label for the for that sensor And we see that all of the components have here have a footprint and going down to you too Yeah, some Bosch footprint that is Correct in this case Yeah, and they are also downloadable into your program and you can also create custom footprints if you'd like To do that or if you have to do that now When you've done doing that, then you basically have a Set of components that you have decided on and also what the component looks like and physically now you go to a layout editor and You import these components and they will all be clustered in the middle And you have to move them out to where you want them to be on your PCB and All of the connections that you specified in your schematic diagram You will have to actually draw a trace manually from from where it's supposed to be to where it's supposed to go so Let's quickly try to open that as well We go to the PCB editor Yeah, and yeah Here you can see the entire pad. You're also able to view it in a 3d viewer So you can see it This is always a lot of fun to to look at the 3d viewer. It helps up with the motivation a lot This touch sensor here is actually a custom footprint that we created. Yeah, just to show our logo and that you can touch it So that's cool In the layout here, I'm going to zoom into the environment sensor That's the u2 here and You can see that the ground pin the pin that's supposed to go to the ground has a very short trace Into a so-called via. So this is a penetration into another layer of the PCB So if we look at the ground layer here You can see that the penetration actually touches the ground layer So this will now be connected to ground which is nice because you don't have to move You don't don't have to take you make a long trace to some to some other place The same with the power But if we look at one of the the data pin, for example It should go to the microcontroller That's a long ways and it's probably connected to more I square C devices what we can do is we can try to delete it and You might see there's a Indicator line that tells you you need to create a a trace from this point to that point So very helpful Now the the more specialized corporate tools they have Automatic tracing So maybe you don't have to spend so much time on it But we do at least I do So what you can do also if you decide to have multiple layers of a PCB You can use more two layers for the signal. So what we've done here is that we've created a via That goes to the other side of the PCB so that we can actually cross paths Because they're not on the same layer if that makes sense All right That is the last step of the design process After you've done that You want to order your PCB? so these design tools they have a way for you to generate so-called Gerber files and these are like a standardized format which defines I guess good way to to To yeah, the production process. So it's basically a Something you can visualize the Gerber files you can view and see if everything makes sense or if there's something wrong with the files But you take these Gerber files and you upload them to your PCB manufacturer. I listed three of them here The one I've been using the most is JLC PCB also Chinese PCB manufacturer and As an option you might want to consider ordering a stencil and I'll quick. I will shortly Tell you what a stencil is Okay, now you have your PCB in place and you might have your components that you've tested on its own And you want to assemble it all together. So you have a couple of options of doing that So let's first look at hand soldering Hand soldering when it comes to printed circuit boards are good for through-hole components So that are components in which it goes through a hole in the seat in the PCB I don't know. I don't know how to to place surface mounted Components using a hand solder. Maybe some people know how to do it, but I think it would be very difficult to do So in our case here, this is the final product You can see the environment sensor To the to the left bottom left of the screen there to display and you also have some push buttons on the right And these are through-hole components so I Just simply push them through the holes because it matches with the footprint of the other component and Then I turn it on its other side and I solder solder them together and They are then connected because you have traces to each point So that's great Before we start discussing the two other options There's this stencil thing. So When you order your PCB, you Can also order a stencil, which is a like a metal sheet with holes Where the solder is supposed to go on the PCB? So if you align it properly and you secure the the printed circuit board and then you put this Stencil on top you can apply solder paste Using a credit card or whatever you find find handy. We like using cards. I Would recommend not over applying solder paste because then these small pads might actually Be bridged with solder when you heat it up. That's not good Also, this solder paste tends to dry up pretty fast. So you might want to Refrigerate it keep it cool. It will double the lifetime of the solder paste And if it's already dry, you can you can try mixing some flux into the solder paste Which will help losing out giving it some moisture Okay Next up in terms of assembly is the hot air gun which can be very good for like Setting up one or a few Devices it can also be very good for fixing small mistakes For placing and for removing small sensors stuff like that But it can at least if you're not very good at it. It can be easy to overheat. Maybe even damage the component You might loosen some of nearby components because it gets too warm So There's one thing you can do is you can put the whole PCB on top of a heating plate and heat it up Because then the temperature difference will not be as high. So you heat it up until a little bit below melting points for the for the solder You can also use aluminum foil if you want to like really pinpoint where the hot air goes This is a learning process that I definitely But if you want to make it really easy for you You apply the solder with the stencil and then you put it into these PCB reflow oven If you have one of those at home They're very nice for for putting surface mounted components together Of course, it's easier if you have all of the components on one side If not, you might have to run it again on the opposite side And I don't know if you might actually lose the The original components that you put in initially But this is a really nice if you have like small scale factory. We needed to make a couple or maybe 25 of these guys So that helped a lot Yeah, in terms of assembly You want to use flux Don't be afraid of using flux. This is like a chemical reagent that heats up You can apply it's like a paste you can apply and it heats up the solder Very nicely. It makes life easier Also making life easier is if you use proper tools. So don't cheap out too much on the soldering iron, etc um be very of Wary of very small form factors so One of our sensors was an npu 90 250 which is like a gyro sensor accelerometer thingy And we had lots of trouble uh with that because our solder paste was dry and we had to fix more than half of them Simply because the the pads are very small and very close together. So it's easy for them to bridge and then uh, finally, uh, very good idea to write test firmware because It's not like it's not like code. You have physical stuff that can You can have issues with connections. There's a lot of things that can be wrong So it's a good idea to just have one script that tests all the components after you've placed it So you can do like a little assembly line there um Yeah, uh joining your local makerspace will save you a lot of money. You don't have to buy all this equipment yourself There's a lot of skilled people there that might be Willing to help you When it comes to soldering also, there's so many small Things that you can do to improve drastically How you do it. So just hanging out with people who know what they're doing has helped tremendously for me In our hacker space, we also have an ultrasonic cleaner that you can see Which makes your PCBs look like they just came out of the factory. So it removes flocks and fats very nicely You might have access to a 3d printer. We used it to mount this direction pad to our PCB our gaming pad You might have access to a laser cutter that you can make to use to use to make these cute enclosures We used it to basically Um Decide what size the our printed circuit board should be so we just made a wooden Uh prototype of it just to see how it feels in the in the hand So all of these tools can help out in its own way Yeah You can organize your components when you get them from the other distributor They come in these strips. So you might want to get these tiny boxes. These are resistors It will help you if you yeah, if you're doing Yeah, mounting more than one thing then it's it's really beneficial It does take a lot of time to Take these tiny components out of the strips. You can see the garbage bag is full Also, if you do this it creates a single point of failure Uh, which I had the I guess I'm the single point of failure I dropped it on the ground and it's not so fun to to To make sure uh, we Put them in the right boxes again. That was we didn't even bother So, yeah, um If you decided you've been able to make something cool And you don't want to assemble it yourself You there are services that can do the pcb manufacturing They can help you out with finding the correct components that you decided you want They will even assemble it for you and keep inventory Of your product And can even help with sales and distribution. So if you do find a really cool gadget and you want to To really commit to it that could be one fun approach I would say Yeah makerfabs. I haven't used them myself, but I heard good things about them Yeah, I think that's it all the source code for the design of the pad is uh, is available On github as well as the source code for all of the drivers With micro python you can actually pip install Stuff so directly onto the micro controller. So if you do that with this pad, you'll get all the drivers that it has Those are really nice little detail And that's it. Thanks a lot