background image

15

Содержание Micro:bit Mini Smart Robot Car V2

Страница 1: ...Micro bit Mini Smart Robot Car V2...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 11: ...2 b To begin with should use two screws of universal wheel to mount the wheel on the bottom shield...

Страница 12: ...3 The front and back view are shown as below picture...

Страница 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...

Страница 14: ...5...

Страница 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...

Страница 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...

Страница 17: ...8...

Страница 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...

Страница 19: ...10 Installed well fix the two Acrylic plates together with 1pcs M3 10MM flat head screw and 1pcs M3 nickel plating nut...

Страница 20: ...11...

Страница 21: ...12 e Finally you should get the parts below...

Страница 22: ...13...

Страница 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...

Страница 24: ...15...

Страница 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...

Страница 26: ...17 Insert the micro bit main board into bottom shield Congrats The fantastic micro bit robot is installed well...

Страница 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...

Страница 28: ...2...

Страница 29: ...3 3 After that click Next to continue the installation...

Страница 30: ...4 4 Wait the driver installing finished...

Страница 31: ...5 5 Completing the driver installation...

Страница 32: ...6 6 Driver installation completed then you can right click the Computer Properties Device Manager...

Страница 33: ...7 You can check the detailed Ports information shown as below...

Страница 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...

Страница 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...

Страница 36: ...10 Click the JavaScript you can see the corresponding program code Shown as below figure...

Страница 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...

Страница 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...

Страница 39: ...13 You can power it using USB cable or battery The battery holder should connect two 1 5V AA batteries...

Страница 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...

Страница 41: ...15...

Страница 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...

Страница 43: ...17...

Страница 44: ...18...

Страница 45: ...19 Get Started with Micro bit Robot Projects...

Страница 46: ...20 Get Knowledge of Micro bit Shield Elements...

Страница 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...

Страница 48: ...22 Birthday...

Страница 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...

Страница 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...

Страница 51: ...25 Source Code...

Страница 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...

Страница 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...

Страница 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...

Страница 55: ...29 Then click Advanced find the Extensions to add file...

Страница 56: ...30 Search neopixel then add the library file...

Страница 57: ...31...

Страница 58: ...32 Library added well you should see the Neopixel on the Blocks interface...

Страница 59: ...33 Test code 1 You can drag the code file to the MicrosoftMakeCode window...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 64: ...38 Then click Advanced find the Extensions to add file...

Страница 65: ...39 Enter https github com jdarling pxt pca9685 and search...

Страница 66: ...40 Then you will get the pca9685 below...

Страница 67: ...41 Click the pca9685 to download the extension...

Страница 68: ...42 Finally you should see the PCA9685 project is added successfully...

Страница 69: ...43 Test code 1...

Страница 70: ...44 Test code 2...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 80: ...54 Line Tracking Robot...

Страница 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...

Страница 82: ...56...

Страница 83: ...57 Source Code...

Страница 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...

Страница 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...

Страница 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...

Страница 87: ...61...

Страница 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...

Страница 89: ...63 Ultrasonic Following Robot...

Страница 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...

Страница 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...

Страница 92: ...66...

Страница 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...

Страница 94: ...68 Source Code...

Страница 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...

Страница 96: ...70...

Страница 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...

Страница 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...

Страница 99: ...73...

Страница 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...

Страница 101: ...75 Obstacle Avoiding And Following Robot...

Страница 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...

Страница 103: ...77...

Страница 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...

Страница 105: ...79...

Страница 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...

Страница 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...

Страница 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...

Страница 109: ...83 Source Code...

Страница 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...

Страница 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...

Страница 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...

Страница 113: ...87 Source Code...

Страница 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...

Страница 115: ...89 Infrared Control Robot...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 121: ...95 Then click Advanced find the Extensions to add file...

Страница 122: ...96 Enter https github com jhlucky maqueen and search...

Страница 123: ...97 Then you will get the maqueen file below...

Страница 124: ...98 Click the maqueen file to download the extension...

Страница 125: ...99 Finally you should see the maqueen project is added successfully...

Страница 126: ...100 Code...

Страница 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...

Страница 128: ...102...

Страница 129: ...103...

Страница 130: ...104 We have listed out the key value of infrared remote control See the figure below...

Страница 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...

Страница 132: ...106 Source Code...

Страница 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...

Страница 134: ...108 Key on IR remote control Robot status Move forward Move backward Turn left Turn right stop...

Страница 135: ...109 Bluetooth Control Robot...

Страница 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...

Страница 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...

Страница 138: ...112...

Страница 139: ...113 Then click Advanced find the Extensions to add file...

Страница 140: ...114 Then click the Bluetooth...

Страница 141: ...115 Select Remove extensions and add Bluetooth...

Страница 142: ...116 Finally you should see the Bluetooth is added well...

Страница 143: ...117 Then click the Extensions again enter the library link below and search https github com LaboratoryForPlayfulComputation pxt BlockyTalkyBLE UART...

Страница 144: ...118 Finally you should see the library blocky Talky BLE is added successfully...

Страница 145: ...119 Source Code Right click the source code to send to micro bit main board...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 152: ...126...

Страница 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...

Страница 154: ...128...

Страница 155: ...129 Step 3 open the micro bit interface click Choose micro bit...

Страница 156: ...130 Then click Pair a micro bit and click Next...

Страница 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...

Страница 158: ...132 Step 5 copy the pattern from your micro bit device and tap Next...

Страница 159: ...133 Continue to tap Next to pair...

Страница 160: ...134 OK pairing successful...

Страница 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...

Страница 162: ...136 Step 7 open the Microsoft MakeCode for micro bit click the icon select to open the Project Settings...

Страница 163: ...137 Then you will see the interface below Close the option2 JustWorks pairing and open option1 No Pairing Required...

Страница 164: ...138 Step 8 write the code...

Страница 165: ...139 Wrote well click the triangle icon at the bottom left to change the name then click to save the code...

Страница 166: ...140 Step 9 go to the Flash interface click the blue bar to flash code to micro bit Wait the process complete...

Страница 167: ...141 OK Flashing successful...

Страница 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...

Страница 169: ...143 Source Code...

Страница 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...

Страница 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...

Страница 172: ...146...

Страница 173: ...147 Step 3 open the micro bit interface click Choose micro bit...

Страница 174: ...148 Then click Pair a micro bit and click Next...

Страница 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...

Страница 176: ...150 Step 5 copy the pattern from your micro bit device and tap Next...

Страница 177: ...151 Continue to tap Next to pair...

Страница 178: ...152 OK pairing successful...

Страница 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...

Страница 180: ...154 Step 7 Tap the Add and then select the Gamepad...

Страница 181: ...155 And you should see the control interface shown below Click Start to connect...

Страница 182: ...156 Connection successful Click Stop to disconnect...

Страница 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...

Страница 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...

Отзывы: