Outdoor electronic billboards add color to the night, but they also bring inconvenience to people’s daily travel.Billboards that stay lit day and night have gradually changed from eye-catching displays into sources of visual discomfort.At night, they cause serious light pollution and waste valuable electrical energy.

Can we design a sensor-based billboard?
By using a sensor to detect pedestrians within the billboard’s range, the system can remain off when there is no one nearby and start working when someone passes by. Such a responsive billboard not only saves energy but also helps reduce light pollution caused by excessive billboard use. Next, let’s use a PIR motion sensor and the UNIHIKER M10 to create an energy-saving, eco-friendly human-sensing billboard that won’t cause light pollution at night.
Goal
When the PIR Sensor detects someone passing by the billboard, the UNIHIKER screen automatically displays the advertisement; when it detects that the person has left, the UNIHIKER pauses the advertisement display.

Get to Know
1. Understand the concept of digital input signals
2. Learn about control systems and their components
3. Master how the UNIHIKER M10 receives digital input signals
4. Master the usage and working principle of the PIR motion sensor
Materials List
Hardware:

Software:
Mind+ Programming Software x1(download at https://mindplus.cc/en)

Hands-on Practice
How can we create a human-sensing billboard using a PIR Sensor and the UNIHIKER M10? Next, we will break down the human-sensing billboard project into two tasks: Read the PIR Sensor values and Create the human-sensing billboard!
Task 1: Read the PIR Sensor values
The main objective of this task is to read the input signals from the PIR sensor while it’s operating.
Task 2: Create the human-sensing billboard
By analyzing the digital signals received from the PIR sensor, determine whether there are pedestrians within the billboard’s range. If pedestrians are detected, the billboard plays the advertisement; if none are detected, it stops playing.
Task 1: Read the PIR Sensor values
1.Hardware Connection
The PIR Sensor is a device that detects infrared rays emitted by moving humans or animals and outputs digital signals.Connect the PIR Sensor to the P24 digital pin on the UNIHIKER M10.
After completing the hardware connection, use a USB cable to connect the UNIHIKER M10 to your computer.
Note: For the introduction to the PIR Sensor, see Knowledge Base.

2.Software Preparation
Open Mind+ and follow the steps shown in the diagram to complete the software preparation.

3.Write a Program
After connecting the PIR Sensor to the P24 digital pin, how can we obtain the detected value from it? Use the “read digital digital pin” block and select P24.

Then use the text display block to show the digital value detected by the PIR Sensor on the UNIHIKER M10 screen.

4.Run the Program
Click "Run". When the program runs successfully, if the PIR Sensor detects a person, the indicator light on the sensor turns on and the number 1 appears on the UNIHIKER screen.Otherwise, the sensor’s indicator turns off, and the number 0 appears on the screen.

Task 2: Create the human-sensing billboard
1.Write a Program
Think about how to make a human-sensing billboard.
When a person is detected, the billboard should automatically play the advertisement image; when no one is detected, it should stop. To play the advertisement images, first import the pictures in your picture folder into the UNIHIKER M10’s “File in the project”.

Use the “show image” block to show an image on the UNIHIKER screen, and use the “update object” block to set the image width to 240.

When someone approaches the billboard, use the “if...then” block to check whether the value read from digital pin P24 equals 1.
If so, use the “Update image” block to update the picture every 1.5 seconds.

When no one is detected, use the “if...then”check to see if the value read from P24 equals 0. If so, use the “Update Image” block to display the stop image.

If you have only a few images, this method works well to switch advertisements when pedestrians are detected. However, if there are 20 or more images, this approach becomes inefficient. Is there a simpler way to achieve image switching?
Look at the “Update image” blocks in the program. Except for the source file names, everything else is identical—and each file name follows the pattern “number + .png.” Therefore, you can use the “Join” block to build the image file names dynamically.

Create a new variable named "image name". Change the image name by increasing the “image name ”variable by 1 each time.

After running the program, you may notice that once all advertisement images have been played, if the PIR Sensor detects someone again, all images disappear and an error message appears in the terminal.
This happens because the variable “image name” continues to increase, but there is no file named “6.png”. To fix this, add another conditional branch outside the main judgment: when the variable “image name” is less than 6, play the advertisements; otherwise, reset “image name” to 1. The complete program structure is shown below:

2.Run the Program
Click "Run". After the program starts successfully, when the PIR Sensor detects a person, the advertisement plays automatically on the UNIHIKER M10 screen. When no one is detected, the billboard pauses; once someone appears again, it continues playing from the current image.

Knowledge Base
1.What Is a Digital Input Signal
What is a digital input signal? In Lesson 1, we learned that a digital signal is represented by the numbers 0 and 1. A digital input signal is the signal collected by a digital sensor, and its value can only be 0 or 1.
How can we tell whether a sensor is digital?
Look for the letters “D” and “A” printed on the sensor board. “D” stands for digital, and “A” stands for analog. Sensors marked with “D” are digital; those marked with “A” are analog.
We’ll learn about analog sensors later when they are introduced.

When connecting sensors to the UNIHIKER M10, keep in mind:
it has four 3-pin ports (P21, P22, P23, P24), all of which can connect digital sensors. Among them, P21–P23 can connect PWM devices (such as servos), and only P21 and P22 can connect analog sensors. We’ll discuss PWM in later lessons.

2.Understanding Control Systems and their Components
What is a control system? A control system refers to a system that can receive external inputs and adjust its outputs according to certain requirements. The following diagram is a block diagram of the control system.

In other words, a control system must have at least three elements: input, controller, and output. Among them, the input device is used to collect signals, the controller processes the received signals, and finally the output device outputs signals. Taking humans as an example, the five senses (sight, hearing, smell, taste, touch) act as input devices to collect signals, which are then sent to the brain. The brain then responds, and the output is human behavior.

The "input-calculation-output" system model exists throughout daily life. Input obtained from the outside world undergoes calculation to generate output, which then acts on the outside world and further affects the input, thereby forming a control system. Take a microwave oven as an example: after setting the heating time, the controller acquires the input time, then issues a heating command to the heating device (actuator). The microwave oven starts heating and timing; when the timing reaches the set time, the microwave oven stops heating.

In the world of the UNIHIKER M10, the same principle applies:
Input — sensors that collect data;
Controller — the UNIHIKER M10 itself, which processes the data;
Output — screen (display), sound (buzzer), light (LED or RGB), or motion (servos, motors).
In this human-sensing billboard project, the PIR Sensor serves as the input device. When it detects someone approaching, the UNIHIKER M10 controller receives the signal and the actuator displays the advertisement images.

3.Understanding the Working Principle of the PIR Sensor
The PIR Sensor, also known as the human infrared pyroelectric motion sensor, is a type of sensor that can detect infrared rays emitted by humans or animals and output electrical signals. Any object with a temperature above absolute zero (−273 °C) emits infrared energy. Objects with higher surface temperatures emit stronger infrared radiation and shorter wavelengths.

The human body maintains a temperature of about 37 °C and emits infrared rays with a wavelength of roughly 10 micrometers (μm). These rays are focused on the sensing element, where the circuit processes them and generates an output signal.

Why does the PIR Sensor include a Fresnel lens in front of its probe?
The Fresnel lens acts like a magnifying glass. Without it, the detection radius may be under 2 meters; with it, the range can reach 7 meters or more. Therefore, the sensor performs best when used together with a Fresnel lens.

When a person enters the detection area, the Fresnel lens focuses the infrared rays onto the pyroelectric unit, increasing sensitivity. The pyroelectric unit then receives changing heat levels, altering its electrical properties and generating a signal. After the signal is amplified and processed, corresponding digital outputs 1 and 0 are produced.

4.Blocks Overview

Challenge
In this lesson, you learned how to use the PIR Sensor and gained an understanding of automatic control. Next, try using the PIR Sensor to control the onboard LED on the back of the UNIHIKER M10 to create an automatic induction light. When someone passes by, the LED turns on automatically; once the person leaves, it turns off.








