warning

Content guidance

Equipment requiring safe usage.

Adult supervision recommended

video

Lesson video

In progress...

Loading...

Hello, my name is Mrs. Finley, and in today's lesson we are going to learn about technology in the home.

We're going to be designing a system for our pets.

As always, make sure that you're somewhere quiet where you can hear my voice and you can concentrate.

And today you're going to need to be able to access the micro:bit MakeCode software.

I'll explain this a bit more as the lesson goes on.

You will also need a pen and some paper.

Just a reminder that you'll need paper and a pencil today and you'll also need access to the micro:bit website.

On it especially, you need to click on MakeCode and that is where we're going to do all our coding today.

It's all free and it even gives you the micro:bit simulation so you can see what you're coding.

So you should have already done the intro quiz but what else are we going to do today? Well, we're going to start by doing some mini programming tasks, and then we're going to move on to include sensors within that.

Then we're going to take all of that information and you are going to design your own tech palace of the future for a specific pet.

And as always, there's an exit quiz at the end of this lesson.

So let's move on now and look at the key words for today.

Sensors, now they detect change from the environment and they convert it into an electrical signal.

So this could be, for example, pressure, it might be change in temperature or it might be change in light levels, something like that.

Let's see what our next key word is.

Pressure sensors.

Okay, so type of sensor, this converts physical pressure, so maybe pushing, compressive strength, maybe, into an electrical signal.

Let's look at the next key word, programming.

So this is where we create a set of instructions that tell a computer how to perform a task.

And in today's lesson, our micro:bit is our mini computer and that is what we're going to be programming.

This is just a quick note on how you get ready for today's lesson.

So if you search MakeCode so M-A-K-E C-O-D-E, makeCode.

microbit.

org, you have this page come up.

And what you're going to do is you're going to click on new projects and I'm going to do this alongside.

So I'm going to call my programming Oak Academy and I'm going to press create.

And it's going to create a new project for me.

Here we go, it's setting up.

And if you are working on a mobile phone device, it's very similar except for the simulation of the micro:bit, instead of being on the left is down on the right-hand side.

So if you've used them, some of you might've used the micro:bit before but if you haven't, that's fine.

We've got these building blocks all here.

And what I really love is that when you look at the code, the blocks are different colours and these different colours link to the colours that are in this list here.

So it makes it very easy to copy code.

I'm going to show you something super quick.

So we've got on start, that's how we're going to start it.

I'm going to click on basic, I'm going to drag and drop some LEDs in, do a little pattern, I'm going to click on music, I'm going to add in a little bit of melody.

and then when I press play on my simulation of my micro:bit over here, Okay, brilliant.

Now, if I wanted it to repeat, I could, also I can grab, drag and put it in the bin.

So everything we're going to do today, we're going to drag and drop and you'll see your simulation will catch up with that as well.

So it's up to you now, at this point, if you haven't used a micro:bit before, I suggest you go onto the MakeCode, have a little play.

If you're happy and you've used it before, get on the correct web page or have it up 'cause we're going to need it for the lesson and then we'll move forward with using the sensors and what we're going to learn in today lesson.

Now you've got your MakeCode ready to go, we're going to start to look at some of the sensors that we're going to work with today.

So we're going to use a temperature sensor, we're going to use a light sensor and we're going to use a pressure sensor.

For each of those, I want you to be confident with how to code your micro:bit.

So in preparation for today's lesson, I would like you to put your page on A4, and I'd like you to write these three titles at the top.

It will mean that you can write code underneath.

One for temperature sensor, one to set a light sensor, and one for setting the pressure sensor.

You will need these codes for the design task at the end of the lesson.

So pause the video now and set up your page.

Okay, so we're going to move on now and we're going to have a look at some code.

So here we have on button A pressed, show icon, on button B pressed, show icon.

What do you think is going to happen? Have a little think in your head.

Okay, I'm going to demo this coding and let's see what actually happens.

So here we are back in the MakeCode.

Now this time, we're not going to use on start.

We're going to go into inputs, we're going to put on button A, so we're going to drag that one out.

