Aim of the Project: To create an alarm system using distance sensor and buzzer module of structures such as newly built walls using Pinoo Control Card. In this way, when people get closer, the situation of damage is minimized.
Time: 2 lessons
Age Group: 9 years old and above
- Learns to code the Pinoo Control Card.
- Learns to use the distance sensor.
- Learns to use the buzzer module.
- Improves to the ability to establish algorithms.
- Coding skill improves.
- Design skills improve.
- Mblock 3 program
- Pinoo Control Card
- Distance Sensor
- Buzzer Module
Materials Required for Design: Empty cardboard box, brick figure, silicone gun and silicone.
Implementation of the Project:
- Let's start our project by designing the wall first. Let's cover our cardboard box with brick visuals with the help of silicone machine.
- After covering the box, let's place the distance sensor on the left side with the help of a silicone gun.
- Next, let's put the buzzer module on the right side.
- After placing our circuit elements, let's place our Pinoo Control Card on the back of the wall. Thus, we can connect the distance sensor and the buzzer module to our Pinoo card.
We connected the distance sensor to input number 6 and the Buzzer module to input number 4. We can connect different inputs on our Pinoo Control Card in accordance with the colors on the sensors.
- We have completed our design and connections now let's move on to the coding section. We will use the Mblock 3 application for coding.
- Let's connect our Pinoo Control Card to the computer with the connection cable and enter the Mblock3 application. Then let's pair our Pinoo Control Card with the computer. To do this, we click the serial port option on the Connect tab. Then we choose com4. (The number may differ depending on the computer and port.)
- After making the serial port connection, let's choose the card we will use from the cards tab. We work with the Arduino Nano model.
- After selecting our card, we click on the Pinoo option from the Extensions tab. We will write our codes with the Pinoo extension.
- After making our selections, finally, we complete the connection process by doing Firmware Update from the Connect option.
- After the update is over, we proceed to the coding stage. First of all, we get the code "Clicking the Green Flag" from the Events menu for start the application.
- Next, we get the code 'Say Hello' from the View menu to see the value of the Distance Sensor on the screen.
- We get the code to read the Distance Sensor's Value from the Robots menu. We select the port number to which we connect our sensor.
- Then we place our code, which reads the value of the distance sensor, in the code 'Say hi'. To see this value continuously, we take the code 'repeat continuously' from the control menu and place it in other codes. We see that our puppet shows the value.
- After completing our codes related to the Distance Sensor, let's move on to the codes of our Buzzer module, which we use to give a warning when the object approaches. First, let's get the code required for the buzzer to make a sound from the Robots menu and select the port number it is connected to. We can randomly select it by listening to the note and the range part.
- When our obstacle approaches our wall, buzzer will give an audible warning and will not give any warning if there is no obstacle. We take the 'if-else' code from the control menu and put into the code 'repeat continuously'.
- If the value of our distance sensor is less than 20 cm, that is, if the obstacle is approaching the wall, the buzzer will give an audible warning. If it is not smaller than 20 cm, buzzer should not give any warning. For this, we place the 'less than' operation in the 'if-else' code in the transactions menu.
- Next, we enter the code that reads the distance sensor's value to the left side of the transaction and add the number 20 to the right side of the transaction.
- Buzzer warns when the value of the distance sensor is less than 20cm, if not, it does not warn. For this condition, we add the 'buzzer sound on and off' code to the relevant places.
- After completing our codes, we check the operation of our project by clicking the green flag.
- When our hand closer to the distance sensor, our puppet showed a value less than 20 and buzzer beeps.
- If there is no problem in the operation of our project, we need to load the codes that we have written in our card to run our project with a power supply independent of the computer. For this,firstly, we send our 'Say Hello' code to the trash. (Since the code 'Say Hello' is a code that allows our puppet to speak, this code does not work when we want to load our codes on the card.)
- Then, we send the 'click on the green flag' code that we used at the beginning and get the Pinoo Program code from the Robots menu.
- Right click on this code and click on the ‘install on arduino’ option (Because, we are working with arduino board.)
- We wait the codes to be loaded on the card. After the installation is completed, we close the window and remove the Pinoo Control Card connection cable from the computer.
- Finally, with the help of 9v battery and battery cap, we plug the power supply into our Pinoo Control card.