Keyestudio Micro:bit Mini Smart Robot Car V2 Instructions Manual Download Page 104

78

Programming Thinking

1

Set the control pin of left infrared obstacle avoiding sensor to P2; the right one set to P11.

2

Measure the HIGH/LOW level of both sensors’ control end. Obstacle detected, signal end LOW; no

obstacle, signal end HIGH.

3

Judge whether there is obstacles according to the level feedback of sensor’s signal end; make the

micro:bit LED matrix show the patterns.

Source Code

Summary of Contents for Micro:bit Mini Smart Robot Car V2

Page 1: ...Micro bit Mini Smart Robot Car V2...

Page 2: ...tep 2 Program It 9 Step 3 Download It 11 Step 4 Play It 12 7 micro bit Pins 14 8 Get Knowledge of Micro bit Shield Elements Playing Music 21 Micro bit LED Matrix Display 24 RGB Light Cycle 27 RGB Ligh...

Page 3: ...ild an Obstacle Avoiding Robot 81 How to Build an Object Following Robot 85 Infrared Remote Control 90 How to Build an Infrared Remote Control Robot 105 11 Bluetooth Controlling Robot Andriod Bluetoot...

Page 4: ...ce line following as well as infrared and Bluetooth control functions It comes with a passive buzzer for playing music a KEYES 2812 18R module for controlling 18 RGB LED colors a photocell for detecti...

Page 5: ...wer supply with a capacity greater than or equal to 1A 3 Maximum power maximum output power is 10W 4 Operating temperature range 0 50 degrees Celsius 5 Dimensions 120 90 7mm 6 Environmental attributes...

Page 6: ...3 No Item Quantity Image 1 Micro bit robot bottom shield V2 Black and Eco friendly 1 2 Acrylic pack of 3 pieces T 3MM 1...

Page 7: ...4 ultrasonic sensor 1 4 KEYES 2812 18R Module welded with yellow curved pin 1 5 N20 motor wheel diameter 43mm width 19mm hole diameter 3mm type D ABS plastic rubber yellow 2 6 steel universal wheel W2...

Page 8: ...5 7 M1 6 10MM round head screw 8 8 M3 6MM round head screw 8 9 M1 6 304 stainless steel nut 8 10 Double pass M3 35MM hex copper pillar 4 11 M3 10MM flat head screw 1 12 M3 Nickel plated nut 1...

Page 9: ...4 M2 Nickel plated nut 6 15 yellow black handle 3 40MM phillips screwdriver 1 16 USB Cable A MICRO OD 4 0 black L 1 2m eco friendly 1 17 Male to female jumper wire 10CM random color 3 18 Male to femal...

Page 10: ...assembly components before install the micro bit robot a Next let s begin to install the wheel on Micro bit bottom shield Prepare well universal wheel two yellow wheels 4pcs M3 6MM round head screws...

Page 11: ...2 b To begin with should use two screws of universal wheel to mount the wheel on the bottom shield...

Page 12: ...3 The front and back view are shown as below picture...

Page 13: ...4 After that install two yellow wheels into the shield s motor c Mount the 4pcs M3 6MM round head screws and 4pcs dual pass M3 35MM hex copper pillars onto the bottom shield...

Page 14: ...5...

Page 15: ...Two Acrylic plates Ultrasonic module KEYES 2812 18R module Micro bit main board 6pcs M1 6 10MM round head screws 6pcs M1 6 304 stainless steel nuts 4pcs M3 6MM round head screws 1pcs M3 10MM flat head...

Page 16: ...7 At first fix the KEYES 2812 18R module on the Acrylic plate with 2pcs M1 6 10MM round head screws and 2pcs M1 6 304 stainless steel nuts...

Page 17: ...8...

Page 18: ...9 Then mount the HC SR04 ultrasonic module on the Acrylic plate with 4pcs M1 6 10MM round head screws and 4pcs M1 6 304 stainless steel nuts...

Page 19: ...10 Installed well fix the two Acrylic plates together with 1pcs M3 10MM flat head screw and 1pcs M3 nickel plating nut...

Page 20: ...11...

Page 21: ...12 e Finally you should get the parts below...

Page 22: ...13...

Page 23: ...the KEYES 2812 18Rmodule and HC SR04 ultrasonic module to the bottom shield with F M jumper wires KEYES 2812 18R module Micro bit shield G G V V DI D5 HC SR04 ultrasonic module Micro bit shield GND G...

Page 24: ...15...

Page 25: ...16 The final step is to mount the Acrylic plates on the 4pcs dual pass M3 35MM hex copper pillars of micro bit bottom shield with 4pcs M3 6MM round head screws...

