mbed Demo Display

This page is dedicated to the mbed Demo Display, which aims to show off a good range of the capabilities of the mbed Microcontroller

/media/uploads/chris/demo-board.jpg

the headline features of this demo display are :

  • Powered USB Host socket
  • Ethernet
  • Ultrasonic range finder, on I2C
  • Analog panel meter, driven by PwmOut
  • Servo motor, position controlled by PwmOut
  • Three potentiometers on AnalogIn
  • QVGA LCD Display, controlled by SPI
  • RFID tag reader, connected to a Serial port
  • 24-bit Audio DAC driven by I2S, controlled by I2C

Example program

This example program does the following:

  • Prints "Hello world!" to hello.txt on the LocalFileSystem
  • Prints the ID of a tag presented over USB Serial
  • If the middle pot is over half way, the ultrasonic range finder sets the coil meter
  • The Right pot moves the servo motor.

Example Program

USB Host

One of the most useful application of the USB host socket is the ability to mount a USB Mass Storage Class device, such as a USB Flash stick or an external Hard Disk. The code to do this is straight forward once the library module is used:

#include "mbed.h"
#include "MSCFileSystem.h"

AnalogIn ain (p20);
MSCFileSystem fs("fs"); 

int main() {

    FILE *fp = fopen("/fs/data.csv","w");

    for (int i = 0; i < 100 ; i++) {
        fprintf(fp,"%.2f\n",ain.read());
        wait (0.1);
    }
    
fclose(fp);
}

For more details on this example, visit the following notebook page:

Ethernet

The mbed microcontroller contains all the passive circuits, all you need is an RJ45 socket to get onto the internet, and of course some software.

The first place to visit is the Ethernet homepage, which covers the EthernetNetIf that underpins and useful ethernet features that are built upon it.

Once familiar with the EthernetNetIf, useful apps can be built on top:

  • HTTP Client - Call URLS or run scripts
  • HTTP Server - A simple webserver
  • NTP Client - Set the RTC from an internet time server
  • Twitter - Use twitter for automated notificatios
  • Pachube - Upload data to this online service to be visualised however you choose
  • MySQL - A simple client that allows you to query MySQL databases directly

Ultrasonic Ranger - SRF08

This I2C sensor uses ultrasonic echos to measure distance. The library module for the SRF08 has a single method that returns a floating point number representing the distance in centimetres to the reflective object.

Moving coil panel meter

This is a standard panel meter with a 50uA full scale deflection current. The average current can be controlled using PwmOut. The PWM signal will scale the average voltage between 0v and 3.3v. At 3.3v the full scale current of 50uA should be flowing, so we should use a series resistor of 3.3 / 0.00005 i.e. 66k Ohms.

With this resistor in place, the PwmOut channel for the coil canbe assigned directly from the AnalogIn.

#include "mbed.h"

PwmOut coil(p22);
AnalogIn pot(p20);

int main() {
    while (1) {
       coil = pot.read();
    }
}

Servo Motor

Servo motors as used in radio controlled toys are driven by a PWM signal the defines position. The Signal has a 25ms period, and a pulse with of 0.5ms to 2.5ms defines the dynamic range.

A library module exists to abstract a servo motor to a normalised floating point number. As with the previous version, a simple AnalogIn can be used to exercise the Servo Motor.

AnalogIn - Potentiometers

The mbed microcontroller includes six channels of 12 bit A/D conversion with a 3.3v reference voltage. These A/D are abstracted to return either a normalised floating point number, or the raw binary value (0x000 - 0xFFF).

The simplest experiments use a 10k potentiometer connected across 0v and 3.3v with the wiper connected to the AnalogIn. This is the configuration used to generate 0.0 - 1.0 signal as used in the Panel meter example.

QVGA LCD Display

RFID tag reader

The ID12 RFID tag reader is a device with a built in antenna and a serial interface that enables RFID tags to be read.

The library module for this consists of two functions; a non-blocking call to see if a tag has been scanned, and a blocking call to read a tag ID.

A simple example of the RFID tag in use is :

// Print RFID tag numbers

#include "mbed.h"
#include "ID12RFID.h"

ID12RFID rfid(p10); // uart rx

int main() {
    while(1) {
        if(rfid.readable()) {
            printf("RFID Tag number : %d\n", rfid.read());             
        }
    }
}

More details can be found on the ID12 RFID tag page:

24-bit I2S Audio DAC