Playground for Crumble, Micro:Bit & Raspberry Pi

Playground for Crumble, BBC Micro:Bit and Raspberry Pi

IMG_0999b PlayMicro03aPlayCrum_03

(Click on any image to enlarge)

 Purchase Here

Playground Overview

The Playground system allows you to connect external electronics (inputs, outputs, sensors, etc.) to your controller. Currently supports Crumble (from Redfern Electronics), Raspberry Pi and the BBC micro:bit.

The connections from the controller are converted to 3-pin 3.5mm jack connections and the connecting cables are 20cm jack cables – although longer cables can be used if required.

The separate electronic parts, Gizmos, can be used with any Playground. The exception being the Motor Gizmo, which can only be used with Crumble, as the micro:bit does not have integral motor drivers.

All of the Gizmos can be used within your programs using the built-in drivers for the relevant part.

Because each connection includes the necessary power and ground, you don’t need to wire these in separately – this transforms what can be a complicated and messy wiring setup into something tidy and more easily understood

Please check out these videos for Playground for Crumble and Playground for MicroBit

 

Installing Raspberry Pi Software

We have created a python library module that allows you to use the Playground for Raspberry Pi easily and quickly. You can install this from your Raspberry Pi connected to the internet as follows.

  • Download the latest version of the software using wget like this from a command line (eg. LXTerminal):
    wget http://4tronix.co.uk/pg.sh -O pg.sh
    bash pg.sh
  • This will create a new folder on your Pi in the /home/pi folder called playground (all lower case) with the playground.py library module and example files

 

Gizmos

IMG_0337a

Initially, we have 11 Gizmos for sale. These have been colour-coded in a similar way to our Crumbs:

  • Blue:  Digital inputs, such as a Button or Touch sensor
  • Yellow:  Analog inputs, such as a Light sensor or Dial
  • Black: Digital outputs, such as LEDs or Buzzer
  • Red:  Analog outputs such as the Servo or Motor
  • White:  Smart Pixels (aka “neopixels” or “sparkles”), individually addressable, chainable, RGB pixels (Flame, Blaze and Fire Stick)

 

Button Gizmo

Button_02

This provides a simple digital input to Playground. It is Active (High) when pressed and inactive (Low) when not pressed. There is a white indicator LED to show whether it is active or not.

Worksheet Links: Crumble  BBC micro:bit   Raspberry Pi

 

Touch Sensor Gizmo

Touch_02

This provides a digital input to PlayGround. Simply touch the pad on the sensor for it to become active (High) and release for it become inactive (Low). There is a white indicator LED to show whether it is active or not. In fact the sensor will detect your finger without actually touching, so you can do experiments to see how many sheets of paper you can cover it with before it stops working

Worksheet Links: Crumble  BBC micro:bit  Raspberry Pi

 

Dial Gizmo

Dial_02

The Dial Gizmo provides an analog input to your Playground. On the Crumble it will read from 0 to 256, while on the micro:bit it will go from 0 to 1023. The actual top end number will vary due to various losses in the system

Worksheet Links: Crumble  BBC micro:bit    Raspberry Pi

 

Light Sensor Gizmo

Light_02

The Light Sensor Gizmo is an anlog input Gizmo that reacts to the brightness of light to the sensor in the centre. It is tuned to be sensitive to daylight. The values vary from 0 (dark) to 256 (bright) on the Crumble, while on the micro:bit it will go from 0 to 1023. The actual top end number will vary due to various losses in the system

Worksheet Links: Crumble  BBC micro:bit  Raspberry Pi

 

Traffic Light Gizmo

Traffic_02

The Traffic Light Gizmo is a digital output Gizmo for your Playground. Each of the large 10mm LEDs will turn on when the appropriate input is set to High. There are three inputs, one for each of Red, Amber and Yellow

Worksheet Links: Crumble  BBC micro:bit  Raspberry Pi

 

Buzzer Gizmo

Buzzer_02

The Buzzer Gizmo is a digital output Gizmo for your Playground. When the input is set to High, the buzzer will sound and a white indicator LED will light

Worksheet Links: Crumble  BBC micro:bit  Raspberry Pi

 

Flame Gizmo

Flame_01

The Flame Gizmo provides a single, fully controllable, RGB pixel. This allows you to change the colour to any one of 16 million different colours. These are chainable, with both an input and an output connector. On the Crumble, these “smart pixels” are referred to as “Sparkles”, while on the micro:bit they are known as “neopixels”

Worksheet Links: Crumble  BBC micro:bit  Raspberry Pi

 

Blaze Gizmo

Blaze_02

The Blaze Gizmo gives you a ring of 8 , independently controllable, RGB pixels. This allows you to change the colour of any or all of them to any one of 16 million different colours. On the Crumble, these “smart pixels” are referred to as “Sparkles”, while on the micro:bit they are known as “neopixels”. These can be added onto the end of a chain of Flame Gizmos if required, or used on their own

Worksheet Links: Crumble  BBC micro:bit  Raspberry Pi

 

Servo Gizmo

Servo_02

As the name suggests, this Gizmo allows you to very easily connect a miniature 9g servo to your Playground. Plug it in, then program it for a 180 degree range of movement. With the Crumble, the allowable range is -90 to +90. Do not try and use it outside the allowable range.

Worksheet Links: Crumble  BBC micro:bit  Raspberry Pi

 

Motor Gizmo

(Not compatible with micro:bit Playground)

Motor_01

The Motor Gizmo is driven directly from the Crumble motor driver outputs – it cannot work with the micro:bit. Use the Crumble motor control blocks to set the speed and direction of up to 2 Motor Gizmos. You can build yourself a robot very easily with 2 of these