So on button A pressed, and we're going to go into basic ;cause it was blue, wasn't it? And we're going to click on show icon.

This is a really quick way of filling up those 25 LEDs without actually having to make the symbol up yourself.

So that was the first piece of code, wasn't it? Now the second piece of code we were going to press button B.

So we do the same thing.

On button from the input and we're going to change button A to B and we're going to go back into basic and we're going to pull out show icon, but this time we're going to change it to a shrunken heart, there is there.

Okay, so what did you think was going to happen? What do you think? So, first of all, I've got to do an input.

So here we go.

If I put it on there, it tells me, "Do something," when button A is pushed.

So we can click on button A and what do you think will be showing? That's right, the heart, amazing.

So if I then press button B, amazing and I can flick between the two.

Did you guess it right? Let's look at the next programming challenge, Dice Code.

What do you think is happening in this coding and what will happen? Look at the input and then read the code.

So the instruction is, on shake, so by shaking the micro:bit, the basic show number seems to suggest we're going to have something displayed and then the command is pick random one to six.

So we're hoping that by shaking the micro:bit, the display should show us a number between one and six including one and six, just like a dice would work.

If you would like to take this forward, you can go and code this now and pause the video or if you feel more confident with me demonstrating first, carry the video on and I'll demonstrate it and then you can have a go at coding this yourself.

Okay, so this time we're going input on shake, we are then going into basic and we're going to find show number.

Now we don't want just nought, so we're going to go into math.

So it's purple and we scroll right down to pick random nought to 10.

But we are going to change that 10 to six and we're going to change the one, sorry, the nought to one.

So that is what our code is going to look at.

Now at this point, let's see if it works.

So I'm going over to my micro:bit and I'm going to shake it, there we go.

A four has come up, so it works.

So let's shake it again, and a one and we shake again, and a six.

What I would like you to do is have a go at doing this code if you haven't already, so you're using the input for the on shake, the basic to get the show number and then you're going into math to find pick random and changing that from one to six.

I would then like you to add that to the page that you set up and write that code out because later in the lesson, you might want to use this code for one of your design solutions.

So pause the video now.

This is the Dice Code that we've just put in and what actually happened? Well, we shook our micro:bit.

Every time we shook it, a number was demonstrated that was between one and six.

Displayed, sorry, that was between one and six.

So that's our code.

So on shaking it, it showed us our number between one and six.

If we wanted to change that, if we wanted to make that a pressure switch or we wanted the push button, what would we change on the coding? Yeah, the purple bit, the invert.

So instead of having on shake, we'd have press button A or press button B, good.

Okay, we're going to move on.

We're going to look at a different sensor now.

So this we're going to look at light levels.

How do you think it's going to work? What do you think is going to happen? Have a read of the code.

So in this code, it's telling us to set the reading to light level, so we're going to see the light level and it's then asking us to plot a bar graph of that reading up to 225.

So it's asking us to sense the light level, and we're going to have a little slidey sensor for that because we're only simulating it but at the same time, we've asked the micro:bit to share with us the light levels in a visual representation on a graph, and that's going to be through the 25 LEDs.

So essentially, this programming is showing us what the light levels are doing around us.

It's giving us an output of LEDs to demonstrate that.

You might want to pause the video now and write this code down under light levels on your paper.

You also might like to go ahead and have a go at coding it without my demonstration to see if you can do it.

And if you feel that you need my demonstration, just pause the video, write down the code and then we'll do the coding together.

Now I'm going to demonstrate how to do the light levels programming.

So I'm going to start with forever, I'm then going to go into variables.

Now, when you go into variables, nothing will be written, that's fine.

We're going to make a variable and we're going to call it reading.

You'll have to do this as well.

I'll call it reading, okay? And then we're going to get this set reading too.

We're going to drag this out and we want to change this nought to light levels and because light level's an input, what colour, where do you think we'll find it? It's an input, where do you think we'll find it on the coding block? Yeah, that's right in the pink section.

So click on the pink section, there's light level.

I'm going to drag it and you can see the little red dot.

If you go near to that nought, you get like a sticky line, that's going to pop onto there.

And then the next thing we want to do is plot that bar graph.