Page 26: ...17 Insert the micro bit main board into bottom shield Congrats The fantastic micro bit robot is installed well...

Page 27: ...on Next let s install the driver for micro bit main board 1 First of all connect the micro bit to your computer using a USB cable 2 Then double click the driver software to install it Here you can cli...

Page 28: ...2...

Page 29: ...3 3 After that click Next to continue the installation...

Page 30: ...4 4 Wait the driver installing finished...

Page 31: ...5 5 Completing the driver installation...

Page 32: ...6 6 Driver installation completed then you can right click the Computer Properties Device Manager...

Page 33: ...7 You can check the detailed Ports information shown as below...

Page 34: ...8 6 micro bit Example Use Step 1 Connect It Connect the micro bit to your computer via a micro USB cable Your micro bit will show up on your computer as a drive called micro bit...

Page 35: ...Program It Use micro bit MakeCode Block editor https makecode micro bit org to write your first micro bit code You can drag and drop some example blocks and try your program on the Blocks Editor Show...

Page 36: ...10 Click the JavaScript you can see the corresponding program code Shown as below figure...

Page 37: ...load It Click the Download button in the editor This will download a hex file which is a compact format of your program that your micro bit can read Here you can name the project as LED1 then click Sa...

Page 38: ...st like copying a file to a USB drive On Windows you can right click the downloaded file and choose Send To micro bit Step 4 Play It The micro bit will pause and the yellow 5 5 LED on the back of the...

Page 39: ...13 You can power it using USB cable or battery The battery holder should connect two 1 5V AA batteries...

Page 40: ...onnector of the board which we refer to as pins The edge connector is the gray area on the right side of the figure below There are five large pins that are also connected to holes in the board labele...

Page 41: ...15...

Page 42: ...ttp micro bit org Micro bit MakeCode Block Editor https makecode micro bit org Meet micro bit starter programming http micro bit org guide BBC micro bit Features Guide http micro bit org guide feature...

Page 43: ...17...

Page 44: ...18...

Page 45: ...19 Get Started with Micro bit Robot Projects...

Page 46: ...20 Get Knowledge of Micro bit Shield Elements...

Page 47: ...e it beep Instead you need to use square waves whose frequency is between 2K and 5K to drive it Different frequencies produce different sounds You can use micro bit to code the melody of a song quite...

Page 48: ...22 Birthday...

Page 49: ...code to micro bit main board then insert the micro bit main board into the micro bit robot shield Connect a 18650 battery to the shield and turn the POWER and BUZZER switch ON You should hear the micr...

Page 50: ...vidually programmable LEDs allowing you to display text numbers and images The micro bit MakeCode Block editor has built in library So you can use it to control the 25 LED lights on and off showing th...

Page 51: ...25 Source Code...

Page 52: ...26 What will you see Send well the test code to micro bit main board powered on the micro bit 25 LED lights show a big heart for one second then show a small heart image for one second repeatedly...

Page 53: ...12 18R module comes with 18 WS2812 LED lights and a yellow pin header fully compatible with micro bit main board In this circuit we are going to control 18 WS2812 LEDs displaying different status by u...

Page 54: ...fore setting the test code you need to add the libraries Follow the instructions below Open the micro bit Software MakeCode editor https makecode micro bit org Click to add New Project then you will s...

Page 55: ...29 Then click Advanced find the Extensions to add file...

Page 56: ...30 Search neopixel then add the library file...

Page 57: ...31...

Page 58: ...32 Library added well you should see the Neopixel on the Blocks interface...

Page 59: ...33 Test code 1 You can drag the code file to the MicrosoftMakeCode window...

Page 60: ...shield Connect a 18650 battery to the shield and turn the POWER switch ON You should see the 18 RGB LEDs on the KEYES 2812 18R module are all turned on changing with seven colors separately and circu...

Page 61: ...directly send to micro bit main board If upload the test code 2 18 RGB LEDs flash with colorful light turning a round and then off If upload the test code 3 18 RGB LEDs turn circle one circle of one...

Page 62: ...rces we will use a PCA9685PW chip to drive the two RGB lights In the circuit Pin LED 4 of PCA9685PW chip is used to control the blue light of RGB pin LED 5 controls the green light while pin LED 6 con...

Page 63: ...fore setting the test code you need to add the libraries Follow the instructions below Open the micro bit Software MakeCode editor https makecode micro bit org Click to add New Project then you will s...

Page 64: ...38 Then click Advanced find the Extensions to add file...

Page 65: ...39 Enter https github com jdarling pxt pca9685 and search...

Page 66: ...40 Then you will get the pca9685 below...

