top of page

Mousetrap

Project Purpose: In the system we have built using Pinoo Control Card, servo motor, light sensor (LDR) and buzzer module, when the mouse enters the box, it will be detected by the light sensor and the buzzer module will give an audible warning.

Duration:  2 lessons

Pinoo Set:  Pinoo Basic Set,Invention Set,Maker Set,Full Set

Age group:  7 years and older

Achievements:

  • Learns to code Pinoo control board.

  • Learns to use light sensor.

  • Learns to use the buzzer module.

  • Learns to use servo motor.

  • Develops algorithmic skills.

  • Coding skills develop.

 

 


Materials to be used:  Mblock 3 program, pinoo control card, servo motor, buzzer module, light sensor (LDR), connection cables.

 

 

 

Materials Required for Design:  Decota, utility knife, thin and thick wire, glue gun and silicone.

 

 

Project Construction:

 

For our project, we first start by cutting our decoupage.

 

 

 

We cut our decotas into pieces as in the picture.

 

 

 

 

 

 

 

Then we will use thin wire to open the door of our mousetrap. For this, we make a hole with the help of a utility knife as in the picture.

 

 

 

 

 

 

 

 

 

 

 

 

 


We connect our thin wire to the holes to ensure the movement of the door.

 

 

Then we cut the floor piece for our light sensor with the help of a utility knife.

 

 

 

We fix our decota parts with the help of a silicone gun as in the picture.

 

 

We fix our light sensor to the cut we made on the floor.

 

 

 

 

 

 

 

 

 

 

 

 

 

We fix our buzzer module to the side wall of our mousetrap.

 

 

Then we connect our thick wire to the brush of our servo motor and fix the wire that we connected my servo motor to the wall of the mousetrap to the door. Then we make the connections on our pinoo control card. We connect our servo motor to port 2, our buzzer module to port 3, and our light sensor to port 7.

 

Adding Pinoo extension:

 

 

 

 

 

From the Extensions tab, click "Manage Extensions".

 

 

 

In the window that opens, we write “Pinoo” in the search engine and it is enough to say download to the result.

Installed on our computer.

 

Connecting the Pinoo control board to the computer:

 

 

 

 

 

 

 

 

In Mblock 3, we click on the "Connect" tab in the upper left. In the window that opens, we click on the "Serial Port" section and select the "COM4" option from the page that opens.

NOTE: As each computer has different port entries, the numbers next to COM may change.

 

Click on the Cards tab. From the window that opens, we select the "Arduino Nano" card option used by the Pinoo control card.

 

 

Click on the Extensions tab. In the window that opens, we select "Pinoo", the extension of the control card we use.

 

Click on the Connect tab.

Click "Firmware Update" from the window that opens.

 

Coding part:

 

 

 

First, we place our servo motor run code under the 'Key Pressed' codes to check whether our servo motor is working or not. In this way, we control the working status of our servo motor.

 

 

 

We check our Buzzer module by running the code under the code when the green flag is clicked.

 

 

In order to find out if our light sensor is working, we see the values by reading our 'read light sensor' code under the 'Green Flag' code in the 'say hello' code.

 

 

 

 

 

 

 

We start our code with the green flag code. At first, we set the angle of our servo motor to 0 degrees so that the door of our mousetrap remains open.

 

 

 

In the repeat code, if our light sensor value is less than 200, we want our servo motor to adjust its angle to 135 degrees, that is, to close the door.

 

 

Then we want our buzzer module to run at half-second intervals into our loop by repeating it 20 times, and in this way we complete our coding.

 

 

 

Right-click on the “Pinoo Program” command and select the “Install to Arduino” option in the window that opens.

On the page that opens, we click on the "Upload to Arduino" button, which is selected in red.

 

 

 

Our codes are uploaded to our Pinoo control card. After the “Installation Finished” message comes, click the “Close” button. After the installation is finished, the battery holder is inserted and the project is run.

 

 

Working Status of the Project:

 

 

 

If the mouse comes in, the light sensor will detect the mouse and our door will be closed.

 

ARDUINO IDE CODES:

#include <Servo.h>  // We included the servo library in the project.

Servo servomotor;  // We created a servo motor object.

int LDRpin = A0;//We have specified which pin we have attached our light sensor to.

int buzzerpin = 3;// We have specified which pin we have attached our buzzer module.

void setup()

{

  pinMode(buzzerpin,OUTPUT); 

servomotor.attach(2);//We have specified which pin we have attached to our servo motor. 

servomotor.write(0);//We have ensured that our servo motor is at 0 degrees at the beginning.

}

void loop()

{

  int lightvalue = analogRead(LDRpin); // We created a variable called lightvalue and transferred the values of our light sensor, which we connected to the A0 pin, to the variable we created.

  if(lightvalue<200) //If the ambient light value is less than 200, we created the condition block.

  { 

  servomotor.write(135);//We made the servo motor angle 135 degrees.  

for(int i=0; i<=20 ; i++); //We created a for loop for our buzzer module to sound 20 times.

   {   

  digitalWrite(buzzerpin,HIGH);//We have activated our Buzzer module.    

delay(500);//We waited half a second.    

digitalWrite(buzzerpin,LOW);//We have disabled our buzzer module.    

delay(500);//We made it wait half a second again.  

 

}

  }

}

IMG_4513_edited.jpg
IMG_4488.JPEG
IMG_4489.JPEG
IMG_4491.JPEG
IMG_4493.JPEG
IMG_4492.JPEG
IMG_4494.JPEG
IMG_4495.JPEG
IMG_4496.JPEG
IMG_4497.JPEG
1_a8314da2-edff-4525-979d-b2d3ff93364b_large.png
pinoo_uzanti_480x480.jpg
seri_port_480x480.jpg
KART_480x480.jpg
pinooo_480x480 (2).jpg
aygit_yazilim_480x480.jpg
6.JPG
1.JPG
7.JPG
xxxx_ccf65842-52ad-41e1-8e7e-bec28bcb1268_480x480.jpg
2.JPG
3.JPG
4.jpg
5.jpg
calisma.jpg
bottom of page