Mbot and Me ( Or to Be More Accurate, Mbot and Us )
Total Page:16
File Type:pdf, Size:1020Kb
m Bot and Me ( or to be more accurate, mBot and us ) by Lindsay Rooms MBE An informative guide for both the young and the not so young ! An explanation of everything mBot; including how to use the mBlock 5 programming interface, full details of useful add-on components and the best ways to modify your new robot. Contains a comprehensive and in-depth guide to designing and scripting programmes using mBlock 5. M Windows 10 / mBlock v. 5.1.0 - 2020 Edition mBot and Me ( or to be more accurate, mBot and us ) by Lindsay Rooms MBE An in-depth guide for both the young and the not so young ! A comprehensive and sequential explanation of everything mBot; including how to use the mBlock 5 programming interface, full details of useful add-on components and the best ways to modify and programme your new robot. Windows 10 / mBlock 5 2020 Edition For Emma What will she become… … a Scientist ? … a Gymnast ? … an Engineer ? … a Dancer ? … an Astronaut ? Que Sera, Sera - ‘Whatever Will Be, Will Be’. Whatever she does, I will be a proud Grandad (and it’s been a privilege). "Don't let your past dictate who you are; but let it be part of who you will become". also dedicated to John Coll Pioneer P.C. Specialist & I.T. Philanthropist ‘A valued colleague from the 1970’s who encouraged me to programme computers’ John Coll was asked by the BBC to help draw up the functional description for a computer which could be used as part of a television series to teach computer literacy. - Quote: "It was John’s drive, determination and sheer brilliance that really pulled the whole thing off". Contents Chapter 1 An Introduction (… or how it all began …) ......................................... 1 Chapter 2 About Makeblock, Scratch and Arduino ............................................. 4 Chapter 3 About mBot the Robotics Device ........................................................... 8 Chapter 4 About mBlock 5 ................................................................................... 11 Chapter 5 About the mBlock 5 User Interface ..................................................... 15 Chapter 6 Setting up and Connecting mBot ......................................................... 22 Chapter 7 About mBot’s Remote Control Modes ................................................ 28 Chapter 8 All About Batteries ............................................................................... 33 Chapter 9 mBlock 5 / Scratch - the Basics .......................................................... 35 Chapter 10 About mBlock 5 in more Detail ......................................................... 44 Chapter 11 Programming with mBlock 5 .............................................................. 52 Chapter 12 mBlock 5 - Graphics Programming ................................................... 70 Chapter 13 Discovering Broadcast Messages ........................................................ 76 Chapter 14 Creating Graphics Libraries for mBlock 5 ........................................ 80 Chapter 15 Building a Control Interface for mBot ............................................... 98 Chapter 16 Creating ‘Smart Systems’ in mBlock 5 ............................................. 137 Chapter 17 About Good Habits and Best Practice ............................................. 151 Chapter 18 Quo Vadis?.......................................................................................... 157 Chapter 19 An mBot ‘Radar’ Simulation Project ................................................ 160 Chapter 20 An mBot Drawing Machine Project................................................... 171 Appendices Appendix 1 mBot ‘add-on’ Component - LED Panel ....................................... 184 Appendix 2 mBot ‘add-on’ Component - Servo Pack....................................... 192 Appendix 3 mBot Servo Project - Robot - ‘Dancing Cat’ ................................ 199 Appendix 4 mBot Servo Project - Robot - ‘Head-Shaking Cat’ ....................... 205 Appendix 5 mBot Servo Project - Robot - ‘Light-Emitting Cat’ ...................... 215 Appendix 6 mBot ‘add-on’ Component - Six Legged Robot Pack ................. 219 Appendix 7 mBot ‘Walker’ Project - Robot ‘Beetle’ ........................................ 221 Appendix 8 mBot ‘Walker’ Project - Robot ‘Mantis’ ........................................ 226 Appendix 9 mBot ‘Walker’ Project - Robot ‘Crazy Frog’ ................................ 229 Appendix 10 mBot ‘add-on’ Component - Light & Sound Pack ...................... 231 Appendix 11 mBot & Mblock 5 - All you need to know about LEDs ................ 233 Appendix 12 mBot Light & Sound Project - Robot ‘Light-Chasing’ ................. 239 Appendix 13 mBot Light & Sound Project - ‘Intelligent Desk Light’ ................. 243 Appendix 14 mBot Light & Sound Project - Robot ‘Scorpion’ .......................... 253 Appendix 15 mBot components - the latest bits .................................................. 256 mBot and Me a Beginner’s Guide Chapter 1 - An Introduction (… or how it all began…) Well it all began on Christmas morning, December 2017… … After breakfast was over, my granddaughter Emma (aged 7 1/4) began to demolish the huge pile of presents under Grandma & Grandad’s Christmas Tree - eventually we could see the floor and one neat & medium-sized (almost 200mm square & 100mm deep) box-like present remained. It was for me! It felt fairly solid and fairly heavy and when I unwrapped it, the box said ‘Makeblock - construct your dreams’ and ‘mBot’. It also said that was an ‘Educational’ robot construction kit. It also said on the front of the little booklet inside the top of the box that it was ‘mBot - One Robot per Child’ for beginners to learn STEM (Science, Technology, Engineering & Mathematics) - so was this really a present for me? Emma’s mum (my daughter) explained quickly that this was for me to show Emma how to build & modify the robot and how to programme it” … it works on Scratch you know” and “… its Arduino you know!”. “… Arduino - is that a fundamental particle of nuclear physics?” - I was now out of my depth, I hadn’t a clue. Had she thought to herself - Emma’s mum, that is - “That’ll keep the old fossil’s (or something ruder perhaps?) brain working…”? Keeping the old-boy's brain overloaded more like! Well, it is my seventieth birthday this year. I had heard of Scratch and knew that it was a graphical programming interface for kids using coloured blocks that fit together like a sequential jigsaw, but I had never used it and had considered it to be a bit too simple. I wondered how much mBot had cost them? Ball-park figure in the UK about £85 I guess. So, with the festivities in full swing & lunch imminent, I had to put the box to one side. Eventually, in a lull in late afternoon, Emma and I ‘unboxed’ it (that’s a fashionable consumer word isn’t it). The processor board and the chassis were in full view at the top of the box in a very neat cardboard tray. We lifted it out and examined the contents - it was all beautifully made. In the bottom of the box was another cardboard divided tray with all the other bits. Little brown plastic bags that contained mysterious circuit boards which we left untouched, bags of screws & nuts, cables & the wheels. Emma found the Screwdriver (she’s so practical) and had whipped-off the wrapping before I could blink and was exclaiming about it being double ended “… it’s like an Allan key shape” she said meaning the hexagonal cross-section. She studied all the bits that were unpacked and tea-time approaching, I promised her that we (she, I mean) would build it soon - but not today. Well, the next time we would meet to do that would be just over a week later - her first day back at school after the Christmas holiday which coincided with the day of the week we normally go to visit. That gave me time to study all about it - ‘that’ll be a breeze’ I thought! mBot and Me - a Beginner’s Guide - Page 1 mBot and Me a Beginner’s Guide On the day after Boxing Day I started my researches on the great world-wide inter-web and immediately saw that there was a lot more to this mBot and Scratch programming than I thought. I found several rather informative videos on YouTube and marked one of them showing the build-sequence with a bookmark to show Emma before we (she) started our own construction. I found out a lot about Makeblock who manufacture & market mBot too and I had a go at tentatively trying to slot some programming blocks together on the mBlock programming interface which I had to download from Makeblock. I also downloaded it to my Surface tablet PC so that I could communicate with mBot via Bluetooth. My observations and all the projects in this book are based on me using Windows 10 PCs - but they should mostly (I hope) apply to the other operating systems on which mBlock works. Why a book? Well I didn’t set out to write one but … … I spent a lot of time finding out on-line everything I could about MakeBlock, Scratch and mBot - there was so much out there - too much to comprehend and in drips and drabs in many diverse places with nothing explained in complete and understandable sequences of what to do first, second etc. - so I started making comprehensive notes to get my head around it all. A book on mBlock was what was I needed - so I looked; and there was plenty to be found on Scratch but almost nothing specific to mBlock or mBot written in English. There seemed to be paperbacks in German and Dutch and several non-English hardback versions together with a newly published (USA, Dec. 2017) ‘Kindle’ format book.