The BBC Micro Bit: what we know so far…

It’s almost a week since the BBC announced that it would be giving away one million free ‘Micro Bits’ to Year 7 students in September. This small computer is designed to be programmed by students to do fun things like flash lights and respond to inputs from sensors and encourage them to try their hand at a spot of programming. Whilst the BBC’s move has been met with skepticism by some, there are many people like me who are very much looking forward to the Micro Bit’s arrival and getting them into the hands of students for programming fun and hardware hacking!

But, whilst several details of the BBC’s “Make It Digital” programme (of which the Micro Bit is a key element) have been made public, the hardware details of the Micro Bit itself are still a little unclear, which is a bit frustrating to those of us champing at the bit to get going with planning projects for it. So, in this blog post, I thought I’d pull together what I’ve discovered so far and, over the next few weeks and months, keep you updated with the latest news as it becomes available.

The first thing to note is that the hardware that has been shown at the launch is a prototype device that has been used in a recent pilot project. Several people have noted that the prototype Micro Bit is based around an ATMega32U4 processor and this has led to speculation that it is some variant of the Arduino Leonardo board. But, as I’ll explain later, that doesn’t seem to be the case. You can go to the website associated with the pilot project and have a go at using the Blockly-based programming language and even run your code on the simulated prototype Micro Bit there. If you’ve ever written a program in Scratch then Blockly should look fairly familiar.

What’s clear is that the prototype is actually quite different from what the finished project will be, although on the surface it may look quite similar with it’s 5 by 5 matrix of LEDs. According to this post on the ARM Connected Community website, the final version of the Micro Bit will based on one of Freescale’s ARM processors and it seems likely that this might be one of their Cortex-M0 processors within the ‘mbed’ platform. If you’ve not heard of mbed, you’ve been missing out: whereas Arduino boards and the like require the installation of drivers and an IDE, mbed is much simpler to get started with. Firstly, the IDE is web-based and, secondly, the mbed boards appear as a standard flash drive on your PC when connected via USB. Once you’ve written your code in the web-based IDE, you simply click ‘compile’ and then download a binary file that you drop into the mbed’s folder. It’s really all very easy!

So what can we expect to see on this new version of the Micro Bit? Well, the 5 by 5 LED array should stay, and there will be a low-power Bluetooth chip which means you will be able to download code wirelessly from your phone or tablet and not just by USB. According to Wired’s article on the Micro Bit, the final version will also include an accelerometer and magnetometer, which should add to the fun. It seems that you will be able to program the Micro Bit using Blockly, Python or with C++ (like all mbed-based boards).

So what of the prototype? Well, although it contains an ATMega32U4, a bit of digging in the tools provided on the pilot project’s website suggests that it doesn’t use the Arduino bootloader and, instead, uses a bootloader provided by Atmel which allows binaries to be downloaded via USB. That’s not to say it couldn’t be configured to work with the Arduino tools, of course.

So that’s about it for now. Hopefully more details about the hardware will emerge soon but, in the meantime, I’m going to be experimenting with the mbed platform and the Blockly language and will bring you more blog posts about the Micro Bit as soon as possible!

 

A first look at the Crumble Controller

One of the things I love most about the Raspberry Pi is just how easy it is to add LEDs, switches and motors to the GPIO pins and then control them with a bit of Python or Scratch. Sadly the school I teach at doesn’t [currently] have any Raspberry Pies and all the computer suites are kitted-out with Windows machines. If only there was an easy, cheap way to connect LEDs, switches etc. to a PC… well, the Crumble Controller from Redfern Electronics might just be the answer! I ordered a starter which included the Crumble board, a USB cable, some crocodile-clip wires and two “Sparkles” which are LEDs which you can program to be any colour (they’re the same sort of thing as Adafruits “Neopixels”). And here’s how it looked after I unpacked it:

crumble boxI had already installed the Crumble software so it didn’t take me long to get going at all. After connecting the Crumble to my laptop via the USB cable, it installed the driver very happily and then I was ready to program using the graphical programming language that will be very familiar to anyone who has used Scratch. Here’s a basic program that controls a motor attached to the ‘motor 1′ connections and you can probably tell what it is going to do when I click the ‘go’ button: firstprog

Connecting hardware is very easy with the crocodile-clip connection. You need to use an external power source when using high-current devices like a motor and here you can see the power being supplied via the red and black clips at the top and the motor being connected via the two yellow clips:

crumble motor

