How to use mBot Mega

Default function:

 
Please connect to the computer before use and update the firmware in mblock.

download mlink:

15_download_mlink.gif

 

Use mblock

16_Use_mblock.gif

 

Connect mbot mega and upgrade the firmware.

The firmware is divided into two firmwares: Online firmware and Factory firmware, the difference between the two:

  • Online firmware:
    Clear factory procedures. In online programming mode or when using APP to remotely control mBot Mega, it is recommended to select this firmware to avoid affecting custom programs.
  • Factory firmware:
    Restore the factory program (restoration of gesture recognition, obstacle avoidance, line tracking functions). In this mode, the sensor must be installed to the specified interface position according to the instructions of the manual, otherwise the sensor will be triggered by mistake and cause malfunction.

mBotMega_Firmware_Update.gif

 

Please put a battery with sufficient power into the battery box before use, and then turn on the power switch of Megapi, otherwise the motor will not start.
 
 

Function switching:

  • -Press 2 seconds for the collision switch to change different preset functions, the different color of the RGB light indicates different preset functions.

Gesture recognition: default function at boot

  • -Light color: green
  • -Standby state: Both RGB modules are all low-light green: R0G80B0
  • -When the obstacle avoidance sensor detects an obstacle, the RGB module will change to highlighted green: G255
  • -3 obstacle avoidance module assembled in the front can detect three states within 3-10cm:
  • When swipe to the right:
  • Within N seconds, when the obstacle avoidance sensors 1, 2, and 3 respectively detect signals, the robot pans about 10cm to the right. When moving, the RGB light on the right side lights up as G255, and when stopping, it returns to G80.
  • When swipe to the left:
  • Within N seconds, when the obstacle avoidance sensors 3, 2, and 1 respectively detect signals, the robot pans about 10cm to the left. When moving, the RGB light on the left side lights up as G255, and when stopping, it returns to G80.
  • Push:
  • 1. When the No. 3 obstacle avoidance sensor detects the signal at the same time for more than 0.2 seconds, it is judged as a push gesture, the left and right RGB lights are on at the same time as G255, and the robot moves backward.
  • Stop moving when all the sensors fail to detect the signal, and the RGB light returns to G80.

Automatic obstacle avoidance:

  • Light color: yellow
  • When no obstacle is detected, all lights are low-light yellow: R80G80B0
  • When any infrared sensor detects an obstacle, all lights are highlight yellow: R255G255B0
  • After switching to automatic obstacle avoidance mode, it moves according to the state of three sensors:
  • Forward: move forward when none of the three sensors detect obstacles
  • Turn left: When the sensor on the left detects an obstacle, it rotates clockwise about 90 degrees on the spot
  • Turn right: When the sensor on the right detects an obstacle, it rotates about 90 degrees counterclockwise on the spot
  • Backward: When the middle sensor detects an obstacle, go back about 5cm

Automatic line-follow:

  • Light color: blue
  • When the line-following sensor does not detect black line, the RGB light brightness is low-light blue: R0G0B80
  • When the line-following sensor detects black, the RGB light on the corresponding side is blue: R0G0B255
  • After switched to the line-following mode, any line-following sensor detects black, then the line-following starts; if the two line-following sensors cannot detect black, rotate in place for 5 seconds, until black is detected and then start line-following , If the black is still not detected after 5 seconds, mega will stop the movement and wait for the black line to be detected again, then start the line patrol (waiting to manually move to the black line).
 

Programming:

Arduino

Download the library file:Libray file

 

Include library

18_Include_library.png

 

19_Include_library.png

 

mblock

Start programming and upload the program.
20_Start_programming.gif
 
 

About the blocks of mblock

Move control statement block description:

  • The range of the moving speed value is -100~100, and a negative number means reverse movement. Variables can be used.
  • -Give all motors the same speed at the same time:
  • Set the moving speed of mBot Mega in the X and Y axis directions, as well as the direction and speed of rotation.
  • Set the moving speed of mBot Mega in the forward, backward, left and right directions.
  • Set the speed of a single motor.
  • Set the speed of the two motors at the same time.

Sensor sentence block description

  • The default sensor in the mBot mega kit specifies the interface position. If it is connected incorrectly, it will not respond during programming. Programming in the Arduino IDE is not limited by the location of the interface.
  • Impact sensor (limit switch)
  • Line Tracking sensor (default trigger condition: trigger when the surface is 2-20mm away from the transmitter and can reflect infrared light, judged as "white", otherwise judged as "black". Most dark object surfaces will absorb infrared rays , Cannot trigger the Line Tracking sensor; the surface of most light-colored objects can reflect infrared rays.)
  • IR proximity sensor (default trigger condition: trigger when the object is about 30mm away from the transmitter head, the upper limit of the detection distance can be changed by adjusting the potentiometer, and the detection distance is increased when it is rotated counterclockwise. But the degree of absorption of infrared light on the surface of the object , Flatness, area and other factors. Materials that absorb infrared light will not be able to trigger the IR proximity sensor, such as most black objects.)

RGB light statement block

  • Control the color of all LED lights on a single RGB light module
  • Control the color of the specified LED light on a single RGB light module, and control all LEDs when the LED light serial number is 0. Variables can be used for values.
  • Control the color of the designated LED lights on a single RGB light module with RGB values, and control all LEDs when the LED light number is 0. The RGB value range is 0-255, and variables can be used.
  • Control the color of all LED lights on the RGB light module with RGB values. Variables can be used for values.
  • Turn off the LED at the designated position on the RGB lighting module. When the value is 0, all LEDs are turned off. Variables can be used for this value.

P13.gif

 

Motion Control example

  • Control the speed and direction of rotation of the 4 motors separately, which can combine a variety of movement methods.

M01.png

Linear movement

M02.gif

Forward:
 
Backward:
MV02.png
Left:
MV03.png
Right:
MV04.png
Upper left:
MV05.png
 
Bottom right: 
MV06.png
Upper right:
MV07.png
Bottom left:
MV08.png
 

Rotate:

Clockwise: 
MV09.png
Counterclockwise:
MV10.png

 

Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.