Now that's purple, so we're going to go down to, oh, LED actually, the darker purple and there it is, plot bar graph, so we're going to click and drag that out.

Now we're going to plot the bar graph off the reading, so we're going to go back into variables, we're going to drag reading and we're going to drag it on here and then we're going to say up to, I'm going to make that 225, there we go.

Now, you might have seen on the left-hand side, I've suddenly got this up here, so if I drag my light levels, there we go, full exposure, all 25 LEDs, if I reduce the light levels, my LEDs reduce as well until there's just one there.

So up the light levels, all the LEDs on, down the light levels, only one led left on.

So if you haven't already had a go at programming this, pause the video now and have a go.

Make sure the code is written underneath light levels on your paper also.

Temperature levels, this code is for sensing temperature change.

If you look at the code on the left-hand side can you find two things that are different from the code we use for light levels? Have a look.

Okay, I'm going to tell you.

So the first one was that instead of light levels, we've now got temperature in degrees Celsius and we're plotting our bar chart up to 50 degrees C.

So not as much as it was for light levels.

You'll also notice on the micro:bit that the light level has been changed by a thermometer and at the moment it's on 21 degrees.

What I would like you to do is I would like you to go back into your MakeCode and I would like you to work out how you change the input from light level to temperature and change the reading on the plot bar graph from 225 to 50.

So I'm going to show you how to do that but I would like you to pause the video now and see if you can do that yourself.

Okay, so just in case you didn't manage to do that we are going to go into inputs and we're going to scroll down to temperature, drag and drop that in there, light level moves out the way, and then for reading, very simple.

We just click on that and pop 50 on.

And then when we go over to our micro:bit, just click off of that as we go down in terms of the temperature, so nought degrees would be one LED all the way up to 50 and we've got a full compliment there of LEDs.

Okay, so hopefully that's what you guys got.

And as always, could you write that code for me under the temperature in your piece of work that you've got in front of you because you might want to use this code later in the lesson.

Let's have a quick moment where we check some of our learning.

Which of these cannot be found on the face of the new micro:bit? A compass, a light sensor, 28 LEDs or a temperature sensor.

So I know they're not always all there, but which ones of those in the list cannot be found on the new face of micro:bit? What do you think? Make a quick guess.

Okay, 28 LEDs.

Why is it wrong? Because there're 25 LEDs on a micro:bit but all the others, we can have a compass on there, the direction, we've got the light sensor and the temperature sensor we know.

Okay, let's try the next one.

What is the micro:bit programme to report on? So, let's look at this micro:bit.

Is it reporting on light levels? Is it reporting on temperature? Is it reporting on compass direction or is it reporting on speed of an object? What do you think? Should we see what the answer is? It's light levels.

Yeah, and there's a clue, isn't it? Because on the left-hand side you have got it showing half light and half dark.

Okay, fantastic.

So what sensors can we programme? What can we use the micro:bit to programme? Well, we've looked at a temperature sensor, we've looked at a light sensor and although we didn't use a pure pressure sensor, we did use the switches to have a go at changing our heart from a big heart to a little heart.

And these are the three sensors that I'm going to get you to use.

Now we go into your design challenge for today.

Okay, design challenge, pet home of the future.

Let's have a look at what I'm asking you to do.

This is Hilda, she's a Rhode Island Red.

If you know anything about hens or chickens, you'll be right at home.

Hilda is amazing at scaping and so what I'm asking you to do is using your programming skills, I would like you to design a new henhouse for her.

There she goes in that lovely, luscious green grass.

Okay, so a little bit more detail I think you need, so let's look into it.

I want your henhouse to use the three sensors that we've used today in your programming and this is why I got you to write down those codes in the lesson today.

So use a pressure sensor or just something that comes off a switch, that's fine, a light sensor and a temperature sensor.

And it's up to you, what they output to.

So if the temperature drops, you might have under-floor heating in the hen house come on.

Or if the temperature drops you might have a disco light that goes on, maybe, that's got heating in it or something.

So, be really, really creative with your ideas.

Now I'm going to give you a specification to work to.

