Smart greenhouse

This Year 7–10 design challenge provides students with an opportunity to explore emerging agriculture technologies through microcontrollers, sensors, and coding.

Design brief

Students will follow an engineering design process to design, make and evaluate a small desktop smart greenhouse that can help manage temperature autonomously.

The smart greenhouse should include at least one microcontroller board, sensor (for example, temperature sensor), and effector (for example, servo, pump, fan).

Brainstorm and design

Watch the teaching videos for brainstorming inspiration and design ideas.

Watch 'Brainstorm and ideation' (4:29).

Brainstorming a smart greenhouse

[Light, inspirational music plays. STEM Education appears on screen followed by Smart greenhouse – brainstorming. Music ceases.]

Speaker

Watch as I go through the process of brainstorming ideas for a desktop greenhouse. To start, I've broken down the project into these 6 important factors, and I'll be stepping through them one at a time.

[A sheet of paper displays the important factors:

  1. Users
  2. Base
  3. Materials/structure
  4. Temperature
  5. Humidity
  6. Light.

The speaker sketches on the paper throughout the video.]

[Users]

You may choose to focus on other factors in your design. However, the best place to start is to identify who will actually be using the design and understand what will benefit them the most. For example, a teacher may want a greenhouse that can be disassembled at the end of a project and hold a large growing tray like this one. If designing for students, they may prefer to have their own small size greenhouses or save costs by using recycled containers.

[Base]

What will the base of your greenhouse look like? Maybe an old board, a cupboard door, a polystyrene lid, or something much more dense like a paver that will absorb that sun's energy and then release it at night to keep the plants warm.

Here I'm using a simple food container as the base. Remember that the base will need to hold the growing container as well, and that's going to have a growth medium for our microgreens and it will also importantly need to have drainage holes.

[Speaker sketches the inside of a greenhouse, with plants, growing medium and water to illustrate drainage.]

[Materials/structure]

The materials that you're building with will affect the design of your structure.

For instance, timber sticks will need to be covered by a polymer film or maybe some bubble wrap that will offer more insulation.

Plastic bottles are an awesome material. The challenge will be cutting openings big enough for watering and for harvesting the crops.

[Draws milk bottle with long edge cut open.]

Another structure may be a board with holes holding hoops of wire, some polymer film over, or even an old plastic bag.

Feel the freedom to be creative with your ideas. Play around with some different ideas. Always try to think of three possibilities for what you're trying to achieve.

[Temperature]

How will you maintain a nice temperature inside your greenhouse? Well, typically this is done by opening vents and on the front view and the left hand side view, you can see we've cut the hole in the top.

[Sketches another point of view of the milk bottle greenhouse with the long edge open and a long, thin cut along the base of the long edge.]

We could swing the lid. If we have a small opening in the bottom, we'll get some convection, the warm air rises and that should help cool down the temperature.

[The visual changes from the sketch paper to a large bottle]

Looking from the top, this bottle has a large vent glued to a stick that's hinged at both ends.

[Visual changes to a new bottle design.]

On another design, the whole top of the bottle opens up, hinged on a screw.

[Visual changes to a third bottle design.]

This vent rotates to open.

[Visual changes to a takeaway container design.]

And on another design the whole top of the container could open as a vent.

[Visual returns to sketch paper]

Lifting the entire roof may be done with the use of a counterweight. It's more common to have way up high a number of vents that could open like this:

[Visual changes to a piece of cardboard with a hinged flap covering a hole. The speaker pushes the flap open with a stick.]

[Humidity]

In our smart greenhouse one or more fans could be switched on to control our temperature. The level of humidity is also related to temperature, so allowing for lots of airflow could be one approach. I wonder if your design could deploy a movable shade when it's required to block the sun.

I've noticed that sometimes products are packaged with a little sachet of water-absorbing crystals. I wonder if that could be practical if we could apply it to our design.

[Light]

If your greenhouse was not close enough to some natural light, then we could consider adding the right colour of LED. Or maybe we could reflect some light from a source.

[Sketches a reflective surface directing beams of light onto a sketched container.]

If the light was way too strong could you design some type of structure that would protect the crop during the hottest part of the day? Maybe a screen could be used to provide filtered light, but when would a smart greenhouse know when to leave it on and when to take it off?

This video has shown what brainstorming could look like across a range of factors.

[Visual displays the entire sketch paper with brainstorming ideas.]

[Light inspirational music plays. Copyright slide appears detailing Creative Commons 4.0 licence and exceptions.

Material in this resource not available under a Creative Commons licence:

  • the NSW Department of Education logo, other logos and trademark-protected material
  • Material owned by a third party that has been reproduced with permission. You will need to obtain permission from the third party to reuse its material.

Slide changes to NSW Government logo. © State of New South Wales (Department of Education) 2025]

[End of transcript]

Watch 'Design and drawing' (7:10).

Drawing ideas for additional functionality

