Creating fruitful and sustainable links between innovative organisations committed to the improvement

CCITE of technological education for young people.

The Centre for Innovation in Technological Education in Cambridge http://ccite.org

Learning to code - with a purpose Part 5 Adrian Oldknow March 2015 [email protected]

22. More Robotics - OhBot: This is another UK invention currently being crowd-sourced. £80 buys you the top-of-the-range model with 6 motors to control: http://ohbot.weebly.com/ and http://www.crowdfunder.co.uk/ohbot-robot/backers/. There are some videos from BETT show 2015 at: http://ohbot.weebly.com/bett-videos.html. Matt Walker and Dan Warner set up a company called Loopy Computy in Stroud: http://www.loopycomputy.com/about.html.

23. More Robotics – Edison: This is another interesting crowd- sourced development, this time from Australia. Edison is an easy to use, cheap and LEGO compatible vehicles. I bought the `Edpack3 for £80’ deal from: http://meetedison.com/. The software and programming guides can be downloaded from http://meetedison.com/downloads/. One simple way (and unusual) way to program Edison is by making barcodes for it to read. Program can be written on many devices including Android and Apple portables and the designers have chosen to use the sound port as a way to send programs to Edison. The system was designed by Brenton O’Brien: http://meetedison.com/blog/meet-brenton-errr-edison/.

There are just 3 buttons for on-board control to run, stop and learn programs.

Programming: Edison is programmed using EdWare, an icon based graphical . Programs are downloaded to Edison using the EdComm cable. The EdComm cable plugs into the computer's headphone jack and carries a pulsed audio signal to a high efficiency LED. The LED converts the pulsed audio signal into light that is received by Edison's line tracker phototransistor and loads the program into the processor. It has the following sensors, inputs and outputs: Obstacle detection: using 2 IR LEDs (front left and right) and IR receiver module (doubles as IR receiver). Remote control: IR receiver module (38kHz) compatible with most standard TV/DVD remote controls.

1

Infrared data comms: IR receiver module (double as obstacle detection sensor and IR remote receiver). Line tracker: Red LED and phototransistor (doubles as barcode reader and programming port). Light sensors: 2 phototransistors (front left and right). Sound sensor: Piezo transducer (doubles as sounder). Drive: Differential drive system Infrared data comms: 2 infrared LEDs (double as obstacle detection sensor) Sound: Piezo buzzer (doubles as sound sensor) Lights: 2 red LEDs (Front left and right) Processor: Freescale 8-bit MC9S08PA8VLC Power: Battery: 4 x AAA (UM 4)

24. Robosapiens X and Phone dongle: This was designed by the NASA space scientist, Mark Tilden, and released in 2009 when it sold 1.5m units! The robot can be picked up for around £80 from sources such as Amazon, Argos and e-bay e.g. http://www.argos.co.uk/static/Product/partNumber/1114696.htm It weighs in at 6lbs and stands 14in tall. 2 D type batteries in each boot provide stability. You can program it from its remote control or from a mobile phone App using an infra-red dongle. Its specification includes: Sight, sound and touch sensors Humanoid body movements, including bending, sitting and standing, lying down and getting up, dancing, waving, martial arts Speech: Responds verbally to environmental stimuli and to controller commands Colour Vision System: Recognises colours and skin tones Stereo Sound Detection System: "Hears" and reacts to sounds IR Vision: Detects and avoids obstacles; tracks moving objects True bi-pedal walking with multiple gaits Precision gripping, articulated fingers Realistic 2-axis turning head with animated LED eyes It can also make disgusting noises!!

25. Kodu is a free simple programming environment for children to write games: http://www.kodugamelab.com/. The program consists of a sequence of WHEN X DO Y commands. Here is the start of a program to move the object with the keyboard’s 4 arrow keys.

2

Here is an example of a longer program which also uses the Microsoft X-Box game controller. Needless to say there are a lot of bells, whistles and especially bangs available!

26. is a very user-friendly and free version of which is ideal for learning Basic Programming: http://smallbasic.com/. It can output text into a text window and graphics into a graphics window. As you start to type commands a helper pops up to suggest what you might want to enter! I want line 9 of my program to hide the Turtle. Once I have entered `Turtle’ it tells me what sorts of things can come next. So I can see the syntax and complete line `9 Turtle.Hide()’. There are plenty of interesting ideas of the website such as the Collision Physics example below. You can see the program run and also view the code.

3

28. Flowol This is a flowcharting system by Rod & Anthony Bowker for control and data-logging using either on screen `mimics’ or connected to a range of sensing and control systems. The system is illustrated by the screen below showing three simple processes running in parallel to control the greenhouse heater, sprinkler and ventilation systems according to sensed values. http://www.flowol.com/

