Note

Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts.

Why Join?

  • Expert Support: Solve post-sale issues and technical challenges with help from our community and team.

  • Learn & Share: Exchange tips and tutorials to enhance your skills.

  • Exclusive Previews: Get early access to new product announcements and sneak peeks.

  • Special Discounts: Enjoy exclusive discounts on our newest products.

  • Festive Promotions and Giveaways: Take part in giveaways and holiday promotions.

👉 Ready to explore and create with us? Click [here] and join today!

1.5 Wake up the Owl

Today we are going to play a game of waking up the owl.

When someone approaches the PIR sensor module, the owl will wake up from sleep.

../_images/1.5_header.png

Required Components

In this project, we need the following components.

../_images/1.5_component.png

It’s definitely convenient to buy a whole kit, here’s the link:

Name

ITEMS IN THIS KIT

LINK

Raphael Kit

337

Raphael Kit

You can also buy them separately from the links below.

COMPONENT INTRODUCTION

PURCHASE LINK

GPIO Extension Board

BUY

Breadboard

BUY

Jumper Wires

BUY

PIR Motion Sensor Module

-

Build the Circuit

../_images/1.5_fritzing.png

There are two potentiometers on the PIR module: one is to adjust sensitivity and the other is to adjust the detection distance. To make the PIR module work better, you You need to turn both of them counterclockwise to the end.

../_images/PIR_TTE.png

Load the Code and See What Happens

Load the code file (1.5_wake_up_the_owl.sb3) to Scratch 3.

When you approach the PIR sensor module, you will see the owl on the stage area open its wings and wake up, and when you leave, the owl will go back to sleep again.

Tips on Sprite

Select Sprite1 and click Costumes in the top left corner; upload owl1.png and owl2.png from the ~/raphael-kit/scratch/picture path via the Upload Costume button; delete the default 2 costumes, and rename the sprite to owl.

../_images/1.5_pir1.png

Tips on Codes

../_images/1.3_title2.png

When the green flag is clicked, the initial state of gpio17 is set to low.

../_images/1.5_owl1.png

When pin17 is low (no one is approaching), switch the costume of the owl sprite to owl1 (sleeping state).

../_images/1.5_owl2.png

When pin17 is high (someone is approaching), we switch the costume of owl sprite to owl2 (wake up state).