Outline
Let's make a fireplace, which can start work automatically when someone is in house, and go off when there is no person.
Suitable kits: mCookie202, IBC
Module Bill
Module
Other Equipment
- USB cable*1
- Sensor cable*2
- Sensor shell
- Lego or other fixation structure
Module Setup
Look at the New Sensor
PIR sensor
It can induce whether there is someone or animals moving around(approaching). The induction distance is 0-12m, and the angle is 50°, the induction range is spherical.
- In some banks, markets, hotels, and so on, when we get close to the door, the door will automatically open, do you students know the reason?
- When there is no people passing by, the sensor hasn’t detected person, the door keeps still.
- When there is someone passing by, the sensor detected the movement, the door will open.
Setup
- Assemble the modules and sensors:
- Connect the color LED to pin 6/7 of Hub;
- Connect the Tem&Hum sensor to pin IIC of Hub;
- Connect the PIR sensor to pin 4/5 of Hub;
- Insert one end of USB cable into the battery base, and connect the other end to computer.
Programming
Required Program Blocks
Programming Thought
When there is someone in house or the indoor temperature is lower than 30 degrees(need to keep warm), the fireplace is activated. When there is no one in house or the indoor temperature is higher than 30 degrees (needn't to keep warm), the fireplace goes off.
Start To program
There is someone needing to keep warm
ColorLED prepare: connect one color LED to pin 6. Wait for the PIR sensor of pin 4 to induce people in house, and the indoor temperature is lower than 30 degrees(someone needs to keep warm), the red LED is activated(turn the fireplace on).
Turn the fireplace off
Wait for the PIR sensor of pin 4 to induce no people in house, or the indoor temperature is higher than 30 degrees(don't need to keep warm), turn the LED(fireplace) off.
Test the result
After upload, when approach to the PIR sensor(or wave your hand), if the indoor temperature is lower than 30 degrees, the red LED will be activated. Blow to the Tem&Hum sensor (simulating the hot air), and observe whether the LED will go off. Because different temperature in different seasons, to make it convenient to observe, you can adjust the standard value (30 in the program) of activating the fireplace appropriately.
Technical Specification
- The product number of the Tem&Hum sensor: MSDT31
- For details about PIR sensor, please refer to Sensor-PIR
Related Cases
FAQ
|