Download Print this page
Makeblock mBot2 Instruction Manual

Makeblock mBot2 Instruction Manual

Block coding
Hide thumbs Also See for mBot2:

Advertisement

MakeBlock mBot2 / CyberPi
Version 1.0
Feb 2022
1 |
P a g e
Digital Technology
Block Coding
Barry Butler
bbutl58@eq.edu.au

Advertisement

loading
Need help?

Need help?

Do you have a question about the mBot2 and is the answer not in the manual?

Questions and answers

Subscribe to Our Youtube Channel

Summary of Contents for Makeblock mBot2

  • Page 1 Digital Technology MakeBlock mBot2 / CyberPi Block Coding Version 1.0 Barry Butler Feb 2022 bbutl58@eq.edu.au P a g e...
  • Page 2: Table Of Contents

    CyberPi Extras Documentation https://www.yuque.com/makeblock-help-center-en/mblock-5 CyberPi Blocks https://www.yuque.com/makeblock-help-center-en/cyberpi (including Pocket Shield, mBot2 Shield and mBuild Modules) Firmware Update To update the CyberPi firmware: 1. Open the online ide at https://ide.mblock.cc/#/ 2. Click on Devices and add the CyberPi device to the list, if it is not there already 3.
  • Page 3: The Mbot2 Vehicle

    A. The mBot2 Vehicle Documentation MBot2 Introduction https://education.makeblock.com/help/cyberpi-series/cyberpi-series-cyberpi- series-packages-and-extensions/mbot2-introduction/ Operational Guide https://education.makeblock.com/help/cyberpi-series/cyberpi-series-cyberpi- series-packages-and-extensions/mbot2-operational-guide/ Python Reference https://www.yuque.com/makeblock-help-center-en/mcode/cyberpi-api- shields#9eo89 mBuild Modules (Ultrasonic Sensor 2, Quad RGB Sensor) https://www.yuque.com/makeblock-help-center-en/mcode/cyberpi-api-mbuild https://education.makeblock.com/help/mblock-python/mblock-python-editor- python-api-documentation-for-devices/mblock-python-editor-python-api- documentation-for-cyberpi/mblock-python-editor-apis-for-mbuild-modules/ The Build The Connections (Ultrasonic into the mBuild port, motors to EM1/EM2)
  • Page 4: B Introduction And Setup

    Rename project Coding space Connection button When you Connect and change to Upload mode the Upload button appears, to upload code to the mBot2. Click the Setting button to carry out a firmware update and set up a wi-fi connection.
  • Page 5 2. INSTALL AND UPDATE BLOCK MODULES If the mBot2, Ultrasonic Sensor 2 or Quad RGB Sensor pictures have a plus or update symbol on them, click on this symbol to add or update these blocks. Click the Add buttons to add these block sets to your software.
  • Page 6 6. Click on the File menu and select New Project. 7. Start coding P a g e...
  • Page 7: C Our First Program - Hello

    Unsuccessful Upload If the upload is unsuccessful check three things: 1. The mBot2 is turned on (the power switch on the left side). 2. The cable is plugged in and a connection established (see section B4). P a g e...
  • Page 8 Save the Project and Upload to the CyberPi Save the project to your computer by clicking on the File menu and choosing Save to your computer. It is a good idea to create a folder to contain all your projects. Make sure you type in a descriptive name for your file.
  • Page 9 D. Buttons The mBot2 is controlled by a module called cyberpi. This has a joystick, a home button and two push buttons (A and B). We can use the joystick and buttons in our code. It also has a light sensor and microphone that we can use.
  • Page 10: E Run The Motors

    E. Run the Motors There are a number of ways we may want to move the mBot2. The blocks we need are in the mBot2 Chassis group. Movement Commands Forward or backward forever. forever (Should only be used when the...
  • Page 11 CHALLENGES 1. Place one or more large objects on the floor. Navigate the mBot2 through and/or around them. 2. One of the RoboRAVE competitions is AMAZE-ing. It consists of a series of boards that make up a maze. You do not know the shape of the maze until the competition.
  • Page 12 USB connection. This code is mainly used in conjunction with the joystick and buttons, or the ultrasonic and line follower sensors, where the mBot2 will respond to changes in sensor values. CHALLENGES 3. Place two small objects on the floor at least 1m apart. Drive around these multiple times in a figure of 8. When you turn use the led’s to indicate your turns.
  • Page 13: F Avoid Or Seek

    F. Avoid or Seek The Ultrasonic Sensor is used to measure the distance between the mBot2 and anything in front of it (up to about 200cm). It can be used to avoid obstacles or seek out an object and move toward it.
  • Page 14 Slow Down when Close to a Collision Seek Objects and Move Toward Them Rotate to detect an object closer than 80cm, then move toward the object. 14 | P a g e...
  • Page 15 CHALLENGES 5. Place 4 objects at the corners of a square. Find one of them and stop before you hit it. Turn and find the next object, until you have found all four. 6. Find your way autonomously through a simple maze (sides are 10cm high) 15 | P a g e...
  • Page 16: G Detect And Follow A Line

    The Quad RGB Sensor (color sensor) enables us to detect and follow lines, and detect colours and respond to the colours in different ways. Test the Sensor using either of these, by passing the mBot2 over a black line on a white background and checking the displayed message and lights.
  • Page 17 Assume for a start that if the reflected light value is less than 50% if we are on or near a black line. • Place the mBot2 on the middle of the black line • If both sensors L1 and R1 are on black – go straight ahead •...
  • Page 18 To follow the line faster, you might need the change: • The power to the left and right wheels • The difference in power between the left and right wheels • How you interpret the percentage color sensor values • Use the L2 and R2 sensors as well CHALLENGES 7.
  • Page 19 H. SumoBot SumoBots use the ultrasonic sensor to seek and destroy another robot vehicle in the Sumo ring, while using the color sensor to sense the white border and avoid falling off the edge. H1. Basic Sumo Code The basic actions of a SumoBot are: •...
  • Page 20 H2. Enhancements • Only scan left and right up to 90 degrees the first time • Stop every 10 degrees when scanning to make sure scan detects vehicle (moving too fast doesn’t work) • Use movement sensor to detect a collision or the bot lifted off the ground (pitch or roll) and respond to that (see Appendix 1) •...
  • Page 21: I Connect Servos, Sensors And Motors

    I. Connect Servos, Sensors and Motors These blocks are found in the mBot2 Extension Port group. Servos Up to 4 servos can be plugged in the servo ports on the right-hand side (S3 and S4), or the general IO ports on the left (S1 and S2).
  • Page 22: Appendix

    Appendix 1 CyberPi Extras Ultrasonic, slider (potentiometer) and multi-touch import cyberpi as cpi import time while True: distance = cpi.ultrasonic2.get(index=1) pot = cpi.slider.get() touch = cpi.multi_touch.is_touch(ch = 1) #1-8 or ch = "any" print(distance, pot, touch) time.sleep(0.1) Light sensor light = cpi.get_bri() Sound sensor volume = cpi.get_loudness(mode = "maximum") Audio Commands...

This manual is also suitable for:

Cyberpi
Save PDF