Above is a selection of the mimics available, and to the right is the current range of sensing and control systems supported.

The parent company is called Keep I.T. Easy and it is developing a new system called RobotMesh for use with Vex Robotic systems. Here is a sneak preview. As I don’t have a Vex robot I have just done some trivial arithmetic instead!

4

This system uses another graphical language based on blocks which closely resembles Scratch, but will also output equivalent code in the Python language, as shown here. So that led me to hunt for more information on Blockly

29. Blockly This is a coding system developed by Google for people to develop their own software and apps for Google’s Android system, such as I have in my Samsung Galaxy Note smart-phone.

Doing a Google search on Blockly takes you to the Home page which tells you it has moved! Following the `Developers’ link takes you to the current system home page. It states that: “Blockly is one of a growing number of visual programming environments. Many of these languages have roots at MIT, leading to a similar look and feel across different products. Blockly was influenced by App Inventor, which in turn was influenced by Scratch, which in turn was influenced byStarLogo.” So now you know!

By coincidence I ran into Blockly again much sooner than I expected. It is being used by the BBC as the platform for developing the code for the newly announced BBC Micro Bit microcontroller.

5

30. The BBC Micro Bit (aka Bug) On Thursday 12th March, the BBC launched their plans for the new BBC Micro Bit. The device is a small microcontroller board with an ARM processor. The plan, as I understand it, is that every Year 7 pupil (age 11/12), whose parent is a BBC licence holder, will receive a free unit via their school at this September.

The announcement, together with a video, is at: http://www.bbc.co.uk/news/technology-31834927. “The BBC does not see Micro Bit as a rival to similar computing devices such as Raspberry Pi, Arduino, Galileo and Kano, but rather hopes it will act as a "springboard" to these more complex machines. The tiny programmable machine is still a prototype and the BBC is working with several partners, including chip-designer Arm, Microsoft and Samsung, to get the end product right. When it launches in September it will be compatible with three coding languages - Touch Develop, Python and ++. The device is tiny - fitting easily into the of a hand. Children will be able to create text via a series of LED lights and they will also be able to use it to create basic games. The final version will have a Bluetooth link enabling it to be hooked up to other devices such as a Raspberry Pi.”

Most of the information I have gleaned comes from these Computing At School forums: http://community.computingatschool.org.uk/forums/1/topics/4160 http://community.computingatschool.org.uk/forums/1/topics/4182/posts/53335 The trial site for pilot schools is at: http://bug.iotoy.org/bug You can create your own account at: http://bug.iotoy.org/bug/create_user_form/ This gives you access to the emulator in which you write your own programs. The students have physical prototypes too – see http://bug.iotoy.org/downloads/FAQ/Microbug_FAQ.pdf My own attempt at programming in Blockly can be found at: http://bug.iotoy.org/bug/program/2384/Binary%20to%20LED

6

Here is the full program in Blockly: The Micro Bit board, known as the Bug, is designed to be run autonomously – in which case its principal display device is the 5x5 array of small LEDs. So my little program takes a whole number, such as 19, and subtracts enough 2s from it so that it eventually gets down to a 0 or 1 depending on whether the number was even or odd. The LEDs are numbered from left to right and from top to bottom, so that the coordinates of the top right LED are (4,0). If the number is odd that LED will be lit up by the `plot x,y’ command in the If statement. Then the number is replaced by the value of Mod which would be 9 in this case. The process is repeated until Mod is zero. When you run the program, by pressing the green arrow button under the emulated Bug, the LEDs will up to show that the binary equivalent of 19 is 10011 or 16+2+1.

Selecting the `Code’ tab displays the Python equivalent of the Blockly program.

The announcement also mentioned that the Bug will also be compatible with the `Touch Develop’ programming system. So that’s the next thing to explore!

