Ks0356 keyestudio Micro:bit Mini Smart Robot Car

From Keyestudio Wiki
Jump to navigation Jump to search
File:KS0356.png
Keyestudio Micro:bit Mini Smart Robot Car

Product Description

Here comes the educational robot based on Micro:bit programming. Micro: bit is an ARM structure microcontroller designed by BBC. It is only half size of a credit card, onboard comes with Bluetooth, accelerometer, compass, three buttons, 5x5 LED matrix, mainly used for teens programming education. The Micro:bit Mini Smart Robot Car integrates ultrasonic and infrared obstacle avoidance as well as line following. Also comes with a passive buzzer for playing music. Moreover, supply the power by 18650 batteries, supporting charge when run out of power. You will be able to adjust the motor speed. This micro:bit robot is a perfect toy for kids to start learning robotics. The plug-and-play allow children to quickly learn graphic programming in entertaining, nurturing children's interest in science and logical thinking.


Specifications

  • Voltage: 4.2-5.5V
  • Current: USB power supply or power supply with a capacity greater than or equal to 1A
  • Maximum power: maximum output power is 5W
  • Operating temperature range: 0-50 degrees Celsius
  • Dimensions: 120*90.7mm
  • Environmental attributes: ROHS


Packing List

No. Specification Quantity Picture
1 Micro:bit main board black 1
thumb
2 keyestudio Micro:bit smart robot shield (Black and Eco-friendly) 1
thumb
3 USB cable A/MICRO OD: 4.0 Black with magnetic spring L=1.2m Eco-friendly 1
thumb
4 Keyestudio line tracking sensor (Black and Eco-friendly) 1
thumb
5 HC-SR04 ultrasonic sensor 1
thumb
6 JST PH2.0MM-5PIN double-head cable length 55MM 1
thumb
7 W420 steel universal wheel 1
thumb
8 N20 motor wheel diameter:43mm ; width: 19mm ; hole diameter: 3mm type DABS plastic + rubber yellow 2
thumb
9 M3 Nickel plated nut 2
thumb
10 Single pass M3*6mm+6mm hex copper pillar 2
thumb
11 M3*6MM round-head screw 2
thumb
12 yellow-black handle 3*40MM phillips screwdriver 1
thumb


Installation Method

a. Firstly prepare all the assembly components. Place them together before install the micro:bit robot car.
thumb

b. The first step should mount 2pcs hex copper pillar and 2pcs M3 Nickel plated nut on the front of car shield.
thumb

c. Connect the JST PH2.0MM-5PIN double-head cable to line tracking sensor.
thumb

d. Then fix the line tracking sensor and W420 steel universal wheel onto the hex copper pillar on the car shield using 2pcs M3*6MM round-head screws.
thumb thumb

e. After that, mount the 2pcs N20 motor wheels into the DC motor.
thumb thumb

f. Now, we insert the ultrasonic sensor and micro:bit main board into the car shield.
thumb thumb

g. Connect the JST PH2.0MM-5PIN cable connected to line tracking sensor to the car shield.
thumb

h. Finally, insert the 18650 battery into the car shield.
thumb

i. Congrats! The mini micro:bit robot car is installed well. Pretty simple.


micro:bit Driver Installation

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.
thumb

2)Then, double click the driver software to install it. Here you can click the icon below to download it.thumb

thumb

3) After that, click Next to continue the installation.
thumb

4) Wait the driver installing finished.
thumb

5) Wait the driver installing finished.
thumb

6) Driver installation completed, then you can right click the “Computer” —> “Properties”—> “Device Manager”.
thumb
You can check the detailed Ports information shown as below.
thumb

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 'MICROBIT'. 
thumb

Step 2: Program It

Using micro bit MakeCode Block editor https://makecode.microbit.org/, write your first micro:bit code.
You can drag and drop some example blocks and try your program on the Simulator in the Javascript Blocks Editor, like in the image below.
thumb

Click the JavaScript, you can see the corresponding program code. Shown as below figure.
thumb

Step 3: Download 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 “Save”. Shown below.
thumb

Once the hex file has downloaded, copy it to your micro:bit just like copying a file to a USB drive. On Windows find the microbit-LED1 file, you can right click and choose "Send To→MICROBIT."
thumb

thumb

Step 4: Play It

The micro:bit will pause and the yellow 5*5 LED on the back of the micro:bit will display the images while your code is programmed.
thumb

You can power it using USB cable or battery. The battery holder need to connect two 1.5V AA batteries. Shown below.
thumb


micro:bit Pins

Before getting started with the following projects, first need to figure out each pin of micro:bit main board. Please refer to the reference diagram shown below.
thumb
The BBC micro:bit has 25 external connections on the edge connector of the board, which we refer to as ‘pins’. The edge connector is the grey area on the right side of the figure above. There are five large pins, that are also connected to holes in the board labelled: 0, 1, 2, 3V, and GND. And along the same edge, there are 20 small pins that you can use when plugging the BBC micro:bit into an edge connector.

