Learning Outcome

In this chapter, we learn to


Introduction:  Light Sensor, Humidity and Temperature Sensor, and Data Logging.

Activities: Build a climate control greenhouse while integrating temperature and humidity sensor, light sensor, DC and servo motor, NeoPixel and OLED.

Bonus: Program an IoT enabled greenhouse with data logging capability.

Introduction to Light Sensor

By now you have probably noticed the APDS9960 sensor on the EDU PICO offers several advantages for your project. Here's one last feature we have yet to explore from this powerful sensor, it is none other than the commonly used, light sensor. In this activity, we will learn how to measure different level of ambient light, allowing you to create project that respond to changes in lighting conditions!

> Libraries <

-> Libraries: board, time, digitalio, adafruit_apds9960.

-> Light Sensor I2C Pins Configuration: SCL = GP5 and SDA = GP4.

-> Input:

< CircuitPython Code >

Click here to download code

< Expected Output >

Upon completion of the activity, you should be able to:

-> The program will print brightness percentile in shell console.

Introduction to
Temperature & Humidity Sensor (AHT20)

The AHT20 sensor is a powerful component that provides accurate measurements for both humidity and temperature. Imagine having the ability to monitor and respond to changes in your project's environment, whether its a home automation system, a weather station, or a smart gardening project.

> Libraries <

-> Libraries: board, time, digitalio, adafruit_ahtx0.

-> AHT20 I2C Pins Configuration: SCL = GP5 and SDA = GP4.

< CircuitPython Code >

Click here to download code

< Expected Output >

Upon completion of the activity, you should be able to:

-> Program will print temperature in Celcius and relative humidity percentile in the shell console.

-> Enable view > plotter in Thonny IDE to allow you to visualize the temperature and humidity data in the same graph, making graph analysis easier.

Climate Control Greenhouse

In this project, you will learn how to construct a control system that regulates the humidity and temperature of a closed greenhouse environment. To achieve that, you are required to integrate AHT20 temperature humidity sensor and APDS9960 light sensor as input devices; RGB LEDs (for light), servo motor (for rooftop control), DC motor (for the fan), and OLED screen for printing the greenhouse status.

> Libraries <

-> Libraries: board, busio, time, adafruit_ssd1306, neopixel, PWMOut, adafruit_ahtx0, adafruit_motor, adafruit_apds9960.

-> I2C Pins Configuration: SCL = GP5 and SDA = GP4.

-> Input:

< CircuitPython Code >

Click here to download code

< Expected Output >

Upon completion of the activity, you should be able to:

-> If the surroundings are bright, the RGB LEDs remain off; whereas if the surroundings are dark, the RBG LEDs will light up in violet.

-> If the surroundings are hot, the servo will activate to 60 degrees (opening the rooftop), and the DC motor fan will activate to ventilate the area to cool down the environment.

< Components >

Introduction to Internet of Things (IOT)

Imagine if everyday objects could connect to the internet and communicate with each other. IoT is all about linking things together via the internet to make them smarter and more useful. In this activity, we will turn the EDU PICO into an Iot-enabled device by reading the Raspberry Pi Pico W onboard temperature and controlling the EDU PICO's USB relay output through a webpage.

Libraries <

-> Libraries: board, digitalio, wifi, socketpool, os, adafruit_httpserver, microcontroller.

-> USB Relay Configuration:

-> Create Wifi configuration file "settings.toml":

[Note: If you want to use AP-Mode (Chapter 7 Bonus) on the Raspberry Pi Pico W, make sure to delete the settings.toml file.]

-> Connect your PC to WiFi:

< CircuitPython Code >

Click here to download code

< Expected Output >

Upon completion of the activity, you should be able to:

-> The program begins by connecting to the WiFi with the SSID and Password preset in the settings.toml file.

-> Type your IP address into your browser.

-> Clicking the buttons will send a signal to either turn ON or OFF the USB relay.

-> Message like "Light ON" and "Light OFF" will be printed on the shell console when the buttons are clicked.

Introduction to Data Logging

In this topic, we will learn how to use CircuitPython to read the Raspberry Pi Pico W internal temperature data and write it to a file on the CircuitPython drive. This will enable you to create your own temperature data logger.

Libraries <

-> Libraries: boot.py, board, digitalio, time, microcontroller, os.

-> Data Logging Configuration File:

< CircuitPython Code >

boot.py

Click here to download code

BONUS_DATALOGGER.py

Click here to download code

< Expected Output >

Upon completion of the activity, you should be able to:

-> After resetting the EDU PICO, a file named temperature.csv will appear in the CircuitPython drive.

CONGRATULATIONS!

You have completed your educational journey.
We can't wait to see what you will be building with the EDU PICO