Microcomputer Robot Engineering Programming Q&A

In The Beginning
This Q&A section is a collection of information necessary to program the microcontroller robot tool set. The explanation is based on programming using visual programming software "MakeCode" on a personal computer. Make sure that you understand the basic usage of BBC microbit and MakeCode. You can use the "Tutorial" in the free software "MakeCode" on the Web to understand the program better.

★ PLEASE DO NOT WARRANT FOR ANY FAULTS OR ACCIDENTS THAT MAY BE OCCUR WHEN THE PROGRAM IS CHANGED OR REWRITTEN BY YOU (including to the sample program provided by our company). In addition, we can accept questions about sample programs provided by us, but we can not answer questions regarding how to set up programs. Please see the Q&A provided by us or the BBC microbit reference.

In addition, we can not answer about the structure and contents of MakeCode provided by BBC Micro Bit. - BBC micro: bit is a registered trademark of micro: bit Education Foundation.


Basic Questions:
Q. How do I write a program to a robot?
A. Connect the PC and "BBC Micro Bit" and download the necessary programs from "Programs" in "About BBC Micro Bit Programs" on the Tamiya website . Copy the saved file to "BBC Micro Bit" again on the PC.

The work procedure is the same as “To return to the program at the time of shipment” on the Tamiya website. Please refer.


Q. How to modify the program?
A. Programming is recommended "MakeCode (Japanese version - Use Google translater)" which can be used with a web browser . By arranging blocks with actions written on the screen, you can perform visual program modifications.


Q. How can I restore the program to the original, purchased state?
A. Please refer to the "To restore the program at the time of shipment" on the Tamiya website - "About BBC Micro Bit Programs"


Q. How do I get a sample program?
A. Please download it from the "Programs" section of the Tamiya website "About BBC Micro Bit Programs".


Q. How do I know the role of the blocks used in the downloaded program?
A. If there is an icon at the left end of the block, clicking it will display a comment.

BBC Microbit


Application Questions (ultrasonic sensor, drive circuit):

Q. How to measure the distance to an obstacle (object) using the ultrasonic sensor mi-02?
A. In order to use the sensor, it is necessary to send and receive numerical values (I2C communication) between the BBC microbit and the ultrasonic sensor mi-02 (address: 44). First, the BBC microbit sends measurement instructions to the sensor. The sensor emits ultrasound and measures the time it takes for the ultrasound to reflect back to the object. When instructed to acquire measurement data from the BBC microbit side, the sensor splits the measurement data into two numbers and sends it back. You can calculate the distance from the sent back data to the object. Below are the specific steps.

Step 1. Tell the ultrasonic sensor mi-02 to start measurement. Use [Export I2C value] and set the address “44”, type “UInt8BE”, then “false” and send the value “51”. (The address, format and so on are set in the same way thereafter).

Step 2. Use [Read I2C value] to obtain a value. If the acquired value is "1", it indicates that the measurement has started and if it is "0", it indicates that it has not started. BBC Microbit

Step 3. Use [Export I2C value] and send the value “15”.

Step 4. Acquire measurement data using [I2C reading numerical value]. The acquired measurement data is the upper digit of reflection time (upper half digit in binary notation).
BBC Microbit

Step 5. Use [Export I2C numbers] and send the value “14”.

Step 6. Use [Read I2C value] to acquire measurement data.The acquired measurement data is the lower digit (the lower half digit in binary notation) of the reflection time. BBC Microbit

Step 7. If the acquired “upper digit” and “lower digit” values are not both 0, the measurement is successful. The reflection time (in microseconds = 1/1000 milliseconds) can be determined from [【upper digit × 256】 + lower digit]. Furthermore, the distance to the object (unit: millimeter) can be found by [【【reflection time-160】 / 2】 × 0.315】. BBC Microbit


Q. How to confirm that the measurement data from the ultrasonic sensor mi-02 is correct?
A. Even if the sensor measures the distance to the object correctly, communication between the BBC micro bit and the ultrasonic sensor mi-02 may fail, and correct measurement data may not be measured. To confirm that the measurement data is correct, it can be confirmed by calculating and comparing the sum of the two divided measurement data in the sensor and in the BBC microbit respectively. Below are the specific steps.

Step 1. Use [Export I2C value] and send the value “16”.

Step 2. Use [Read I2C value] to get the value. The acquired value is "sum of upper and lower digits". BBC Microbit

Step 3. Add separately the “upper digit” and “lower digit” acquired separately and check if it is equal to the acquired “sum of upper digit and lower digit”. If it is equal, the reflection time will be acquired correctly. If they are not equal, it means that one of the "upper digit", "lower digit" and "sum of upper digit and lower digit" could not be acquired correctly. BBC Microbit


Q. What are the specifications of drive circuit mi-01 and ultrasonic sensor mi-02?
A.
Drive Circuit mi-01
Power supply: 3 V (2 AA batteries)
Consumption current: 500 mA (Stop 50 mA)
Input / output connector: BBC micro bit, switch input, motor output x 2,
I2C communication (3.3 V) x 2, I2C communication (power supply voltage)

Ultrasonic Sensor mi-02
power supply voltage: 3.3 V
ultrasonic wave: 40 kHz
viewing angle (horizontal direction): about ± 30°

BBC Microbit


Q. May I replace the microcomputer robot's motor?
A. Do not use a motor other than the one supplied with the set for the microcomputer robot.


Application Questions (radio control):
Q. How to make a radio maneuver?
A. Initial settings are required when communicating between BBC micro bits. In order for the controller (sender) side to issue maneuvering instructions, set the data to be sent after the button or other operation. In order to receive maneuvering instructions on the robot (reception) side, set the operation for each received data. It is possible to perform radio control by setting which data to transmit when the operation is performed by the controller and which motion to perform when the robot receives which data. The specific procedure of wireless communication is shown below.

Step 1. Make initial settings. This initial setting is required on both the controller side and the robot side. Set the same group number using [Set wireless group] in [Only first]. This setting is necessary because BBC micro bits set with the same number communicate with each other.

Step 2. To transmit data from the controller side, use either [Transmit numeric value by radio] [Transmit text by radio] or [Transmit by radio]. Each sends a value, a string, a string and a value.

Step 3. In order to receive data on the robot side, either [When received by wireless (receivedNumber)] [When received by wireless (receivedString)] [when received by wireless (name (value))] Use Each receives a value, a string, a string and a value. Use the one corresponding to the send block used on the controller side.

Step 4. Received data can be used by dragging (receivedNumber) etc. of the received block and extracting it as a variable. If you use data outside of [when received by wireless] (such as [long all] or function), save the data in any variable.

BBC Microbit BBC Microbit BBC Microbit BBC Microbit


Q. How do I maneuver wirelessly with multiple sets of controllers and robots individually?
A. Set a different group number for each controller and robot pair in [Set wireless group]. Communication is performed between BBC micro bits set with the same number. The group number at the time of product purchase is "37".

BBC Microbit

Close