Monday, 28 November 2016

Training a Neuron using Scratch

In a previous post I used Scratch to build a working artificial neuron.

In this post, the training of a neuron all written in Scratch is tackled. The video shows it action and you can have a go at using the software yourself at the end of the post. The Scratch code can be found at

All views are those of the author and should not be seen as the views of any organisation the author is associated with.

Saturday, 26 November 2016

Computer Science for Fun - cs4fn: cs4fn Magazine+: Issue 22 Creative Computing

Computer Science for Fun - cs4fn: cs4fn Magazine+: Issue 22 Creative Computing:

cs4fn Magazine+: Issue 22: Computing Sounds Wild

Front Cover of cs4fn issue 22

ISSN 1754-3657 (Print)

ISSN 1754-3665 (Online)

A pdf is available to download for free from our download site.
'via Blog this' All views and opinions are the author's and do not necessarily reflected those of any organisation they are associated with. Twitter: @scottturneruon

Tuesday, 22 November 2016

Artificial Neuron in Scratch


  • Set the inputs by pressing the buttons marked input 1 and input 2 (Red is off(False or 0) and Green is on(True or 1))
  • Change the weights by changing weights 1 to 3, wx goes with input x and weight 3 is the bias.
  • To activate the neuron you need to click on the the yellow ball ('the neuron').

The video below show it in action and explains the code.

All views are those of the author and should not be seen as the views of any organisation the author is associated with.

Sunday, 6 November 2016

How to be an Unplugged Artist

A recently released book Teaching Computing Unplugged in Primary Schools  edited by Helen Caldwell (University of Northampton) and Neil Smith (Open University) has a number of interesting chapters by authors who are passionate about how computing is taught in schools. The central theme is unplugged activities, without using computers, but still teach the fundamental of computational thinking.

Ok, confession time. I co-wrote, along with Katharine Childs (Code Club), Chapter 3 Artists so I am biased here, but I believe in the central theme of Unplugged Computing. Computing, and Computational Thinking in general,  is not just about programming and using a computer (though using computers and  programming are vitally important to Computing) but it is also about many other things including problem-solving, being creative and working collaboratively.

Chapter 3 is about linking these computational thinking ideas to produce visual art, by applying computing principles including  repetition, following and refining algorithms, and abstraction. The chapter also looks, how these links have already being made, with examples such Sol Le Witt where not all the work that was produced by the artist himself, but some by others following his written instructions - in other words an algorithm. There is even a game Thomas's Tangles

The other chapters make links with areas such as Robots, Musicians, Explorers, Magicians, Gamers, Cooks and Scientists.


Barr, D., Harrion, J., and Conery, L. (2011) Computational Thinking: A Digital Age Skill for Everyone Leading and Learning with Technology, ISTE, March/April 2011 [accessed via on 26/12/2015]
Barr, V. and Stephenson, C. (2011) Bringing Computational Thinking to K-12, ACM Inroads, Vol 2. No 1, pp 48 - 54 [accessed via on 26/12/2015]
Computing at School (2013) Computing in the National Curriculum: A guide for primary teachers [accessed via on 13/3/2016]
Denning, Peter J. (2009) Beyond Computational Thinking, Communications of the ACM Vol 52, Issue 6, pp 28 - 30 [accessed via on 26/12/2015]
DfE: Department for Education (2013) National Curriculum in England: computing programmes of study
Freedman, J. (2015) Cycloid Drawing Machine [online] URL: accessed on 3/3/2016.
Google. 2016 Project Jacquard [online] URL: accesed on:1/3/2016.
Knuth, D. 1968. Preface, The Art of Programming vol 1., Boston: Addison-Wesley.
Knuth, D. 1996. Foreword. In: Petkovsek, M., Wilf, H., Zeilberger, D. A=B.. Natick: A K Peters/CRC Press, vii.
Koetsier, T., 2001. On the prehistory of programmable machines: Musical automata, looms, calculators. Mechanism and Machine Theory, 36(5), 589-603.
Menegus, B (2016) CDMS: Built with Processing [online] URL: accessed on 4/3/2016
MoMA. 2012. MoMA| Video Games [online] URL: accessed on: 1/3/2016.
Papert, S (1993) The children's machine: Rethinking schools in the age of the computer. New York: Basic books
Pearson M (2011) Generative Art: A practical guide using Processing, New York: Manning, 3-12
Selby, C. and Woollard, J. (2013) Computational thinking: the developing definition University of Southampton [accessed via on 26/12/2015]
The Art Story (2016) Sol LeWitt [online] accessed on: 6/3/2016
Wing, J. (2006) Computational Thinking Communications of the ACM Vol 49 pp 33 - 35 [accessed via on 26/12/2015]
Wing, J. (2011) Computational Thinking - What and Why The Link - News from the School of Computer Science, Issue 6.0, Spring 2011 [accessed via on 26/12/2015]
Liukas L (2015) Activity 7 The Robots Hello Ruby - Adventures in Coding, New York: Feiwel and Friends, 94-97.
Schofield, S (2016) Generative Artworks [online] URL:
Turner S (2016) 3 'Art' Scratch Projects [online] URL: accessed on: 12/3/2016.

All views and opinions are the author's and do not necessarily reflected those of any organisation they are associated with. Twitter: @scottturneruonAll views are those of the author and should not be seen as the views of any organisation the author is associated with.

Monday, 26 September 2016

Microbit and junkbot?

What is a Junkbot?
For this project, it is a moving ‘bot’ made from waste materials, combined with an electric motor and a programmable device (in this case a Micro:Bit) to control (or try) it. An example is shown below. More details on junkbots can be found at

Stage 1 - The start of a Junkbot
This stage is relatively simple. Tape some pens or straws to a drinks can.

Stage 2 - Physical arrangement of Microbit and motor control board

The control part is this via a Micro:bit ( Kitronik produce a motor driver board, and provide quite a bit of support for it, for the Micro:Bit (the latest version of the board can be found at ). A 6v battery pack is connected (see on the left of the image) and wires going to a motor are attached to the first block on the front left (marked as motor A).

The overall arrangement is show below, including a broken propellor as an unbalanced load to make the motor vibrate - the propellor was to hand but if you can secure something a clothes peg this could be used.

Stage 3 - Built Junkbot
Now we just need to put them together by taping (or fixing somehow) the motor to the junkbot built in stage 1. A further possibility is to attach the Micro:Bit, motor driver board and battery pack to the junkbots; but this adds weight.

Stage 4 Code
 Using Micropython via the online editor to program the board and therefore the junkbot. 
An example piece of code is shown below:

from microbit import *

def startIt():

def leftTurn(duration):
def stopIt():

while True:
   if button_a.is_pressed():
   if button_b.is_pressed():

Unplug the Micro:bit from the motor driver board and download the code to the microbit. Unplug the download cable and plug the Micro:Bit back into the motorboard, with the battery pack attached there is enough power for the Micro:Bit and the motor - don't plug in any other power including the programming cable when it is in the motor driver board.

Stage 5 In action

Suggested Resource List
  • Small Electric Motor
  • Kitronik Motor Board
  • Battery Pack
  • BBC Micro:bit
  • Pens
  • Junk (Can or Bottle)
  • Wires
  • Tape
  • Scissors
  • Broken Propeller or un-balanced load
  • Screw Driver

Stage 6: More control
In the remained of this post I want to show a modification to it, to use one Micro:Bit to control the junkbot controlled by another Micro:Bit. A nice feature of the Micro:Bit using micropython, is it can send and receive simple messages via radio - so here is my take on it.

The first problem is the Python editor available on does not seem to work with the radio API. One solution to this is to change to the mu editor.

Two pieces of code are needed.

Stage 7 Sending Code for the 'remote' control:
Essentially it is set up to send two messages, via the built-in radio module, spinl or spinr depending on which button is pressed.

import radio
from microbit import button_a, button_b


while True:
   if button_a.is_pressed():
   if button_b.is_pressed():


Satge 8 Junkbot Code
This takes an adapted form of the previous Junkbot code to work by; on receiving spinl or spinr via the radio link; spin the motor clockwise or anticlockwise.
import radio
from microbit import pin8, pin12, sleep

def leftTurn(duration):
def rightTurn(duration):
def stopIt():

while True:
   incoming = radio.receive()
   if incoming == 'spinl':
   if incoming == 'spinr':

All views are those of the author and should not be seen as the views of any organisation the author is associated with.

Thursday, 11 August 2016

Traffic Lights

Ok, one of my quirks is I think the programming exercise of programming simulated traffic lights is fun and interesting! Here are two examples; the first in Scratch and the second using a BBC Micro:bit and GlowBugs (programmable LEDs).

All views are those of the author and should not be seen as the views of any organisation the author is associated with.

Wednesday, 6 July 2016

Review of a Problems-First Approach to Programming

Review of a Problems-First Approach to First Year Undergraduate Programming - Springer

Gary J. Hill   

Published in Software Engineering Education Going Agile Part of the series Progress in IS pp 73-80

DOI 10.1007/978-3-319-29166-6_11

This paper, predominantly discusses the teaching of programming and problem solving to undergraduate first year computing students, using robots/robot simulators and visual programming to emulate the robot tasks. The needs to focus initial programming education on problem solving, prior to the teaching of programming syntax and software design methodology is also considered. The main vehicle for this approach is a robot/robot simulation programmed in Java, followed by the programming of a visual representation/simulation to develop programming skills.


  1. 1.
    Beaumont, C., and Fox, C.: Learning programming: Enhancing quality through problem-based learning. In: Proceeding of 4th Annual Conference of the subject centre for Information and Computer Sciences of the Higher Education Academy (pp. 90-95). Newtownabbey, Northern Ireland: Higher Education Academy (2003).
  2. 2.
    Hill G. J., Turner S.: Chapter 7:​ Problems First. In: Software Industry-Oriented Education Practices and Curriculum Development: Experiences and Lessons, M Hussey, X Xu & B Wu (Eds.), IGI Global, USA, pp 110-126, ISBN: 978-1-60960-797-5 (2011).
  3. 3.
    Hill, G., Turner, S. J.: Problems first, second and third. In: International Journal of Quality Assurance in Engineering and Technology Education (IJQAETE). 3(3), pp. 88-109. 2155-496X (2014).
  4. 4.
    Williams, A. B.: The qualitative impact of using Lego Mindstorms robot to teach computer engineering. In: Institute of Electrical and Electronic Engineering (IEEE) Transactions on Education, 46, 206 (2003).
  5. 5.
    Štuikys, V., Burbaitė, R., Damaševičius, R.: Teaching of Computer Science Topics Using Meta-Programming-Based GLOs and LEGO Robots. In: Informatics in Education - An International Journal (Vol12_1), pp125-142 (2013).
  6. 6.
    Kariyawasam, K., A., Turner, S., Hill, G.: Is it Visual? The importance of a Problem Solving Module within a Computing course. In: Computer Education, Volume 10, Issue 166, May 2012, pp. 5-7, ISSN: 1672-5913 (2012).
  7. 7.
    HEA-ICS Development Fund: HEA-ICS Development Fund [online] Available from: http://​www.​ics.​heacademy.​ac.​uk/​projects/​development-fund/​index.​php[Accessed: February 2015] (2015).
  8. 8.
    HEA-ICS/Microsoft Innovative Teaching Fund: Developing problem-solving teaching materials based upon Microsoft Robotics Studio [online] Available from: http://​www.​ics.​heacademy.​ac.​uk/​projects/​development-fund/​fund_​details.​php?​id =​ 88 [Accessed February 2015] (2015).
  9. 9.
    Adams, J. P., & Turner, S. J.: Problem Solving and Creativity for Undergraduate Engineers: process or product? In: International Conference on Innovation, Good Practice and Research in Engineering Education July 14-16, 2008, Loughborough, England, Higher Education Academy. 9781904804659 (2008).
  10. 10.
    Adams, J., Turner, S., Kaczmarczyk, S., Picton, P., & Demian, P.: Problem solving and creativity for undergraduate engineers: Findings of an action research project involving robots. In: International Conference on Engineering Education (ICEE 2008), Budapest, Hungary (2008).
  11. 11.
    Turner S., Hill G. J.: Robots in Problem-Solving and Programming. In: 8th Annual Conference of the Subject Centre for Information and Computer Sciences, University of Southampton, 28th - 30th August 2007, pp 82-85 ISBN 0-978-0-9552005-7-1 (2007).
  12. 12.
    Gallopoulos, E., Houstis, E., Rice, J. R.: Computer as Thinker/Doer. In: Problem-Solving Environments for Computational Science, IEEE Computational Science and Engineering pp 11-23 (1994).
  13. 13.
    Houghton, W.: How can Learning and Teaching Theory assist Engineering Academics? [online] School of Engineering - University of Exeter. Available from: https://​www.​heacademy.​ac.​uk/​sites/​default/​files/​learning-teaching-theory.​pdf [Accessed: November 2015] (2004).
  14. 14.
    Bloom, B. S. (Ed.): Taxonomy of educational objectives. In: Handbook I: Cognitive domain. White Plains, NY: Longman (1956).
  15. 15.
    JICC5: Java & the Internet in the Computing Curriculum, Higher Education Academy (HEA) – Information and Computer Sciences (ICS) Conference, South Bank University, London, 22nd Jan, [online] Available from: http://​www.​ics.​heacademy.​ac.​uk/​events/​displayevent.​php?​id=​127[Accessed: February 2015] (2001).
  16. 16.
    Computing Curricula: IEEE CS, ACM Joint Task Force on Computing Curricula, IEEE Computer Society Press and ACM Press. [online] Available from http://​www.​acm.​org/​education/​curricula.​html [Accessed: February, 2015] (2001).
  17. 17.
    Koulouri, T., Lauria, S., Macredie, R., D.: Teaching introductory programming: A quantitative evaluation of different approaches. In: ACM Trans. Comput. Educ. 14, 4, Article 26 (December 2014), 28 pages, DOI: http://​dx.​doi.​org/​10.​1145/​2662412 (2014).
  18. 18.
    Turner S., Hill G. J.: The Inclusion of Robots Within The Teaching OF Problem Solving: Preliminary Results. In: 7th Annual Conference of the ICS HE Academy, Trinity College, Dublin, 29th - 31st August 2006, Proceedings pg 241-242 ISBN 0-9552005-3-9 (2006).
  19. 19.
    Turner S., Hill G. J.: Robots within the teaching of Problem-Solving. In: ITALICS, HEA-ICS, Volume 7 Issue 1, June 2008, pp. 108-119, ISSN: 1473-7507 (2008).
  20. 20.
    Turner S., Hill G. J.: Innovative Use of Robots and Graphical Programming in Software Education. In: Computer Education, Volume 9, May 2010, pp. 54-6, ISSN: 1672-5913 (2010).
  21. 21.
    Turner S, Hill G, Adams: Robots in problem solving in programming. In: 9th 1-day Teaching of Programming Workshop, University of Bath, 6th April 2009 (2009).
  22. 22.
    Gold. N.: Motivating Students in Software Engineering Group Projects: An Experience Report. In: Innovation in Teaching and Learning in Information and Computer Sciences 9(1), 10-19. DOI: 10.11120/ital.2010.09010010 (2010).
  23. 23.
    Greenfoot: Teach and Learn Java Programming. [online] Available from http://​www.​greenfoot.​org/​ [Accessed: February 1, 2015] (2015).
  24. 24.
    Microsoft: Microsoft robotics studio [online] Available from: http://​msdn2.​microsoft.​com/​en-us/​robotics/​aa731520.​aspx [Accessed: February 2015] (2006).
  25. 25.
    Chickering, A. W., Gamson. Z. F.: Seven Principles for Good Practice in Undergraduate Education. In: AAHE Bulletin 39:3-7. ED 282 491.6 pp. MF-01; PC-01 (1987).
  26. 26.
    Savin-Baden, M. & Wilkie, K.: (eds) Challenging Research in Problem-based Learning. Maidenhead: Open University Press/SRHE (2004).

To read more go to: Review of a Problems-First Approach to First Year Undergraduate Programming - Springer

'via Blog this'

Posting on the site does not imply endorsement in any way, by the blog owner or any organisations the blog owner is associated with.

If you'd like to find out more about Computing at the University of Northampton go to: All views and opinions are the author's and do not necessarily reflected those of any organisation they are associated withAll views are those of the author and should not be seen as the views of any organisation the author is associated with.