Some prior experience with building programs in Scratch is assumed. You can find some introductory materials here:

Similar documents
A Day in the Life CTE Enrichment Grades 3-5 mblock Programs Using the Sensors

A - Debris on the Track

A - Debris on the Track

An Introduction to Programming using the NXT Robot:

A - Debris on the Track

Robotics 2a. What Have We Got to Work With?

Your EdVenture into Robotics 10 Lesson plans

Programming 2 Servos. Learn to connect and write code to control two servos.

understanding sensors

Robotics using Lego Mindstorms EV3 (Intermediate)

A Day in the Life CTE Enrichment Grades 3-5 mblock Robotics - Simple Programs

C - Underground Exploration

Game Making Workshop on Scratch

Lab book. Exploring Robotics (CORC3303)

Lab 1: Testing and Measurement on the r-one

How Do You Make a Program Wait?

Setup Download the Arduino library (link) for Processing and the Lab 12 sketches (link).

Lesson 3: Arduino. Goals

Agent-based/Robotics Programming Lab II

The light sensor, rotation sensor, and motors may all be monitored using the view function on the RCX.

CURIE Academy, Summer 2014 Lab 2: Computer Engineering Software Perspective Sign-Off Sheet

Where C= circumference, π = 3.14, and D = diameter EV3 Distance. Developed by Joanna M. Skluzacek Wisconsin 4-H 2016 Page 1

Mindstorms NXT. mindstorms.lego.com

MAKEBLOCK MUSIC ROBOT KIT V2.0

Studuino Icon Programming Environment Guide

Worksheet Answer Key: Tree Measurer Projects > Tree Measurer

What s Up with Kaltura?

For more add-on packs and building instructions, please visit:

Whack-a-Witch. Level. Activity Checklist Follow these INSTRUCTIONS one by one. Test Your Project Click on the green flag to TEST your code

Standard Operating Procedure

Tech Tips from Mr G Introducing Libby - The New Face of OverDrive

Fish Chomp. Level. Activity Checklist Follow these INSTRUCTIONS one by one. Test Your Project Click on the green flag to TEST your code

Two Hour Robot. Lets build a Robot.

Parts of a Lego RCX Robot

uiulearn TUTORIAL INTEGRATIONS> HOW TO USE PANOPTO (STUDENT)

Faculty Lecture Capture Guide

How to Blog to the Vanguard Website

Programming a Servo. Servo. Red Wire. Black Wire. White Wire

The Beauty and Joy of Computing Lab Exercise 10: Shall we play a game? Objectives. Background (Pre-Lab Reading)

Tilt Sensor Maze Game

Handbook. Antenna Rotator Controller

You are going to learn how to create a game in which a helicopter scores points by watering flowers in the city.

Chapter 1. Robots and Programs

Learn about the RoboMind programming environment

Pre-Activity Quiz. 2 feet forward in a straight line? 1. What is a design challenge? 2. How do you program a robot to move

SINGLE SENSOR LINE FOLLOWER

Sample Pages. Classroom Activities for the Busy Teacher: NXT. 2 nd Edition. Classroom Activities for the Busy Teacher: NXT -

ID station Photomatic

Inspiring Creative Fun Ysbrydoledig Creadigol Hwyl. LEGO Bowling Workbook

TETRIX PULSE Workshop Guide

Session 11 Introduction to Robotics and Programming mbot. >_ {Code4Loop}; Roochir Purani

Table of Contents. Sample Pages - get the whole book at

MODULE 1 IMAGE TRACE AND BASIC MANIPULATION IN ADOBE ILLUSTRATOR. The Art and Business of Surface Pattern Design

Revision for Grade 7 in Unit #1&3

How to create a survey with SurveyMonkey

Module. Introduction to Scratch

RGB Line Follower. 1. Basic knowledge of RGB line follower

QUICKSTART COURSE - MODULE 1 PART 2

// Parts of a Multimeter

Programming with Scratch

UNIT1. Keywords page 13-14

Arduino STEAM Academy Arduino STEM Academy Art without Engineering is dreaming. Engineering without Art is calculating. - Steven K.

The Basics. Introducing PaintShop Pro X4 CHAPTER 1. What s Covered in this Chapter

INTRO TO LAYERS (PART 2)

LEGO Mindstorms Class: Lesson 1

Erik Von Burg Mesa Public Schools Gifted and Talented Program Johnson Elementary School