One thing that might not be immediately apparent is that the Crumble doesn’t need to be connected to a PC to work! After you’ve programmed it, remove the USB cable and then connect a power supply (between 4.5v and 5.5v) and it will start running your program as soon as it is powered-up.

Flushed with my success with the motor, I then connected on of the ‘Sparkle’ LEDs. These need three wires: two for power and one for the ‘data’ signal that should be connected to the Crumble’s output marked ‘D’. The Sparkles can be very bright – here’s the code I used to try out some different colours and how the sparkle looked when it was set to be red:sparkles

sparkle brightIf you’re wondering why this Sparkle is called Sparkle 0 (zero) in the code, it’s because you can daisy-chain several of them together. The first in the chain is Sparkle 0, the second is Sparkle 1 then Sparkle 2 etc.:IMG_0630The code that I used above set the Sparkle to be one of several pre-defined colours, but you can use another command that allows you to specify the proportion of red, green and blue in the final colour by specifying a number between 0 and 255 for each: sparkle2By setting the blue component to be just 5 out of 255 the brightness was significantly reduced and kinder on the eyes!

So, that’s the extent of my tinkering so far. I really like the Crumble and think it could make a great device for hacking together simple projects in lunchtime sessions. As well as the two high-current motor outputs, it’s got four other input/output connections and it seems like it even allows analogue inputs as well as digital… there’s still so much to play with and I’m very much looking forward to finding out more about what the Crumble can do! So far, though, I’ve been mightily impressed and very pleased with the price. You could, of course, use all sorts of other boards (such as Arduino), but the Crumble’s simple programming interface, easy software installation and crocodile-clip friendly connections means I’m going to be using it for plenty of projects in the near future.

PocketMoneyTronics is changing!

If you’ve been following this blog over the last year (and I strongly suspect no-one has!) then get ready for a change! The original plan was that I would review a number of low-cost electronics kits and point followers in the way of pocket money electronics projects. Well, whilst there are some great kits out there, I’ve decided that there just aren’t enough and that I’m going to release some of my own! The first is the C.L.A.S. LED & Switches kit for the Raspberry Pi but I have several more in the pipeline that should be released in the next few months. Come back in a little while and see what’s new!

A trip to Cambridge & Maplin’s Raspberry Pi Cobbler

At the weekend I took a trip to Cambridge, the home of the Raspberry Pi. I was hoping to find some evidence that this was the Pi’s home town: I have this vision that, in the early 1980’s, you could hardly walk down a Cambridge shopping street without having ZX81s, Electrons, Lynxes and Jupiter Aces leaping out at you. Sadly, this was not to be: neither of the computer shops on Mill Road had any hint of the Pi and the wonderfully dusty H. Gee’s electronics shop had nothing remotely raspberryish. In town proper, the bookshop Heffer’s did have a Pi in their window display (under a ‘student essentials’ display, I think) but I couldn’t spot it in the shop – and they only had one Pi book on their shelves.

But guess where I did come up trumps? In Maplin’s! Actually, I knew already that they stocked Raspberry Pi (and Arduino) items, but I’d always thought there were better/cheaper sources… it turns out that, in the case of the Pi Cobbler I was after, I was very wrong: they had a kit (made by Cyntech, I think) for just £3.39 which is cheaper than most web stores, especially when you consider that you don’t have to pay postage:

kit“Cobbler”, by the way, appears to be the name for a short ribbon cable and PCB combination that lets you experiment with GPIO pins easily on a solderless breadboard. The kit had a pre-assembled ribbon cable, a box header (to receive the cable), a PCB and two rows of pin headers to plug into a breadboard:

parts

I didn’t pay too much attention to the instructions as it all seemed fairly straightforward but they did have one good tip of inserting the pin headers into a breadboard as you solder them to the board so that they end up at 90 degrees to the PCB. I was a little worried about melting my breadboard but I did my soldering quickly and all was fine:

soldered

All that remained was to connect the board to my Raspberry Pi, push the cobbler into a breadboard and wire-up a simple circuit with one resistor and an LED in the manner suggested in the Raspberry Pi User Guide:

gpio

Incidentally, it seems that things have changed a bit since the User Guide was written. Firstly, there’s no longer any need to download and install the GPIO library as it’s already included by default in Raspbian. Secondly, you need to add a line to the example code to use GPIO.setmode to say how you will be referring to the I/O pins (either by their board pin numbers or their GPIO numbers):

code

