 Hi. Thank you very much for joining us. My name is Leona Naveed. I'm a senior software engineer in a consortium group. The company is providing open source consultancy services for embedded and the automotive industry. So I have the pleasure to work on some very cool projects, including the presentation that you saw by Zeeshan from Geneva Development Platform and AGL. But I'm here to talk about something which is my hobby. And it's about open source hardware that is created and powered by free and open source software. And in this talk, I'll show you how to make Raspberry Pi hats. The keyword here is hobby. The agenda for today includes the Raspberry Pi hat specification, some tips and tricks for designing an open source hardware device. And after that, of course, a few slides for the software support. How many of you are software engineers? Could you please raise your hand? OK, almost everybody. And how many of you are hardware engineers? OK, a few of you as well. So keep in mind, I'm a software engineer. And the combination between a software engineer and a soldering chiron could be very, very dangerous. So everything that I say about hardware, you double check it, right? OK, let's go. So before we start with technical details, we have to clarify something very important. There is a huge difference between a hat and a Raspberry Pi hat. I have both of these, but this one is for my hat and this one is for my Raspberry Pi hat, for my Raspberry. It comes from hardware attached on top, and it's a standard by the Raspberry Pi Foundation. A few milestones that are important in terms of this talk. You're all familiar with the credit size computer Raspberry Pi, right? Anyone that doesn't know it? No one, perfect. So the first model appeared in 2012. It is developed by a foundation founded in 2009, a called Raspberry Pi Foundation. And the next important milestone was 2014, when the Raspberry Pi model B-plus was announced. It brings several changes, and a few of them are very, very specific for this talk. We're going to discuss them in details in the next slide. And last year, Raspberry Pi Zero was announced. It's a five-door Raspberry Pi. Unfortunately, it's very hard to get it. It's with a little bit different form factor. Therefore, it's also important for this talk. Raspberry Pi comes in different flavors. I believe you're all familiar with them, but I just wanted to show them. Just this is the small portion of all Raspberry Pies that are available on the market. Here, this is the very first one that appeared five years ago. Next to it is the B-plus model. You can notice some differences. We've got the second version, the third version, the compute stick, which is an attempt to conquer the industry. And there are already some companies using this compute stick into products. And this is the Raspberry Pi Zero from last year. I mentioned that there were a lot of changes in Raspberry Pi B-plus. Probably the most significant changes from the point of view of a user are related to the additional USB, as well as to the change of locations, of the locations of some components. But actually, for this talk, the most important change is the header. The first version had 26 pins, and the second version has 40 pins. And this is important because our add-on boards will be with 40-pin header. In the five-year span, since the first model, there have been a lot of add-on boards. And new boards appear each day. But there are very strict specifications for a hat. So today's talk is about not just add-on boards, it's about Raspberry Pi hats. So let's have a look at the previous slides. But this time, we'll highlight the Raspberry Pi models, which have 40-pin header. As you can see, the first model is with 26 pins, and the compute stick is something totally different. But all the rest models have 40-pin header, which means that the add-on boards that we are discussing are compatible for all of them. And if you design an add-on board for Raspberry Pi B+, it will be compatible with Raspberry Pi 2, 3, as well as with the zero. Now let's have a closer look at the 40-pin header. The 26 pins are identical to the first version of Raspberry Pi. The changes are coming with the new 40 pins. The majority of them are general-purpose input-output pins, so you can attach more devices, you can control more things with them. But the significant difference is actually these pins, 27 and 28. There is additional I2C bus on them, and it's used for identification of the hardware that you are putting on top of your Raspberry Pi. This is done through an EE-Prom and a device refragment. Now this is the list of requirements for a head. This list was published on the Raspberry Pi Foundation website. Here is the URL. I'm not sure if you can see it from the back seats, but the slides are available in slideshare, as well as on the Foslum website, so you can download them and have a very good look at all the links. There is a long article explaining all the details, but these are the most important requirements. The first thing is the form factor, and the mounting hose. You should leave places for the camera connector and the display connector for Raspberry Pi. You need a 40-pin header compatible with Raspberry Pi B+, and the newer models of Raspberry PIs that are already on the market, as well as all new models that are supposed to appear in the next years. And of course, to have an EE-Prom with the device refragment. This is actually quite interesting and important because this is the binding point between the hardware and the software. There is another standard, which is actually not official. It's not a standard of the Raspberry Pi foundation, but a lot of companies and individuals are developing smaller hats, which have the prefix P. It's a little bit vague. I don't know why it's called P. Some people say it's Pico, others say it's coming from Pirate, poor, and so on. It's not a standard, but there are some recommendations. It has the form factor for Raspberry Pi Zero with four mounting hose. The size is shorter. It's, again, 65 millimeters, but this time only 30 millimeters height. Four pin header, true hole header, and the EE-Prom is not mandatory, which means you can put it, or if you want, you can skip it. It's important to say that all these standards are not mandatory. If you want to do an add-on board for Raspberry Pi, no problem, do it. But if you want to do something that is called a hat, you have to follow the standard of the Raspberry Pi Foundation. The first Raspberry Pi hat that appeared on the market was the Raspberry Pi Sense Hat. It's an official product of the Raspberry Pi Foundation. It comes with a bunch of sensors. There's a sensor for temperature, humidity, barometric pressure, there's an accelerometer, gyroscope, probably you know it very well. There's also RGB LED matrix over here, so you can experiment with some lights and nice tech signs. There is a five-button joystick over here. The product was designed for a program in the United Kingdom which allowed students to develop software which after that was sent to space with an astronaut who was bringing with him a Raspberry Pi. Probably it has been pretty interesting. I bought this Sense Hat two years ago. I wanted to do some IoT experiments because IoT is the buzzword nowadays, right? But I found out that if the load of the CPU is too high, there is a heat and this heat is kind of a problematic for the temperature sensor. So it was good for prototyping, but I was thinking, can I make it better? And that's how I decided to start my new hobby and to try to make an open source hardware out on board with some improvements. By the way, there are a lot of hats, P-hats and out on boards and there is one great website that you can visit. It's pinout.xyz, the last slide you see the exact URL. So a lot of individuals, companies are making hats. You can start making your own hats. Actually, this is the purpose of this talk. I hope that you'll get inspired and as soon as you come back after FOSDEM, you'll grab the soldering iron and start prototyping, right? So before making any prototypes, just check this website. Have a look at what are other people doing and think how we can improve these hats or make other hats. So now let's get our hands dirty and let's make our Raspberry Pi hat. Are you interested in this? Raise any hands? Okay, good. I haven't lost it. So the first thing is that you need some equipment, right? But don't worry. I have a very amateur equipment, a very basic soldering iron that I bought from Olimax and it's still good enough for making some small prototypes and hats. This is the way to get started is to buy other fruit perma proto hat. This is the board that you see over here. I believe that you know where to find it. This is the keyword here, other fruit. So it comes in two models. One of the models of this hat is without an apron and the other one is with an apron. Here is the apron. So it's up to you to decide which version you prefer for your first prototype. You need an idea for your prototype. The simplest idea is to make a blinking LED. It's normal for the embedded world, right? So depending on the idea, you might need a few additional components. If you're making a blink LED, you need a LED with a few resistors. The good news is that the MacPie has a very nice article explaining step by step how to make a blinking LED Raspberry Pi hat. So you can start from it and to use this prototype from out of route to make your first Raspberry Pi hat in, well, depending on your soldering skills, but you can do it in less than an hour. So now let's speak about the device tree fragment. How many of you are familiar with device tree? Okay, almost everyone. So I'll just summarize that the device tree is a software description of the hardware. It's a standard that originates from open firmware and it contains a list of tree structure with nodes and each node can contain a child node or a property when the property is just a key value pair. The idea of the device tree is that you can use the same Linux kernel with various hardware configurations within a wider range of architecture families. Since recently, the device tree is mandatory for all new board support packages for ARM devices. So it's used in Raspberry Pi as well. The thing that you see here is an EEPROM. It has the form factor of deep with eight pins and it is using I squared C interface. The recommended EEPROM, according to the Raspberry Pi Foundation, is cut 24 C23. But if you have any troubles finding this one or if your local supplier can provide you another EEPROM with the same hardware capabilities, don't worry, go for it, it should work. Now, I would like to explain the process of flashing the EEPROM. Basically, the idea is that you have to describe the hardware that you're gonna put on your Raspberry Pi head then to flash it on the EEPROM and finally to test it, of course, to test it, and finally to solder it on your Raspberry Pi. So the first step, it contains only four steps. The process is not complicated, actually it's quite easy. First, download the source code, just type git clone, it's in GitHub. After that, there is a text file called EEPROM settings. You can use it as a sample and you can describe your head. It's a very simple format. As soon as you open the file, you'll see how to describe your head. After that, using the EEP Make tool, which you have to build by typing make after cloning this source code, you have to, using this tool, you have to generate a binary file with extension EPP. And finally, there is a bar script which you should use to flash the content on the EEPROM. So how to actually wire the EEPROM to make sure that you can flash it. Depending on the type of EEPROM that you are using in terms of the soldering technology, it could be true hole or surface mount technology, you can use different device. There are some professional devices but since I said at the beginning that the key word for this talk is hobby, I made my own flasher. This is it. It's definitely not professional but the idea is that on the primary I squared C bus I attach the EEPROM for flashing it and after that I attach it to the secondary I squared C bus just to verify that the flashing is correct and the device tree information appears just as I want it to appear. So basically this simple tool that I created is used first to flash the EEPROM from the left side. After that I move the EEPROM on the right side, reboot the Raspberry Pi and make sure that the device tree is okay. This is how the device tree looks from the software world. You can access it. There is information about the vendor, the head that you have created as well as an unique identifier. So the whole procedure that you are doing for this EEPROM is to generate this and to be able to access it from the software side. So now we're coming to the hardware thing, right? If you have already made a simple hat using the other fruit out on board you'll be interesting to make your own board, right? And this question, this topic about picking the right tool for designing the PCB, it's kind of religion. I'm super nervous to talk about it because I'm a software guy and this is something that hardware engineers know about. It's very hard to recommend which tool to use. It's really a religion depends on the personal preferences. I personally like to use free and open source tools. So my primary choice is KitKat. A lot of hobbies that are using Ego. Recently it was acquired by Autodesk. They changed their business model and now they still have a free version for small boards which fit within the requirements for a Raspberry Pi hat but there is a subscription if you wanna do something more complex. For example, if you wanna do a Raspberry Pi hat with four layers. So if you don't have previous experience just like me when I started working on this hobby project I recommend you to use KitKat. Of course, there are a lot of other tools for designing PCBs. Some of them are far, far more advanced and more professional. There are also others that are free and open source software. It's up to you really. So the KitKat advantages, as I said, free and open source software, cross-platform works on several operating systems and all of the Linux distributions. It has an integrated 3D viewer as an option to do the outer routing of the PCB. It's funded by CERN. There are several developers working full time on it. Actually it's a quite old product project more than 20 years old but I've heard about it like a couple of years ago just because a company that I really like because they have a headquarter in my hometown called Olimax is using KitKat for all their new open source development boards. That's why when I was designing my boards I wanted to use KitKat as well. And I visited a few workshops from Olimax about KitKat. So when you're designing a hat it's recommended to grab a template. This will save you some time to just place your components and not to waste time in making the etches and placing the mounting holes. There are templates for KitKat as well as for EGO. This is what I created. The first board took me more than six months. I needed a lot of help from my friends so it's very important to say a few names here. Here, Volodymyr Harizanov, huge thanks to Vado who helped me with the design. He'd done almost the old design of the hat for me. Rado Kolev and Rangi Ivanov. Without my friends I wasn't able to do it. I'm a software guy so it was... The second hat was far easier because it's a P-hat so it's smaller version of the first one and I created it just over a weekend with a little bit of help from my friends. The first revision works. Both of them are open source hardware under Creative Commons share license. You can find them in GitHub. This is how KitKat looks, one of the screens in KitKat. You can see all the layers. These are two-layer PCBs. A few recommendations and... Well, I'm putting these recommendations just to make sure that you avoid some of the common mistakes that people do and I did all of them, believe me. So before making the design, please check with the company that is going to manufacture the PCB for you and comply with their minimum requirements for tray spaces. This can save you a lot of headache. Keep in mind the assembly while you're designing the PCB. Sometimes you can design the PCB perfectly but after that the assembly could be too hard and could take too much time. Also, you should consider the components on your head depending on the Raspberry Pi components below the head. I had this problem that I had a potentialometer on the first head that I designed which was above the HDMI connector and there was a button. So when people were pressing the button, the potential meter was making a contact with the HDMI connector and this was leading to a restart of the Raspberry Pi board. Really annoying. So what was the solution? Just move the potentialometer to the other side or to use spacers to make sure that this will happen. But consider these things in mind when you create your Raspberry Pi's and Raspberry Pi's heads and I hope you'll do it. Now, when you're ready with the PCB design you have to move on to the next step which is to make the actual PCB and there are a lot of companies providing services for manufacturing the PCBs and placing the components. Probably the best one and the most popular one is from OSH Park. It's made in the United States. It's amazing because it's dirt cheap and the quality is excellent. It's a flat crate. You pay just five US dollars per square inch and they provide you three of these boards with this very specific color. There are just a few things that you have to select and you can do the whole process online. Of course, if you wanna do more boards and if you're looking for even cheaper prizes you should go to China. It's not a surprise, right? And alternatively, and this is what I'm using right now is to use local companies, have a look around in your region. Probably there is a company that can make hardware for you. The advantage of this is that sometimes you save time from shipping. And when you do a prototype, all people are very excited to give it a try, right? So, about the software. It appears that Python is the most popular programming language for Raspberry Pi. I didn't know that when I started making my Raspberry Pi head. But since it's an open source project, several contributors provided me the feedback that they need examples in Python, not in C. So, okay, if you make a Raspberry Pi head, provide the examples with Python and it's important to have documentation. Wiring Pi, you probably know this library. It's the great library written in C with language bindings for all the popular languages and even some exotic languages. It's very easy to use it from C and C++ since written in C. But you can find language bindings for Java, JavaScript in terms of Node.js. There is a package for that. PHP Pro, as well as new exotic languages as Go and Rust and so on. You can use any free and open source tools that are compatible with the hardware that you have. For example, both my hats have infrared and for infrared, there is this great tool called lurk. So with it, you can control it. One more thing, we're just on time. Share your hardware and software and their open source licenses. We're at FOSDOM, this is really important. It's important for the community and for everyone so we can share knowledge and ideas. So thank you. I think we've got a time just for one or two questions. After that, I'll be outside so you can come with me and you can have a look at the hats, ask any questions. So is there any question right now? Okay, the question is, can I recommend a certain version of Kikad? Very tough question. I'm personally a Ubuntu user. I'm using for the moment the stable version that comes with Ubuntu. But for optimal performance, you should build a Kikad version from the repositories directly. Okay, thank you very much.