top of page

Smart Crib

Project Purpose: Making a Smart Cradle project using Pinoo Control Card, button and servo motor module.

Duration:  2 lessons

Age group:  7 years+

Pinoo Set:  Invention set, maker set and full set.

  Achievements :

  • Learns to code Pinoo Control Board.

  • Learns to use servo motor module.

  • Learns to use the button module.

  • Develops algorithmic skills.

  • Coding skills develop.

  • Design skills develop.

  • Gains ideas about 3D printers and designs.

 

Materials to be used:  Mblock 3 program, Pinoo Control Card, Button Module, Servo Motor Module, Cables

 

 

Materials Required for Design:  Eva or craft paper,  wooden boards or cardboard, glue gun and silicone, 3d printer output cradle (you can also design the cradle from waste materials)


 

 

Project Construction:

 

  1. We start our project by making the floor first. We combine 4 pieces of wood with the help of a silicone machine. Cardboard can also be used.

 

  1. After creating the floor, we cover the floor with a color of our choice, eva or craft paper. Excess parts can be cut off  Or it can be folded inwards.

 

  1. Then, we fix the cradle on the upper part of the floor, which we printed from the 3D printer, with the help of a silicone machine.

(On the protruding bar on the side of our crib.  we will fix the servo motor. If you want to do this project with different cradle designs, the servo motor can be used directly.  It can also be fixed to the bassinet.)

 

 

  1. We stick the servo motor to the rod in our cradle with the help of a silicone machine.

 

  1. In order for the servo motor to reach the length of the bar, we make an elevation with a tongue bar or a piece of cardboard. The rod and servo motor in the cradle will move as a whole. In this way, the cradle will swing. We can connect the servo motor to any of the appropriate colored inputs on the Pinoo Control card. We connected it to port 1.

 

  1. We connect the button module to the appropriate colored inputs on the Pinoo Control Card. We connected it to port 3.  When we press the button, the cradle will start to work. We fix the button anywhere on the floor.

 

  1. We have completed our design and connections, now let's move on to the coding part. We will use the Mblock 3 application for this.

 

 

  1. We connect our Pinoo Control Card to the computer with the help of the connection cable.  Let's connect and login to Mblock3 application. Then let's introduce our Pinoo Control Card to the computer. To do this, we first click on the serial port option from the Connect tab. Then com4  we choose. (Depending on computer and port  number may differ.)

 

 

  1. After making the serial port connection, let's choose the card we will use from the cards tab. We are working with the Nano model of Arduino.

 

 

  1. After selecting our card, we click on the Pinoo option from the Extensions tab. We will write our codes with the Pinoo extension.

 

 

  1. After making our selections, we finally complete our connection process by updating the Device Software from the Connect option.

 

 

 

  1. After the update is finished, we move on to the coding phase. First of all, we get the code when the Green Flag is clicked from the Events menu.

 

 

  1. Then we read the value of our button module. For this, we first get the Say Hello code from the View menu.

 

 

  1. We take the code that will read the value of the Button Module from the Robots menu and insert it into the say hello code. We select the input to which the Button Module is connected.

 

 

 

  1. In order to see the changing value of the button module continuously, we place our codes inside the Repeat Continuous code. Then we click on the green flag and look at the value displayed by our panda.

( It will be 1 when we press the button and 0 when we do not press the button.  values will differ.)  

 

 

 

  1. When our button value shows 1, our cradle will rock and when it shows 0, it will stay fixed. For this, we will use the control menu, if not, the code.

 

  1. After getting the code if not from the control menu, we place the equality code from the Operations menu.

 

  1. Our cradle will work if the value of the button module is equal to 1. If not, it will stop.

 

 

  1. If the value of the button module is equal to 1, we want our cradle to rock 2 times. For this, we get the repeat code 2 times from the Control menu.

 

  1. We start the angle of our servo motor from 90 degrees (mid point).

 

  1. Then, we increase the angles of the servo motor in 1 second intervals so that the cradle swings to the right gradually.

 

  1. Then we write the necessary codes for the servo motor to swing to the left.

 

  1. If we get it from the Control Block so that our cradle will stop when we do not press the button module later, if the code is not available.  We write the necessary code in the section.

 

  1. We have completed the codes of our crib. We will upload our codes to our card to run our project with a computer-independent power supply. For this, we first throw the codes we added from the View menu and the event when the Green Flag is clicked on at the beginning.

 

 

  1. To begin with, we get the Pinoo Program code from the Robots menu.

 

 

  1. We upload our codes to Arduino by right-clicking on the Pinoo Program code.

 

 

  1. We are waiting for the codes to be uploaded. After the installation is finished, we close the window and disconnect the connection cable of our Pinoo Card from the computer.

 

 

  1. Finally, with the help of 9v battery and Battery cap, we power our Pinoo board and make our project work.

 

 

 

  ARDUINO IDE CODES:

#include <Servo.h> // we added the servo library Servo servo; // name the servo object int button = 4; // added the button to the 4th pin int buttonstate; // we assign a variable named buttonstate void setup() {  servo.attach(2); // assign the servo to pin 2.  pinMode(button, INPUT); // button is input pin } void loop() {  buttonstate = digitalRead(button); // we read the value from the button  if (buttonstate == HIGH) { // if button is pressed   // get the servo to the positions 9,120,150,120,90,60 respectively   servo.write(90);   delay(1000);   servo.write(120);   delay(1000);   servo.write(150);   delay(1000);   servo.write(120);   delay(1000);   servo.write(90);   delay(1000);   servo.write(60);   delay(1000);  } else { // otherwise   // get the servo to the 90 position   servo.write(90);  } }

bottom of page