QS PRO & QS PRO 2 Set-up App Instructions For Bluetooth BLE (Android 4.4+)

ADMS-847 Programming Software for the Yaesu FT-847

The D70 only controls one external group of flashes. You can use many external flashes, but they will fire at the same power.

Robotic Manipulation Lab 1: Getting Acquainted with the Denso Robot Arms Fall 2010

ACTIVITY 1: Measuring Speed

EE-110 Introduction to Engineering & Laboratory Experience Saeid Rahimi, Ph.D. Labs Introduction to Arduino

2020 DRAWBOT INSTALLATION AND USE. Robert Ashford Henry Arnold 4-H OABB

BEST PRACTICES COURSE WEEK 14 PART 2 Advanced Mouse Constraints and the Control Box

Instructional Technology Center

Robot Programming Manual

Using Google Analytics to Make Better Decisions

Introduction to Turtle Art

Understanding the Arduino to LabVIEW Interface

INSTRUCTIONS THIRD CHALLENGE Date of Announcement:

Smart Passive Income Gets Critiqued - Conversion Strategies with Derek Halpern TRANSCRIPT

Wavelab 5.0 Matrix How-To:

Internet of Things Student STEM Project Jackson High School. Lesson 2: Arduino and LED

Exercise 2. Point-to-Point Programs EXERCISE OBJECTIVE

Organizing and Customizing Content

Sten BOT Robot Kit 1 Stensat Group LLC, Copyright 2016

Thanks to Autocheck function, it is possible to perform a complete check-up of the robot thanks to a stepby-step

Let There Be Light. Opening Files. Deleting National Technology and Science Press

Creating Computer Games

QS PRO Set-up App Instructions Bluetooth setup

MAKING THE FAN HOUSING

PHYSICS 220 LAB #1: ONE-DIMENSIONAL MOTION

Using LEGO WeDo kits with Scratch

1Getting Started SIK BINDER //3

High Speed Motion Trail Effect With Photoshop

Instruction Manual. 1) Starting Amnesia

Laboratory 7: CONTROL SYSTEMS FUNDAMENTALS

In this project we ll make our own version of the highly popular mobile game Flappy Bird. This project requires Scratch 2.0.

Create a game in which you have to guide a parrot through scrolling pipes to score points.

DUBAI TECH & DIGITAL WINTER CAMP

Transcription:

Robotics 1b Building an mbot Program Some prior experience with building programs in Scratch is assumed. You can find some introductory materials here: http://www.mblock.cc/edu/ The mbot Blocks The mbot has some of its own special Scratch blocks to help is make its way in the world. These include; Making the motors run, Lighting LEDs, Detecting obstacles with the ultrasonic rangefinder, Following lines with the line following sensor, and Playing tones. There are a heap of other blocks we can use that allow us to interact with other sensors and actuators we can add to the mbot. Here is the list of blocks available. Connecting to the mbot When working with robots you will need to connect them to a computer at some point to program them. With the mbots we do this through the USB connection. Because the mbot will immediately start running whatever program is loaded when it is turned on, we will need to stop it running away or doing anything strange. To do this we will use the simple solution of sitting the mbot on some blocks so its wheels can t touch the ground or turning it upside down. Robotics 1b Building and mbot Program Page 1 of 6 June 2017

To upload programs to your mbot connect it to one of the USB ports. I would suggest you use the same one consistently to make things easier for yourself in the future. Depending on whether the mbot has been used on that USB port before there may be a delay while Windows figures out what port you have connected to and gives it a name. The names given will vary but will look something like COM4 or COM10 etc. Start the mblock software and minimise the Stage that s the area with the Panda. You can do this with the Edit menu dropdown at the top of the screen. Turn on the mbot. And be prepared to grab it if it decides to run away. Hopefully it should have its default program loaded and it will beep a little but otherwise behave. To upload a program to the mbot, select the correct port from the Connect menu item at the top of the screen. We are using a Serial connection. Look for COM 10 or similar and click on that. Now use the Edit menu item to pull up the Arduino mode. From the top menu bar go Edit > Arduino Mode. On the right hand side of the screen is a button marked Upload to Arduino. If we had a program ready to go we would hit this button to begin the upload process. If it fails to work, just try a different COM port. Robotics 1b Building and mbot Program Page 2 of 6 June 2017

