Sunday 4 December 2016

Hackaball is fun

The long awaited Hackaball has been released to those who backed as a kickstarter: https://www.kickstarter.com/projects/hackaball/hackaball-a-programmable-ball-for-active-and-creat , designed as a tough, easily programmable device for children that can be thrown around and (within reason) treated roughly. Further protected by an outer shell.


The microcontroller is surrounded by a tough what appears to be a silicone (or similar) ring and encased in a two rubbery halves of a ball. In included within are sensors (accelerometer and gyro), vibration motor,  LEDs, rechargeable battery, and a speaker (that can be programmed to make some interesting sounds, that go down well with children and adults). The two halves of the ball are translucent and diffuse the LEDs effectively.


The computer you can throw, was the campaign's strapline and that is not an idle boast, I have let a six-year throw it around a large room with hard floors and even harder walls, treat like a ball and I have thrown it high it the air at night and not tried catch it to make a second 'moon' (temporarily) and it survives. Getting going with it initially, is basically, switch it on, close the two half of the balls, pull the outer shell over the ball and start throwing it.

The App is free to download and comes with a number of games to download or you can write your own using their graphical language. Though it seems initially simple, it is suited to someone beginning to program - which is its target audience. An example of the code is shown below.


I like this package both as 'just' a toy, it is great fun throwing it within a group and watching it change colour and make interesting noises, from instructions such as "sound like fart" (see the image above). As a relatively simple programmed toy it is good. It in the end though comes down to their strapline "computer you can throw", that is its beauty. When you realise you can program something and throw it, drop it; you are moving from seeing computers as fragile things but to as a physical, enjoyable item - you are throwing it around and not thinking of as a computer.


All opinions in this blog are the Author's and should not in any way be seen as reflecting the views of any organisation the Author has any association with. Twitter @scottturneruon

Monday 28 November 2016

Scratch for Neurones



1. Single Neurone


Instructions:


  • 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.



To see the code go to https://scratch.mit.edu/projects/131892234/ .

A slight modification click on the bell to change the weights

The code is available at https://scratch.mit.edu/projects/171190294/

2. Training a Neurone
In this part, 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 https://scratch.mit.edu/projects/132915502/






All opinions in this blog are the Author's and should not in any way be seen as reflecting the views of any organisation the Author has any association with. Twitter @scottturneruon

Saturday 19 November 2016

kamibot