The example code works as expected and, all in all, I was quite pleased with the kit: easy to solder and very affordable. My only gripe is not specific to Maplin’s kit but more general of this type of Cobbler: the ribbon cable obscures one side of the breadboard making it difficult to insert jumper wires and components. That could probably be solved by moving the breadboard closer to the Pi so that there is more slack in the cable or by using a longer cable. I suppose this problem is why Adafruit’s T-Cobbler came into existence.

Oh, and my time wasn’t totally wasted on Mill Road: H. Gee, the electronics shop I mentioned earlier, is a delightfully ramshackle place with a layer of dust on all the items. If you ask for a component then they usually have to disappear out the back and rummage through old carboard boxes, and that’s precisely what they did to present me with this nice little 10-LED bargraph display which I bought for a quid. OK, not as cheap as I could have got it from Rapid or CPC, but nice that these shops still exist and you can still get things like this without having to resort to mail order.

bargraph

Laika & Raspberry Pi experiments: controlling a robot from Scratch

I thought I’d have a go at using my new Laika Explorer board to control two motors on a small robot. A ‘Microbot’ (intended to be controlled by the on-board Picaxe chip) was my candidate for cannibalisation and I added some wires directly to the motors which then connected to some 4-way ribbon cable back to the Laika Explorer (I had tried using solid-core telephone cable but it wasn’t flexible enough). Don’t be deceived by the battery box on the Microbot: the power for the motors comes from the Laika via my ribbon cable.

microbot

The other end of the ribbon cable connected to the screw terminal on the Laika board (two per motor) with the cable tucked through one of the mounting holes to stop the delicate wires from being accidentally ripped out. The power for the board [and hence the motors] came from three AA cells which is a bit low compared to Laika’s recommended minimum of 4.6v, but it worked OK:

motor wiring

After installing the Laika software, you’ll find an icon on the desktop called “laika_scratch” which starts Scratch with the necessary extensions to communicate with the Explorer board. I started it up and then went to File/Open and loaded lk_exp_example_2 which had the following basic bit of code to turn motor 1 on for one second when you click the green flag:

example motor code

That all looked pretty straightforward, so I thought I’d have a go at writing my own Scratch program to use the four cursor arrow keys to move the robot forwards, backwards, left and right. Do you see the broadcast commands above? By changing these broadcast messages you can control motor_1 or motor_2 and the final portion of the message allows to set the motor to forward (fwd), reverse (rev), stop (stop) or brake (brake). I didn’t experiment with ‘brake’, but here’s half of my code:

my code

The up arrow cursor key moved the robot forward and the left arrow cursor key turned it to the left. I had similar bits of code for the down and right arrow keys to move it backwards and to the right, respectively.

So, controlling motors from Scratch looks like it’s going to be pretty easy! There are two other example bits of code which control the digital outputs and read the analogue inputs: I’ll have a look at these in the not-too-distant future.

Update: I strapped a pen onto the robot and here’s what it drew!

a

 

First look at Laika I/O & motor controller board for Raspberry Pi

Back in the summer there was a Kickstarter campaign to raise funds to build the Project Laika board for the Raspberry Pi and, after what must have been a busy few months, the boards have been manufactured and posted – mine arrived today! It’s designed by Eightdog and will [I think] be available from Kitronik in the future. Basically it’s an input/output board that connects to the Raspberry Pi via USB and lets you drive motors and anything else you wish to hook-up to it: you might be thinking you can do all that already via the GPIO ports, but Laika will let you draw significantly more current that the GPIO pins can provide and allows you to use any voltage that suits your motors (as long as it’s between 4.6v and 10.8v). OK, you could add your own buffers and motor driver ICs to the GPIO pins yourself, but I know I’ll never quite get round to it, so here’s a quick and affordable short-cut to get you adding hardware to your Pi.

Embarrassingly, my Raspberry Pi has sat in the cupboard since I bought it, apart from one brief outing a long while ago. I figured that the Raspbian image on my SD card would be rather out of date so I decided to try out the new NOOBS method of getting the Pi going and it worked a treat. Connecting to Wi-Fi was easy, too (but I did ensure I bought a USB adapter that was specially recommended for the Pi). Anyway, I was up and running in surprisingly little time.

Next I had to install the software for the Laika board itself and I had no problem following the instructions on the Project Laika website. All of the documentation is a bit sparse at the moment, but they’ve clearly been busy ’til now getting the board manufactured and despatched, so that should change soon. The Laika board didn’t come with a USB cable or power supply, but I had both to hand (the power supply was a 9v one I’ve got for an Arduino board and has a 2.1mm barrel back, centre-positive). The end result was a pleasing mess of wires, reminding me of my days using my brother’s ZX81:

setup

