Wednesday, 1 June 2011

mBedded is embedded

A lovely surprise this morning here at Nerd Towers - after an afternoon on the beach, I returned home to find an evaluation kit sitting on the doormat, from the guys at Farnell.
After publishing a number of project ideas at BuildBrighton, and posting some ideas on an earlier blog, Geektar (a guitar for geeks), we were thrilled to be invited to evaluate the mBed development board and to "blog" about the findings here.

So the first thing to do was to have a look what we'd been sent.
The contents seemed a little sparse - a dev board, a usb cable, a plastic credit card showing the pinout and a single sheet of A5 basically saying "go to the website and learn more"

In fact, the credit card proved to be more interesting than we first thought.
It shows all the cool stuff that the processor supports - and it's a pretty impressive list of stuff! The mBed system is based on an ARM7 processor and it has some pretty cool features. It's a 40-pin microcontroller (similar to the PIC18F4550) and has lots of hardware features you'd expect to find on a higher-end 'controller:

2 x hardware SPI interfaces
2 x hardware serial/USART interfaces
2 x hardware I2C interfaces
6 x analogue-to-digital input pins
1 x digital-to-analogue output pin
6 x hardware PWM pins
USB support
CAN interface (home automation CANBUS?)
1 x ethernet/networking interface

Most of these functions are either available on the PIC18F series of chips, or can be recreated in software (see our 20-channel servo controller project for examples of how multiple PWM output pins can be generated using software) but being a 32-bit processor and supporting much faster speeds (PIC 18F runs at up to 48Mhz, ARM7 up to 72Mhz) the mBed controller is perfect for processor intensive tasks like driving displays, multi-processing and so on.

But what sets this chip apart from other chips we've worked with is the exciting introduction of onboard ethernet. Until now, most of our microcontroller projects have been USB-based, requiring a host PC. Most of the time, this is more than adequate, as the functionality of the device can be greatly enhanced through the use of some custom-built software.

But the mBed dev board suddenly makes "real" embedded systems a possibility:
the introduction of the ethernet interface means we can create devices which talk to our home internet connection and control (or be controlled by) commands send so/from the 'net.

The mBed system couldn't be easier to use: the device itself appears, when connected to a PC, as a removable drive. Code is compiled into .bin files and you don't need a programmer or any special hardware to "burn code" - just copy and paste the .bin file to the device, press the reset button and the mBed device restarts, running your code! It's that easy!

The examples on the mBed website are pretty impressive too - it uses a number of pre-built libraries, similar to the approach used by Arduino, and abstracts all the complicated low-level stuff, allowing you to concentrate on just getting your stuff working. Code is written using an online editor and saved to the "cloud", so it's always accessible wherever you are. This makes it ideal for cross-platform development and sharing code, whether you're on Windows, Linux or Mac. There's no software to install or complicated folder paths to set up. In fact, to re-program the device you simply plug it in and download a new file to the removable device.

One of the first ethernet examples on the mBed website shows how an RFID tag can generate tweets, to show who has arrived over the course of the day. As we're looking to make a stand-alone device that will communicate over the internet (without the need for a host controller) these examples will form the basis of most of our learning in the coming days.....