Page 67: ...41 Click the pca9685 to download the extension...

Page 68: ...42 Finally you should see the PCA9685 project is added successfully...

Page 69: ...43 Test code 1...

Page 70: ...44 Test code 2...

Page 71: ...ard into the micro bit robot shield Connect a 18650 battery to the shield and turn the POWER switch ON The two RGB LEDs on the robot shield flash in three colors red green and blue With the same metho...

Page 72: ...oto resistor Photovaristor is a resistor whose resistance varies with different incident light strength In the project we will use the photocell sensor to detect the ambient light intensity controllin...

Page 73: ...47 Source Code Note here involves KEYES 2812 18R RGB module Before setting the test code you need to add the libraries Follow the instructions mentioned above RGB Light Cycle...

Page 74: ...icro bit main board then insert the micro bit main board into the micro bit robot shield Connect a 18650 battery to the shield and turn the POWER switch ON The 18 WS2812 LEDs are turned on The darker...

Page 75: ...G chip through PCA9685PW chip then control the moving direction and speed of two DC motors by TB6612FNG chip Pin LED1 and LED2 of PCA9685PW chip are separately used to control the direction and speed...

Page 76: ...0 motor turns forward set to 100 motor turns reverse In the code LED2 and LED4 are setting the motor s speed in the range of 0 100 The greater the value the faster the speed Below table is the running...

Page 77: ...or control direction of right motor LED3 control speed of right motor LED4 Right motor Forward 0 100 Turn forward 0 100 Turn forward Backward 100 50 Turn backward 100 50 Turn backward Stop 0 0 Stop 0...

Page 78: ...52 Source Code Note here need to drive PCA9685PW chip Before setting the test code you need to add the libraries Follow the instructions mentioned above RGB Light Test...

Page 79: ...nsert the micro bit main board into the robot shield and connect a 18650 battery Turn the POWER switch ON The micro bit robot will go forward for 2 seconds backward for 2 seconds stop for 1 seconds tu...

Page 80: ...54 Line Tracking Robot...

Page 81: ...e different reflectivity of infrared light to the color then convert the strength of the reflected signal into a current signal During the process of detection black is active at HIGH level but white...

Page 82: ...56...

Page 83: ...57 Source Code...

Page 84: ...racking sensor detects an obstacle the micro bit LED matrix will show at the left side When the right tracking sensor detects an obstacle the micro bit LED matrix will show at the right side When both...

Page 85: ...ing What is line tracking Line tracking is exactly what it sounds like following the track The robot can always stay on its black track How does it work It uses the tracking sensor to detect the black...

Page 86: ...812 18R module to turn on 18 RGB LEDs in various colors 2 Judge white and black line by both side line tracking sensors 3 If right side tracking sensor detects black line robot turns right if left sid...

Page 87: ...61...

Page 88: ...8650 battery and turn the POWER switch ON The micro bit robot will move forward along the black track Note 1 The width of black track should be greater than the distance between the two tracking senso...

Page 89: ...63 Ultrasonic Following Robot...

Page 90: ...requency If these ultrasonic signals hit other objects on the flight path they will be reflected back immediately After receive the returned information the bats complete the whole process of listenin...

Page 91: ...ge of sensitivity no blind area and no interference with obstacles As the following picture shown it is our keyestudio ultrasonic module It has two something like eyes One is transmitting end the othe...

Page 92: ...66...

Page 93: ...nds eight square waves of 40khz to automatically detect whether there is a signal return back 3 There is a signal return through the IO output a High level and the duration period of High level is the...

Page 94: ...68 Source Code...

Page 95: ...bstacle and ultrasonic module is less than 10cm the passive buzzer on micro bit shield will beep up Note Open the Arduino IDE select the proper board and COM port then open serial monitor and set the...

Page 96: ...70...

Page 97: ...trasonic module combined with micro bit robot shield to build an ultrasonic obstacle following robot How does it work The principle is very simple We will use an ultrasonic module to measure the dista...

Page 98: ...on purple light robot stops 18 RGB LEDs turn on red light 2 Measure the distance between the robot and obstacles using an ultrasonic sensor 3 When the measured distance is greater than or equal to 10...

Page 99: ...73...

Page 100: ...main board into the robot shield and connect a 18650 battery Turn the POWER switch ON The 18 RGB LEDs on the KEYES 2812 18R module will emit different colors The micro bit robot will follow along the...

Page 101: ...75 Obstacle Avoiding And Following Robot...

Page 102: ...ertain frequency When the detection direction encounters an obstacle reflecting surface the infrared rays are reflected back and receiving tube will receive it At this time the indicator SIG1 SIG2 LED...