31. Touch Develop This is a free product from Microsoft Research for developers of apps and games for all platforms, not just Windows: https://www.touchdevelop.com/. There is quite a range of “holding your hand” tutorials to get you started. Here is one which shows the similarities, and differences, between it and Scratch: https://www.touchdevelop.com/docs/scratchcattutorial

The completed tutorial doesn’t quite fit on a single screen shot – but I hope it does give a good feel.

7

Personally I very much hope that the BBC will explore how to make the Bug compatible with the Scratch 2 system in the way Revolution Education has achieved with its S2P (Scratch to PICAXE) and S2Bot (Scratch to Robots) development.

Another avenue I hope it will explore is making it compatible with another, simpler, text-based programming language being developed currently by Professor Peter Millican of Hertford College Oxford – the Turtle System. Peter is very much a polymath. He is the Gilbert Ryle Professor of Philosophy at Oxford University and the PPE coordinator at Hertford College (of which I’m an alumnus). He also established the Computing & Philosophy degree course in the Department of Computer Science. Before taking up his post in Oxford he taught Computing and Philosophy at the University of Leeds. While there he developed the Turtle System as a learning package both as a general studies course and for specialist computer scientists.

32. The Turtle System Here is a screen shot showing some of the main features.

8

The software is still in development and is currently available for Windows in a version which expires at the end of each month, so you are forced to install the latest edition which is at: http://www.turtle.ox.ac.uk/downloads/TurtleSystemBeta.exe. There is also an online trial version. The core of the system is the Turbo Pascal language to which Peter has added commands for Turtle graphics

The window on the left is the program editor where you create and edit your program. Like BASIC the lines of the program are numbered. This very simple program does not use any user variables. The first block in lines 3-8 defines a procedure `prong’ which draws a line 400 units long from the current turtle position and in its current direction. It then draws a filled in disc before returning. The main program has a repeat loop controlled by the turtle’s direction which is stored in the system variable `turtd’. After each ‘prong’ is drawn in a random colour, the turtle’s direction is changed by 61° until it is zero (modulus 360). The program runs incredibly fast. The output is to a graphics screen called the `canvas’ whose origin is in the top left corner. I have opted to view the system as a `power user’ in order to peel the layers off the onion to get a peek at what’s going on under the bonnet. The window to the right has a number of tabs below it. I have selected the `PCode’ tab which shows the `pseudocode’ in which the Pascal program has been compiled. The screen below shows how the Turtle equivalent of the Decimal to Binary conversion program for the BBC Bug. In the Blockly emulator there is no way currently to take the integer part of real number, which is why we had to relatedly subtract 2s to see if anything was left. In Turtle all numeric variables are integers, so the result of 19/2 is 9. So we have a much more efficient way to find the remainder – just subtract 2*(x/2) from x to get o if x is even and 2 if x is odd. Our program starts by defining the names and types of the variables used. I could not use `mod’ as the name of a user variable since it is already the name of a function!

I have used one of the `QuickHelp’ tabs which has a further row of tabs on the right-hand side. I have chosen the `’ tab which tells me about the main structures in Turtle. So the system comes complete with the manuals bundled in. At the BETT show this year the Secretary of State for Education, Nicky Morgan, announced a number of initiatives to improve the teaching of the Computing curriculum.

9

“A consortium led by Queen Mary University of London working closely with Hertford College, Oxford will use £25,000 DfE funding and a further £25,000 matched funding from Google, the UCL led CHI+MED project, the faculty of philosophy at the University of Oxford and a private philanthropist to create a range of resources that will support teachers in promoting the development of computing-related thinking skills. These include 16,000 booklets for teachers on computing-related thinking across the curriculum and further development of the Turtle programming system, which makes text-based programming easier to teach so that it is fully available online.”

The new teachers’ Forum has gone online at: http://www.turtle.ox.ac.uk/forum/user There are a couple of articles about Turtle by Peter which appeared in the CAS group’s Switched On journal: http://www.turtle.ox.ac.uk/downloads/SwitchedOn_Article1.pdf and http://www.turtle.ox.ac.uk/downloads/SwitchedOn_Article2.pdf. Peter is now developing the Turtle System to support physical computing by interfacing to devices like UCL’s Engduino and Vernier’s range of sensors for data-logging.

33. Footnote The eagled-eyed reader who has got this far will have noticed that languages like Python, Java and C++ have not been given much attention. This is not in any way to demean their importance as programming languages. But in my personal view these are not the most appropriate languages to use with beginners – of any age. There are excellent introductory chapters for Python in the CAS Raspberry Pi education manual – and very many fine resources to support learning any language on the web, especially on the CAS site. The KS1-3 (5-14) Computing curriculum for English schools specifies that learners should be taught to program in at least two languages, one of which should be text-based. My explorations over the past couple of months have convinced me that `Blocky’ languages, particularly Scratch 2, and `Basic’ languages, particularly Turtle, are sufficiently powerful, accessible and motivating to support anyone (no matter how old) who wants to learn to code, with a purpose. With the availability of such free and well supported software as Turtle and Scratch along with very cheap and easy to use sensing and microcontroller systems we are at the dawning of a new age for computing for fun. We had such an age back in the early 1980s with the BBC micro and the Sinclair ZX Spectrum supported by the BBC digital literacy and its TV programs such as `Micro Live’. The House of Lords Digital Skills Committee report this February highlights the urgent need for a new digital literacy campaign. Martha Lane Fox developed this theme around the `doteveryone’ concept during her Dimbleby lecture this week. The BBC’s announcement of its `Make It Digital’ initiative, together with the development of the BBC Bug, should get things on the right road. Of course we want children to learn Computing at schools, but now we have a real opportunity to wring in a much wider community in the way that the BBC micro era achieved. We need to involve families, homes, the retired, the media, companies, ambassadors, academics, professionals to make the UK once again the crucible for home computing.

