 Hello everybody, thank you very much for joining this session. My name is Leonon Navey and I'm a senior software engineer at Cancelco Group. The company provides open source consultancy services. But I'm here today to speak about my hobby. And my hobby is related to making open source hardware out on boards for Raspberry Pi. Therefore, I would like to share with you my experience. I'm living in Europe, in Bulgaria. This is far, far away. I even didn't realize how far away is this by the time when I applied for a speaker at the embedded Linux conference and the Open IoT Summit. The agenda for today includes a little bit of information about open source hardware. And after that, overview about the Raspberry Pi Het, which is a standard of the Raspberry Pi Foundation for making out on boards for Raspberry Pi. We'll go into details, how you can make your own open source hardware out on boards. Peahat, which is a simplified version of the standard. And after that, I'll share some of the practical experience that I have in designing open source hardware. Keep in mind that I'm a software engineer. I only recently bought a soldering chiron. So you know, the combination between software engineer and a soldering chiron can make a lot of dangerous prototypes. So beware each of my words and double check them. I'm just sharing my experience and the keyword for this talk is definitely hobby. Finally, we'll speak a little bit about the software support for Raspberry Pi and how after you have an out on board, how to adjust the software for it. So how many of you are familiar with open source hardware as a concept? Could you please raise your hand? Okay, that's perfect. Open source hardware is not that different from the open source software. The idea is that it's a concept for providing the design of the physical objects so other people can study them, reproduce them, modify them, distribute them, even sell them. Definitely open source hardware is not for everyone, but especially for hobby projects, it's great to have experience with it. Just like in open source software, there are a number of licenses for open source hardware. This is just a small portion of the open source hardware licenses. I think that these are some of the most popular. As you can see, some of the open source software licenses can be also used for open source hardware. So why Raspberry Pi? The answer is that this is probably the most popular single board computer on the market. It's very low cost, a lot of people have it, students love it, hobbyists love it, we the software developers love it as well. There is a decent software support and a huge community. But the disadvantage is that it is not open source hardware. Is there anyone in the room who does not have a Raspberry Pi? Anyone? Perfect. You are the perfect audience. Raspberry Pi has a long history and at the beginning of this talk, I would like to share with you some milestones which are important for this talk. So the Raspberry Pi Foundation was established in 2009. But the first Raspberry Pi models appeared in 2012 on the market. The first version was announced in 2011, but the manufacturing was a little bit slowed down. In 2014, something very important related to this talk happened. The Raspberry Pi model B-plus appeared. This model brings a lot of significant changes, especially for out-of-boards. That's why this is a milestone important for our talk right now. Last year, Raspberry Pi Foundation announced the zero. This is a small version of Raspberry Pi that costs just five US dollars, but it's like a unicorn. It's very hard to get one. Do you have a Raspberry Pi zero? Okay, well done. So Raspberry Pi, as you probably all of you know, comes in different flavors. This here is the very first version that appeared in 2012. After that, we have model B-plus, the second version of Raspberry Pi, the third version, as well as the compute stick, which is kind of an attempt of the Raspberry Pi Foundation to go for more industrial markets. And the Raspberry Pi zero that we have already discussed. After 2012, in the past five years, a lot of individuals or companies were making out-of-boards. And basically if you want to do Internet of Things with Raspberry Pi, you need an out-of-board. It could be a sensor, it could be a whole kit that you just attach on top of your Raspberry Pi, various shapes, various form factors, and various software support. It could be a little messy if you want to combine all of these things in a single device. So Raspberry Pi Foundation decided to bring some order. And in 2014, they announced the model B-plus of Raspberry Pi. It's still the first version, it's still the same system on the chip. But there are some significant changes. From the perspective of a user, probably the most important changes are the new USBs and the change of locations of the connectors such as the HDMI, some connectors were removed and so on. But actually the most important and significant change, in my opinion, is that model B-plus has 40-pin header instead of the 26 pins that were existing on the first Raspberry Pi model. So now let's have a look at the previous slide, but this time I have highlighted the boards that have 40-pin header. So these are the boards with 40-pin header starting from model B-plus, the second version of Raspberry Pi, the third version, and the zero. It also has 40-pin header. Let's have a closer look at these 40 pins. So the first 26 pins are exactly the same as the pins of the first version of Raspberry Pi. So if you have an add-on board that is already compatible with the first version of Raspberry Pi, you can just attach it to the new models and it will work out of the box, no problem. But what we have here are 40 new pins. The majority of these pins are 14 new pins. The majority of these pins are general-purpose input-output pins. There are a few grounds, and most importantly for this particular talk is the secondary I2C bus, which is located on pin 27 and 28. Following the announcement of the Raspberry Pi 1 model B-plus, Raspberry Pi Foundation made another announcement for something called Raspberry Pi hats. There is a very nice blog article published at raspberrypi.org that explains the standard and how you can make your own Raspberry Pi. This happened in 2014. So let me clarify something. Hat and Raspberry Pi hat are totally different things. So this is the Raspberry Pi sense hat, one of the first hats, and hats stands for hardware attached on top. Basically this is an add-on board that you place on top of your Raspberry Pi. And in this presentation, I'll try to explain to you how you can create hardware attached on top for your Raspberry Pi and this way to create Internet of Things. Are you familiar with the Raspberry Pi hat requirements and the standard? Have you done any hats? Anyone? Am I the only one? Okay, good. Ideally, after this talk, you got inspired, you go back home, you grab the soldering iron and you do your first Raspberry Pi hat. Okay? You didn't seem very enthusiastic right now, but I hope that by the end of the talk, it will be different. I beg your pardon? I'm a software engineer. So the first thing from the requirements is the form factor and the dimensions. They're set to 65 by 56 millimeters and the form factor of the hat should leave space for the monitor and the camera that you can attach to your Raspberry Pi. We have already discussed in details the 40 pin header and one of the requirements is that your add-on board that is called a hat should be compatible with these 40 pins. Last but not least and actually very important, there is an EEPROM with a device tree fragment that should be placed on your hat. The details are available here. This is an article from the Raspberry Pi Foundation. By the way, my slides have been already uploaded at the website of this conference as well as in SlideShare. So I'll share the links at the end of the presentation. So does it mean that you can do a board that does not follow this standard? Yes, of course, you can. No problem to do it. You can still do any kind of add-on boards for Raspberry Pi. It doesn't matter if it follows these requirements or not. But if you want to call your board a hat, then you have to comply with these things. Later on, a UK company called Pimeroni came with another standard which is not official, but it's simpler. It's called P-HAT. The form factor is suitable for Raspberry Pi 0, which means it's just 30 millimeters height. It has four mounting holes and there is four pin true hole header just like for the hat. The difference is that the EEPROM is not mandatory. As a software engineer, I really enjoy having this EEPROM with the device tree fragment, but this is obviously not the case for all people. I'll explain in details the EEPROM in the next slides. So following the release of the standard, the first add-on board was the SenseHAT. You probably have seen it. This is a photo of Raspberry Pi with the SenseHAT attached on top of it. This is an official product of the Raspberry Pi Foundation. It includes a bunch of sensors, including sensors for temperature, humidity, barometric pressure, accelerometer, and so on. There are also RGB LEDs, 8 rolls, 8 columns. And there is a five-button joystick over here. In general, the idea was that the Raspberry Pi Foundation announced this as part of an initiative for students in the UK to develop software written in Python. And the best software solutions with the Raspberry Pi SenseHAT have been sent to space thanks to a British astronaut. After that, this product was on sale through distributors of Raspberry Pi, such as Element 14 and Farnell. So that's how I got one, and I started prototyping with it. By that time, I was just a software engineer, wanted to make some hobby Internet of Things, and I was searching for off-the-shelf hardware that just works. But obviously, the SenseHAT was not the perfect solution for my ideas. So I started wondering, how can I make something different? How can I make my own hardware? Is it that difficult to do it? One of the problems that I had with the SenseHAT was that I was using the temperature sensors, but since the Raspberry Pi was making some big computations, the CPU load was very high, and at the end of the day, the data coming from the temperature sensor was not accurate because of the heating made by the CPU. So the SenseHAT is not the only add-on board for Raspberry Pi. There are hundreds of boards. Nowadays, everyone is making a board. So before making your own board, it's good to check if someone has already done it. And the easiest way that I found out for checking Raspberry Pi boards is this really nice website called Raspberry Pi Pinout, where you can find information about the 40-pin header of the new Raspberry Pis, as well as a list of a lot of devices that have been already created. This is a community website, volunteers are maintaining it, so if you want, you can add more boards. And eventually, if you got inspired, if you create your add-on boards for Internet of Things for Raspberry Pi, you should go here and list your board as well. So now I would like to share with you the basic steps for making your first Raspberry Pi head. By the way, I forgot to ask you at the beginning of the presentation, how many of you are software engineers? Okay. And how many of you are hardware engineers? Okay, a few of them. Okay. So the hardware engineers could help me right now with these slides. The software engineers, hopefully, you'll get inspired. So first you need an idea. It's better to have a simple idea for the beginning. The best example is a blinking LED. It's easy to do it and you can do it fast. You need a soldering equipment, obviously. I'm using a hobby soldering equipment from a company called Olimax. They have a headquarter in my hometown, Povdiv, Bulgaria, so this was the easiest option. I went there, bought my first soldering iron from them and it's quite decent for the small stuff that I do. So in order to start making your head, I recommend you to get a proto-head from Adafruit. It basically already has the EEPROM. Actually, you can buy it with or without the EEPROM. It's up to you. But it has the size, the form factor for a Raspberry Pi head, so it's an easy beginning. You also need additional hardware resources. If you're making a blinking LED head, you just need the LED and a few resistors. So it's an easy choice. So once you have soldered everything, it's time to flush the device tree fragment on the EEPROM. Are you familiar with device trees? OK. So the device tree is a data structure that contains the hardware description and it could be read from the software side. The idea is that the device tree has a DTS file which contains a tree of nodes and properties. Each property can contain name value pairs and different nodes can either have sub nodes or other properties. The idea is that with the device tree, you can use the same kernel that once it's compiled, you can use it with a wider variety of devices using the same system on a chip. It's very convenient. If you have similar devices with different peripherals. And in our particular case, the atom board that we are creating is a peripheral device. So on the EEPROM, we're going to flush a device tree fragment. And during booting, the device tree fragment information will be read. And after that, you'll see how you can read it from the software side. So this is some kind of a bridge between the hardware and the software. According to the Raspberry Pi Foundation, the recommended EEPROM is this one, cat24c32. But if you are unable to find it, don't worry. You just can find another one that has similar specifications. If it's easier for you to use another one or to get another one, just go for it. No problems. So the flashing of the EEPROM happens in few easy steps. And you can even do it on your Raspberry Pi. Actually, that's what I'm doing. So Raspberry Pi Foundation has a GitHub account over here. And there is a GitHub repository called Hats. You should go there, check out the source code, and build a tool called EEPROM UTOs. After the build procedure is super simple, you just have to type make, and you have it. After that, you have to create simple text description of your atom board. In this text file, you should describe which pins of the Raspberry Pi header are you using. There is an example. An example text file called eepromsettings.txt. You can just copy it, adjust it, depending on the capabilities of your atom board. And then to generate an EEP file, using a tool called eepmake. Finally, you should flush the binary file generated on the previous step to your EEPROM. And for that, there is another bar script that you can run. The easiest way to do this for hobbies is just to use your Raspberry Pi. So Raspberry Pi has two I squared C buses. And if you want to flush something, you should use pins 3 and 5. This is the primary I squared C bus. And I created for my own needs a very simple atom board just for flushing the EEPROMs. Since I'm doing a true-hole mounting of the EEPROMs, this was a really easy option. From the left side, I have a setup for flushing the EEPROM. And when I'm done, I'm just putting the EEPROM on the other side. This is a small breadboard, so it's really easy to move it around just to verify that the EEPROM has been successfully written. Sorry, could you please repeat? Yeah, that's also possible. If you have a separate flasher for EEPROMs, yes, that's also an option. Or if you have to manufacture a lot of the Raspberry Pi atom boards, it's better to use an EEPROM for surface mounting technology. That would be faster, of course. The wiring is a little bit different. I've got a couple of resistors here. So what I'm doing, I'm just flushing it. And after that, moving it to the other side of this prototype board that I created with my bare hands just for flushing. But initially, there are so many ways to flush it. Yeah, so after booting the board with your EEPROM, this is what is going to happen. You have a device called proc.device3.hatt. And in this directory, you have a bunch of files that you can see over here. These files are read from the device3 fragment that is in the EEPROM. So if you have correctly created the device3 fragment and flushed it to the EEPROM, this is going to be the result. This is a small project that I'm having for open source hardware infrared small hat. This is the P-HAT standard. But I put an EEPROM because I just like to have the information about the hardware from the software side. So this is going to be the end result. So now I would like to move on to kind of a deep dive from the perspective of software engineering to hardware stuff. I explain to you how you can do your first prototype with soldering and a protohat for other fruit. But now let's talk about making something more professional and making a PCB. Have you used any of these tools, Kicad, EGO, or something else? How many of you are using Kicad? And how many of you are using EGO? OK. So as I said, I'm a software engineer, so I had a pretty much zero experience with any of these suits. And actually, these are not the only one. It's full of very professional and more expensive design automation suits. But keep in mind that, as I said, at the beginning of the talk, the keyword here is hobby. So for hobbies, the two most popular options are Kicad and EGO. And Kicad is a free and open source software that runs on Linux. And since I'm a Linux user and since I did not had any previous experience with any of this software, the choice for me was pretty easy. I went to Kicad. Furthermore, a company in my hometown, Olimax, that is making open source hardware design, is using Kicad. And they were kind enough to make a few community presentations, to introduce our local community to Kicad. And that's how I got inspired. EGO, on the other hand, is a more professional tool. It's free for small two-layers PCB, but they recently switched their licensing model to a subscription model. So it's a little bit more complicated from business side of things with EGO. For if you are a hobbyist and if you don't have experience, just like me, use Kicad. Otherwise, it's picking up the design automation suit. It's a little bit like a religion. So if you have your favorite tool, just go for it, of course. As I said, I'm using Kicad. Therefore, I would like to share with you a little bit of information on what are the advantages of Kicad. As I said, it's a free and open-source software tool. It's available under the GPL version 3 license. It's cross-platform, which means that you can use it on your favorite Gnullinux distribution, but you can also use it with Microsoft Windows or macOS. It had a pretty decent integrated 3D viewer. And furthermore, out-routing. Because the routing is a little bit tricky, especially for beginners like me. Kicad has been developed very actively in the past couple of years, primarily by contributions from certain developers. And as I said, it is now used by Olimax for designing their new open-source hardware boards. I saw an eight-layer board that I designed with Kicad. So this is a good sign that Kicad is ready, even for industry use. If you are designing a head template, and after all, this is the focus of the talk, you should get a, I recommend you to get a template. If you don't like templates, you can do it on your own, of course, but using a template will save you some time, at least for the edge cutches and the placement of the EEPROM. I found a few templates that are available for both Kicad and EGO. If you are using a different type of a software, probably there is a template for it as well. But here are some of the templates that I have found, a couple of them for Kicad and one for EGO. So these are my products, my hobby products. The first one is a general purpose flexible head with a bunch of stuff. As a software engineer, I wanted to be able to easily plug in different sensors over the I squared C. There is a relay, there is an infrared, there is an option to add a modular display to one of these simple displays that you can get from almost everywhere, their cheap displays, RGB led and a buzzer. Both of these are on boards, are entirely open source, they're published in GitHub and my friends helped me a lot with the first head. So the second one, I decided to do a better version, improved version for infrared. I did it last month as part of preparation to this talk and it's the P-Head form factor, very similar again, again designed with Kicad and again, entirely open source hardware available at GitHub. This is how Kicad looks, these are all the layers, are almost all the layers are enabled here and this is your work environment. As a software engineer, I would say that using software like this is a little bit like, you should learn the hotkeys and all the menu options so it could take you some time to get started but it's not as hard as I initially thought, so give it a try. A few recommendations, as you can guess, I was a beginner with the open source hardware and with the hardware design, so I made a few mistakes over the time. So I would like to share with you some recommendations just to make sure that you save time and we will not repeat my mistakes. First of all, you should pick up your PCB manufacturer and each PCB manufacturer has different requirements for tray spaces, drills, and so on. So make sure that while you're designing your hardware, you are complying with the minimal requirements of your PCB manufacturer. Keep in mind the complexity of the assembly of the board because sometimes if you don't place well the components, it could take you a lot of time to solder the prototypes and the manufacturing could be difficult. Also, you should consider the location of the components that you place on your head in terms of the components that already exist on the Raspberry Pi. I have to confess that the first versions of my very first board had a potential meter just above the HDMI display and I had also a button. So sometimes when I was pressing the button, the potential meter was making a contact with the HDMI and my Raspberry Pi was rebooting, really bad experience. So the solution was pretty simple. I just moved the potential meter away from the HDMI but just keep in mind that in this particular case you are designing an atom board so you should know the Raspberry Pi below the atom board. So once you have the design, you should go to prototyping. And there are at least three options or I have to write three options for making the PCB design. I know that some people are manufacturing PCB at home. Yes, it's possible. I've seen this in YouTube, but this is quite of a challenge. So I decided to use some professional help here and one of the options is actually made in the United States, OSH Park. The first thing over there is from OSH Park. They provide an awesome service. This is the first board that I had. OSH Park is providing service exactly for people like me. At that time I had zero experience so it was very difficult to understand what exactly I need but OSH Park have a very user-friendly interface where you just upload the Gerber files, very reasonable pricing, it's fantastic quality and in a few weeks you'll get your first prototypes delivered in your mailbox. Alternatives are of course China, it's always, in China we can always find cheaper things, bigger quantity and the third alternative is to do something local. As I said, I'm living in Europe so local for me means probably a different thing for local for you but yes, it appears that there are a lot of companies making PCB design and nowadays I switched to local Bulgarian companies so I'm living in this city called Poblif and I'm proud to say that my boards are fully designed and assembled in Poblif. Is there a question up there? Sorry, I wasn't able to hear you well. Yeah, that's true, that's true, that's by design. The head up, sorry, just to repeat the question, it's actually an observation that most of these heads go on top of the CPU so that could lead to heating problems and yes, that's true, you have to keep it in mind. Depending on the application that you would like to run on your Raspberry Pi, you can add a heatsink just to reduce a little bit the heating of the CPU. So I would like to share with you a little bit of information about software. Since the majority of you are software developers I believe it's easy for you to handle this part. It appears that Python is the most popular programming language for Raspberry Pi. Since I was doing Raspberry Pi open source hardware and software boards, I sent a few of the prototypes that I had to community members around Raspberry Pi and one of the first feedback was that at that time I had some basic software written in sieges to show how my add-on board works and the feedback was, well, we need something in Python, you need to do it in Python. So if you're making an add-on board for Raspberry Pi consider writing at least the examples in Python. There is a great library called WiringPi, it's very easy to use from C and C++ and there are a lot of bindings of WiringPi for the most popular programming languages like Java or Node.js and JavaScript, PHP, Perl or even modern languages such as Go and Trist. Of course, there is a bunch of other open source tools that you can use depending on the components that you have on top of your Raspberry Pi. And one more thing, keep in mind to share the hardware and the software under open source licenses. This is great for the community and Raspberry Pi is pretty much about community projects. Thank you very much. These are some of the useful links that I've used while I was working on these slides and we still have 15 minutes for questions. Any questions? Anyone? Okay, so the question is, have I tried both Ego and Kickat? And the answer is no, I have tried only Kickat just because it was hard enough to learn one of them. Probably in future I might try Ego but since I'm having Ubuntu on my laptop and I prefer something that's for sure runs on Linux and Linux distributions, furthermore, I was encouraged by the presentations of this company that I mentioned, Olimax because they were sharing tips and tricks how to use Kickat. So it was easier for me to get started with Kickat. Okay, so the question is, is anyone capable of comparing this? I'm sorry that I cannot provide an answer since I don't have experience with Ego but maybe someone else in the room can provide information? Olimax just designed a all-in-or-asic for the laptop with the Linux version of Kickat. So that's kind of an example of what you can do is that you can do a fold for the EAR memory of the Ego. And that's why they changed their licensing model to subscription. But I would like to add that, yeah it's very true that Ego has, the free version of Ego has these restrictions about the board size and the number of layers. Correct me if I'm wrong, but I think that they allow up to four layers for the free version, right? Yeah, I think it's four layer boards and the size, I don't remember the exact restrictions for the size, but the Raspberry Pi heads are good to go with the free version of Ego. It's like four by two, yeah. It's more than enough for, yeah. Yeah, so if someone has experience with Ego, definitely the free version will be good enough to make these type of boards. I just repeat that the information is that all the boards that Adafruit makes are designed with Ego. Any other questions, any other topics to discuss? Yes? Yes, so since we know each other with Drew, he knows that I did a small crowdfunding campaign in Indiegogo. The thing with hardware is that when you design, when you have a hobby to make open source software at home, you basically create a GitHub account, put your software there and you have users out of the box because other developers and users will come to GitHub, grab the source code and use it. It's a little bit different when you have a physical product because even if you have the design, you still need someone to manufacture it for you and in most of the cases, you cannot manufacture a single board. You have to manufacture at least a few of them. So yeah, I did a Indiegogo campaign. A few people contributed to the campaign. I think I had like 50 people and it was great because this is an open source project since the beginning and a lot of people are contributing back experience, sharing what they did with the project, sharing ideas, what could be improved and furthermore, they can even fork the project in GitHub, make their modifications of the Kick-At and produce their own boards based on this design. Any other questions? And those two bus pins? So the question is about the Raspberry Pi pinout. Just to go back a little bit, the faster. Okay. Well, you have, okay. So the question is about the pins available on Raspberry Pi if I can summarize it, right? So you have power, you have ground, you have a lot of general purpose input outputs. There is a PWM. It's on, it's over here. You have the first I2C bus on pins three and five. You have SPI as well. Well, if you want, you can use them as general purpose input output, but some of them have additional features, for example, for SPI or I2C. So it's up to you to decide. It's on the website, but I cannot provide you a direct link at the moment. I'm sorry that. I tried to do it a little bit. Well, I recommend you to go to this website, Raspberry Pi pinout. Exactly, thank you for the help. Yeah, so they have a very good information about the existing add-on boards as well as for the pinout. Thank you for the help. Yeah. Yes, this is very important. For some features like the infrared that I'm using, I'm using a Lyric software. This is a very popular open source too, but I have to make sure that it's properly configured with the proper device tree overlay, hold it in order to use the pins that I have configured in Lyric and within the device tree. Okay, thank you. Thank you. So any other questions? We still have time for at least one question. Oh, I have so many ideas. So the question is, do I have a new idea? Yes, I have so many ideas, but the thing is that this is a site project. It's an entirely hobby thing, so I have to do well balance between my work and the stuff that I do during the weekends. But yeah, there are a lot of ideas. Furthermore, since the previous projects are open source hardware, a lot of people are commenting and providing suggestions. So yes, it's even for such a small project, like the one that I did, people are starting to provide a very good feedback and this is the magic of open source hardware and open source software. Okay, anyone else? Any suggestions, recommendations or questions? Okay, the question is, which distro have I used for the prototypes that I do? Initially, I use Raspbian, because Raspbian is the most popular distribution for Raspberry Pi, it's provided by the Raspberry Pi Foundation, so it's an easy start. But in general, since as part of my professional work, I have experience with the Yocto project and open embedded, I prefer to build my own distribution using the meta Raspberry Pi layer, which is very well maintained, they have releases following the releases of the Yocto project. So I recommend you to go for your own custom distribution if you are creating a very specific internet of things with Raspberry Pi. Okay, thank you very much for joining.