Note that it read from the BBC micro:bit official website. More reference you can click the link below:
BBC micro bit Pins: http://microbit.org/guide/hardware/pins/
BBC micro:bit website: http://microbit.org/
Micro bit MakeCode Block Editor: https://makecode.microbit.org/
Meet micro:bit starter programming: http://microbit.org/guide/
BBC micro:bit Features Guide: http://microbit.org/guide/features/
BBC micro:bit Safety Warnings: http://microbit.org/guide/features/
BBC micro:bit Quick Start Guide: http://microbit.org/guide/quick/

thumb thumb


Learning Projects

Playing Music

Description Buzzers can be categorized as active and passive ones. The difference between the two is that an active buzzer has a built-in oscillating source, so it will generate a sound when electrified. A passive buzzer does not have such a source, so DC signal cannot drive 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 fun and simple. The keyestudio Micro:bit robot shield comes with a passive buzzer element. The signal terminal of buzzer is connected to the P9 interface of micro:bit main board. In the experiment, we make use of the software built-in library to drive the passive buzzer play a song of Happy Birthday.
thumb


Test Code
thumb


Test Result Send well the test 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 micro:bit robot shield playing a song of《Happy Birthday》

Micro:bit LED Matrix Display

Description LED stands for Light Emitting Diode. The micro:bit has 25 individually-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 the different images. In the experiment, we drive the 25 LED lights show a big heart and a small heart images.


Test Code
thumb


Test Result
thumb


Motor Driving

Description The micro:bit robot shield has a built-in TB6612FNG chip. When using, you just need to insert the micro:bit main board into the shield, and send the test code to micro:bit main board. Insert well the 18650 battery into the shield to control the two motors rotate, thus control the micro:bit car run.

Below is a table of TB6612FNG chip pins (PWM range of 0~1023)
thumb


Test Code
thumb


Test Result Send well the test code to micro:bit main board, then insert the micro:bit main board into the car shield, and connect a 18650 battery into the car shield. Turn the POWER switch ON. The micro:bit car will go forward for 3 seconds, backward for 3 seconds, stop for 3 seconds, turn left for 3 seconds and turn right for 3 seconds, repeatedly.

Line Tracking

Test the tracking sensor

Description The tracking sensor is actually an infrared sensor. The component used here is the TCRT5000 infrared tube. Its working principle is to use the 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 LOW level, but white is active at High level.

The following picture is our keyestudio line tracking sensor designed for Micro:bit robot car. We have integrated 3 sets of TCRT5000 infrared tube on a single board, pretty convenient for wiring and controlling.
thumb


TECH SPECS

  • Operating Voltage: 3.3-5V(DC)
  • Interface: 5Pin connector
  • Output Signal: digital signal


Test Code
thumb


Test Result Send the test code to micro:bit main board, then insert the micro:bit main board into the car shield and connect a 18650 battery, turn the POWER switch ON. At this moment, the micro:bit LED matric has no display. But if approach your finger to the first tracking sensor (S1), the LED matrix will showⅠin the middle; Approach your finger to the second tracking sensor (S2), the LED matrix will showⅡ; Approach your finger to the third tracking sensor (S3), the LED matrix will show Ⅲ;
thumb thumb thumb


Line Tracking Car

Description In the previous section, we have introduced the principle and application of line tracking module and motor driving. After that, combine the tracking sensor and module to build a line following car. So at first what does line tracking mean? It refers to follow the line trajectory. You might often see some robots always follow or track a black line.


How does it work? It uses the tracking sensor to detect the black track on the pavement, and detection signal will feed back to the micro:bit main board. Then micro:bit main board will analyze and judge the collected signals to control and drive the motor in time, thus can adjust the car’s turning direction. That is why the micro:bit car can automatically follow the black track, achieving the automatic line tracking function.


Programming Thinking At first judge the middle tracking sensor. If it detects a black line, no matter detect a black line on either side, the micro:bit car always goes forward. If the middle tracking sensor does not detect a black line, then judge the sensor on both sides. If the left sensor detects a black line, but the right sensor doesn’t, the micro:bit car will turn left; If the right sensor detects a black line, but the left sensor doesn’t, the micro:bit car will turn right; If all three sensors do not detect a black line, the micro:bit car will stop.


Test Code
thumb


Test Result Send the test code to micro:bit main board, then insert the micro:bit main board into the car shield and connect a 18650 battery, turn the POWER switch ON. At this moment, the micro:bit mini robot car will follow a black line.

Special Note: When testing the car, do not test it under the sun. During the test, if go wrong, you can try to test it in a darker environment.
thumb


Ultrasonic Avoiding Obstacles

Ultrasonic Ranging