Page 103: ...77...

Page 104: ...the right one set to P11 2 Measure the HIGH LOW level of both sensors control end Obstacle detected signal end LOW no obstacle signal end HIGH 3 Judge whether there is obstacles according to the leve...

Page 105: ...79...

Page 106: ...robot shield can detect an obstacle ahead If both infrared sensors do not detect obstacles the LED matrix will show an upward arrow If both infrared sensors detect obstacles the LED matrix will show...

Page 107: ...s it work The principle is very simple We will use an ultrasonic module to measure the distance between the micro bit robot and an obstacle ahead Then detect the left and right side obstacles using in...

Page 108: ...ot moves forward if obstacles are at right side but not left side robots turn left if obstacles are at left side but not right side robots turn right if both sides have obstacles robot will go back fo...

Page 109: ...83 Source Code...

Page 110: ...nd the test code to micro bit main board then insert the micro bit main board into the robot shield and connect a 18650 battery Turn the POWER switch ON The micro bit robot is ready to avoid an obstac...

Page 111: ...another upgraded capability Object Following Combine ultrasonic module infrared detector sensor and robot shield to build an obstacle following robot that can turn around How does it work The princip...

Page 112: ...frared detector sensors to detect the obstacles on both sides of micro bit robot 3 When the measured distance is greater than 3cm but less than or equal to 6cm no obstacles at both sides micro bit rob...

Page 113: ...87 Source Code...

Page 114: ...d the test code to micro bit main board then insert the micro bit main board into the robot shield and connect a 18650 battery Turn the POWER switch ON The micro bit robot will follow the front object...

Page 115: ...89 Infrared Control Robot...

Page 116: ...magine our world without it An infrared remote control can be used to control a wide range of home appliances such as television audio video recorders and satellite signal receivers Well in the follow...

Page 117: ...coding chip inside the remote controller It is composed of a pilot code user code data code and data inversion code The time interval between pulses is used to distinguish whether it is a signal 0 or...

Page 118: ...y is pressed The microcontroller is decoded by an received signal 0 or 1 to determine which key is pressed by the remote control Infrared Receiving The robot shield comes with infrared receiver module...

Page 119: ...93 1 Operating Voltage 3 3 5V DC 2 Output Signal Digital signal 3 Receiving Angle 90 degrees 4 Frequency 38khz 5 Receiving Distance 18m...

Page 120: ...fore setting the test code you need to add the libraries Follow the instructions below Open the micro bit Software MakeCode editor https makecode micro bit org Click to add New Project then you will s...

Page 121: ...95 Then click Advanced find the Extensions to add file...

Page 122: ...96 Enter https github com jhlucky maqueen and search...

Page 123: ...97 Then you will get the maqueen file below...

Page 124: ...98 Click the maqueen file to download the extension...

Page 125: ...99 Finally you should see the maqueen project is added successfully...

Page 126: ...100 Code...

Page 127: ...e button on the infrared remote controller the serial monitor will show the corresponding key value Note Open the Arduino IDE select the proper board and COM port then open serial monitor and set the...

Page 128: ...102...

Page 129: ...103...

Page 130: ...104 We have listed out the key value of infrared remote control See the figure below...

Page 131: ...ith tracking sensor and robot shield in the above project So in this circuit you can combine an infrared remote control and robot shield to build an infrared remote control robot The principle is inde...

Page 132: ...106 Source Code...

Page 133: ...the POWER switch ON Aimed at the infrared receiver head press the button on the infrared remote controller it can control the micro bit robot go front back turn right or turn left and stop Note durin...

Page 134: ...108 Key on IR remote control Robot status Move forward Move backward Turn left Turn right stop...

Page 135: ...109 Bluetooth Control Robot...

Page 136: ...odule with your mobile phone then use Bluetooth APP to control the external devices connected to micro bit main board The built in Bluetooth module can support both Andriod and IOS system But the use...

Page 137: ...u need to add the libraries Follow the instructions below Connect the micro bit main board to your computer using a USB cable Open the micro bit Software MakeCode editor https makecode micro bit org C...

Page 138: ...112...

Page 139: ...113 Then click Advanced find the Extensions to add file...

Page 140: ...114 Then click the Bluetooth...

Page 141: ...115 Select Remove extensions and add Bluetooth...

Page 142: ...116 Finally you should see the Bluetooth is added well...

Page 143: ...117 Then click the Extensions again enter the library link below and search https github com LaboratoryForPlayfulComputation pxt BlockyTalkyBLE UART...

Page 144: ...118 Finally you should see the library blocky Talky BLE is added successfully...

Page 145: ...119 Source Code Right click the source code to send to micro bit main board...

Page 146: ...link to download the Bluetooth APP https drive google com open id 1u_wXlpuRjcChpCcVPcIha4yWYWhefhW2 Installed well the Bluetooth APP click the icon to open the APP Once your phone detects Bluetooth m...

Page 147: ...121 No connecting the Bluetooth APP Micro bit main board will show a smile face on the LED matrix Then click the Bluetooth icon it will pop up the micro bit Bluetooth interface...

Page 148: ...122 Then click to connect the micro bit Bluetooth Bluetooth connected you will see the LED matrix on the Micro bit main board showing a heart image...

Page 149: ...ntrol Long press to operate release to stop Arrow for controlling the robot s moving direction Voice control Speak go back left right stop towards your Andriod phone to control the robot status Gravit...

Page 150: ...ert the micro bit main board into robot shield turn power switch on Follow the method mentioned above connect the Bluetooth on the micro bit main board using Bluetooth APP Bluetooth connected click th...

Page 151: ...ing and Control This section will introduce how to use wireless programming and control in IOS devices ipad iPhone Use Method is follows Step 1 Open the App store on your ipad iPhone Step 2 Search the...

Page 152: ...126...

Page 153: ...Pay close attention to Connect your micro bit main board to PC Open the micro bit Software MakeCode editor https makecode micro bit org click the icon select the Project Settings and no pairing requi...

Page 154: ...128...

Page 155: ...129 Step 3 open the micro bit interface click Choose micro bit...

Page 156: ...130 Then click Pair a micro bit and click Next...

Page 157: ...4 power on the micro bit main board HOLD the A and B buttons then press and release RESET button The micro bit main board will enter the Bluetooth pairing mode You should see an image showing on the L...

Page 158: ...132 Step 5 copy the pattern from your micro bit device and tap Next...

Page 159: ...133 Continue to tap Next to pair...

Page 160: ...134 OK pairing successful...

Page 161: ...135 Step 6 now go to control robot press the reset button on the micro bit main board then tap Create Code on the micro bit APP...

Page 162: ...136 Step 7 open the Microsoft MakeCode for micro bit click the icon select to open the Project Settings...

Page 163: ...137 Then you will see the interface below Close the option2 JustWorks pairing and open option1 No Pairing Required...

Page 164: ...138 Step 8 write the code...

Page 165: ...139 Wrote well click the triangle icon at the bottom left to change the name then click to save the code...

Page 166: ...140 Step 9 go to the Flash interface click the blue bar to flash code to micro bit Wait the process complete...

Page 167: ...141 OK Flashing successful...

Page 168: ...OS Bluetooth wireless programming and control Now let s move on to build an IOS Bluetooth control robot The method is almost the same We have packaged all the source code So you can drag the code file...

Page 169: ...143 Source Code...

Page 170: ...144 Use Method is follows Step 1 Right click the source code to send to micro bit main board Step 2 Open the App store on your ipad iPhone Search the micro bit to download and install...

Page 171: ...Pay close attention to Connect your micro bit main board to PC Open the micro bit Software MakeCode editor https makecode micro bit org click the icon select the Project Settings and no pairing requi...

Page 172: ...146...

Page 173: ...147 Step 3 open the micro bit interface click Choose micro bit...

Page 174: ...148 Then click Pair a micro bit and click Next...

Page 175: ...4 power on the micro bit main board HOLD the A and B buttons then press and release RESET button The micro bit main board will enter the Bluetooth pairing mode You should see an image showing on the L...

Page 176: ...150 Step 5 copy the pattern from your micro bit device and tap Next...

Page 177: ...151 Continue to tap Next to pair...

Page 178: ...152 OK pairing successful...

Page 179: ...153 Step 6 now go to control the robot press the reset button on the micro bit main board then tap Monitor and Control on the micro bit APP...

Page 180: ...154 Step 7 Tap the Add and then select the Gamepad...

Page 181: ...155 And you should see the control interface shown below Click Start to connect...

Page 182: ...156 Connection successful Click Stop to disconnect...

Page 183: ...ck Press key C turn left Press key D turn right Press Stop to disconnect the Bluetooth robot will stop Press key 1 robot stops Press key 2 robot stops to turn left 180 and then stop to go forward Pres...

Page 184: ...d the micro bit driver https drive google com open id 18g1tebO73kpHDqohhP2WWjmrWO7MvvrZ Download the Bluetooth APP https drive google com open id 1u_wXlpuRjcChpCcVPcIha4yWYWhefhW2 Download the User Gu...

Reviews: