 Well, now we're going to have a Maria Jose talking about doing yourself a whole home automation with controllers and Love you, Maria. How are you? Really good. Thank you so much How are you doing? Where are you streaming from? From Berlin from Berlin. Oh, yes They are the cloudy How's the weather over there? Oh, it's kind of weird is this kind of day that it's not sunny. It's not cloudy, but it's warm But it's really warm. Yeah, yeah, I mean after that man. It's Okay, are you ready? Yes Okay, so now the screen will appear good luck and let's begin Thank you so much Well, thank you for having me and so so excited to be here talking today. My name is Is Maria Jose I am Sorry goes a bit good delay I am data scientist that in farm where I have for I work with really cool data science project today I'm gonna talk about what I am doing in my free time that it's work. It's The project so with my own with microcontrollers iot electronics and this kind of things But kind of topics we're gonna talk about today. Well, as I mentioned, we are gonna talk about microcontrollers We're gonna talk about Python do it yourself projects here with Python and Devices simulators. You're gonna see why in this talk This is included and of course We're gonna see two projects to apply the previous knowledge that will be a watering and also a cleaning automation project Well electronics and Python. I think that it's the first part to start But don't be afraid because this kind of projects are really diverse And it's true that even this talk is being unfriendly or I try to do it beginner friendly There are so many concepts and new things that sometimes we assume when you are doing things that That people is familiar with but if you but ground it's not the electronics or engineering Maybe it could be overwhelming, but no worries. I have a solution for you today And for that reason we are gonna use a device simulator that will help with this part About microcontrollers boards. There are so many kind of boards and shapes and Specification and could be also quite overwhelming but I think that the end you need to be familiar a step by step and at the end you're gonna finish ending Finding your the microcontrollers that you need depends of the project that you want to develop Why Python for microcontrollers? Well, it's because easy to learn is quietly use it and has a great to support the global community And this always help to start In a new world But can we use our path and code directly in our microcontroller? Well, not really we use micro Python that it's a version of Python or We can use circuit Python with these a fork that the other fruit that is the open-source hardware company focus in educational purposes and We in this talk we are gonna be focused today in circuit Python Well, let's start with microcontrollers, but without devices using a device simulator express and And first because I wanted to give you the chance to be able to program microcontrollers today without having the microcontroller or the device at home I'm second to avoid the overwhelming situation to say, okay the cable that I don't know about voltages or whatever Then we're gonna keep it simple in that sense I'm going to introduce you one project that the develop was developed by Microsoft that it was a garage project with also educational purposes and This is a device simulator Included that you can include in visual studio code and there is this chunk of program three different microcontrollers I think we play ground on express. That is the round that we have on the left on the right Sorry, then we have the micro bit that runs micro Python and clue that runs a secret Python We're gonna focus today in circuit play ground express running Secret Python why The answer is clear to me. It was because I got one physically in the Python US 2019 and Also, I have a kind of nostalgia relation with this micro microcontroller Because there is a playground as its name mentioned then you can experiment with sensors For instance in here. We have the light sensors. We have Temperature sensor. We have buttons. We have input output connections that you can connect directly with With a cake Coco's right cables. You have infrared transmitter sound and Also, no pixels And also what I wanted to show today is that the the same microcontroller that you can program in this day In the simulator you can develop at the end a real projects With microcontroller that as I mentioned before it's a playground that maybe it's not the most efficient that but You can do it and this is great To install the install to have the installation ready for them for the The sim the device simulator you can go you can go to the repo that I create for this talk And I try to explain as better as I could Also, they include the official documentation of my of Microsoft and it's I hope it's well explained it You can install it. That's really easily well What is a hello wall in this in this microcontroller because sometimes in told people say Ask me, yeah, but how I start how I wrote my first hello wall, right? Well, we need to consider that in this kind of microcontrollers We are gonna have a while through forever They this means that our code could be executed continuously executing then it's a good thing to Thinking include a time-sleep or something to break this eternal loop but What is need to know is a I'm not sure if you can see really well This is the microcontroller in all the all these cables I'm in here is connected to the USP then you can connect directly your microcontroller to your computer and Write this code and you're gonna be able to see Well, in this case, we is just a print Will not be massive fit but for the other things that we are gonna do. It's the way to go But as we talk we mentioned we are gonna go first for the simulator Let's see here, it's a I try I try to emulate the steps that you need to follow and show you how To do it on the left we need to write our code Our libraries and what we want to do in this case What they wanted to do is fill some pixels with a specific color And then as I mentioned, I'm gonna include the sleep time to have control The I give a time right between one color another once you write this code You need to save it as a code dot pi or as a main dot pi and then execute it. That's all Okay, let's go for a specific example now in the simulator imagine that you want to Detect or yeah, you want to rotate the room temperature Using this simulator Well, in my case what I did is I'm gonna show you here the code because I wanted to show you how simple code it is Use it first. We need to call the other fruit if we playground library That is this a library a specific library for this microcontroller We're gonna include the time and then we have the wild true loop that I mentioned before Then inside we have a condition that what I want to do is if the temperature is lower than 30 degrees I want to have display the blue color and if it's higher to 30 Degrees, I want that red color. This is nice because imagine that you want to know If the temperature is really high in your apartment or in your living room or in your office And then this is a solution that can help us to say hey the temperature is not completely right to work or to be there Let's see how Works this is the code that needs to be right in on the left as I show you before and on the right you are gonna have The this image and then you can interact with this with the numbers and yay Here we have more than 30 degrees and then you can play around This is not the only thing that we can do with Of course, I sorry. I spent so much time just playing with a temperature, but it was not Super important There are other things for instance There are buttons that you can play and also change the colors and do other things as you can see in this Short video that I try to press one button and the other and see some pixels no It's as it is in development. I still there are not all the functions that the real microcontroller has but it's I think that it's a project that it's open and People record request the features and they are improving This This is quite brief. I know but I want to go also to the applicability of this knowledge to to the projects to the real projects Because I Well, I love automate processes I'm one of the processes that I automate It's the water in system in this case is a solar powered water in system What the plants is challenging it's really easy to go from over Your plan with over watering your plan to forget that you have a plan because you're busy You have other things and I look I had a plan there And then I thought okay. Well, let's invest some time in automate this process at home For that they develop two projects in the past that I share with the Python community Sometime ago that one is plantarys that include different microcontrollers. I did some trials I include IOT. I did develop a flash application at chatbot And then I also implement the almost a full machine learning pipeline And I implement a neural network to the tech plan illness plan But still having all these in place was not enough because I decide to grow lettuce in my In my windows with this soft phasing Um But I live in Berlin that the weather is not a stable then it's quite challenging but I we have really worn days with a High intensity of sun and I thought wow I need to explore that I think that could be really really nice if I could I could develop something really more sustainable Then the first thing that I did was to buy a really small panel solar and check if it was able to To have energy enough to Implement my water in system the water in system that I'm going to show you is super simple It's something that has almost the less components as Possible and I try to keep it as simple as possible But including the solar panel here are the components the two rectangles of the bottom as the solar panel and about the round it's It's that is the microcontroller then we have this blue thing that it's a relay at the end is a switch on switch off Um, the white thing is a pump. I added the soil moisture sensor and some two inks Some comments about this project The soil moisture measurement is really really important in this project because it's it's as I mentioned before It's easy to be in the extreme in the stream if the is the temperature is really high or if you go outside for the weekend or whichever and You forget you that you have plants then It's important to know when your plan will be happy and this will depend on the weather will be the pen of the soil and This will be also depends of the plant that you have because it's not the same. I let I'll let you use than A strawberry for instance Then know your plan will give you a success in this kind of project Then these are the components and this is the way that they are connected of course Have in mind that this is a prototype and for that reason I have all the cables there This is not the Definitive Implacement is just to be sure that I could to have automated the watering Powered with solar energy Then we have the solar panel a connected with a pump that it's in B That the pump that it's in B is connected with D that it's the microcontroller at the at the same time the Microcontroller that it's in D gets the energy from the solar panel that is the C and Then also we have E that it's a moisture sensor that of course needs to go to the microcontroller In such a case we have also the relay that is the switch on to itself Okay, well, let's see how this looks like in The video Something that they didn't mention it's not that and it's important it's in the in the tube There are some small holes and then the water drops by By these holes then the water go away the to open And at the same time Water of all the soil Yeah, and that's and that was the dream and who looks the code The code is quite simple again and we need to import some libraries then Establish the relay Where is connected in the board? I instantiate it and then we have the sensor in this case With this tricky and it's more experimental is the Wait time the weathering time and the right value. That's our values that you need to Get them is pretty mentally of course the manufacturers usually give some values and also In tutorials has some values and that but I can tell you that Depends a lot of your case and We mentioned before to go with the soil moisture. We are measuring the conductance this means that The depends of your soil if you change the type of soil or the brand of soil You are gonna have different values The important well then this is a of course This is the same quote. Sorry. I didn't mention but I have not a space enough in the slide then what we have is the wild loop and the conditions that they say, okay, if the is the value The from the sensor is lower than the tried value. We are gonna water our plants and if not will be The relay will be closed and will not be water Yeah, that was one of the projects that you can develop just with the same playground microcontroller But it's not the only one you can automate more things at home And here came another interesting topic that it's the cleaning We're busy in our lives and there are so many cool things to do in life And I decided that I wanted to automate the cleaning process For the reason I think that it was also an excuse Because I decided to do to build a robot and And this was the first thing that I did is say, okay I'm gonna build a robot and then the robot can clean my apartment and I will be happy and Then this this was the first version And as you can see it's so was super big my apartment is really small and This was a problem. Also the the surface does the area that cover the Cleaning was not the best. Okay. It was kind of okay would try but no we need to improve that Because the goal is clean the apartment not just have fun building robots Yeah, then here we have a before and after as you can see the lock down also affect to my robot No, it's a joke. It's just What I decide is just take a mop directly. I took a mop. I And I build a robot and I implement the robot and I fuse the robot with a mop More functional even in cheaper and faster to do it Something interesting that has this road is the ultrasonic distance sensor in this case is these HCS are zero four, but this ultrasonic and If you are not familiar with this kind of sensors, it's the same of It's a similar mechanism that has that bad for instance in the the device sent up poles and Of ultrasound and then the ones that is an object this pulse It's a robot and it's received by the sensor This means that the environmental Conditions affect to this dynamic. This means that if you are implementing your your your robot or your code In summer or in some specific location will be different The behavior will not be the same if you the tribe later In winter for instance Okay, this is something that was important and then I thought There was another option. There was another reason when I use this specific sensor it's because if you want to have our famous Robot, you need to have this cute This cute face of robots It's also a joke, but was quite cute to see it Again really simple robot Ultrasonic sensor as you can see in here on the the top We have the several a several motor here and then we have some motors on Three wills That's all and let's see what happened when I added to the mop and this kind of things Of course in here I tested with the normal thing that you have at home, right? So I'm in your floor some plans a fan a baby eight Normal things, you know in this case. I implemented the robot in a way that Advanced a stop it check it and continue For that reason has this a stop between the movements Because and as you can see in here BB8 was ignored completely That was because at the beginning I was thinking in that also Servo or something that could help in the cleaning, but the still is not I didn't like it at the end this idea and it's really a functional this mop This automatic mop. It's it's works really good Then I added the most direct Approach that is go directly and then once find something Stop it check it and Continue to our site the the decision where Where to go? This is a This is the logic the distant When to check that is when to stop it and detect There is an object check to the left and then to the right and the decision where should go It's based on what is the higher distance. We want to go always. Where is the emptiness? Hey, Maria, sorry to interrupt. It's the last slight. Oh, okay I just wanted to say if you're not convinced still In build your robot. I can give you here just an excuse You can create your own means and be just happy for hours And with that it I would like to finish. Thank you Well, that's a super amazing I actually Thought about all of that ideas, but you actually implemented all of them super cool So we have a couple of questions quite a lot We don't have much time left. So the discussion can continue in the breakout room Okay, but here goes the first a question is can the prototype survive the rainfall? Um, I think it means that yeah The the water in I suppose, right? Well, I Try I I forget it I need to say that I forget it the other day And I start to brain a lot and survive it This is a good sign If it's the is a storm, I am not sure if will be Sure, but normal rain. It's a just a little surprise. It's okay The next one can you circuit Python with any microcontroller or just certain developer kids? Good question that are Not for all of them Available because you're gonna need some libraries, but they're a bank show for microcontrollers I think that they cover. I don't remember exactly the name but the number right now, but it's it's a huge amount But if you have a specific question for some specific microcontroller, just let me know or I can send you directly the sources on the link We have one more question How hard is to move the code from the simulator to a real device? Do we need to make any changes? No, you just need to copy paste Yeah, it that is fantastic for that reason you can play first with the Emulator learn and then just move it to the copy paste to your code Okay, thank you so much Maria super nice. Thank you