34. About the Author – Adrian Oldknow graduated in maths from Oxford and later in Computer Science from Brunel. He has taught in state and independent secondary schools, as well as in Further Education and Teacher Training Colleges. Together with Prof. Afzal Ahmed, he established the Mathematics Centre at the West Sussex Institute of Higher Education WSIHE. He was awarded a Personal Chair in Mathematics & Computing Education at University College Chichester and is now Emeritus Professor of STEM Education at the University of Chichester. He left Higher Education at the age of 50 to pursue a free-lance career advising IT companies such as Casio, HP, Intel, Microsoft, Promethean, SMARTBoard and on STEM education developments as well as working for the Mathematical Association and carrying out contract work for government agencies such as the BECTA, DfE, QCA, TTA and the World Bank. Now retired he is a full-time campaigner for a world-class STEM education for all students as Founder of the Cambridge Centre for Innovation in Technological Education CCITE and co-founder of the Engineering & Technology Education Partnership ETEP.

Adrian Oldknow [email protected] 30th March 2015

10

Learning to code - with a purpose Adrian Oldknow [email protected] March 2015 Contents Part 1 13 pages 1. Introduction 1.1 2. Scratch 1.1 3. MaKey MaKey and PicoBoard 1.2 4. LEGO WeDo 1.3 5. Robotiky 1.5 6. Crumble and Sparkle 1.6 7. Arduino and Engduino 1.9 8. Résumé 1.12

Part 2 7 pages 8. Résumé 2.1 9. Genie 2.2 10. PICAXE BOT 120 Microbot kit 2.3 11. Micropython 2.5 12. Mindsets IQ4 2.6 13. Résumé – part 2 2.7

Part 3 6 pages 14. Raspberry Pi and add-ons 3.2

Part 4 8 pages 15. K’Nex and control 4.1 16. gPiO board for the Raspberry Pi 4.1 17. Raspberry Pi toppings aka `HATS’ – watch this SPACE! 4.2 18. LEGO revisited – graphical programming with WeDo 4.2 19. LEGO Mindstorms NXT 2.0 4.3 20. LEGO Mindstorms EV3 4.6 21. LEGO Mindstorms, Scratch and Bluetooth 4.7

Part 5 11 pages 22. More Robotics – OhBot 5.1 23. More Robotics – Edison 5.1 24. Robosapiens X and Phone dongle 5.2 25. Microsoft Kodu 5.2 26. Microsoft Small Basic 5.3 28. Flowol 5.4 29. Blockly 5.5 30. The BBC Micro Bit (aka Bug) 5.6 31. Touch Develop 5.7 32. The Turtle System 5.8 33. Footnote 5.10 34. About the Author 5.10

11