Lesson video

In progress...

Loading...

Hello, my name's Mrs. Taylor and I'm so pleased you can be here to join me for our lesson today.

Our lesson today is micro:bits in Tinkercad and this is part of the functional prototypes: wearable technology unit.

The outcome: I can combine inputs, processes, and outputs with feedback in a control system.

There are three keywords.

Microcontroller, which is a device that can be programmed to control how an electrical product operates.

Programme, a sequence of instructions used to control electrical components.

And feedback, a signal sent back in a loop, depending upon a condition.

There are two parts to the lesson: Using a micro:bit and designing a control system with feedback.

Let's get started with using a micro:bit.

The micro:bit is a microcontroller.

A microcontroller can be programmed to control how an electrical product operates.

By using inputs, the micro:bit can be programmed to process information to control outputs.

We can see the front of the micro:bit here has an onboard input, which is called button A.

And the micro:bit uses an onboard processor, which we can see on the reverse.

The front has a series of LEDs that are onboard outputs.

Additional offboard input and output components can be connected via the pins.

Components can be connected to the connector pins to create a circuit.

These can be inputs or outputs.

Input examples include a push switch, an LDR, which stands for light-dependent resistor, or a slide switch.

Output examples include a bulb, an LED, which stands for light-emitting diode, or a motor.

Here we have a check for understanding.

Read and complete the sentence with the missing word.

Pause the video and have a go.

Great.

Let's check.

A microcontroller can be programmed to control how an electrical product operates.

Well done.

To use a micro:bit in Tinkercad, drag the micro:bit image from the component menu into the workspace.

We can select and connect the components to create a control system.

This is a single LED connected to pin zero and the ground pin.

GND is short for ground.

The positive anode must be connected to pin zero and the negative cathode must be connected to the ground pin.

Here we have a check for understanding.

Identify the input components.

A is an LDR, B is a motor, and C is an LED.

Pause the video and have a go.

Great.

Let's check.

That's right, it's an LDR, a light-dependent resistor.

Well done.

To programme the micro:bit, open the code editor from the top toolbar by clicking Code.

The code blocks can be dragged from the menu into the code editor to create a programme.

To programme the LED to turn on when button A is pressed, the code block would look like this.

On button A pressed.

This means when button A is pressed, the digital write pin, pin zero, will be high.

High means on.

We now have task A.

Part one, create a simple control system with a micro:bit and an LED.

Part two, programme the system so the LED illuminates when button A is pressed.

Part three, add another LED to pin one.

Part four, amend the programme to illuminate both LEDs when button A is pressed.

And part five, simulate the control system and describe what happened.

Pause the video and have a go.

Wonderful.

Let's a look at some of the answers you may have come up with.

Here is the programme for part one and two, which would illuminate the LED when button A is pressed.

Part three and four, we can see two LEDs, a red one connected to pin zero and a green one connected to pin one.

And we can also see the programme which says on button A pressed, digital write pin zero will be high and digital write pin one will also be high.

Well done.

Part five.

Lucas says, "The first time I simulated it, my LEDs did not emit light.

I looked at my code and realised that the digital write pin for both code blocks was set to zero.

When I changed the blocks to digital write pin one, it worked well." Well done.

We now move to the second part of our lesson, designing a control system with feedback.

To develop a control system, we can add more complex instructions in the programme.

Feedback is when a signal is sent back in a loop, depending upon a condition.

Usually an output is fed back into the system as an input.

This can be useful if there are decisions within the system.

If statements are used to let a programme select an action if a specific condition has been met.

Here we have a check for understanding.

What is feedback in a control system? Is it A, an input fed back into the system? B, an extra output in the system.

C, an extra process in the system.

Or D, an output fed back into the system.

Pause the video and have a go.

Wonderful.

Let's check.

That's right.

It's an output fed back into the system.

Well done.

In this example, if button A is pressed, the LED is on, else the LED is off.

There are only two options to an if statement.

It is either true or false.

If and else statements are used together to programme two different outcomes.

Here we have another check for understanding.

An if statement can be A, true, B, false, C, on or D, off.

Pause the video and have a go.

Wonderful.

Let's check.

An if statement can be A, true or B, false.

Well done.

A wearable device to keep children safe when walking to school could use flashing LEDs, which would be noticeable by road users.

How could this be achieved in code? We could turn the LED on and then off.

This happens very quickly to make it more noticeable.

A wait command can be used to add a pause when the LED is on and off, as we can see here.

Task B, using the single LED system from task A, amend the programme to add an if and else statement to turn the LED on when button A is pressed and off when it is not.

Part two, add an LED and amend the programme so that both LEDs switch on if button A is pressed and off when it is not.

Part three, amend the programme further to make both LEDs flash alternatively if button A is pressed and off when it is not.

And part four, simulate the control system and describe what happened.

Pause the video and have a go.

Wonderful.

Let's have a look at some of the answers you may have come up with.

For part one, here we can see a programme which says if button A is pressed, then digital pin zero is high.

Else digital pin zero will be low.

This means if button A is pressed, the LED will be on, but if it is not pressed, the LED will be off.

Well done.

Part two is to add an LED and change the programme.

And we can see here that the programme says if button A is pressed, digital pin zero will be high, and digital pin one will be high.

So that means both the red and green LED will be on.

Else digital pin zero and digital pin one will be low, which means that both the red and green LED will be off.

Well done.

For part three, we can see here that the programme has been amended to make both LEDs flash if button A is pressed and off when it is not.

So we can see the programme if button A is pressed.

Then digital pin zero is high whilst digital pin one is low.

Then there is a two-second wait before digital pin zero is low and digital pin one is high.

And then there is another two-second wait.

Else both digital pin zero and digital pin one will be low.

Well done.

And here we can see part four, which was to simulate the control system and describe what happened.

Lucas says, "Both the LEDs flashed on and off when button A was pressed.

I changed the wait to be two seconds as I thought that would be clearer to see." Well done.

We now have a summary of our learning.

The micro:bit is a microcontroller.

A microcontroller can be programmed to control how an electrical product operates.

They have built-in inputs and outputs and connectors for external components to be added.

When programming to control a microcontroller, a feedback loop can be used so an output is fed back into the system as an input.

I'm really pleased you could join me for our lesson today.

Well done.