Description There is an animal called bat in nature. The bats can fly at night, not depend on its eyes, but on its ears and vocal organs. When the bat flies, it will emit a scream, an ultrasonic signal that humans cannot hear because of its high audio frequency. 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 listening, seeing, calculating and bypassing obstacles during the flutter.
thumb
The principle of the ultrasonic module is as the same as the above principle. The ultrasonic module will emit the ultrasonic waves after trigger signal. When the ultrasonic waves encounter the object and are reflected back, the ultrasonic module outputs an echo signal, so it can determine the distance of object from the time difference between trigger signal and echo signal. Ultrasonic sensor has a wide range of sensitivity, no blind area, and no interference with obstacles. As the following picture shown, it is our keyestudio ultrasonic module. It has two somethings like eyes. One is transmitting end, the other is receiving end.
thumb


TECH SPECS

  • Operating Voltage: 5V(DC)
  • Operating Current: 15mA
  • Operating Frequency: 40khz
  • Maximum Detection Distance: 3-5m
  • Minimum Detection Distance: 3-4cm
  • Sensing Angle: less than 15 degrees


Test Code
thumb


Test Result Send the test code to micro:bit main board, then insert the micro:bit main board into the car shield and connect a 18650 battery, turn the POWER switch ON. At this moment, when the micro:bit mini robot car detects an obstacle ahead, the measured result will be showed on the micro:bit LED matrix. If the measured distance between an obstacle and ultrasonic module is less than 10cm, the micro:bit LED matrix will show a big prismatic image; If the measured distance is greater than 10cm, the micro:bit LED matrix will show a small prismatic image.
thumb thumb


Ultrasonic Obstacle Avoiding Car

Description In the previous project, we have combined a tracking sensor and micro:bit car shield to build a line tracking car. Here we combine a ultrasonic module and micro:bit car shield to build an ultrasonic obstacle avoiding car. How does it work? We have introduced the principle of ultrasonic module before. We can use a ultrasonic module to measure the distance between the micro:bit car and an obstacle ahead. Then control the running state of micro:bit robot car according to the measured distance.
thumb


Programming Thinking At first, use a ultrasonic module to measure the distance between the micro:bit car and an obstacle ahead. When the measured distance is less than 10cm, the micro:bit car stops for 0.2 second, then turns left for 0.5 second and then goes forward. If the measured distance is greater than or equal to 10cm, the micro:bit car will directly go forward.


Test Code
thumb


Test Result Send the test code to micro:bit main board, then insert the micro:bit main board into the car shield and connect a 18650 battery, turn the POWER switch ON. At this moment, if the micro:bit robot car encounters an obstacle ahead, it will turn left to a certain angle, then go forward.
thumb


Infrared Avoiding Obstacles

Infrared Detection

Description The micro:bit robot car shield comes with two infrared obstacle detector sensors. It is actually designed for infrared obstacle avoidance robot. The infrared obstacle detector sensor has a pair of infrared transmitting and receiving tubes. The transmitter emits an infrared rays of a certain 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) lights up. After processed by the circuit, the signal output terminal will output Digital signal. You can rotate the potentiometer on the shield to adjust the detection distance. It is better to adjust the potentiometer to make the SIG1/SIG2 LED in a state between on and off. The detection distance is the best, almost 10cm.
thumb


Test Code
thumb


Test Result Send the test code to micro:bit main board, then insert the micro:bit main board into the car shield and connect a 18650 battery, turn the POWER switch ON. The two infrared obstacle detector sensors on the micro:bit mini robot car can used to detect an obstacle ahead.

  • If the infrared sensors on both side do not detect an obstacle, the LED matrix will show a big heart image.
  • If the infrared sensors on both side detect an obstacle, the LED matrix will show a small heart image.
  • If the left infrared sensor detects an obstacle, but the right sensor doesn’t, the left column of LED matrix will light up.
  • If the right infrared sensor detects an obstacle, but the left sensor doesn’t, the right column of LED matrix will light up.


thumb thumb
thumb thumb


Infrared Obstacle Avoiding Car

Description In the previous project, we have combined sensor and micro:bit car shield to build a specific function car. Now, we use an infrared obstacle detector module and motor driving circuit on the micro:bit car shield to build an infrared obstacle avoiding car.

How does it work? We have introduced the principle of infrared obstacle detector module before. We can make use of two infrared obstacle detector modules integrated on the car shield to detect whether have obstacles on the both sides of micro:bit car. Thus control the car’s running state according to the testing interface.


Programming Thinking If detects an obstacle on the left side but not on the right side, the car will turn right for 0.05 second. If detects an obstacle on the right side but not on the left side, the car will turn left for 0.1 second. If detects no obstacle at both sides, the car will go forward. If detects obstacles at both sides, the car will stop for 0.5 second, then go backward for 0.2 second and then turn left for 0.5 second.


