16. Case 10: The Farm Protection Devices#

16.1. Introduction#

In order to protect the farmlands from people to get in, we can set a farmland protection device.

../_images/tooca-laser-1-case-10-01.png

16.2. Materials Requested#

TOOCA laser 1

Smart Agriculture Kit

3mm Plywood

16.3. Relevant Parameters#

Model TOOCA Laser 1
Material of consumables Basswood board
Thickness 2.8mm
Power 100%
Speed 240mm/min
Times required to be engraved/cut 3

Note: This case takes a 2.8mm basswood board as an example. If you need to use different thicknesses or use different materials, please modify the drawing by yourself and refer to the Recommended parameter modify the parameters of the software.

16.5. Hardware Connection#

Connect the Sonar:bit to P1, the PIR sensor to P2 on IoT:bit.

../_images/tooca-laser-1-case-10-02.png

16.6. Software Programming#

Click “Advanced” in the MakeCode to see more choices.

../_images/tooca-laser-1-case-10-03.png

For programming, we need to add a package: click “Extensions” at the bottom of the MakeCode drawer and search with “iot-environment-kit” in the dialogue box to download it.

../_images/tooca-laser-1-case-10-04.png

Notice: If you met a tip indicating that some codebases would be deleted due to incompatibility, you may continue as the tips say or create a new project in the menu.

16.7. Program#

Set the ultrasonic sensor to connect to P1, measure the distance in cm, and save the return value to the variable “ultrasonic_distance”, set the PIR sensor to connect to P2, and save the return value to the variable “IR”.

../_images/tooca-laser-1-case-10-05.png

Judge whether the value of variable “ultrasonic_distance” is within the threshold, if so, judge whether the return value of variable “IR” is 1, if the return value of variable “IR” is 1, then set the LED matrix to display the icon and the buzzer to sound the alarm otherwise turn off the light.

../_images/tooca-laser-1-case-10-06.png

If the value of the variable “ultrasonic_distance” is not within the threshold, set to display the icon as we progrommed.

../_images/tooca-laser-1-case-10-07.png

Link: https://makecode.microbit.org/_5PbACb8kLcqr

16.8. Results#

When someone approaches the farmland, the farmland protection device will display the icon and sound an alarm to warn others to stay away.

16.9. Effect Show#

../_images/tooca-laser-1-case-10-01.png

../_images/tooca-laser-1-case-10-08.png

16.10. material data#

More detail about the material:laser cutting materialLaser engraving material

Welcome to join the Laser Engraving Cutter Creative Sharing Community to share your creativity.