Building and Loading a Program Build your programs using exactly the same drag-and-drop method you use when programming Scratch, but in this case start the programme with the block called mbot Program or When on board button pressed. mbot Program: starts the program running as soon as the mbot is turned on. I would suggest if you are going to use this one, add a 5 second delay into the program at the start to give you enough time to put the mbot on the floor before the action begins. You will find a Delay or Wait block in the Control series of blocks in the Blocks Palette in the top left-hand side of the screen. When on board button pressed: Starts the program running when the black button on the front end of the mbot s top bit is pressed. Robotics 1b Building and mbot Program Page 3 of 6 June 2017

Investigating the motors Unlike computers, robots are physical things and so they do real stuff. In order to understand how our mbot works and what the code blocks really mean we shall do an experiment. The available Scratch code blocks for controlling the motors are; The two blocks above have slightly different functions. Use one or other to achieve the motor control you are after. The run forward at speed block controls both motors. You can tell the mbot to run forward, run backwards, or turn left or right by using the drop down box. We put a number for the speed into the space at the right-hand end of the block. The set motor M1 speed block controls one motor only. The motors are called M1 and M2. You can select either motor with the drop down and put a number into the right-hand end space to control the speed. If we put a number into the space at the right hand end of these code blocks, this will make the motors move at a particular speed, but we don t know what that speed is. Is a speed of 100 really fast? Note: The maximum speed is 255. A bit of physics What is speed? Speed is the distance something travels in a particular time. For example a car travelling at 50km/h goes 50km in one hour. Speed = distance time Or Speed= Distance Time How far does it travel in two hours? Distance=Speed Time Adding meaning to the Speed number To find out what the speed numbers in our code blocks mean we will write a program to run the motors at a particular speed for a known time and then measure the distance travelled. The program Program the mbot to run at a speed of 100 for five seconds (or less) and measure how far it goes. Things you will need to include; A delay or wait at the start of the program to give you time to put the mbot down somewhere. Robotics 1b Building and mbot Program Page 4 of 6 June 2017

A speed of 0 at the end of the program to stop the mbot. Things to watch out for: Once you tell the mbot to move with one of the speed blocks it will continue to move until it is told to do something else. This is why we use a wait block after the run forward at speed X block. The mbot will keep going at speed X until the time in the wait block is up. If you don t tell it to do something else (like speed 0) it will just carry on running and you will have to chase it. Your program will look something like this: Our results When the mbot stops moving, measure how far it went in the time you gave it. You can get a real speed from this by using the equation; Speed= Distance Time Say it went 50cm in 5 seconds, then we can say its speed was Speed= 50 cm =10 cm/ s 5 sec If our speed value in the block was 100, then we know that 100 is the same speed as 10cm/s. So that is an example, use your measurements to find out what the real speed is? So using the example above, if we want to move our mbot a particular distance (75cm for example) then we will need to run our mbot at a speed of 100 (10cm/s) for a time that we can find through a simple calculation. Speed= Distance 75 cm 10 cm = = Time Time s So Time= Distance Speed 75 cm = 10 cm/ s =7.5seconds For our mbot set to a speed of 100 and travelling at 10cm/s it will need to run for 7.5 seconds to cover a distance of 75cm. Try the same calculation with your mbot using the real speed values you have calculated. Robotics 1b Building and mbot Program Page 5 of 6 June 2017

Turning Turning the mbot is simply done by running one motor forward and the other backward. Like the speed problem we don t know how long we need to run the motors to turn 90. You get to the Turn controls using the same block as the Run Forward at Speed X but we use the drop down to change it to turn right or turn left. Do some experiments. Create a program to make the mbot turn on the spot. See what combination of speed and time achieves a 90 turn. The bit to make the mbot turn should end up looking something like this; but don't forget to to set the speed to zero after the wait. If you want to be fancy, set up a program that tests a number of different speeds and times to see which works best. Separate each test with a Run Forward at Speed 0 and a wait of several seconds. When you know the speeds and times. write them down somewhere. We will need them in future sessions. Done Well done! That s us for this session. Next time we ll look at creating a program to guide the mbot through a path. We will need our speed and time measurements for this. This document Robotics1b - Building an mbot Program by Hamish Trolove is provided under a creative commons license - Attribution, Share Alike. http://creativecommons.org/licenses/by-sa/4.0/ www.techmonkeybusiness.com Robotics 1b Building and mbot Program Page 6 of 6 June 2017