I wasn’t sure of the voltage of my motor but, as it had come from an old printer, I guessed that my 9v supply wouldn’t be wildly off the mark. Before toying with the motor, though, I ran the Python Example 1 which counted up through the 128 on/off combinations for the 7 digital output pins you can see in a row just above the motor. Each output pin has a corresponding yellow LED which showed the count in binary and the two blue LEDs (which flash when the Pi communicates with Laika) went utterly bananas:

binary

So, having established that my Raspberry Pi was communicating happily with Laika, I thought I’d use Python Example 2 to test my motor. As you can see from the screenshot below, pressing button 0 and button 1 on the Laika board should turn on motor 0 and 1 respectively (with button 2 quitting the program):

example1

However, my motor was didn’t spin when I pressed button 0. Why not? I delved into the code and saw that the speed of the motor was determined by the voltage on the analogue input pins (one pin per motor). As these pins were not connected to anything, the example code was obviously reading them as zero volts and, although motor 0 was being turned on, its speed was being set to zero! As I didn’t have a potentiometer to hand to provide a variable voltage on the analogue input pin, I lazily shorted the pin with the 3.3v pin using an excessively chunky wire:

shorting

Finally, the motor was working as expected when I pressed button 0 and the program displayed the speed as 254 (rather than the previous speed of 0):

example1 with 254

Incidentally, there’s a tiny bug here: you can see it displaying the speed of Motor 0 twice whereas [presumably] it should be showing the speed of Motor 1 on the second line. I had a quick look at the Python code for this example and was pleased to see that it was fairly easy to understand and correcting this to show the speed of both motors would be trivial. EDIT: see the comment below from Andy Bakin regarding how to solve this and the naming of the motors which should be 1 and 2 (not 0 and 1)

So, all in all, a fun couple of hours configuring my dusty Raspberry Pi and then surprisingly little hassle getting Laika up and running and controlling a motor. The next step will be moving beyond the example code and starting writing some programs of my own: I’ll keep you posted how I get on!

 

 

Velleman’s Electronic Dice

An Electronic Dice is quite a classic kit for any beginner to build and Velleman doesn’t disappoint with this offering from their mini kit range (kit number MK109). You can get this kit from a lot of places including Rapid Electronics who are currently selling it for £5.70 + postage.

The instructions are adequate but rather brief and there’s no explanation of how the circuit works, but it’s a satisfying kit to build all the same. However, I’m somewhat sceptical about the randomness of the dice: it appears to use a 3-bit counter which would give eight “sides” to the dice whereas we only need six! It looks like there are actually two ways of displaying a rolled 3 and similarly for a rolled 2.

You can see it in action on my video:

Bare Conductive’s Electric Paint Cards

If you’ve ever been to a Maker Faire then you’ll almost certainly have heard of Bare Conductive’s Electric Paint: it’s a conductive black gloopy substance that you can paint or draw onto paper and is available in pots or pens. As well as being interesting for a whole range of experiments (see Bare Conductive’s website for some ideas) they also sell kits that enable electronics newcomers to make greeting cards with flashing LEDs. The circuits are incredibly simple but quite fun nonetheless.

A pen of paint will set you back £6 + postage but I picked up a pack of the greeting cards that included a pen at the Elephant and Castle Maker Faire in London in July. It’s taken me a while to get round to using it but this video shows my efforts: as you’ll see, I was a bit cavalier when reading the instructions and didn’t get the best results first time! In essence, when making the cards, don’t be too miserly with the paint and make sure you give it sufficient time to dry (otherwise the resistance is too high).

For seasoned electronics tinkerers the greetings card circuits may be a little trivial to amuse you for too long but the paint itself is fun to experiment with. You could use it to make paper-based variable resistors (again, see their website) but I used it to write a Morse Code message on a strip of paper and play it on a small buzzer.

Kitronik’s Light Activated Switch

Kitronik’s light activated switch is a nice module that uses a light-dependent resistor and a handful of other components to turn on a device when the light intensity drops below (or rises above) a level of your choice. At £1.91 it’s one of the cheapest, simplest kits available but you will need to add your own battery connector and output device such as an LED or buzzer.

The postage is a little high at £3.95 but it would be easy to find enough interesting Kitronik kits to make your order up to the £40 required for free postage. And £40 would get you quite a bumper parcel, too: their basic mono audio amplifier kit is just £3.62, a “Simon” memory game kit is £5.50 and an LED-flashing bike light kit is just £2.10 (at the time of writing).

Have a look at my video where I give a quick run-down of the kit and look at a few simple applications: