Using the Mbot in a Classroom This Resource Is Aimed at New Users Who Are Getting Started with the Mbot
Total Page:16
File Type:pdf, Size:1020Kb
Intro Course - Using the mBot in a Classroom This resource is aimed at new users who are getting started with the mBot. It offers some teaching ideas and collates in one place a lot of information from various places across the web. About the mBot: The mBot is a low cost, easy-to-run robot kit to get hands-on experience about programming, electronics and robotics. It is an all-in-one solution for robotics learning and designed for STEM education. Features: ● Easy to assemble ● Electronics are based on the Arduino open source platform ● Supports IOS & Android App. ● Two programming tools: Arduino IDE and mBlock, a drag-and-drop programming tool based on Scratch 2.0 ● Bluetooth or 2.4GHz wireless module included ● Easy and intuitive wiring with color-coded RJ25 connector ● 2 mm thick aluminum chassis, strong and compatible with Makeblock & Lego parts Check Your Robot: Does your mBot have bluetooth or wifi? Check the specs on the packaging. Spare Parts: MakeBlock put out a range of parts, sensors, extras and extension kits so students can also design their own robot for a purpose by either completing building the whole robot or adding to the existing mBot. Vocabulary mBot is the robot mBlock is the drag n drop software to download for Windows or Mac. It is a customised version of Scratch. Arduino is an open source programming language, and hardware platform. It’s intended for anyone making interactive projects. The Arduino development environment makes it easy to write code and upload it to the I/O board. You can use Arduino language (C\C++) to interact with Arduino hardware. mBot Ranger is a slightly more complex mBot with tank like tracks to move on instead of wheels. Default program takes the mBot back to the status it started with such as manual control mode, obstacle avoidance mode, line inspection mode. Useful if using the mBot with multiple users so each user starts from the same status each time or when the user wants to use the remote control. Upgrade firmware Here is an example of a situation where you need to upgrade firmware. Do the online program testing with Green flag head as below: You may find it won’t work when you click the green flag, this may due to that you haven’t upgrade the firmware for the robot to clear the pre-loaded program on the main board. Remember to Upgrade Firmware for the robot every time before you test the online program. Getting Started Build the mBot according to the guide book. You will need 4 AA batteries. Rechargeables are better over the long term. Although the initial outlay is higher they will pay for themselves. The remote will need a battery as well. Using the remote Once built it should work from the remote. If it doesn’t, check that the remote’s battery is in correctly. Play around with the remote. Some ideas are: Button A is manual control - moving and changing the speed Students could plan and design a game. Eg Robot balloon ball - a game of “football” with a light soft ball or small balloon. Students devise rules that make an interesting game. They will need at least two mBots, the ball and two goal areas drawn on paper. Button B sets the robot to obstacle avoidance. How does this work - what does the robot do? Students could try to write an algorithm similar to that which was used to program this obstacle avoidance. Button C sets the robot to follow a line. This does need to be quite chunky with good contrast between the line colour and background colours. This makes a good exercise to experiment - how thin can the line be before the mBot can’t detect it? How much contrast in colours/tone before the mBot can’t detect the line from the background? Programming Your mBot On your Laptop or desktop you will need to install the graphical programming software mBlock. mBlock is a graphical programming environment based on Scratch 2 open source code that makes it easy to program. mBlock 3 versus mBlock 5? With mBlock 3 you can see the Arduino coding and even code in Arduino language. mBlock 3 is a block-based programming software based on Scratch 2.0. mBlock 3 interacts with Makeblock controller boards and other Arduino-based hardware, allowing users to create interactive hardware applications.The block-based code can be converted to Arduino C Arduino is an open-source electronics platform based on easy-to-use hardware and software. The Arduino language is based on C\C++. It’s intended for anyone making interactive projects. The Arduino development environment makes it easy to write code and upload it to the I/O board. With mBlock 5 you can see the Python coding and even code in Python language. mBlock 5 is a block-based and text-based programming software based on Scratch 3.0. mBlock 5 allows users to program Makeblock robots, Arduino boards and micro:bit. Using mBlock 5 without any hardware, users are able to code games and animations. The block-based code can be converted to Python code, be connected to IoT and supports AI-functionality such as face and voice recognition, as well as mood sensing. The software is available for Windows & Mac, download here http://mblock.cc/download/ mBot communication options ● Option 1: USB cable ● Option 2: Bluetooth ● Option 3: 2.4G wireless serial mBot Board When uploading to the mBot’s board the program runs as a standalone. This means that all the programming scripts that were only relevant to the mBlock environment programming (such as “Motion” and “Looks”) are unavailable. On the plus side, because the code is uploaded to the board, there is no lag between, for example, reading sensors and acting accordingly. When you want to upload a program to the mBot’s Arduino board, you should go into Arduino mode. You can do that by selecting it from the menu. You need to select Edit and Choose Arduino mode. Connect the mBot to your computer via the cable and turn it on. In the mBlock menu choose Connect, Serial Port, and the appropriate name - in this diagram it is COM3 Finally upload the program to the mBot by clicking the Upload to Arduino button. Remember to get the mBot back to the original state where it can be controlled via remote you will need to connect the mBot via cable, select Connect and Serial Port, and then go back to the Connect menu and choose reset default program Exercises Follow the tutorials and complete the challenge tasks at the end of each tutorial. 1. Code your mBot to move in a square by following the steps here: http://learn.makeblock.com/en/robot-kits/mbot/move-in-a-square/ Challenges: A. Do I need the last movement command in my repeat loop? Can you make the code more streamlined – so it still does what we want, but with less commands issued? B. Can you write a program that moves the robot in a rectangle? C. Can you extend your program from question B to write a program that gives a warning sound before starting, and has lights on while moving? 2. Code your mBot to move in a circle by following the steps here: http://learn.makeblock.com/en/robot-kits/mbot/move-in-a-circle/ Challenge: A. Write a program so your robot moves in a figure-of-eight. B. Write a program so your robot spells your initials. 3. Learn how to control the LEDs here: http://learn.makeblock.com/en/robot-kits/mbot/the-led-display/ Challenge: A. Play with different settings of the LEDS. What different colors can you make? What settings of the RGB LED creates these colors? B. Can you write a program that sets the left LED and the right LED at different times to your favorite color? So if the right LED is on the left LED is off, and vice-versa. C. Can you write a program that gives a light show that is accompanied with music? Remember to add comments 4. Code your mBot to play a tune http://learn.makeblock.com/en/robot-kits/mbot/play-music/ Challenge: A. Do you know what the song is? Can you finish the song? Can you amend the comments to reflect the updated status? B. Can you write the song “Merry Christmas”? Be sure to add comments C. Can you write your own song? Add comments 5. Read data from sensors: http://learn.makeblock.com/en/get-started/reading-sensors/ Challenge: A. Can you find a way to display the values of different sensors at the same time? B. Can you find out the range of possible values for all the sensors? 6. Complete the challenge for coding the light sensor: http://learn.makeblock.com/en/robot-kits/mbot/the-light-sensor/ Challenge: A. Develop a program where the robot runs forward in the light and stops in the dark. B. Develop a program where the robot dances in the dark (be creative with your dance moves) and rests in the light. C. Develop a program where the robot goes at different speeds depending on the light – the lighter it is, the faster it goes. D. Develop a program that plays lots of different notes – the more light sensed, the higher the note. This site has many more tutorials which guide the user through the different features including 5 tutorials using sensors and seven that go through more advanced programs.