Basic HTML Version

|  | Table of Contents |  | View Full Version

Page 155 - 2615_KEC
P. 155

    Movement Commands:
     HANDS-ON PROJECT        o  Based on the DATA value, control the movement of the car:

                                     ‘f’ (Forward): Move the car forward.
     PROJECT NAME: Building a Bluetooth-Controlled 4-Wheel Car with Micro:bit
                                     ‘b’ (Backward): Move the car backward.
     Objective: Students will build a 4-wheel car using a readymade chassis, a Micro:bit, Bluetooth,
     servo motors and a GPIO board. They will use Bluetooth commands to control the car’s movement.     ‘l’ (Left): Turn the car left.

     Materials Required:             ‘r’ (Right): Turn the car right.

       ∑  Micro:bit (with inbuilt Bluetooth)     ‘s’ (Stop): Stop the car.
       ∑  Continuous servo motors (4)     Servo Control:

       ∑  GPIO board         o  Use the continuous servo blocks to control the servo motors for each direction:
       ∑  Breadboard                 ‘f’: Run all four motors at speed 50 for forward movement.

       ∑  Jumper wires               ‘b’: Run all four motors at speed 50 for backward movement.

       ∑  Readymade chassis (to mount the motors and wheels)     ‘l’: Run the left motors in reverse for turning left.
       ∑  Mobile device with Bluetooth capability     ‘r’: Run the right motors in reverse for turning right.

       ∑  Micro:bit extension for Bluetooth     ‘s’: Stop all motors.

     Step-By-Step Instructions:

     1.  Assemble the 4-Wheel Car with Readymade Chassis:
        Begin by assembling the 4-wheel car using the readymade chassis.

        Attach the 4 continuous servo motors (2 for the front wheels and 2 for the back wheels) to
     the chassis.
        Mount the wheels to the servo motors and ensure they rotate freely.

     2.  Set-up Micro:bit with Bluetooth:

        Open the MakeCode Editor for Micro:bit and create a new project.
        From the Extensions menu, add the Bluetooth extension to your project.

     3.  Writing the Code:

        Initialize Bluetooth:
        o    Use the bluetooth uart service block to initiate Bluetooth communication when the
     program starts.

        Code Blocks Explanation:

        o   On Bluetooth  Connected:  Display  ‘C’  on the  Micro:bit  screen  when the  Bluetooth
     connects.
        o  On Bluetooth Disconnected: Display ‘D’ when Bluetooth is disconnected.

        Receiving Bluetooth Data:
        o   Use the on data received block to capture data from the mobile device and store it in
     a variable called DATA.

                                                                                     IoT and Smart Motions with Micro:bit  153

| 150 151 152 153 154 155 156 157 158 159 160 |