And remember, a specification is just a list of criteria, things that product should do.

So let's have a little look together.

The henhouse should fit at least three hens and I've put the size of one hen there for you to help you out.

There needs to be suitable ventilation for them so not so they can escape but so that air can go in and out of the house.

It should shelter the hen from inclement weather.

So that means rain or snow.

So keep them nice and snug and safe and not get wet.

And it should keep them safe from predators, so things like foxes.

And finally, the house should include a light, a pressure and a temperature sensor.

What I would like you to do is to design your house, draw in where you want those sensors to go, label up what they would do and I would also like you to have a go at writing the code in the MakeCode as we did in the lesson.

For one more bit of help, I'm going to demonstrate how we could put all of these things together in a quick sketch to get you started.

As always, you might like to send your solutions to your teacher 'cause I know they would love to see them.

Okay, so my first little plans are that my henhouse is going to be, I'll get a little bit focus for you there, good, on feet, so I had a little earlier little sketch.

It's going to have a, bits on there, little ramp to go up to and let's put some grass in there.

By the time these hens are actually binning, their chicken keep expectedly covered in mud 'cause quite often they are muddy and kick everything out.

Oh, it looks like their colour.

Okay, so that's roughly what it's going to look like from the side.

I'm going to do a isometric drawing 'cause I think I can show quite a lot of detail that way.

Now I know it's a bit boring and it's rectangular but I'm just doing this quickly so you guys have got an idea.

You could do views from different sides and then do maybe a view from the top, how you divide it out and things like that, totally up to you.

Okay, so let's go back to the one I'm doing.

I am going to pop some perches in.

So I'm going to draw some little perches in, they probably come to that there.

And I'm also going to put some ventilation in 'cause that was one of the spec points, wasn't it? That it had to let air in and out.

Air in and out, there we go.

Oh, and maybe I'll put some over here as well and that could be added as a pattern as well to the box.

Up to the box, to the henhouse.

Could add a little bit of a pattern and have some down here and so forth.

There we go, get an idea.

We'll then also need to put in some form of door.

So I think I'm going to do, there's more door.

And I think what we're going to do is have a sliding door.

Now this could go on, I think I'm going to put this on the outside.

Sliding door on the outside that closes up, so it would have to have some kind of mechanism.

Maybe something like this.

Don't worry too much about mechanisms and things like that.

Something it slides along, maybe.

That had to go a long way.

Would that work? Yeah.

So that would move that slides along, maybe on there, something like that.

So, we would have a light sensor here, activates the motor, makes the door close.

Sensor here would stop and then it would go in reverse.

So that's a light sensor on the door working with a little motor.

What else do we need? Oh, heating.

Okay, so can't really draw the heating very easily in here, so I'm going to draw it to the side.

So I'm going to do a big, old arrow there, and I'm going to have under-floor heating.

I mean, how cool would a chicken, sorry, not chicken, henhouse be with under-floor heating? So under-floor heating there and I'm going to put the sensor for the under-floor heating inside rather than outside.

That's a conscious decision.

I'm not putting on the back wall 'cause essentially, the bottom of my chicken's going to be there.

So they might be warming the sensor up.

I'm going to put it on the other side of this door here.

So temperature sensor, I put brackets inside and in the end, that will kick the under-floor heating.

So linked to under-floor heating.

Okay, now the only other one I wanted to add in was a pressure sensor.

And because I want to make this special for our chicken, Hilda, she deserves it, I'm thinking one of these over here, one of these little runs over here, we could have a pressure sensor and when you press it, it plays an entrance jingle.

That'd be brilliant and also they light up different colours, different colours.

And this is where, sorry, I'm designing too fast on my hand, this is where you could really go to town on your micro:bit programming, couldn't you? 'Cause you could have the LED going in different patterns.

I mean, if we're really good, we could almost have it like a thumbprint and you could have different, different hen has a different entrance jingle.

Okay, so this is what I would like you to produce.

Something quite fun, I want you to use the senses, lots of annotations, really have fun with it.

Okay, good luck.

Well done today, you've done another fantastic lesson.

Don't forget to show your work to your teachers and I'll see you again very soon.