Loading...
Hello, my name's Mrs. Taylor and I'm really glad you can join me today for our lesson.
Today, our lesson is "Programmable systems" and this is part of the "Core principles" unit, let's begin.
The outcome, I can use a microcontroller to design and test a control system.
We have three keywords.
Microcontroller, which is used to control outputs by processing inputs.
Programmable, which means to provide instructions to complete certain tasks.
And flowchart, a simple diagram using symbols to show steps in a task.
Within the lesson we have two learning cycles, "Planning a programmable system" and "Testing a programmable system." Let's begin with "Planning a programmable system." A computer is programmable.
This means that a set of instructions can be inputted for the computer to perform.
Computers are, however, large.
There is an increasing demand for smaller devices to be programmable and carry out functions.
Examples include domestic appliances such as a robotic vacuum cleaner.
The programmable feature allows the user to set a time for cleaning and avoid certain areas.
Microcontrollers are used to control outputs by processing inputs.
There are two main types.
PIC, which stands for peripheral interface controller, and reprogrammable.
This example shows the input is a temperature sensor, and the process could be either a PIC or a reprogrammable, and the output could be a fan.
Peripheral interface controller, or PIC, microcontrollers can be used to control systems. A PIC microcontroller is programmed to control a device such as a washing machine or a microwave.
PIC microcontrollers are empty when manufactured.
A computer programme is created, uploaded, and stored on the PIC, which is built into the product.
PICs generally cannot be reprogrammed.
Here's an example.
Programmable microcontrollers such as micro:bit, Raspberry Pi or Arduino are small computers which can be easily programmed to control systems. They can be reprogrammed by erasing its instructions to reuse in different systems. For example, a microcontroller from a temperature sensor project can be reprogrammed to control lights in the home.
Here's a picture of a micro:bit.
Here's a picture of Raspberry Pi.
And here's a picture of an Arduino.
Let's have a check.
Which of these are examples of a microcontroller which can easily be reprogrammed and used in different systems? Is it A, a mini chip; B, chip; or C, micro:bit? Pause the video and have a go.
Well done, let's look.
That's right, micro:bit is the correct answer.
There are different languages for programming microcontrollers.
Some use Python, which is a text-based code.
Some, like Scratch, use block-based programming, and others use flowcharts.
Flowcharts are useful for planning a control system.
There are specific symbols used for different parts of a flowchart.
A decision is in a diamond, process is in a rectangle, terminator is a lozenge shape, and an input or output is a rhombus.
Here is a simple system to turn a nightlight on when it's dark shown using a flowchart.
This system includes a decision which has two options.
The options feedback into the system.
This is known as a feedback loop.
We can see we start and the first question is, is it dark? We go to the right and the answer is yes and then it turns the light on.
If the answer is no, we go down and the system turns the light off.
Let's have another check.
Which shape is used to begin or end a flowchart? Is it A, a rectangle; B, a diamond; or C, a lozenge? Pause the video and have a go.
Fantastic, let's check.
That's right, the answer is C, the lozenge shape.
Think about a pelican crossing and how many stages there are to control the system.
What happens when a pedestrian pushes the button? Here are the stages of a pelican crossing sequence.
We have the traffic light sequence on the left and the pedestrian light sequence on the right.
Number one, the pedestrian pushes the control button to activate the traffic signals.
Number two, the amber traffic light is illuminated whilst the red pedestrian light is illuminated.
Number three, the red traffic light is illuminated and the red pedestrian light remains on.
Number four, we have a red traffic light and a green pedestrian light.
Number five, we have a flashing amber traffic light and a flashing green pedestrian light.
And number six, a green traffic light and a red pedestrian light.
Here we have your first task.
Complete this flowchart to show the traffic light sequence for the pelican crossing control system.
Pause the video and have a go.
Well done, let's have a look.
We started and then followed down to the first question.
Has a pedestrian pressed the button? If the answer is no, we move to the left and see that the green traffic light is on and it loops back around to the original question.
If the answer is yes, the amber light is turned on and we wait, and then we follow around and see that the red traffic light is turned on and we wait.
And then the amber traffic light begins to flash.
We follow the flowchart around and the green traffic light is on again, well done.
We're now going to move on to the second part of our lesson, "Testing a programmable system." Tinkercad is a CAD software that enables electronic circuits and control systems to be designed and tested virtually.
Micro:bits are one of the built-in microcontrollers.
The advantages of testing a control system virtually include it's less expensive than physically building the system, it's quicker than physically building the system.
This therefore means that designs can be created, tested, and improved quickly and easily.
Add the missing words.
A control system.
And improved using CAD is.
And less expensive than physically building the system.
Pause the video and have a go.
Well done.
A control system tested and improved using CAD is quicker and less expensive than physically building the system, brilliant.
Here is a micro:bit in Tinkercad.
There are five holes along the golden edge.
These are points at which the components can be added.
Each LED is connected to the ground pin, which is the negative power.
The green LED is connected to pin 2, the amber LED connected to pin 1, and the red LED connected to pin 0.
Each LED also has a 220 ohm resistor in series with it.
We're now going to watch a video of this circuit being constructed in Tinkercad.
Click Create and Circuits and then grab the micro:bit.
I find it easier to turn it around.
Click and drag an LED and change it to green.
Click and drag an LED and change it to orange.
Click and drag an LED and it remains red.
Add a resistor and change the ohms to 220, and then you can copy and paste this as it's the same for each of the three LEDs.
Then at the top we change the colour of the wire and we draw a red between the LED and the anode, or the positive leg of the LED, and a red wire between each LED resistor and the corresponding pin, so pin 2 for the green LED, pin 1 for the amber LED, and pin 0 for the red LED.
We then add black wires between the cathode, the negative leg of the LED, and draw that and connect to ground.
Here we have a check.
Some components are polarised.
LEDs are an example.
What does this mean? Pause the video and have a go.
Fantastic, let's check.
LEDs and other polarised components must be placed in the circuit the correct way round, well done.
The blocks for the computer programme are planned on this table.
We can see the traffic light sequence on the left and the plan for the computer programme on the right.
Traffic light sequence number one, the pedestrian pushes the control button to activate the traffic signals, and the computer programme plan is on button A is pressed.
Number two, the amber traffic light is illuminated, and the plan for that would be green pin number 2 is low.
Low means off.
The amber pin 1 would be high, this means on, and we would wait one second.
Stages three and four are that the red traffic light is on, and the plan for this would be amber pin 1 is low, this means off, and red pin 0 is high, this means on.
And we again wait one second.
Number five, the flashing amber traffic light.
Here we have red pin 0 low, which means off, and then we have a repeat five times, which is the amber pin 1 high, wait one second, and the amber pin 1 low, wait one second.
And stage six, green traffic light is illuminated, and the plan, green pin 2 is high, which means on.
The computer programme to control the LEDs is created in Tinkercad using blocks.
We can see an image here and we're also now going to watch a video showing the computer programme created in Tinkercad.
We click Code and from the basic menu scroll down and pick up On Button A Pressed.
And then change to output.
Scroll down and pick up Digital Right Pin and change this to Pin 2 and Low.
Grab another one of those and change it to Pin 1 and it's already High.
Go to the control menu, add a Wait.
Back to the output menu.
Pick up Digital Right Pin and change to Pin 1 and Low.
And grab another one and change to Pin 0 and High.
Add another Wait from the control panel, back to output.
Pick up a Digital Right Pin, changing Pin 0 to Low.
Back to control.
Find the Repeat button, change to 5 times, not 10.
Back to the output menu, click Digital Right Pin, change it to Pin 1, and then go back to the control menu, collect a Wait.
Another Digital Right Pin.
Change to Pin 1 and Low.
Pick up a Wait from the control menu.
And then pick up another Digital Right Pin.
Change to Pin 2 and High.
And start the simulation and we compress the Button A and see that the lights are changing colour in the sequence in which we wanted.
Additional blocks can be added to the computer programme to show the pedestrian signals alongside the traffic lights.
The built-in LEDs on the micro:bit are the easiest way to show these.
We can see these added in the diagram on the left, and a cross is used to indicate the red pedestrian signal and an arrow is used to indicate the green pedestrian signal.
Here we have Task B.
Number one is to create a micro:bit circuit on Tinkercad to represent the traffic lights on a pelican crossing.
Include a red, a green, and an amber LED.
The second part is to programme this to change colour in the sequence as previously shown in Task A.
The third part is to explain each block in your computer programme.
Part four is to add additional blocks to sequence the pedestrian signals.
Use the built-in micro:bit LEDs to show either a cross or an arrow.
And number five, explain the computer programme.
Pause the video and have a go.
Fantastic, let's check.
Here is the picture from Tinkercad of the circuit with the three LEDs connected correctly.
Here we have a video simulation showing the colour change sequence which you planned in the flowchart in Task A.
We press Simulate and we can then press Button A and see the lights change from green to amber to red, and then to flashing amber and back to green, and then we stop the simulation.
Part three, explain the computer programme.
Button A represents the pedestrian pushing the control button to activate the traffic signals.
Pin 2, which is the green traffic light goes off, and Pin 1, which is the amber traffic light goes on.
A one-second wait is added.
Pin 1, which is the amber traffic light, goes off.
Pin 0, which is the red traffic light, goes on.
A one-second wait is added.
Pin 0, the red traffic light goes off.
A repeat routine is added, which flashes Pin 1 on and off five times.
This is the amber traffic light.
And Pin 2 goes on, which is the green traffic light, well done.
Part four is to add additional blocks to the sequence to show the pedestrian signals using the built-in micro:bit LEDs.
Here is a video showing this.
Please note that the micro:bit is on its side and therefore the arrow points sideways rather than upwards, as in the programme.
Press Start Simulation and then press Button A and we can see that both the traffic lights are changing in the sequence, but also the built-in LEDs are changing in the correct sequence, currently flashing, and now a red cross to simulate do not cross.
And part five was to explain the computer programme.
Button A represents the pedestrian pushing the control button to activate the traffic signals.
Pin 2, which is the green traffic light, goes off, and Pin 1, which is the amber traffic light, goes on.
A one-second wait is added.
The micro:bit LEDs illuminate a cross to indicate that pedestrians should wait.
Then Pin 1, which is the amber light, goes off, and Pin 0, which is the red traffic light, goes on.
A one-second wait is added.
The micro:bit LEDs illuminate an arrow to indicate the pedestrians can cross.
Pin 0, the red traffic light goes off.
A repeat routine is added, which flashes Pin 1 on and off five times.
This is the amber traffic light.
The micro:bit LEDs flash the arrow on and off.
Pin 2 goes on, which is the green traffic light.
The micro:bit LEDs show a solid cross, well done.
Here is a summary of today's learning.
Input, process, and output are the basic features of a control system.
Microcontrollers are used to control outputs by processing inputs.
Some can be reprogrammable.
There are different languages to plan and create computer programmes.
It may be text-based, blocks, or flowcharts.
Really well done and thank you for joining me today.