 So, I'm Juan. Today I'm going to talk about building an open source webcam with a Raspberry Pi. And without further ado, let's get started. Slide two. All right. So, in this talk, I'm mainly going to talk about what I'm doing, why I'm doing it, and how can we all leave some results with it. And thank you to all the contributors that I have seamlessly all the pictures. Thank you. So, I'm going to talk quickly about what I'm doing. I'm building a firmware that transform your Raspberry Pi zero or soon to be fall to a very powerful webcam. What I mean by this is it actually comes with a quite high quality sensor, and you can use a lot of lenses with it, just like you can use with a professional camera. It runs open source software in it. And with a lot of control and fine tuning that you can do, I will explain more later. And it doesn't only stop just at the webcam, you can make it a document camera, a microscope or a telescope. So, why I'm doing it. The reason is there's a pandemic going on. So I work a lot from home. So I have to do a lot of zooms and I have lots of free time on my hand. So could as well put it to good use. Sometimes I do host live YouTube meetings, and I kind of research it myself. What kind of like streaming equipment that I should use. So it turns out each kind of streaming solution kind of suck in a different way. We have laptop webcams, which are very readily available, but they, you know, have horrible quality 720p and it's been that way since like eight years ago, right. You can buy a very high end MacBook for $2,000. The camera quality still is potato. So some people have come to different solutions. They use phone cameras as a webcam. It's nice. However, you often have to connect the camera to the computer to a network. So you have to run the software on the camera, on the phone, and you have to run a piece of another software on the host OS. And so with that combination of phone operating system and host OS, you have a very a lot of architecture to support and cross OS and cross hardware support is horrible. And they are not luck and play. You are like kind of like depend on the developer to kind of find a solution for you. And no one cares about Linux, right. Some people have pro cameras. So they are very high quality. They often use DSLR or mirrorless camera to kind of use at a glorified webcam. So they are expensive, bulky and cumbersome to set up. But that's that's very nice. If you can afford it. USB camera are nice, but they are in short supply and the quality varies and the OS support you often, if you want to fine tune that webcam, you have to use a vendor kind of software in order to tune the webcam. So again, no one really writes software for Linux to tune your webcam camera. So why don't we fix it to a Raspberry Pi, right? It's cheap. You can have good quality sensors. You can have good customization. It's light. You can carry it everywhere and it may have cross platform support, hopefully, with the right solution. So let's see. Some people may ask, you know, Juan, you are just like writing another kind of solution for Raspberry Pi. And I kind of see that, you know, like in grad school, I used to work on the NVIDIA GPU and they changed from being a graphic card to a GPU, that's a general purpose GPU. I kind of tend to think the same way about the Raspberry Pi as a GP gadgets that is general purpose gadget because it's so ubiquitous and cheap, got a lot of interfacing IOs, you know, and it's very easy to get anyone started. However, Raspberry Pi projects are kind of like have some gorgeous if you think about it. If you want to use it at a dedicated device, you rather not think about it as a Linux computer that run can run anything you want. You may want a dedicated firmware for it to do just one purpose and do one purpose well. It's a gadget that happens to run Linux instead of a Linux computer that happens to be a gadget and that's very important as I can, I will explain later on. And so how to get started with this? Basically, you only need to start with a sensor. That's a Raspberry Pi camera and you put it into Raspberry Pi with a nice case and just write the so many webcam firmware on the SD card and you have a USB webcam, simple as that and a story. But the fun really, really begins when you use the high quality sensor on the right here that the Raspberry Pi foundation provide on their store and then you can play with it. Now, what I mean by that is that you can put a lot of lenses on it. So here, as you can see, on the left, like some of the lenses that you can use. And with them, you can have vastly different quality as and feel a view as you can see on the right. And you can adapt to different purposes. For example, if you want to open your yoga class at home, right, you would want a lens that can give you a full view of the room. Or if you want to do just a talk like me, you may want a closer zoom camera. So that all is possible with the high quality sensor and the lenses that come with it and you can buy from third party. So what else can you do with it for education, of course. So here is a picture from Dr. Don Binner from my old college. And he is concocting like a custom setup over here on the left that he used to teach math. And as you can see, it is, it requires a very special setup where you need a fixed focus because you don't want your webcam to kind of hunt for your kind of guest focus. And zoom on your hands when you are presenting it. You want a very fixed setup that have, you know, a crop of just your piece of paper to teach. So here, as you can see, the one of the requirements is distortion has to be minimal. And we have a lens for that. So that's very nice for teaching, you know, in a pandemic. And so what else you can use it for discovery and sharing as well. As you can see here on the left, they have a Raspberry Pi zero mounted on top of microscope. And on the right, you can see a cell that is magnified by the microscope. And what is special about this setup is that it requires a very special kind of tuning to the image. For example, with this microscope setup, you have to rotate the image. And that is done to an interface that we provide for the camera to a zero interface. Just anything that can talk zero can talk to the camera and configure it. And you can see the result on the fly. So, and once you save it, it's saved for everything. So you bring that microscope setup to another computer, it will work as expected. So not only discovery and sharing of science, you can do it for fun as well. Here, you can see a lot of 3D cases printed for it. You can use as vanilla of a setup as a normal webcam on the top middle here. Or you can make it as fancy as you like and an user of the software also send me a picture of him making a case for the camera that looks like an octopus. And the cool thing is the light will turn on and the octopus eyes will show up when it's in use. And so why is it all important? I think it's important for a couple of reasons. You need one firmware for all needs. It works on all OS. It's setting on the device and you don't need a proprietary app to run on the host OS, which often to be Windows and Mac OS for it to run. Anything talk zero can configure it. And one standardized hardware to roll all needs. It can adapt it to whatever application you want. You can reuse it. Use it for your yoga class. Use it for your sign class. That's especially, I think, important for developing countries where teachers don't have a lot of, you know, resource to spare. It saves money, costs and training. Hardware is cheap and readily available almost anywhere in the world for the Raspberry Pi. So I think that cannot be saved for many other software and hardware solution. And you can say, oh, yeah, the US, you know, bring it to Asia. And then what's the same, right? That's really, really nice property of the Raspberry Pi. For developers, I think there's not much to be said. But to make it happen, there's a USB on the on the pie that's unique in red over here. That's called the OTG port. It can be configured either as a host or device when it configures the device can act as a USB gadgets. And you configure that gadgets to a system called config fs on Linux. It has a C base core that stream the image from the real camera to virtual camera. That program is called UBC gadget. And that's maintained by Peter who is joining with us today. Thank you, Peter. And, um, and we put it all together by a distro based on that's our so many webcam code is only 300 lines of code for the whole repo that we maintain. You take a couple of hours to understand boots really fast five second. The image is really tiny 64 megabytes will fit will fit everything. The root fs is really only so you can disconnect the power to it anytime and it will not corrupt the serial interface that give you root and you can change anything. By the way, if you want to learn how to make your own be rude based firmware that does one thing and one thing only show me webcam is great place to start. So what I learned from this project is a project that I do for fun. And I learned that you can have a day job and a hobby. You just have to learn to limit yourself in terms of scope but you want to do with a hobby. And that didn't work well for me in the last project because I tried to kind of like make an infotainment for the car and it's like to be too much of a too broad of a scope for me to do. And even though people are interested in it, I don't have time to maintain it. The part that I still have to be hands on is to encourage and review people's contribution to the project. The part of them hands off is the trust and ask for help from people in the community to help maintain the project and different parts of it. So how to handle open source firmware project? It has to I think it has to scratch a popular itch for a lot of people. It has to have a standard and easy to obtain hardware that everyone can get. It has to be easy for people to understand it easy to validate build and test and it built. In fact, you can build the show me a webcam firmware without just actually having a built computer. It will build on GitHub CI. So any commit must work and must pass some quality test. And in fact, you can download any commit on the GitHub repository of show me webcam and it will likely work. So the thing I have a lot of things that I will I hope get improved over time and a lot of plan for the future. For example, I really want to the camera to just zoom on my face at the same time. You know, if I'm like kind of put it on there on the frame, right? But that's for the future. So anyway, that's that's it. If you want to learn more about the project, just check out the GitHub repository and show me webcam.org. Sometimes I blog at my blog as well. So that's the place that you can you can learn about it. So I will I will turn to the to the questions to answer and I will demo a little bit in the meantime. All right, so let me try to share a screen and oh, I cannot share my screen over here. Let's see. A lot of things will go wrong. Just be ready for it. All right. If you in the meantime, I'm happy to answer the question from the audience. So here. Oh, I can get to the camera interface from here. So I'm on route over here. And here I will have to put the presentation on the other window and camera control. Right. And you'll see my face on the presentation. I'll do a flip. I can change my contrast and saturation. That's a standard stuff. But look what happened. Now I'm inverted. So that's the kind of customization that I can do. So from now I'm just going to be rotated here and I can play with this all day long. That's it. That's it for me. Thank you so much, Mr. Juan, for your insightful presentation.