Smart Cradle
SMART CRADLE WITH PİNOO
Aim of the Project: Making a button-controlled smart cradle with Pinoo Control Card. Our cradle will work with servo motor and the button module, whenever we want.
Time: 2 lessons
Age Group: 9 years old and above
Main goals:
- Learns to code the Pinoo Control Card.
- Learns to use the servo motor module.
- Learns to use the button module.
- The ability to establish algorithms improves.
- Coding skill improves.
- Design skills improve.
- Get an idea about 3D printers and designs.
Required Materials:
- Mblock 3 program
- Pinoo Control Card
- Button Module
- Servo Motor Module
- RJ-11 Cables
Materials Required for Design: Craft paper, wooden boards or cardboard, silicone gun and silicone, cradle produced with 3d printer (you can also design the cradle from waste materials)
Implementation of the Project:
- Projemize ilk önce zemin yapmakla başlıyoruz. 4 adet ahşap parçasını silikon makinesi yardımıyla birleştiriyoruz. Mukavva da kullanılabilir.
- After creating the floor, we cover the floor with any colour of handcrafted paper we chose. Excess parts can be cut or folded inward.
- Then, we install the cradle on the upper part of the floor with the help of a silicone machine that we print from a 3D printer.
(We will install a servo motor on the bar-shaped ledge on the side of our cradle. If this project is desired with different cradle designs, the servo motor can be fixed directly to the cradle.)
- We attach the servo motor to the ledge in our cradle with the help of a silicone machine.
- In order for the servo motor to reach the length of the ledge, we raise the bottom with a tongue stick or piece of cardboard. The ledge and the servo motor will move as a whole, so the cradle will swing. We can connect the servo motor to any of the inputs in the appropriate color on our Pinoo Control card. We connected it to gate 1.
- We connect the button module to the same colored gates on our Pinoo Control Card. We connected it to the gate 3. When we press the button, the cradle will start working. We put the button anywhere on the ground.
- We have completed our design and connections now let's move on to the coding section. We will use the Mblock 3 application for this.
- 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 first click the serial port option on the Connect tab. Then we select 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 Arduino's 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, we finally 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.
- Then we read the value of our button module. To do this, we first get the 'Say Hello' code from the View menu.
- We take the code that will read the value of the Button Module from the Robots menu and place it in the 'Say Hello' code. We select the gate to which the Button Module is connected.
- We place our codes in the 'Repeat Continuous' code to constantly see the changing value of the button module. Then, by clicking on the green flag, we look at the value shown by our panda. (The values will be different as '1' when we press the button and '0' when we do not press the button.)
- When our button value shows 1, our cradle will shake, and when it shows 0, it will remain constant. For this, we will use the 'if-else' code from the control menu.
- After getting the 'if-else' code from the control menu, we place the 'equals' code in the Actions menu.
- If the value of the button module is equal to 1, our cradle will work. If not, it will stop.
- If the value of the button module equals 1, we want our cradle to swing 2 times. For this, we get the 'repeat 2 times' code from the Control menu.
- In 1 second, we start the angle of our servo motor from 90 degrees (midpoint) and increase it in order, shaking it to the right.
- We were able to swing our servo motor to the right.
- We write the necessary codes for our servo motor to swing to the left.
- Then, when we do not press the button module, we write the necessary code in the 'else' part of the 'if-else' code we received from the Control Block to stop our cradle.
- We have completed the codes of our cradle. We will upload our codes to our card to run our project with a power source independent from the computer. To do this, we first extract the codes we added from the View menu and the 'When the Green Flag is clicked' event we received at the beginning.
- To get started, we get the Pinoo Program code from the Robots menu.
- Right-clicking the Pinoo Program code, we upload our codes to Arduino.
- We are waiting for the codes to load. After the installation, we close the window and remove the connection cable of our Pinoo Card from the computer.
- Finally, with the help of a 9v battery and a battery cap, we power our Pinoo card to keep our project running.