Worksheet Links: Crumble  (BBC micro:bit and Raspberry Pi not available – a prototype motor Gizmo for Pi is shown at top of page – this has a built in motor driver.)

 

Prototyping Gizmo

Proto_01

This simple Gizmo allows you to build your own Gizmo for those inputs or outputs that are not yet available as a ready-made Gizmo. For instance, you could make a temperature sensor, or have a controllable relay. The board has 4 holes for the Signal, 6 for each of Power and Ground, and 48 for you to use for your creation.

 

 

 

McRoboFace Home Page

McRoboFace – Emoticon for Electronic Creations

mrf02b

(Click on any image to enlarge)

Purchase McRoboFace Here

Overview

The McRoboFace is a robotic face with 17 individually controllable RGB LEDs that you can use to bring your electronic creations to life.

Each LED can be set to any of 16 million different colours (256 for each of Red, Green and Blue).

All the LEDs as fully compatible with the “standard” WS2812, also known as “neopixels” – a name coined by Adafruit. As such, any of the many libraries and examples for most of the common controllers can be used to drive them. This includes:

  • Crumble
  • Arduino
  • micro:bit
  • ESP8266
  • Raspberry Pi
  • Codebug
  • BeagleBone

 

Tour of the ‘Face

v02_Render03

The “mouth” is made up of 14 small (3.5mm) pixels numbered in small lettering from 0 to 13:

  • Lighting 0 to 5 gives a smile
  • Lighting 0, 5, 6, 7, 8, 9 gives a frown
  • Lighting 0, 5, 10, 11, 12, 13 gives a straight-line
  • Use other combinations for quizzical looks, open mouth, etc

The “nose” comprises a small (3.5mm) pixel numbered 14

The “eyes” comprise two standard (5mm) pixels numbered 15 & 16

 

v02_Render04

The rear shows the 3 mounting holes, each is 2.8mm diameter for use with M2.5 screws

There are 4 connections at the bottom:

  • Gnd – Ground pin. Connect to 0V from your controller
  • Vcc – Power pin. Connect to the power pin from your controller.Ideally this is 5V, but on the micro:bit for instance only 3.3V is available. This will work, although it is below the recommended minimum voltage
  • Din – Data input pin. Connect this to the control output from your controller
  • Dout – Data Output pin. Use this to connect additional smart pixels such as another McRoboFace, a CodeBug GlowStar/GlowBug, Crumble Sparkles or an Adafruit neopixel strip etc.

 

Connections to Example Controllers

For the following photos I have soldered on the 4-pin right angle header to make connections easier using jumper leads. Photos are of a prototype McRoboFace, without the numbers to identify each pixel

Crumble

Crumble01

The Crumble knows smart pixels as Sparkles and they must be connected to the D pin. Use the + and – pins to provide Power and Ground

The software is as simple as setting each pixel to the required colour. This is what the picture above is running:

Crumble02

 

Arduino

Arduino01

For the Arduino, any of the output pins will work. In this example we are using A0 as it is closest to the %V and Ground pins.

The code used relies on the well-known and well supported FastLED library. In the Arduino IDE, go to Sketch / Include library / Manage Libraries and then search for FastLED. Select it and install.

Then you can use this example code to show various facial expressions. The important parts are:

  • in setup ( ) – you need to define the number of LEDs, and the pin to be used to control them: FastLED.addLeds<WS2812B, DATA_PIN, RGB>(leds, NUM_LEDS);
  • to change any pixel, set its RGB value in the led array, eg. leds [3] = CRGB (RedValue, GreenValue, BlueValue);  When you have set all the pixels you need, then call FastLED.show ( ); to transfer the changes to the pixels.

 

micro:bit

microbit01

In micro python on the micro:bit, you can use any output pin to control the McRoboFace’s pixels. In this example we’re using Pin 0

As with the Arduino, you first need to include the right library and then define which pin you’ll be using and how many pixels are required. micro:bit calls them “neopixels”

microbit02

 

Raspberry Pi

You can do this in two ways:

  1. Connect directly to GPIO pin and install some software. This software often changes as Raspberry Pi change things in the kernel and will need keeping up to date
  2. Use Picon Zero to provide a simple interface to all your devices including smart pixels

Directly to GPIO Pin

rpi01

You need to use GPIO 18, which is physical pin 12. You can use the 5V and Ground pins directly. No level changers are required as the pixel can be controlled using 3.3V quite happily as shown.

If you already have neopixels supported on your Pi then there is no need for the build and install steps below. You can visit McRoboFace githib repo for the information below

$ git clone https://github.com/4tronix/mcroboface
$ cd ~/mcroboface
$ sudo apt-get install python-pip python-dev
$ sudo python setup.py install

NB. For Raspbian Jessie release 10th May 2016 (and probably later versions also) you will need to add the following lines in ‘/boot/config.txt’ :

hdmi_force_hotplug=1
hdmi_force_edid_audio=1

This will create a folder on your Pi called mcroboface and provide a simple example, mcroboface.py. Run this as:

$ sudo python mcroboface.py

 

Using the 4tronix Picon Zero

rpi02

Picon Zero output 5 can be used to drive smart pixels in a very simple manner. You should first visit the main Picon Zero page to download the library

Download the simple test example from here

 

Singalong Kit for McRoboFace

sa02

The Kickstarter campaign for McRoboFace included an option for some electronics that allowed the mouth of McRoboFace to be controlled by an audio input signal.

This was developed by Robin Newman and the full blog can be seen here

Download the assembly instructions here