Page 148 - KEC Khaitan C6 Flipbook
P. 148

∑  Develop  practical  skills  in assembling  circuits  and writing  code  to  simulate  real-world
                      problem-solving through automation.

                  Step-By-Step Instructions:

                  1.  Open MakeCode for Micro:bit:
                          Visit MakeCode for Micro:bit.

                          Click “New Project” and name it Smart Dustbin.

                  2.  Write the Code:
                          Programming Logic:

                          ◦    Use the ultrasonic sensor to detect the distance of an object.

                          ◦    If the distance is below a threshold (e.g., 10 cm), the servo motor rotates to open the
                              dustbin lid.
                          ◦    Send a message over the WiFi module to log the activity (optional).

                          Add Extensions:

                          ◦    Click the gear icon in MakeCode and select Extensions.
                          ◦    Search for “Sonar” (for the ultrasonic sensor) and “Servo” (for the servo motor) and
                              add them.

                  3.  Simulate the Project in MakeCode:

                          Use the simulator on MakeCode to verify the program:
                          ◦      Simulate object detection by adjusting the input values for the ultrasonic sensor.

                          ◦      Check if the servo motor rotates correctly when the distance is below the threshold.

                  4.  Gather Materials for Physical Implementation:
                          Micro:bit with a battery pack.

                          Ultrasonic sensor (e.g., HC-SR04).

                          Servo motor.
                          WiFi module (e.g., ESP8266).

                          Connecting wires or jumper cables.

                          Cardboard or plastic container for the dustbin body.
                          Adhesive materials (glue, tape).

                  5.  Assemble the Smart Dustbin Body:

                          Use a cardboard or plastic container as the dustbin.

                          Create a hinge mechanism for the lid, attaching it to the servo motor.
                          Position the ultrasonic sensor at the top front of the dustbin to detect nearby objects.






                  146   Premium Edition-VI
   143   144   145   146   147   148   149   150   151   152   153