Kamibot was a recent kickstarter (https://www.kickstarter.com/projects/kamibot/kamibot-teach-your-kids-to-code) from the interesting named, Korean company, 3.14 Co., Ltd as a robot you can dress up in paper outfits.




It is actually quite a nice little kit that can be controlled via Android, IOS or PC (available at http://www.kamibot.com/default.php along with some of the plans for paper outfits). The software is a simple Scratch/Blockly style interface and programming is simple. Connecting the robot to the, in my case, an iPad was relatively easy. I would welcome a Mac version of the KamiBlock software but apart from that nice robot kit, that allows you to get programming quickly if you have used Scratch, Blockly or Crumble. 






They have recently twitted about new piece of software for Android device - using cards on the screen in combination with their paper mapboard.






All opinions in this blog are the Author's and should not in any way be seen as reflecting the views of any organisation the Author has any association with. Twitter @scottturneruon

Saturday 12 November 2016

Be an Unplugged Computing 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. An example activity is shown below (named after my son who was the first to play it).


Thomas’ Tangles
Exploring abstract patterns using randomness within an algorithm.


Using crayons, pencils or pens, we are going to follow an algorithm to create a random drawing. This could be done in pairs and you will need squared paper.
Person A: Rolls the dice and reads out the instructions.
Person B: Is the ‘robot' carrying out the instructions.


IMG_0226.JPG


When the starting or central square is blocked and a new central square is needed the roles of A and B swap (so A is the ‘robot’ and B rolls the dice and reads out the instruction). The roles keep swapping.


Algorithm


Start from a random square – call it the centre square
Repeat until end of game
If die roll = 1
Roll die for number of moves
Check for blocks
If not blocked then
move die roll number of steps up the page
If die roll = 2
Roll die for number of moves
Check for blocks
If not blocked then
move die roll number of steps down the page
If die roll = 3
Roll die for number of moves
Check for blocks
If not blocked then
move die roll number of steps to the left
If die roll = 4
Roll die for number of moves
Check for blocks
If not blocked then
move die roll number of steps to the right
If die roll = 5
Roll die
If die = 1 change colour to Red
If die = 2 change colour to Blue
If die = 3 change colour to Black
If die = 4 change colour to Red
If die = 5 change colour to Orange
If die = 6 change colour to Yellow
If die roll = 6
Return to current centre square


Check for blocks:
If pathway blocked do not move then
reroll die
If number of spaces in the direction > die roll then
move until blocked
If all pathways blocked then
choose a new centre square



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


References

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 http://www.csta.acm.org/Curriculum/sub/CurrFiles/LLCTArticle.pdf 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 http://csta.acm.org/Curriculum/sub/CurrFiles/BarrStephensonInroadsArticle.pdf on 26/12/2015]
https://doi.org/10.1145/1929887.1929905
 
Computing at School (2013) Computing in the National Curriculum: A guide for primary teachers [accessed via http://www.computingatschool.org.uk/data/uploads/CASPrimaryComputing.pdf on 13/3/2016]
 
Denning, Peter J. (2009) Beyond Computational Thinking, Communications of the ACM Vol 52, Issue 6, pp 28 - 30 [accessed via http://sgd.cs.colorado.edu/wiki/images/7/71/Denning.pdf 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: https://www.kickstarter.com/projects/1765367532/cycloid-drawing-machine accessed on 3/3/2016.
 
Google. 2016 Project Jacquard [online] URL: https://www.google.com/atap/project-jacquard/ 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.
https://doi.org/10.1016/S0094-114X(01)00005-2
 
Menegus, B (2016) CDMS: Built with Processing [online] URL: http://wheelof.com/sketch/ accessed on 4/3/2016
 
MoMA. 2012. MoMA| Video Games [online] URL: http://www.moma.org/explore/inside_out/2012/11/29/video-games-14-in-the-collection-for-starters/ 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 http://eprints.soton.ac.uk/356481/7/Selby_Woollard_bg_soton_eprints.pdf on 26/12/2015]
 
The Art Story (2016) Sol LeWitt [online] http://www.theartstory.org/artist-lewitt-sol.htm accessed on: 6/3/2016
 
Wing, J. (2006) Computational Thinking Communications of the ACM Vol 49 pp 33 - 35 [accessed via https://www.cs.cmu.edu/~15110-s13/Wing06-ct.pdf on 26/12/2015]
https://doi.org/10.1145/1118178.1118215
 
Wing, J. (2011) Computational Thinking - What and Why The Link - News from the School of Computer Science, Issue 6.0, Spring 2011 [accessed via http://www.cs.cmu.edu/sites/default/files/11-399_The_Link_Newsletter-3.pdf 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: http://www.simonschofield.net
 
Turner S (2016) 3 'Art' Scratch Projects [online] URL: http://compuationalthinking.blogspot.co.uk/2016/03/3-of-my-scratch-projects-for-week.html 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 opinions in this blog are the Author's and should not in any way be seen as reflecting the views of any organisation the Author has any association with. Twitter @scottturneruon

Monday 31 October 2016

Simple (and temporary) Halloween Hack


This really is a simple one. A Glowbug (or a NeoPixel) with the data in, Ground and 5v connected pushed into the neck of the balloon, then inflated the balloon. The neck of the balloon and wires are twisted tightly and insulating tape used to provide a bit of a seal.

The data in wire is connected to Pin 0 of a Micro:Bit and the other two wires are attached to the corresponding connections of the Micro:Bit. The code below randomly selects the colours and the length of the delay before changing colour.

from microbit import *
import neopixel, random

np = neopixel.NeoPixel(pin0, 1)

while True:
    rd=random.randint(1,254)
    gr=random.randint(1,254)
    bl=random.randint(1,254)
    t1=random.randint(200,2000)
    np[0] = (rd, gr, bl)
    np.show()
    sleep(t1)

The problem is a slow leak means it only stays inflated for a short while.


All opinions in this blog are the Author's and should not in any way be seen as reflecting the views of any organisation the Author has any association with. Twitter @scottturneruon

Monday 24 October 2016

Dancing pixels

In previous post I played with using the combination of the Proto-Pic Micro:pixel and Micro:Bit to react, using the accelerometer, to music through a computer speakers. The vibrations from the music shake the Micro:Bit enough to give measurable changes in three axis, and these values are used to change the pixels colour.



The latest version of this uses most of pixels.




Coded in micropython using the Mu editor.

from microbit import *
import neopixel, random

np = neopixel.NeoPixel(pin0, 32)

while True:
    for pxl in range (2,32, 5):
        rd=int(abs(accelerometer.get_x())/20)
        gr=int(abs(accelerometer.get_y())/20)
        bl=int(abs(accelerometer.get_z())/20)
        np[pxl] = (rd, gr, 0)
        np[pxl-1] = (rd, gr, 0)
        np[pxl+1] = (0, gr, rd)
        np[pxl-2] = (rd, 0, 0)
        np[pxl+2] = (0, gr,0)
        np.show()

Video of it action, using royalty-free music Electro Deluxe by My Free Mickey feat. Gurdonark. http://dig.ccmixter.org/files/myfreemickey/48180





As one of the reviewers on Proto-Pic site states, the box the Micro:pixel comes in does make a good diffuser.

All opinions in this blog are the Author's and should not in any way be seen as reflecting the views of any organisation the Author has any association with. Twitter @scottturneruon

Saturday 22 October 2016

Microbit + Micro:pixel reacting to music

This post discusses a simple way to get the Micropixel-Micro:Bit combination to change the Neopixels based on the music. Using the accelerometer on the Micro:Bit to provide x,y,z values to provide colour values for the neopixels; the micropixel sits over the speaker and vibrations are picked up. 

Simple but it roughly works (see the video at the end of the post).


Code
from microbit import *
import neopixel, random

# Setup the Neopixel strip on pin0 with a length of 2 pixels
np = neopixel.NeoPixel(pin0, 32)

while True:
    pxl=11
    rd=int(abs(accelerometer.get_x())/20)
    gr=int(abs(accelerometer.get_y())/20)
    bl=int(abs(accelerometer.get_z())/20)
    t1=10
    np[pxl] = (0, 0, bl)
    np[pxl-1] = (rd, gr, 0)
    np[pxl+1] = (0, gr, rd)
    np[pxl-2] = (rd, 0, 0)
    np[pxl+2] = (0, gr,0)
    np.show()
    sleep(t1)
    np[pxl] = (0, 0, 0)
    np[pxl+1] = (0, 0, 0)
    np[pxl-1] = (0, 0, 0)
    np[pxl+2] = (0, 0, 0)
    np[pxl-2] = (0, 0, 0)


Video of it action using Revolve by cinematrix available under Creative Commons Licence (http://ccmixter.org/files/hisboyelroy/430 ).





Always obey the safety advice provided by Micro:bit https://microbit0.blob.core.windows.net/pub/jedfednb/Parent-and-Teacher-micro-bit-safety-guide.pdf 



All opinions in this blog are the Author's and should not in any way be seen as reflecting the views of any organisation the Author has any association with. Twitter @scottturneruon

Disco micro:pixel


In a previous post Proto-Pic board, Microbit and Micropython I played with the Proto-Pic micro:pixel 4x8 NeoPixel board. 

This post is just a short description of a quick play with making it flashing blocks of different colours across the board. The routine produces five random numbers (three to define the colours, one for which pixel is selected and the last for the delay each iteration). The idea of being - a pixel is selected, but so are the ones either side of it, each one has a different combination of the colour values, but only two of the pixels are turned off after the delay.

from microbit import *
import neopixel, random

# Setup the Neopixel strip on pin0 with a length of 2 pixels
np = neopixel.NeoPixel(pin0, 32)

while True:
    pxl=random.randint(1,30)
    rd=random.randint(1,32)
    gr=random.randint(1,32)
    bl=random.randint(1,32)
    t1=random.randint(10,100)
    np[pxl] = (rd, gr, bl)
    np[pxl-1] = (gr, bl, rd)
    np[pxl+1] = (bl, rd, gr)
    np.show()
    sleep(t1)
    np[pxl] = (0, 0, 0)
    np[pxl+1] = (0, 0, 0)

The video below shows the routine in action. There is no connection between the pixels and the music on the video - but making the connection between music and the pixels would be an interesting project.




All opinions in this blog are the Author's and should not in any way be seen as reflecting the views of any organisation the Author has any association with. Twitter @scottturneruon

Thursday 20 October 2016

micro:pixel board, micro:bit and micropython

A new (or to me at least)  addition to devices you can attach a Micro:Bit to, is the Proto-Pic micro:pixel 4x8 NeoPixel board; essentially a board with 4 x8 grid of NeoPixels that you plug the Micro:Bit into. Following the advice of the website the  values of RGB are all set to 32 or below to avoid pulling too much power. Pin0 is used to write to. You will need to use the Mu editor for this.





Two tests were tried

Example 1: To get the pixels to appear to light up from the last to the first one.

from microbit import *
import neopixel

np = neopixel.NeoPixel(pin0, 32)


while True:

    for x in range(0, 32):
        for y in range(0, (32-x)):
            np[y] = (y, 32-y, 1)
            if (y>0):
                np[y-1]=(0,0,0)
            np.show()
            sleep(30)




Example 2: To randomly select a pixel and its colour.

from microbit import *
import neopixel, random

np = neopixel.NeoPixel(pin0, 32)

while True:

    pxl=random.randint(0,31)
    rd=random.randint(1,32)
    gr=random.randint(1,32)
    bl=random.randint(1,32)
    np[pxl] = (rd, gr, bl)
    np.show()
    sleep(500)
    np[pxl] = (0, 0, 0)




This is a good, fun board to play with; relatively easy to use.





All opinions in this blog are the Author's and should not in any way be seen as reflecting the views of any organisation the Author has any association with. Twitter @scottturneruon

Thursday 6 October 2016

Micro:bit sings - sort of

Just a short post today on getting the Micro:bit to sing using micropython. The process is covered very well in the Micro:bit-Micropython documentation. This post is just my notes really of what I did.

The goal was to the try and replicate a bit of the intro to Kraftwerk's The Man-Machine (the repeating of Machine)- I came nowhere near it but it was fun trying.

Everything needs to be spelt out in Phonemes, which is a bit of a challenge, but I only had one word to do so that was ok. The Micro:bit-Micropython documentation has a list of the Phonemes allowed, you do need to get them right this was the most common error I found with the code. Pins 0 and 1 had croc-clips connecting them to the first and third parts on a speakers 3.5mm plug (as above) - thank you to Sway Grantham for showing me that.

from microbit import *
import speech

while True:

    speech.sing("MEYSHEYN  ", pitch=90,speed=100)
    speech.sing("MEYSHEYN  ", pitch=70, speed=80)
    speech.sing("MEYSHEYN  ", pitch=60,speed=60)


It is good fun, but develop it away from others, it has the potential to annoy.

It also works with 4Tronix's (thank you for the suggestion) Micro:Bit PlayGround - only one connection needed this time.



All opinions in this blog are the Author's and should not in any way be seen as reflecting the views of any organisation the Author has any association with. Twitter @scottturneruon

Monday 3 October 2016

Playing with 4Tronix's Micro:bit Playground

As much as I like the simplicity and flexibility of Crocodile Clips connecting components to a Micro:Bit, it can get a bit of a rat's nest of wires (especially if you are as messy as I am!). 4Tronix's have released their Micro:Bit PlayGround (http://4tronix.co.uk/store/index.php?rt=product/product&path=89&product_id=580)which is a board that has 3.5mm jack plugs to connect to a range of Gizmos (their phrase not mine) to which the Micro:Bit is screwed into. The battery pack is integrated onto the board on its back (see image below)



The Micro:Bit screws into the PlayGround via five screws which also for the connection between the PlayGround and the 'bit'. 

Below via the three cables connecting 3.5mm plugs, I have attached a 'Dial' (a potentiometer ) and two Flames (neopixels) to change the LED/neopixel's colours by rotating the Dial. Pin 0 has the 'Dial' attached and Pin 1 has the two Flames (neopixels) attached the out from the first goes in as input of the second via one the cables. 





Code
Essentially vary the 'Dial' varies the R,G,B values going to the two Flames/neopixels and so varying their colours. The code used is shown below.

from microbit import *
import neopixel

# Setup the Neopixel strip on pin0 with a length of 2 pixels

np = neopixel.NeoPixel(pin1, 2)

while True:

    s1=int(pin0.read_analog()/5)
    np[0] = (255, s1, 255-s1)
    np[1] = (s1,255, 255-s1)
    np.show()





Video of it in action





Thoughts
I like the idea that the cable doing both the power and control for the Gizmos, it does simplify building a little, more importantly it does produce less clutter (not so many wires). The whole unit with the batteries installed is a little weighty but that does give it at the same a sense of sturdiness which is a positive feature for just playing around  - you wouldn't use it for wearables. Not using croc clips also avoids issues with the clips slipping off with rough handling. 

Nice little arrangement which I am enjoying playing - is for everyone? Probably not, but does provide a sturdy system to experiment with some standardised units.


Related Links
Micro:Bit Playground - Starter Kit
Traffic lights - Microbit, GlowBugs and micropython


All opinions in this blog are the Author's and should not in any way be seen as reflecting the views of any organisation the Author has any association with. Twitter @scottturneruon

Saturday 1 October 2016

Micro:bit, Servo control with Micropython or blocks

You can control servos (small ones) from a Micro:Bit directly. Following a link from the David Whale (Twitter ) , thank you, took me to a Kitronik blog post, https://www.kitronik.co.uk/blog/using-bbc-microbit-control-servo/, which has the answer.

The code uses Microsoft Blocks taken from the post, runs the servos 180 degrees and back again, when button A is pressed. It does exactly what it should. I am also using the Tower Pro SG90 servo.
Can it be replicated in Micropython? This is a new mini project, there seems to be little out there yet on how do this but the best so far is this video by PHILG2864:



The closest I have is the following, it is essentially there.
from microbit import *
pin0.set_analog_period(20)
while True:
    pin0.write_analog(180)
    sleep(1000)
    pin0.write_analog(1)
    sleep(1000)

Setting the time period to 20ms  pin0.set_analog_period(20)seems by experiment (and used in the video above) to be best value so far. The reason for pin0.write_analog(1)  set to 1 instead of 0, 0 seems to stop the whole thing.





All opinions in this blog are the Author's and should not in any way be seen as reflecting the views of any organisation the Author has any association with. Twitter @scottturneruon

Sunday 25 September 2016

UFO talks to Robot - part two

In part one of this series of posts, the project to get Consumable Robotics UFO and Dimm robot was started but focussed on the UFO kit. The goal being for some action on Dimm to trigger a series of messages being passed between the two of them.

In this post, the focus moves to Dimm and the setting up the actions leading to the messaging.

Stage 1 Build
Using the Micro:bits port 0 (as part of the Dimm robot) for the input from the light sensor, which is included in the kit (Red lead going to 3v and the black lead going to GND). Just to note the less light there is the higher the value on the sensor.




Stage 2 Code
Micropython programmed through the Mu editor (see below)

If light levels are high then :
      scroll a message saying "calling UFO" 
      send the code "dimm" via bluetooth.
otherwise: 
      scroll a message saying "I can't see"
If it recieves "ufo" via bluetooth :
      display "Hello, UFO called me"

Micropython code
import radio
from microbit import pin0, pin1, display, sleep

radio.on()

while True:
   incoming = radio.receive()
   if incoming == 'ufo':  
      display.scroll("Hello, UFO called me", 75)
   if pin0.read_analog()<175:
        display.scroll("calling UFO")
        radio.send("dimm")
   else:
        display.scroll("I can't see")

Stage 3 Testing

Video below shows it in action including what happens when the light (in this case a torch) shines on the sensor connected to Dimm; a message is sent and picked up by the UFO kit (LEDs flash and the message saying "DIMM calling" scrolls  across the UFO LED array - see UFO talks to robot - part one for more details). A message is sent back from the UFO kit and on Dimm's LED array the message "Hello, UFO called me").
If the light levels are too low then the message "I can't see" scrolls across Dimm's LED array.






As an aside, the Dimm robot still reminds me, a little, of a colourful, friendly, Ood from Dr Who with all the leads hanging out of the 'mouth' - think that is geeky I know.




All opinions in this blog are the Author's and should not in any way be seen as reflecting the views of any organisation the Author has any association with. Twitter @scottturneruon

ChatGPT, Data Scientist - fitting it a bit

This is a second post about using ChatGPT to do some data analysis. In the first looked at using it to some basic statistics  https://robots...