[Light, inspirational music plays. STEM Education appears on screen followed by Smart greenhouse – Design and drawing. Music ceases.

Speaker

[Examples of smart greenhouses appear on screen. One, a bottle with a long cut in the side, one a take away container with a plastic bag covering it.]

If you're designing and building a smart greenhouse, watch for ideas on adding some electronic movement.

[A switch connects to the top of a takeaway container, when pressed the lid opens and closes.]

Drawing, and recording your ideas, your design ideas.

[Speaker sketches on paper.]

Think about moving to a mock-up, testing just one part of the design before moving on.

[Speaker opens and closes a hinge on a piece of cardboard.]

Later we'll look at some simple electronic options. Let's start with a drawing.

If I'm looking at just the front, looking straight on at the front and then straight on at the side and the top, these are called orthogonal drawings.

[How to draw your ideas. The speaker sketches teh following on paper.]

It may help to imagine a grid or even a centre line to get started. This is the left-hand side of that container. Here's the front. The front is the most important view, often drawn first and then the others are arranged around. Notice the way the top view always sits directly above the front, and that they line up.

Same with these simple house drawings. Try to imagine these lines in 3D, one to the left, to the right and vertically upwards. These are isometric axes. You can draw cylinders lined up to any of the 3 axes, and once you can draw a cylinder and a cube, that's going to get you started in drawing almost anything you can imagine.

Even the hole in the centre really is just another cylinder. You'll see this common container is a cylinder with a cone-shaped object attached to the front.

Here's how we draw a cube and this rectangular prism is really just a short cube that's stretched. If we add a funnel shape to the front, let's do a little fix-up there better and add a little shade just to one side it's looking much more 3D.

Your first drawings will look really rough and that's fine. Add some annotation, some words and arrows and your design intent will be very clear.

A splash of colour really adds interest to your page. The other core 3D objects are the cone, sphere, and pyramid. Practice just a few minutes a day, you'll be amazed at how you improve your sketching.

At the same time as recording your ideas, you'll most likely be experimenting with materials to learn all about them. For instance, can a brittle plastic be drilled, without splitting? Will a vent open and close just like I'm expecting, or is it too heavy? Should I swing it from the bottom as you see here, or should I swing it from the top?

[Visual depicts a hinge on a piece of cardboard tied with string opening and closing.]

Your mock-ups will be the roughest and quickest way that you could possibly test just one part of your idea at a time.

Here's a design concept for a mini greenhouse. At this stage, I really don't know if those tiny motors will even lift the lid up and down.

[Visual depicts a takeaway container with a switch connected, pressing the switch opens the lid.]

So I'm making a test programme. I've added a servo and I'm using one button to open, one button to close. No sensors yet.

Here's another container. Same little servo, very simple programme.

[Visual of a computer screen in Microsoft micro:bit on the 'Blocks' screen. Three code blocks are shown which control the angle of the lid. 'on start', 'on button A pressed' and 'on button B pressed'.]

On start we're going to set the servo angle to 90°, that's closed, and then show me a little dot on button A, move it to 0, button B move it to 90°, that's closed. O for open, X for closed.

To get started with a very simple and low-cost microcontroller, you could consider the micro bit.

[Visual of the micro bit. A battery, back and front of the chip, connector leads, 3 arms and a servo.]

It's easy to connect to and you can see it already has switches built in as well as an LED array.

Here is a range of electronic devices that could be used in a smart greenhouse.

[Input/sensor]

On the left are sensors. Switch is a very simple input. Humidity and temperature sensors. These are soil moisture sensors. The one on the left is very accurate.

[Micro controller boards]

Micro:bit, Raspberry Pico, and an Arduino Uno.

[Output/effectors]

Effectors are outputs, for instance LED lighting, low power fan, this is a digital display, and of course the servo motor. Maybe even a water pump.

Imagine a simple greenhouse where I only need to sense the temperature and then turn on a fan or open a vent using a servo. This microcontroller has a temperature sensor built in in that position shown.

I'm drawing a simple greenhouse roof and I'm going to sketch some possible arrangements or set-up for your servos. Let's draw the lid of the vent in the open position so the air is going to escape. Here's the arm of the servo motor that rotates. It's in the up position, so it's moved around and it's pushed the vent up or open.

Let's sketch 3 ideas for hinging this vent holes with elastic bands, cloth tape, or glue a shaft along the edge and let it rotate inside some paper clips.

If we cut a hole in the roof and place our servo in there, the servo motor lines up with the axis of the shaft and we'll call that an axiel arrangement. This one would be more like a pull arrangement where we have a linkage that joins the vent to the servo. So we've got a push, pull and an axiel arrangement.

Great.

Here's an opening vent cut into the side of a bottle and it's covered when this collar rotates.

[Collar is wrapped around the outside of the bottle.]

Let's try to brainstorm 3 concepts of how we could rotate that vent into place and cover it. Well, first, I'm drawing a continuously rotating servo. It will move further than an ordinary servo can. I could use a rubber band to rotate that collar.

Two, we could drive a gear onto a rack that would allow the hot air to escape and draw in cool air from the bottom.

[Rack attached to the outside of the bottle with the gear rolling over hte top.]

Three, this concept relies on splits all the way around the bottle, and when the bottle's twisted, the splits will open up and allow lots of ventilation. But can you think of a way to use effectors to either twist the bottle or shorten the bottle so the vents open?

In this video, we've looked at adding electronics for movement, drawing and recording your ideas, brainstorming, and using mock-ups to prove the really important parts of your design.

Thanks for watching and enjoy developing your concepts.

[Light inspirational music plays. Copyright slide appears detailing Creative Commons 4.0 licence and exceptions.

Material in this resource not available under a Creative Commons licence:

  • the NSW Department of Education logo, other logos and trademark-protected material
  • Material owned by a third party that has been reproduced with permission. You will need to obtain permission from the third party to reuse its material.

Slide changes to NSW Government logo. © State of New South Wales (Department of Education) 2025]

[End of transcript]

Coding a microcontroller

Watch the teaching videos for instructions in connecting and using a microcontroller. Videos include coverage of two coding environments, Thonny and Microsoft Visual Studio Code.

Coding with Thonny

Instructions to connect and use a microcontroller in the Thonny coding environment.

Watch 'Connecting a microcontroller using Thonny' (2:01).

Walkthrough of the initial PC set up of a microcontroller in Thonny

[Light, inspirational music plays. STEM Education appears on screen followed by Smart greenhouse – Connecting a Microcontroller board. Music ceases.]

Speaker

Hi there, in this video we demonstrate connecting a microcontroller to the computer.

In this video we have a camera, file directory and Thonny window open.

[Camera window shows the speaker connecting the USB to to the computer.]

To start, we connect the USB to our computer. Now locate and hold down the BootSel button while connecting the micro USB. RPI should show up under 'Devices and drives'.

Now we set up the interpreter in Thonny. To do this, [in Thonny] select 'Tools', 'Options', 'Interpreter', 'Raspberry Pi Pico', and 'Automatic Discovery'. We notice that no new pane is visible in the bottom left, so we will manually install a version of MicroPython onto our Pico.

To do this, [in Thonny] select 'Tools', 'Options', 'Interpreter', 'Install or Update MicroPython', choose the version you want, and select 'Install'. MicroPython will install onto the Pico, and when that’s complete, we see a Pico pane pop up in Thonny in the bottom left.

[Window pane appears in Thonny labelled 'Raspberry Pi Pico'.]

Enjoy the Pico.

[End of transcript]

Watch 'Using a microcontroller with Thonny' (1:55).

Manipulate the LED in the microcontroller using Thonny

[Light, inspirational music plays. STEM Education appears on screen followed by Using a Microcontroller board – Blink LED. Music ceases.]

Speaker

Hi there, this video will run through the blink LED script for the Raspberry Pi Pico.

In Thonny, left click 'File' and select 'New'.

An untitled pane should appear. Left click 'File' and select 'Save as'. Select 'This Computer' in the pop-up. Name the file 'Blink.py', and save.

Type in or paste the blink code. Pause this video if needed.

[Blink code:

import machine

import utime

led_onboard = machine.Pin(25, machine.Pin.OUT)

while True:

led onboard. toggle()

utime.sleep(1)]

Save and select 'Run current script'.

[Run current script (F5).]

We see that the LED blinks on and off in one-second intervals.

[The LED of the USB Controller connected blinks.]

Now let's change the timing. We'll try 0.1 of a second, select Run, and see what happens.

[Adjusts code in Thonny from 'utime.sleep(1)' to 'utime.sleep(0.1), selects 'Run''

Change the timing back or try different timings to see what happens.

Here we change it back to one-second intervals.

[Changes the code back to 'utime.sleep(1)'.]

[Light inspirational music plays. Copyright slide appears detailing Creative Commons 4.0 licence and exceptions.

Material in this resource not available under a Creative Commons licence:

  • the NSW Department of Education logo, other logos and trademark-protected material
  • Material owned by a third party that has been reproduced with permission. You will need to obtain permission from the third party to reuse its material.

Slide changes to NSW Government logo. © State of New South Wales (Department of Education) 2025]

[End of transcript]

Watch 'Microcontroller and sensor using Thonny' (3:04).

Running and testing code for the microcontroller and sensor

[Light, inspirational music plays. STEM Education appears on screen followed by Smart greenhouse – Microcontroller and Atmospheric sensor. Music ceases.]

Speaker

Hi, in this video we demonstrate how to connect a sensor to a microcontroller and use a coding environment to program its use.

[Speaker demonstrates plugging in the Pico.]

First, we plug our Pico into the expansion board, making sure the micro USB port is at the top of the expansion board. Then we plug the cable into the four-pin port on the expansion board and connect the sensor.

We then plug in the micro USB. We see the green light switch on. Now we move to Thonny and press the 'Stop' button. We see the 'Raspberry Pi Pico' pane appear.

[Visual changes to a slide. Slide content:

Files

This video uses a particular sensor and expansion board.

You will need to download two python files from PiicoDev atmospheric sensor BME280 - raspberry pi pico guide, they are:

  • PiicoDev_Unified.py
  • PiicoDev_BME280.py

File address is in the reference at the end of the video.]

Different sensors will have different driver files or libraries.

The unified file in this example is a library that drives I squared C connections for this sensor. The BME 280 file is a specific driver for this specific atmospheric sensor.

[Visual returns to Thonny screen.]

In our folder, we have the temperature and humidity code that we created, the sensor driver, and the unified library. We upload the library and driver by right-clicking on the file [In the 'This computer' pane] and selecting 'Upload' to.

To run the temperature and humidity file we select the file [in the 'This computer' pane] and click 'Run'. The temperature and humidity data is shown in the 'Shell' window, and we notice a change when we place our finger over the sensor.

[Speaker places finger over sensor. The Shell pane depicts a rise in temperature on the live temperature graph.]

Press 'Stop' at the end of the test, and our sensor is working.

In the next step, we will use the code on the screen, which is a combination of a blink LED code with the sensor code.

[2 blocks of code appear.

Code block 1 title: 'LED_temp_hum_BME.py'

Code:

import machine

import utime

led_onboard = machine.Pin(25, machine. Pin. OUT)


while True:

led_onboard.value(1)

utime.sleep(1)

led_onboard. value (0)

utime.sleep(1)]

Code block 2 title: 'LED_temp_hum_BME.py *'

Code:

import machine

from PiicoDev BME280 import PiicoDev BME280

from PiicoDev_Unified import sleep_ms


led_onboard = machine.Pin(25, machine.Pin.OUT)

sensor = PiicoDev_BME280()

while True:

led _ onboard. value (1)

tempC, presPa, humRH = sensor.values()

print(str(tempC)+" °C " + str(humRH)+" %RH")


led_onboard. value (0)

sleep_ms (1000) #sleep for one second]

[Visual returns to Thonny screen.]

[In the 'This computer' pane] We have our LED on/off file combined with our temperature and humidity file. We can run our file to test it, and we notice that our LED blinks on and off in time with our data sensing.

[Speaker places finger on sensor to test the code.]

When we are done, we can stop the test. Now that will be a useful feature when we untether the Pico and power it with a battery pack.

[Light inspirational music plays. Copyright slide appears detailing Creative Commons 4.0 licence and exceptions.

Material in this resource not available under a Creative Commons licence:

  • the NSW Department of Education logo, other logos and trademark-protected material
  • Material owned by a third party that has been reproduced with permission. You will need to obtain permission from the third party to reuse its material.

Slide changes to NSW Government logo. © State of New South Wales (Department of Education) 2025]

[End of transcript]

Watch 'Microcontroller, servo and sensor usng Thonny' (6:52).

Programming a vent to operate based on conditions detected by the sensor

[Light, inspirational music plays. STEM Education appears on screen followed by Smart greenhouse – Programming a response to temperature changes. Music ceases.]

Speaker

Hi.

In this video we demonstrate connecting a servo to a microcontroller board and use a programming environment to program a response to temperature change.

We will call upon 3 library files in this video, one for the servo and two for the sensor. These files need to be uploaded to the Raspberry Pi Pico.

[Slide appears, titled 'Required files'.

Slide content:

This video uses a Micropython servo library from Micropython-servo 1.0.1 and two library files from PiicoDev atmospheric sensor BME280 – raspberry pi pico guide, they are:

  • PiicoDev_Unified.py
  • PiicoDev-BME280.py

File addresses are referenced at the end of the video.]

[Visual changes to the speaker assembling the necessary pieces or equipment.]

We will start by connecting our Raspberry Pi Pico and expansion board to our servo. We connect the VBUS to the red signal socket, the ground to the brown socket, and in this case, pin 16 to the signal socket of the servo.

Connect our USB, select 'Stop' in Thonny.

Our Pico pane [titled 'Raspberry Pi Pico'] opens down here in the lower left.

We have our servo code ready to go right here.

[Tab open in Thonny is titled 'Servo1.py'

Code:

'import time

from Servomod import Servo

servo1 = Servo(pin_id=16) # Create our Servo object, assigning the GPIO pin

for position in range(0, 180): # Step the position forward from 0 deg to 180 deg

servo1.write(position) # Set the Servo to the current position

time.sleep_ms(10) # Wait for the servo to make the movement

# Requires the micropython-servo library – https://pypi.org/project/micropython.servo/

# Attribution https://core-electronics.com.au/guides/getting-started-with-servos-examples-with-rasp [link is cut off in visual].

# 24 April 2023]

When we're ready, we press run, and we see the servo move from 0 to 180°.

Now we will demonstrate combining a microservo, sensor, and microcontroller to automate the microservo movement.

[Slide appears titled 'Combining a sensor and microservo' an image of the assesmbled components and a code block titled 'LED_temp_hum_servo1.py'. This code is examined later in the video.]

[Visual returns to the equipment assembly and Thonny screen.]

Use the four-wire cable to connect the sensor to the expansion board. Plug in the USB and move over to Thonny. Select 'Stop' to connect the Pico. Select your combined file and click 'Run'.

The temperature and humidity data is showing down here in the Shell ['Shell' pane in Thonny], and when we place our finger on the sensor, we can see the temperature rise above 25 and the servo move to 130°. Then the servo moves back to 0 when the temperature is below 25°.

Now let's have a close look at this code.

We begin by importing the machine library.

[Line 1: import machine]

Then we import some classes and a sleep function from different libraries.

[Line 2–4:

from Servomod import Servo

from PiicoDev BME280 import PiicoDev BME280

from PiicoDev_Unified import sleep_ms # cross-platform compatible sleep function]

[Line 5 blank]

Line 6 creates a variable named LED onboard. It uses the machine pin function to specify that this variable refers to pin 25 on the Pico.

We also tell the library that this pin is configured as an output, meaning we can control the voltage on that pin to turn an LED light on or off.

[Line 6: led_onboard = machine.Pin(25, machine.Pin.OUT)]

Line 7 creates a variable named sensor.

It calls the Picodev BME 280 class to create an object that represents the sensor connected to the Pico. This line essentially initializes the sensor and prepares it to take measurements.

[Line 7: sensor = PiicoDev BME280() # initialise the sensor.]

In line 8, we create a variable named 'servo1'. It calls the servo class imported earlier to create an object that represents a servo motor that is connected to pin number 16 on the Pico in this case.

[Line 8: servo1 = Servo(pin_id=16)]

Line 9 creates a variable named 'vent open' and assigns it the value 'False'. This variable acts like a flag to keep track of whether the vent controlled by the servo motor is currently open (True) or closed (False).

[Line 9: vent_open = False]

[Line 10 blank.]

The code has a 'while True' loop that keeps repeating forever or until we stop the program. Inside this loop, the following things happen. The LED light turns on. This is a visual indicator that the system is working.

[Line 11 and 12:

while True:

led_onboard. value (1)]

The sensor takes a measurement and gives us 3 pieces of information: Temperature in degrees Celsius, air pressure (which we don’t use in this code), and humidity as a percentage.

[Line 13 blank.]

[Line 14: tempC, presPa, humRH = sensor. values() # read all data from the sensor]

The code only prints the temperature and humidity to the screen.

[Line 15: print(str(tempC)+" °C " + str(humRH)+" %RH") #print only temperature and humidity]

[Line 16 blank]

The code checks two things:

Is the temperature higher than 25°C and is the vent currently closed as in, not vent_open?

If both conditions are true, it means it's hot, and the vent is closed. So, the code does two things: it tells the servo motor to move to a specific position, 130° in this case, opening a vent we will eventually create. It sets the vent_open flag to 'True', remembering that the vent is now open.

[Line 17–19:

if tempC > 25 and not vent_open:

servo1.write(130)

vent_open = True]

The next part of the code checks two things:

Is the temperature 25°C or lower? And is the vent currently open?''vent_open'. If both conditions are true, it means it's cooler and the vent is open. So the code does two things: it tells the servo motor to move to a specific position, '0' in this case, which closes the vent we will eventually create, and it sets the vent open flag to 'False', remembering that the vent is now closed.

[Line 20–22:

elif tempC <= 25 and vent_open:

servol.write(0)

vent_open = False]

[Line 23 blank.]

Then the LED light turns off.

[Line 24–25:

led_onboard. value (0)

sleep_ms(1000) #sleep for one second]

The code waits for one second before starting the loop again.

[Light inspirational music plays. 'References' slide appears: Core Electronics (6 April 2022) PiicoDev atmospheric sensor BME280 - raspberry pi pico guide, Core Electronics website accessed 21 June 2024, https://core-electronics.com.au/guides/piicodev-atmospheric-sensor-bme280-quickstart-guide-for-rpi-pico/

Python Software Foundation (2024) Micropython-servo 1.0.1, accessed 21 June 2024, https://pypi.org/project/micropython-servo/#files

Thonny (2024) Screenshot of Thonny, created June 24]

[Copyright slide appears detailing Creative Commons 4.0 licence and exceptions.

Material in this resource not available under a Creative Commons licence:

the NSW Department of Education logo, other logos and trademark-protected material

  • Material owned by a third party that has been reproduced with permission. You will need to obtain permission from the third party to reuse its material.
  • Slide changes to NSW Government logo. © State of New South Wales (Department of Education) 2025]

[End of transcript]

Coding with Microsoft Visual Studio

Instructions to connect and use a microcontroller in the Microsoft Visual Studio coding environment.

Watch 'Connecting a microcontroller using Microsoft Visual Studio' (1:34).

Walkthrough of the initial PC set up of a microcontroller in Microsoft Visual Studio

[Light, inspirational music plays. STEM Education appears on screen followed by Smart greenhouse – Connecting a Microcontroller board. Music ceases.]

Speaker

Hi there, in this video we demonstrate connecting a microcontroller to the computer.

In this video, we have a camera, the PC file directory, a folder with MicroPython file, and the VS (Visual Studio) Code windows open.

[Camera window shows speaker demonstrating assembly.]

To start we connect the USB to our computer and connect the micro USB to the Pico.

'RPI' should show up under 'Devices and drives' [in the PC file directory].

Drag and drop the MicroPython file onto the RPI drive. When complete, that drive will disappear.

Move to VS Code and hold 'CTRL + Shift + P' and select 'Micro Pico', 'Connect to Pico'. We see the Pico is connected.

To see what is on the Pico, click on the toggle Pico Workspace, and you will see a Pico workspace pane appear.

[WIthin pane 'Untitled (Workspace)' a directory exists names 'Pico (W) Remote Workspace']

It is empty at the moment because we have not put any files on the Pico yet.

Thank you.

[Light inspirational music plays. Copyright slide appears detailing Creative Commons 4.0 licence and exceptions.

Material in this resource not available under a Creative Commons licence:

  • the NSW Department of Education logo, other logos and trademark-protected material
  • Material owned by a third party that has been reproduced with permission. You will need to obtain permission from the third party to reuse its material.

Slide changes to NSW Government logo. © State of New South Wales (Department of Education) 2025]

[End of transcript]

Watch 'Using a microcontroller with Microsoft Visual Studio (VS)' (1:32).

Manipulate the programming of the LED on the microcontroller using VS Code

[Light, inspirational music plays. STEM Education appears on screen followed by Smart greenhouse – Using a Microcontroller board – Blink LED. Music ceases.]

Speaker

Hi there, this video will run through the blink LED script for the Raspberry Pi Pico.

In VS Code, left click 'File' and select 'New', and an untitled pane appears. Left click 'File' and select 'Save as'. Name the file 'blink.py', type in or paste the blink code. Pause this video if needed.

[import machine

import utime

led_onboard = machine.Pin(25, machine.Pin.OUT)

while True:

led_onboard. toggle()

utime. sleep(1)]

Select 'Run current script'.

['Run']

We see that the LED blinks on and off in one-second intervals.

Change the timing to '0.1' of a second.

[Changes 'utime. sleep(1)' to 'utime. sleep(0.1)']

Select 'Run', and see what happens.

You can then change the timing back or try different timings to see what happens and save the file when you are finished.

[Light inspirational music plays. Copyright slide appears detailing Creative Commons 4.0 licence and exceptions.

Material in this resource not available under a Creative Commons licence:

  • the NSW Department of Education logo, other logos and trademark-protected material
  • Material owned by a third party that has been reproduced with permission. You will need to obtain permission from the third party to reuse its material.

Slide changes to NSW Government logo. © State of New South Wales (Department of Education) 2025]

[End of transcript]

Watch 'Microcontroller and sensor using Microsoft Visual Studio' (3:36).

Connecting a sensor to a microcontroller with Microsoft VS

[Light, inspirational music plays. STEM Education appears on screen followed by Smart greenhouse – Microcontroller and Atmospheric sensor. Music ceases.]

Speaker

Hi.

In this video we demonstrate how to connect a sensor to a microcontroller and use a coding environment to program its use.

[Speaker demonstrates assembling the equipment.]

First we plug our Pico into the expansion board making sure the micro USB port is at the top of the expansion board. Then we plug the cable into the four-pin port on the expansion board and the cable into the sensor. We then plug in the micro USB.

Now we move over to VS Code and press 'CTRL', 'Shift', and 'P' at the same time. We will scroll and select our extension 'Micro Pico', 'Connect Pico'. Then we see Pico connected down in the bottom left hand corner of the VS Code window.

[Slide appears titled 'Files'. Slide content:

This video uses a particular sensor and expansion board.

You will need to download two python files from PiicoDev atmospheric sensor BME280 – raspberry pi pico guide, they are:

  • PiicoDev_Unified.py
  • PiicoDev_BME280.py

File address is in the reference at the end of the video.]

Different sensors will have different driver files or libraries. The unified file in this example is a library that drives I squared C connections for this sensor. The BME 280 file is a specific driver for this specific atmospheric sensor.

[Visual returns to VS Code screen.]

In the VS Code project folder, we want to have the 'BME 280 sensor driver', the 'Unified Library', and the temperature and humidity code that we created.

Now we need to send the driver and library files to the actual Pico device. So we press 'CTRL', 'Shift', 'P' at the same time and select 'Micro Pico', 'Upload project to the Pico'.

To run the temperature and humidity file, we can hold 'CTRL', 'Shift', 'P' and select 'Run current file'.

The temperature and humidity data is shown in the terminal window and you notice a change when we place our hand over the sensor. When your test is finished, you press stop and It'll stop.

In the next step we will use the code on the screen which is a combination of a blink LED code with the sensor code.

[Tab title: LED_temp_hum_BME.py.

Code:

import machine

from PiicoDev BME280 import PiicoDev BME280

from PiicoDev_Unified import sleep_ms # cross-platform compatible sleep function

led onboard = machine.Pin(25, machine.Pin.OUT)

sensor = PiicoDev BME280() # initialise the sensor

while True:

led_onboard.value(l)

tempC, presPa, humRH = sensor. values() # read all data from the sensor

print(str(tempC)+" °C " + str(humRH)+" %RH") #print only temperature and humidity

led_onboard. value (0)

sleep_ms(1000) #sleep for one second

# base code from https://core-e1ectronics.com.au/guides/raspberry-pi-pico/piicodev-atmospheric-sensor-bme2

# author Michael Ruppe (6 April 2022)]

Now we have our LED file combined with our temperature and humidity file. We can run our file to test it and we notice that our LED blinks on and off in time with our data sensing. Now that will be a useful feature when we untether the Pico and power it with a battery pack.

When we're done, we can stop the test.

[Light inspirational music plays. References slide appears:

Core Electronics (6 April 2022) PiicoDev atmospheric sensor BME280 - raspberry pi pico guide, Core Electronics website accessed 21 June 2024, https://core-electronics.com.au/guides/piicodev-atmospheric-sensor-bme280-quickstart-guide-for-rpi-pico/

Microsoft (2024) Screenshot of Microsoft Visual Studio Code, created June 2024]

[Copyright slide appears detailing Creative Commons 4.0 licence and exceptions.

Material in this resource not available under a Creative Commons licence:

  • the NSW Department of Education logo, other logos and trademark-protected material
  • Material owned by a third party that has been reproduced with permission. You will need to obtain permission from the third party to reuse its material.

Slide changes to NSW Government logo. © State of New South Wales (Department of Education) 2025]

[End of transcript]

Watch 'Microcontroller, servo and sensor using Microsoft Visual Studio' (6:55).

Programming a vent to operate based on conditions detected by the sensor

[Light, inspirational music plays. STEM Education appears on screen followed by Smart greenhouse – Programming a response to temperature changes. Music ceases.]

Speaker

Hi.

In this video we demonstrate connecting a servo to a microcontroller board and use a programming environment to program a response to temperature change.

[A slide appears titled 'Required files'. Slide content:

This video uses a Micropython servo library from Micropython-servo 1.0.1 and two library files from PiicoDev atmospheric sensor BME280 – raspberry pi pico guide, they are:

  • PiicoDev_Unified.py
  • PiicoDev_BME280.py

File addresses are referenced at the end of the video.]

We will call upon 3 library files in this video, one for the servo and two for the sensor. These files need to be uploaded to the Raspberry Pi pico.

[Visual changes to show the speaker assembing the equipment and the Microsoft Visual Studio Code screen open.]

We have a Raspberry Pi Pico plugged into an expansion board and our microservo.

We start by connecting the red wire from the servo to the Vbus of the expansion board, then connect the orange signal wire to pin 16 of the expansion board in this case, and then the brown ground to a ground on the expansion board. We check that that's plugged in correctly and plug in the USB.

We move over to VS Code, hold 'CTRL', 'Shift', 'P', select 'Micro Pico connect' to connect to the Pico. We open our Servo1 file that we created earlier, find 'Run' down the bottom and select 'Run' [servo arm spins.] and our servo moves from 0° to 180°.

Now we will demonstrate combining a microservo sensor and microcontroller to automate the microservo movement. We begin by adding our sensor and connecting the Pico to the USB. We have our code over in VS Code. The Pico is connected and we click 'Run'.

As we can see when it's running we have temperature and humidity being collected and if we place our finger on the sensor the temperature goes above 25° triggering the servo to move and when we remove our finger the temperature decreases.

[Temperature recordings are logged and visible in the 'Terminal' pane in VS code.]

Now let's have a close look at this code. We begin by importing the machine library.

[Line 1: import machine]

Then we import some classes and a sleep function from different libraries.

[Line 2–4:

from Servomod import Servo

from PiicoDev BME280 import PiicoDev BME280

from PiicoDev_Unified import sleep_ms # cross-platform compatible sleep function]

[Line 5 is blank]

Line 6 creates a variable named LED onboard.

It uses the machine pin function to specify that this variable refers to a pin 25 on the Pico. We also tell the library that this pin is configured as an output, meaning we can control the voltage on that pin to turn an LED light on or off.

[Line 6: led_onboard = machine.Pin(25, machine.Pin .OUT)

Line 7 creates a variable named 'sensor'.

[Line 7: sensor = PiicoDev BME280() # initialise the sensor]

It calls the Picodev BME 280 class to create an object that represents the sensor connected to the Pico. This line essentially initialises the sensor and prepares it to take measurements.

In line 8, we create a variable named Servo 1. It calls the servo class imported earlier to create an object that represents a servo motor that is connected to pin number 16 on the Pico in this case.

[Line 8: servo1 = Servo(pin_id=16)]

Line 9 creates a variable named vent open and assigns it the value 'False'.

[Line 9: vent_open=FALSE]

This variable acts like a flag to keep track of whether the vent controlled by the servo motor is currently open (true) or closed (false).

The code has a while true loop that keeps repeating forever or until we stop the program.

[Line 10 is blank. Line 11: while True]

Inside this loop the following things happen. The LED light turns on. This is a visual indicator that the system is working.

[Line 12:

led_onboard.value(1)]

The sensor takes a measurement and gives us three pieces of information.

Temperature in degrees Celsius, air pressure which we don't use in this code, and humidity as a percentage.

[Line 14: tempC, presPa, humRH = sensor. values() # read all data from the sensor]

The code only prints the temperature and humidity to the screen.

[Line 15: print(str(tempC)+" °C " + str(humRH)+" %RH") #print only temperature and humidity]

The code checks 2 things.

Is the temperature higher than 25°C and is the vent currently closed, as in not vent open. If both conditions are true, it means it's hot and the vent is closed. So the code does two things. It tells the servo motor to move to a specific position, 130° in this case opening event we will eventually create. It sets the vent_open flag to true, remembering that the vent is now open.

[Line 17–19:

if tempC > 25 and not vent_open:

servol. write (130)

vent open = True]

The next part of the code checks 2 things.

Is the temperature 25°C or lower? And is the vent currently open? 'Vent open' If both conditions are true, it means it's cooler and the vent is open. So the code does two things. It tells the server motor to move to a specific position, '0' in this case, which closes the vent we will eventually create and it sets the vent_open flag to false, remembering that the vent is now closed.

[Line 20–22:

elif tempC <= 25 and vent_open:

servo1. write (0)

vent_open = False]

Then the LED light turns off. The code waits for one second before starting the loop again.

[Line 23 is blank. Line 24–25:

led_onboard. value (0)

sleep_ms(1000) #sleep for one second]

[Light inspirational music plays. References slide appears:

Core Electronics (6 April 2022) PiicoDev atmospheric sensor BME280 - raspberry pi pico guide, Core Electronics website, accessed 21 June 2024, https://core-electronics.com.au/guides/piicodev-atmospheric-sensor-bme280-quickstart-guide-for-rpi-pico/

Python Software Foundation (2024) Micropython-servo 1.0.1, accessed 21 June 2024, https://pypi.org/project/micropython-servo/#files

Microsoft (2024) Screenshot of Microsoft Visual Studio Code, created June 2024]

[Copyright slide appears detailing Creative Commons 4.0 licence and exceptions.

Material in this resource not available under a Creative Commons licence:

  • the NSW Department of Education logo, other logos and trademark-protected material
  • Material owned by a third party that has been reproduced with permission. You will need to obtain permission from the third party to reuse its material.

Slide changes to NSW Government logo. © State of New South Wales (Department of Education) 2025]

[End of transcript]

Predesigned greenhouse

The following PDF files are provided as a potential model for a smart greenhouse and are based on the following prototyping video.

Prototype and evaluate

Watch this teaching video for ideas about prototyping and evaluating a smart greenhouse.

Watch 'Rapid prototype' (2:03).

Fast-prototyping vent ideas

[Light, inspirational music plays. STEM Education appears on screen followed by Smart greenhouse. Music ceases.]

Speaker

In this video we will be fast-prototyping some vent ideas using a 4 litre plastic bottle and a pre-made greenhouse. In this rapid prototype we are testing a linkage to open and close the vent.

[Visual depicts a camera viewing the 4 litre bottle greenhouse, and the Microsoft Visual Studio screen.]

A piece of wire is threaded through the servo arm and this pulls the vent open and pushes it closed as the servo rotates to 90° and back to 0°.

In this test we are using some cloth tape to attach the servo arm to our plastic vent and use the rotation to open and close the vent.

Placing the servo inside the container is possible, but it was difficult to place. It was a challenge to close the vent and the moisture and humidity inside the greenhouse may affect the servo.

Initially we were using the bottle as a test structure for different servo orientations but during prototyping we realised that it could make a good greenhouse standing on its side like this and in hindsight we could have made the vent bigger to allow for better access to plants that are growing inside.

[Camera now shows a plastic, pre-made greenhouse with a small vent on the side.]

Taking what we have learnt from our previous tests, we decided to cut a hole in the side of our pre-made greenhouse and attach a survey to our vent using some bolts and metal pieces from an old toy kit.

The main idea of fast prototyping is to trial your designs to see what works and what doesn't, before investing more time and resources into a more intricate prototype.

[Light music plays. Copyright slide appears detailing Creative Commons 4.0 licence and exceptions.

Material in this resource not available under a Creative Commons licence:

  • the NSW Department of Education logo, other logos and trademark-protected material
  • Material owned by a third party that has been reproduced with permission. You will need to obtain permission from the third party to reuse its material.

Slide changes to NSW Government logo. © State of New South Wales (Department of Education) 2025]

[End of transcript]

Watch 'Prototype and evaluate' (6:14).

Prototype assembly and evaluation

[Light, inspirational music plays. STEM Education appears on screen followed by Smart greenhouse. Music ceases.]

Glenn

Hey everyone, welcome back.

In this video, we'll be making a slightly larger benchtop greenhouse for growing microgreens. Coming up, you'll see a prototype of the electronic control, how the greenhouse is assembled and tested.

[A plastic greenhouse is assembled on screen with vents and doors opening and closing.]

[Light, contemplative music plays.]

I'm now thinking of what will help the user of this greenhouse, in this case teachers and groups of students. They'll need to fit a large seedling tray, disassemble and flat pack after it's been used, and some really simple and easy electronics.

This is a common seed tray, a growing tray, so I want the greenhouse to fit around this. I've also found a water storage tray to go underneath. Here I'm using a thin cardboard to check my overall sizes and to think about the shape of the vents. I'm using a much thicker board now to test or mock up the vents to test how it feels to open and close them.

Mock ups were made of the roof panels joining together.

Here I'm testing various elastic band hinges on the door.

Once I had the designs set, I made vector drawings that I could use to laser cut the panels. Shown here is a side panel. This cut-out detail is how the elastic band attaches.

[Visual shows the vector drawing, cut-out detail is a small, c-shaped hole. There is one at each corner of the vector panel and 2 additional cut-outs set in from the top edge.]

This front panel has a cut-out for the doorway and for the elastic bands to hold the servo and the door hinges.

[Visual depicts the front panel vector drawing. Doorway is cut at the bottom edge, through the centre. The servo is on the left, and the 2 cutouts for the hinges are m-shaped; one is above and one is beneath the servo.]

Other drawings were for the door and vent, the roof, and the Gable. The Gable has little details that assemble into those slots in the roof.

[Roof 2 drawing has 4 small rectangle cut-outs, 2 on each side]

Here's how the pieces all fitted together.

[Speaker assembles greenhouse. Pieces are cut from clear plastic.]

I'm using some spacer blocks inside the water holding tray, the growing tray, and here is the back panel. I'm using elastic bands at each of those joins.

[There is a growing tray with soil inside it. The speaker tucks elastic bands into the c-shaped holes in the back panel piece of plastic.]

I made a mistake in the drawing. I left out right there the detail, and so I had to use some pegs to hold those together.

At the far end. I'm testing a triangle kind of method.

Here's the front panel going on.

I'm happy with the corner joins, they actually worked really well. This rubber band tube over the temperature sensor on the board ensures that it's sensing the air on the inside, not the outside.

[The tube placed on the sensor is flush against the hole in the plastic.]

Here I'm using leads with crocodile clips to connect the microcontroller board around to the servos. This idea was a really fast fail using spades on bolts to connect that were much too wide and it was just very unreliable.

[Visual shows a microcontroller board over-crowded with leads. Fail noise plays.]

I'm avoiding using glue on this project, so I'm using a screw and a piece of rubber as an extension for the servo arm to be able to pull on. Here I'm attaching the vent at the back with elastic bands. Rubber bands make a very rugged hinge for the door.

This design aims for complete disassembly and flat packing so that teachers can store it away for next year. In building this prototype, I found a lot of things that I could improve. This crack at the edge of the roof panel, for instance, tells me that I probably need to draw it again with the slot further back as shown.

Now I'm attaching the Gable to the roof panels. They went on fairly well, however next time I probably would use two rubber bands for each panel rather than the one that is shown.

The hole in the wall for the temperature sensor worked well, however next time I would shade the board from direct sunlight. A little soldering was needed for reliability.

[Visual shows 3 yellow wires fused together in the middle.]

Both the positive and the ground wires needed to split to connect to both of the servos.

The rest is easy. Run a signal wire from port zero and port one to each servo. This allows each servo to be turned on one after the other, which puts less drain for power onto the board. On the left is a simulation of the code that you can see on the right of your screen.

[Right of the screen shows code blocks in Microsoft micro:bit]

On start, the servo connected to port 0 moves to 10°. The other servo moves to 170°. On this simulator, I can now slide the temperature upwards. Once equal or above 30°, you'll see both servos move, but one following the other. There now the vents are open and below 30° they'll return to their original position.

If you're new to coding, these block code editors are a great place to jump in. Simply slide the blocks over and assemble the code. Finally, let's bring it all together.

The board reads 29° with a little extra heat will bring it to 30 and both vents open. Great. The board reads 32° with a little chill. We'll drop that below 30 and the vents close.

Excellent.

We're now looking at a fully functional prototype. There has been a few setbacks along the way, but I've thoroughly enjoyed building this greenhouse and I hope you do too.

You may not use laser cut panels, even a plastic tub would serve as an excellent start for a greenhouse. Thanks so much for watching.

I'm Glenn. I'll see your designs soon.

[Light music plays. Copyright slide appears detailing Creative Commons 4.0 licence and exceptions.

Material in this resource not available under a Creative Commons licence:

  • the NSW Department of Education logo, other logos and trademark-protected material
  • Material owned by a third party that has been reproduced with permission. You will need to obtain permission from the third party to reuse its material.

Slide changes to NSW Government logo. © State of New South Wales (Department of Education) 2025]

[End of transcript]

Data logging with the smart greenhouse

The use of a microcontroller provides an opportunity to collect environmental data. Watch these teaching videos for data logging instructions.

Watch 'Data logging' (7:30).

Using a microcontroller board and an atmospheric sensor as a data logger

[Light, inspirational music plays. Screen reads STEM Education followed by Smart greenhouse – data logging]

Speaker

Hi there.

In this video we will look at how to use a microcontroller board and a atmospheric sensor as a data logger. We will call upon 3 library files in this video, one for the servo and two for the sensor. These files need to be uploaded to the Raspberry Pi Pico.

[Slide appears titled 'Required files'. Slide content:

This video uses a Micropython servo library from Micropython-servo 1.0.1 and two library files from PiicoDev atmospheric sensor BME280 – raspberry pi pico guide, they are:

  • PiicoDev_Unified.py
  • PiicoDev_BME280.py

File addresses are referenced at the end of the video.]

Here we have a Raspberry Pi Pico connected to an atmospheric sensor, and previously we may have used a script like this to gather temperature and relative humidity data down here in the shell pane.

[Code pictured in Thonny from previous video to log temperature and relative humidity.]

This is where the data is printing. Now what if we wanted to collect that data in a data file? We can do that by adding some lines to our script.

We see some lines that we have added here,

[Line 6: seconds = 0 #creates a variable called seconds with a starting value of 0]

here,

[Line 9–10:

file = open('bme280-data.txt', "a") #opens a file named "bme280-data.txt" in append mode ("a") - new data will be added to t'[visual cut off]

file.write(str("seconds,temp °C, %RH \n")#writes a header line to the txt file: "seconds,temp°C, %RH"]

and here.

[Line 17–19:

file.write(str(seconds) + "," + str(tempC) + "," + str(humRH) + " \n") #writes seconds, tempC, and humidity to "bme280- [visual cut off].

file.flush()

seconds += 10 = increases the seconds variable by 10, keeping track of measurements by second]

Now what do those lines do?

If we run that script, we see our measurements being printed in the shell pane below, getting our seconds, our temperature, and our relative humidity. The seconds are increasing by 10 each time we go through the loop.

When we select 'Stop', we have our data file here on our pico.

['bme280data.txt' data file appears under Raspberry Pi Pico pane.]

When we open that data file, we see seconds temperature, relative humidity and our data is collected.

[Slide appears titled 'Unplugged'.]

Now what if we want to use our data logger, our Pico and atmospheric sensor when it is disconnected from the computer? Well, we can do that because you may notice that our script is saved onto the Pico as 'main.py'. Which means that if we disconnect it and power the pico on with the power pack like we have here, that script will run and record our data.

['main.py' is visible in the 'Raspberry Pi Pico' pane.]

And it's also important we have any libraries, drivers, files that the script may call upon saved onto the Pico.

So now if we disconnect the pico, plug it into the power source, and turn the power source on, we notice that our LED on board the Pico blinked. Our atmospheric sensor has its LED on and the blink on the LED is happening every 10 seconds, which is what our script is saying.

Let's power that down, connect this to the computer. We hit 'Stop' and we have our data file here [Raspberry Pi Pico' pane] and when we look at the data file, we have captured the data here from when the Pico is connected to the power pack. And also you may notice a new set of data appearing here [in the tab for bme280-data.txt].

That's because when we reconnected the Pico to the computer, it powered on and the main script ran and so hitting 'Stop', stopped that script from running.

[Slide appears titled 'Combining scripts.]

Here we see in this script we have included our data file lines here, here and down here.

[Refers to new code added earlier in video.]

And so if we run our sensor servo data file script and remembering that we've also changed it to 10 seconds, we notice that we have our data being printed to the Shell pane here. And when we select 'Stop', we also have a data file being created on the Pico.

You may have noticed something else that's a little different about this script that we have here.

If we run this script, what do you notice about the onboard LED? Is it blinking every 10 seconds? Oh, it is not. So what have we done instead?

I have changed it so that the onboard LED is on if the temperature is greater than 25° and now that's more of a functional choice because I want to know that the vent is opening if the temperature is greater than 25°.

[Light music plays. References slide appears:

Core Electronics (6 April 2022) PiicoDev atmospheric sensor BME280 – raspberry pi pico guide, Core Electronics website, accessed 21 June 2024, https://core-electronics.com.au/guides/piicodev-atmospheric-sensor-bme280-quickstart-guide-for-rpi-pico/

Python Software Foundation (2024) Micropython-servo 1.0.1, accessed 21 June 2024, https://pypi.org/project/micropython-servo/#files

Thonny (2024) Screenshot of Thonny, created June 2024]

[Copyright slide appears detailing Creative Commons 4.0 licence and exceptions.

Material in this resource not available under a Creative Commons licence:

  • the NSW Department of Education logo, other logos and trademark-protected material
  • Material owned by a third party that has been reproduced with permission. You will need to obtain permission from the third party to reuse its material.

Slide changes to NSW Government logo. © State of New South Wales (Department of Education) 2025]

[End of transcript]

Watch 'Data analysis' (10:56).

Export and compare data sets and create a chart in Microsoft Excel

[Light, inspirational music plays. Screen reads STEM Education followed by Smart greenhouse – Data analysis]

Speaker

Hi there, in this video we will be gathering data that we have saved on microcontrollers and comparing that data in Microsoft Excel. The data in this case is saved on microcontrollers that are linked to temperature and humidity sensors. One microcontroller has a sensor outside or external to the greenhouse, and the other is connected to a sensor internal to the greenhouse or inside the greenhouse.

The microcontrollers, in this case, were collecting data for approximately 48 hours.

The first thing we want to do is power down the microcontrollers we were using. Then we want to connect the microcontroller to our computer using our USB cable.

[Visual depicts 'Thonny' open on screen.]

Now that your Pico is plugged into the computer, select 'Stop'. You'll see the window for the Pico open [Raspberry Pi Pico pane]. Now I want to save my text data txt file in 'Agritech data'.

Right click on the file, select 'Download to'.

[A dialogue box appears.]

Now you'll see it appear here, and I want to rename the file for the external data.

[Right clicks on data file and selects 'Rename'. Adds 'external' to the end of the file name.]

Okay.

If we are also getting the data from the greenhouse test, we select 'Stop' once we have plugged the greenhouse microcontroller into the computer. Again, we right click—actually open the folder that you want to save the data in first.

[Navigates to the file to save the data underneath 'This computer'.]

It's open.

[Returns to the Raspberry Pi Pico folder structure.]

Right click on the file, select 'Download to', and in this case I want to rename the file 'data internal' and I'll have two sets of data that I can compare.

In Microsoft Excel I have uploaded one data set already from the data I have just saved from the microcontroller [table shows internal dataset]. And how did I do that?

[In Microsoft Excel.]

Well, we open a new sheet select 'Data', 'Get data from file', 'Text file' and I am selecting this external data set.

[Navigates to saved external data set file, saved earlier in video.]

Thinks for a little while. You'll see three drop-downs.

You would like to match those as they are there.

[Drop down menu labels and selections: 'File Origin' – '65001: Unicode (UTF-8)', 'Delimiter' – 'Comma', 'Data Type Detection' – 'Based on first 200 rows']

Load the data, we'll get some errors.

Let's clean the data at the bottom. When we plug in the Pico, it powers on and gets a new set of data that we stop when we hit 'Stop'.

[Deletes an empty row, and a single row of unuseful data.]

Now I've got two data sets.

Now that we have our two data sets in Microsoft Excel, let's combine them. So we have a new sheet there.

[Sheet 3]

Let's select the columns in the external data set.

[Selects and copies 3 columns from the external data set.]

Now we want to place them in here as values for now.

[Pastes as values only into Sheet3.]

So we select the values and we see that data in here. Now let's select the columns in the internal data set. Let's place them here.

Again, we want to paste as values.

And let's make sure we keep track of this as the external temperature, external relative humidity, internal to the greenhouse temperature, and internal relative humidity.

[Renames each column header to keep track of the data it relates to.]

Now we notice that we can probably hide or delete this. So right-click, delete.

[Deletes second minutes column.]

We see these two data sets in here. Rename the sheet. Let's name it 'Combined Data Set'. Now we have our combined data, let's add a column here called 'Hours' just so it can help us a little bit when we are looking at our graphs later on.

[Adds a column at Column B.]

Now I am going to put a function in here equals, A2 divided by 60 [places formula in cell B2. '=A2/60'].

Let's see what that does. For the first 6, I select the bottom corner [cell B2] and drag it down and that will copy the function and I can see here 60 minutes divided by 60 gives me one hour. That's working.

Now let's drag that to the bottom and there we have hours. And maybe we format these cells so maybe we have one decimal point. So I right-click on the cells there, I've selected them [B2 to end of data set, right-clik, and 'Format cells'.].

Let's bring this over. Number. [Selects number from 'Category:']

One decimal for now [in 'Decimal places'.]

We say 'Ok'.

Now we have an hours column. I am very keen to see what my temperature data will be telling me. So let's us I'm holding CTRL and selecting the columns that I would want to show in my graph and I'm going to use a scatter with a smooth line.

[Selects 'Hours', internal, and external temperature. 'Insert', 'Chart'.]

And I see here some interesting information. Something I find interesting is just how hot it is getting inside the greenhouse. So that's one thing to note. And the other thing I'm really keen on is the external temperature is showing warmer overnight here than the greenhouse. So that's something I'm going to want to think about a little bit.

I started the experiment or the test here at 10 am gives me about 22 hours and that's about 8 am here. So we can see as soon as the sun is hitting the greenhouse, we're getting temperature increasing. Some things we can do is change the title, add axis labels, etc.

And we can do that quite simply, we want to add maybe some titles and headings. So let's select our graph, chart [design], [add chart] elements, or we want our axis titles. Chart, Title bulk chart.

What are we going to call that? Something like 'Greenhouse internal temperature compared to external temperature'.

Let's grab a heading here. Paste that in 'Temperature degrees celsius' and time that was there we go. We can also tweak our axis a little bit, our axis. Let's, let's change this to 50 and see what that does.

[Selects chart, 'Format Axis' appears. Changes 'Bounds' under 'Axis options' to 'Maximum' = 50.]

There we go.

And let's change this one [the hours axis] and we'll make our minimum [bounds] '10', maybe 10, and we see some changes that occur there. Think critically about the axes and chart heading. Can you make improvements to the heading or is it appropriate to change the axis range?

[Copyright slide appears detailing Creative Commons 4.0 licence and exceptions.

Material in this resource not available under a Creative Commons licence:

  • the NSW Department of Education logo, other logos and trademark-protected material
  • Material owned by a third party that has been reproduced with permission. You will need to obtain permission from the third party to reuse its material.

Slide changes to NSW Government logo. © State of New South Wales (Department of Education) 2025]

[End of transcript]

Category:

  • iSTEM

Business Unit:

  • Curriculum
Return to top of page Back to top