 Okay. Thank you very much for joining. Can you hear me well? Okay. Louder? Okay. Is this just for the camera? All right. So this is just for the camera. Okay. So thank you very much for joining. This is going to be a quick talk about making open source hardware for retro gaming on Raspberry Pi. A disclaimer, I'm here out of my comfort zone. First of all, because I'm not a gamer. I'm pretty lame at playing games, actually. All right. From the camera. Okay. I'm even not a retro computing expert, but I'm an open source enthusiast and I'm a software engineer. Actually, I'm a professional software engineer, and what I'm going to share with you here is something that I do as a hobby. Because although I'm not good at games, I really enjoy making things. So the agenda for today is designing GamePad, inspired by the classical GamePads from the 80s or late 70s. I'll explain what is open source hardware. I believe most of you are already familiar with it. After that, I'll show you the steps for an open source hardware gadget that I created from the hardware to the software. Finally, we'll just briefly mention one of the most popular new Linux distribution for playing retro games, particularly on Raspberry Pi. How many of you have a Raspberry Pi? All right. Is there anyone without a Raspberry Pi here? Okay, a few people. All right. All right. I think this slide is redundant. Obviously everyone knows it, but a Raspberry Pi is pretty much a single board computer, super popular with Broadcom arm system on a chip. There are numerous versions of Raspberry Pi. It's important to say that five years ago, in 2014, the Raspberry Pi Foundation released a Raspberry Pi with 40 pin header. And since then, all Raspberry Pi models and versions are with 40 pin headers. So a GamePad is obviously, I'm pretty sure everyone is aware of that. This is something taken from Wikipedia. So one of the old GamePads that the photo is also taken from Wikipedia. So as a kid, I was used to playing with these gadgets. I believe most of you are also familiar with them. So I decided that I want to create an adult board that I can plug on the Raspberry Pi with a similar shape, something super simple. And here's how I did it. Since I'm a Linux user, I try to use free and open source software pretty much all the time. And I got interested in Kikat or Kikat. So this is free and open source software for designing, for designing hardware. The good thing is that it runs on numerous platforms. It's been actively developed and it's an old project. It has more than 20 years of history. Tomorrow at the open and cut room, the leading developers and contributors to Kikat will be sharing details. So if you're interested in learning more about the project, you can visit their talk as well. You can make numerous layers of a printed circuit board. And it's already adapted by the industry. I got inspired using Kikat because of a company called Olimax. I'm living in the same city. They're making a lot of workshops. So it was good, even for a person like me, I'm a software engineer, to make really simple two layer hardware prototypes and boards. How many of you are actually making hardware designing PCBs? Okay, that's a fair amount of you, very good. I hope that at the end of this talk, everyone will get inspired. You'll see that's really easy to do it. And you can make something like this on your own as well. So the ingredients for a retro gamepad are super simple, obviously. You need a bunch of buttons, four buttons for movement, AB and buttons, and of course the select and start buttons. Since I'm doing this, I decided to put a few I squared C slots so that during the day when I'm not playing, obviously retro gaming, I have to work at that part of the day, I can put some sensors and monitor the temperature of the community at home. One thing that is specific for a Raspberry Pi is the secondary I squared C bus, which is for an EEPROM. I'm going to do a quick deep dive in a few minutes. So here are the schematics. So in terms of schematics, here you see the bunch of buttons. Here is the EEPROM. I'll explain what's the purpose in it. Actually, this is the most interesting part of the whole project. And here are the additional I squared C slots for plug and play sensors. This is how the PCB in you in KICAD looks. Super simple board. Pretty much this is the most simple thing that you can do as an add-on board for Raspberry Pi because it's just bunch of boards. After creating the board in KICAD, I have exported it as Gerber files and using a PCB manufacturer. I have created this thing. This is how it looks. You can see it's from the PCB to this one. Of course, this is assembled. So how many of you are familiar with open source hardware? Okay, not all of you. So this slide is important. I believe if you're here, you're an open source enthusiast and we know very well what is free and open source software and open source hardware has the same spirit. Basically the idea is that whoever is creating a hardware can share the sources under appropriate open source hardware license so that other people can study, modify it, create additional products based on this original design. So it's making an open source hardware device has several ingredients. It's not just the hardware. It's good to do an entirely open source project that involves both the software and the hardware. And because a lot of individuals and companies are claiming that they're open source but they're just releasing PDFs which are not enough for you to go home and order and make a PCB out of the PDF. Several years ago, open source hardware association was established and they are running a certification of open source hardware. It is a free service that they're providing. So if someone is making an open source hardware, he can go there, certify it for free. The good thing is that when someone is browsing for open source hardware projects, he can go to their directory and see, hey, yeah, that's really open source hardware. Of course, there are a lot of open source hardware products that are entirely open source but people haven't certified them yet. This is how the certification looks of the product that you just see. So this is pretty much the end of the first part of the presentation which was about hardware and now I would like to spend a little bit more time talking about device tree. I know that this is a little bit far away from the retro gaming but this is an interesting part and this is actually the ingredient in this whole project, very simple project that connects the hardware and the software. So how many of you are Linux users? Okay, and how many of you are familiar with the device tree? Okay, all right, so device tree is basically a specification for software data structure that describes the hardware. The idea is that the device tree is a pre-compiled binary outside of the Linux kernel which allows single compiled Linux kernel to run within a wider range of devices within one architecture. So you have a device tree binary blob here and device tree source. So basically there is a compiler DTC that compiles the device tree source to DTB. So why I'm telling you this? Because when you have a bunch of buttons and we have it in this particular project for a gamepad, it's good to make it work out of the box. And the device tree is the mechanism that allows you just to plug the board on top of the Raspberry Pi, put the device tree binary blob on the EEPROM that you saw on the previous slides and automatically the operating system and the boot loader will boot this binary, device tree binary overlay. So the device tree binary overlay itself, it enables the device tree binary to be extended and each device tree overlay contains a number of fragments. With the default Raspberry Pi boot loader provided in distributions like Raspbian, there is a config.txt file on the FAT partition in which you can specify manually the device tree binary overlay that should be loaded. Those of you who have Raspberry Pi if you're experimenting with various distributions you can have a look and check the content of this file right now. Sorry. Okay, so the great thing that I really enjoy in Raspberry Pi is this secondary I squared C bus on pins 27 and 28 which allows you to attach an EEPROM to flush the device binary overlay in this EEPROM. So you don't need to manually edit config.txt file because while booting the operating system will read whatever you have stored in the device tree in the EEPROM. So once you boot the system, you can see here, especially on Raspbian, at this path you can see the files that are read from the EEPROM. So how to map the keys in a Linux system. So there is a definition of the Linux key codes here. This is a part of a very small part of course but you get the idea it's the same for all our buttons, right? So this is the procedure with the device tree compiler how you make the binary out of the source code. All this is in GitHub, here is the link and after creating this you have to create specific binary which is provided with a bunch of tools that Raspberry Pi foundation is hosting again in GitHub so you can make an EEP file that is going to be flushed on the EEPROM. And how many of you have flushed an EEPROM? Okay, cool. So since this is a hobby project, I needed something simple and I created this out on board attached to the again on the Raspberry Pi. So the flushing is also done on the Raspberry Pi. For the flushing I'm attaching it to the first I squared C bus and after that after booting the board it's the EEPROM should be connected to these two pins and the thing that I just explained about the device tree would should work. So this is the end result and this is how I tested it. This is with Raspbian. Raspbian has some a bunch of very simple games that are not retro they're new games but they have this retro style like the Tetris. You need to play a game to verify that's working or just to press the buttons to see it's happening. If you really wanna play retro games there is this really awesome project that I found out and I believe everyone is familiar with it. It's called Retro Pi and it's a glue Linux distribution that is optimized for playing retro games on Raspberry Pi as well as a few other boards like Odroid and personal computers of course with Debian and Ubuntu. So it provides a bunch of emulators but it does not provide a wrong file due to copyright concerns because of the developers of these old games. I'm not going to do deep dive in Retro Pi but there are a lot of links so those of you who have Raspberry Pi and this is pretty much all of you can visit there, download the Retro Pi after that you can find interesting chromes and play those retro games. How many of you are already using Retro Pi? Okay, the rest of you should try it. So the problem with Retro Pi that I've experienced despite all the things that I did with the device tree binary overlay and so on is that some of the emulators were actually not working. The buttons were working within the menus provided by Emulation Station and Retro Pi but I had a problem playing the games within some particular games in some particular emulators. So what I did is to actually hack a simple, very simple Python script that converts the clicks into signals that can be processed by the emulators. So here are the steps. It's again open source, how to get it working if you are creating similar board. Okay, so this is pretty much, this is it. Just the conclusions. Although gaming is pretty much for entertaining, it provides an excellent opportunity for grown-ups as well as for kids to learn new things by making things, do it yourself things and after that playing games on them. There are a lot of free and open source software tools so you can do this for free, at least the design and making a very simple two-layer board as this one that you saw is very affordable nowadays so it's easy to make the hardware as well. Kikad is high-quality free and open source software to do it. There are other softwares as well. Picking up the electronic design automation tool is a matter of religion. So if you're using something else, that's totally fine. For me, it's Kikad. Another cool thing is to make one step further, to make it open source, to make it open source hardware and to certify it at the open source hardware association. This way, you show some support to this open source hardware movement. And thank you very much. We still have like five minutes for questions. I have some small gifts for anyone who asks a question. The gifts require soldering. Okay. Are there any questions? How are you doing? All right, you want one? You sure? So the question was, how are you doing? I'm a little bit nervous, but I'm doing fine. Would you like to do some soldering? I don't have a... All right. That's okay. So this one, it seems fairly easy, but still, even though the electronics is simple, you had to learn a lot about how, as an example, to work with the device tree and so on. So all in all, it seems like a good educational project for young kids doing development and so on. But at the same time, it still shows that it becomes more complicated today than in the past to learn about everything you need in order to do what is still a simple device. So first, thank you for doing that because this is useful. I mean, can be used by others to teach young people, young kids, I mean. It's not as easy as it used to be. I don't know. Have you used it yourself to try and teach young kids? Okay, so the question is, have I used this to teach young kids because it seems pretty complex, right? Especially the device tree part. This is the short version, okay. So I haven't tried yet to teach young kids about device tree. I'm a little bit skeptical about this, but what I have done in my hometown, Poverty Bulgaria, is that sometimes we make retro gaming and it's very easy to get a few raspberry pies to give them to the kids so that they can just play and the raspberry pie is cheap. So even if something breaks, it's easy to fix it or to buy a replacement. If we bring something that's really a retro computing, sometimes it's quite hard to repair it. So this is for you. Yes, over there. Could you please? Okay, so just to repeat the question, what I'm using the sensors for, right? So yes, I've added a tree. So let's see where was it. Okay, so over here, there are three I squared C slots that are attached to the primary I squared C bus of raspberry pie. The idea is that I put sensors on them so that when I'm not playing the games, which is pretty much all the time, I have to work. I can monitor the temperature, the light in my room. So pretty much it's not just a ploy, but it's something that could be convenient for more practical things. And it's a good excuse for the people in the house to say, hey, I'm not playing games. I'm working on this weather station. Okay, could you please pass it? There are two questions over there. Okay, so just to repeat the question, what is the benefit of the open source hardware certification? Well, there is no direct benefit, but this way you're supporting the community. And one day, if we have a very big open source hardware directory of certified projects, it is going to be easier for other people to go there and to see that, yes, this is really an open source hardware project. Over the years, and I'm buying a lot of things, I have seen a lot of companies claiming that it's open source hardware without providing all the schematics or just providing PDFs. So going through the open source hardware association, you can easily identify that, yes, what you're buying, what you're seeing there, it's really open source hardware. If you get it, if you decide to modify it, you can do it. Okay, so just to repeat, is this just another way to share your open source hardware designs because you can always upload them to GitHub? Yes, that's true. And actually for my designs, I'm also uploading them to GitHub. It's just a certification directory where you can go and check out what's there. You can give it a try actually. Okay, and can you come after that to grab it? All right, and there was another question. Okay, so the question is why have I choose Raspberry Pi Zero for retro gaming instead of a compute module or another Raspberry Pi model? So the answer is quite straightforward because I have done in the past similar add-on boards and these add-on boards work with any Raspberry Pi model and version with 40 pin header. You can do the same way with a Raspberry Pi 3B, B+, or A+, it's totally fine because they're absolutely compatible for the compute module. It's a little bit more for a kind of industrial things. It requires more efforts. Here, my goal was to make something that's super low cost, super simple. That's why I decided to go for Raspberry Pi Zero 3 and so on, yes. There is one question. Very proud to do something like this, but how many do you need to make before it becomes affordable? Okay, so the question is how many of them have I done and is it affordable to do them, right? Okay, so what I'm doing because obviously making software is easier and cheaper because you can fail cheaper. What I'm doing is that after making an open source hardware product, I run crowdfunding campaigns at CrowdSupply and this way I fund low volume manufacturing. These are not very interesting to people. It's more for workshops that I'm doing locally. I have done maybe 100 or something like that. And actually tomorrow I'll have another talk in the cut room where I'll just speak how is the process for manufacturing low volumes from the perspective of a software engineer and I have to say whatever I say about hardware, take it with a pinch of salt because I'm a software guy. Right? Okay. I think there's one more question. Okay, so the question is how much does it cost to create the circuit? For example, if you just need a prototype, there are several companies. I'll mention them in my presentation tomorrow like OSH Park and a few others where you can go there and make a prototype like just three prototypes and it's fairly cheap. I cannot say exactly how, but they have a calculator so you can go to my GitHub page, download the thing that I have done and you can upload it to OSH Park and see the exact price. Yes. Is there time for another question? Keep in mind I'm running out of boards. Yeah, I agree. Thank you very much. Please come by to get everyone who asked the question.