Test Code
thumb


Test Result Send the test code to micro:bit main board, then insert the micro:bit main board into the car shield and connect a 18650 battery, turn the POWER switch ON. The left infrared sensor on the car shield detects an obstacle, the car will turn right at a certain angle and then go forward. The right infrared sensor on the car shield detects an obstacle, the car will turn left at a certain angle and then go forward. If both of them detect no obstacle, the car will go forward. If both of them detect obstacles, the car will stop, then go backward, turn left at a certain angle and then go forward.

Ultrasonic and Infrared Avoiding Obstacles

Description In the previous sections, we have introduced ultrasonic obstacle avoiding car and infrared obstacle avoiding car. To be more accurate, this lesson we combine both ultrasonic module and infrared obstacle detector sensors to build an obstacle avoiding car.


Programming Thinking ① When the distance between the car and front obstacle is less than or equal to 10cm, the robot car will stop, passive buzzer beeps for 0.5 second, mini car will go backward for 0.2 second, and then turn left for 0.3 second. ② When the distance between the car and front obstacle is greater than 10cm, use two infrared obstacle detector modules on the car shield to detect whether there is obstacles on the front left or on the front right.

  • If detects an obstacle on the left side but not on the right side, the car will turn right.
  • If detects an obstacle on the right side but not on the left side, the car will turn left.
  • If detects no obstacle at both sides, the car will go forward.
  • If detects obstacles at both sides, the car will stop, passive buzzer will beep for 0.5 second, then robot car goes backward for 0.2 second and then turns left for 0.3 second.


Test Code
thumb


Test Result Send the test code to micro:bit main board, then insert the micro:bit main board into the car shield and connect a 18650 battery, turn the POWER switch ON. When the front obstacle distance measured by ultrasonic sensor is greater than 10cm.

  • If detects an obstacle on the left side but not on the right side, the car will turn right at a certain angle then go forward.
  • If detects an obstacle on the right side but not on the left side, the car will turn left at a certain angle then go forward.
  • If detects no obstacle at both sides, the car will go forward.
  • If detects obstacles at both sides, the car will stop, passive buzzer will produce an audible beep, after 500ms, robot car goes backward, after 200ms, turns left at a certain angle and then goes forward.

When the front obstacle distance measured by ultrasonic sensor is less than or equal to 10cm, the car will stop, passive buzzer will produce an audible beep, after 500ms, robot car goes backward, after 200ms, turns left at a certain angle and then goes forward.
thumb


Bluetooth Controlled Car

Bluetooth Test

Description The micro:bit robot car shield comes with a Bluetooth module. We can use the built-in Bluetooth module to communicate with your phone’s APP, thus control the external devices connected to micro:bit control board using APP. In the experiment, we only use the phone’s APP to control the LED matrix on the micro:bit main board, showing the different characters. (note that when controlled by Bluetooth, use leds show matrix drawing module, easy to crash.)


Library link settings The micro:bit robot car shield comes with a Bluetooth module. Before sending the test code, we should add the library to micro:bit on the browser. The method is as below. Connect the micro:bit main board to your computer using a USB cable.
thumb
Open micro:bit MakeCode Block editor: https://makecode.microbit.org/#editor. Firstly click the Extensions.
thumb
Then click the Bluetooth.
thumb

TAP Remove extensions and add Bluetooth.
thumb
Finally, you should see the Bluetooth is added well.
thumb

Then click the Extensions again, enter the library link below and search: https://github.com/LaboratoryForPlayfulComputation/pxt-BlockyTalkyBLE-UART
thumb

Finally, you should see the library blocky Talky BLE is added successfully.
thumb


Test Code
thumb


'Bluetooth APP Use After add the library and send the test code to micro:bit main board, power on the micro:bit main board.
thumb
Click the link to download the Bluetooth APP: https://drive.google.com/open?id=17jJB--GKxPytDyPuqqhs6B2NUCCu7kST


Installed the APP, click the APP icon to open it. thumb
When your phone detects the Bluetooth module on the micro:bit main board, the APP will prompt to open the Bluetooth. Choose to open the Bluetooth. Pop up the interface below.
thumb
Then click the Bluetooth icon thumb , it will pop up the micro:bit information.
thumb

Then click thumb to connect the micro:bit Bluetooth.
thumb

After that, click thumb for connection, pop up the interface shown below.
thumb
Here the Bluetooth is connected successfully, you can use the APP to control your micro:bit car. The options are shown on the right side.

You can click the thumb to disconnect the Bluetooth. Shown below.
thumb


Test Result Send well the test code to micro:bit main board, and power on the micro:bit main board. Follow the method mentioned above, connect the Bluetooth on the micro:bit main board using your phone’s APP. Connected, click the right icons on the APP, the LED matrix on the micro:bit main board should show different letters.