Devantech SRF02 Ultrasound Interface

This page describes how to connect the Devantech SRF02 Ultrasound sensor to a FireFly sensor node. This could be used for ranging, or with multiple FireFly nodes, difference in time of flight ranging can be done using the "fake" mode of the SRF02.

For more information about controlling the SRF02, please see the following technical specification.

Picture of programmer connected to node with ultrasound board

Wire the SRF02 to the FireFly node as shown above. The battery is optional, but allows the ultrasound transmitter to produce a stronger signal.

Image(ultrasound-1.jpg,400)

This is a photograph of the ultrasound connector wired up according to the schematic.

Image(stacked-header.jpg,400)

By soldering a header on top of the receptical, it is possible to program and receive debugging data from a node even with the ultrasound module attached. Only do this for boards that will be used for debugging. Otherwise just solder directly onto the receptical.

Image(jumper.jpg,400)

Adding a jumper to the Ultrasounds UART TX line is required for programming the FireFly node while the ultrasound board is attached. Since the programming board uses the same UART lines, if the ulrasound TX is left connected during downloads, the ultrasound board may send signals that corrupt the FireFly firmware.

Image(programmer-connected.jpg,400)

The above photo shows the FireFly board with the ultrasound and the programmer connected.

Software

The following is the most basic software required to make the ultrasound device ping.

 1void Task1()
 2{
 3//  Setup uart for ultraound board
 4INIT_UART0( UART_BAUDRATE_9K6, (UART_OPT_NO_PARITY|UART_OPT_8_BITS_PER_CHAR|UART_OPT_TWO_STOP_BITS));
 5ENABLE_UART0();
 6
 7// Reset the ultrasound sensor
 8putc0(0x96);
 9
10// Wait for the ultrasound module to reset
11nrk_wait_until_next_period();
12
13  while(1) {
14        nrk_led_toggle(ORANGE_LED);
15        // Ultrasound default address is 0 by default
16        putc0(0x00);
17        // Ultrasound fire modulated pulse
18        putc0(0x5c);
19        nrk_wait_until_next_period();
20        }
21}
22

The SRF02 can be instructed to listen only for the transmission from another module using a command of 0x56,0x57 or 0x58 depending on
what range type you wish to be generated. The 40khz pulse can then be fired from another module with a command of 0x5C, this will just transmit and not listen for a response.

     86 0x56 Fake Ranging Mode - Result in inches
     87 0x57 Fake Ranging Mode - Result in centimeters
     88 0x58 Fake Ranging Mode - Result in micro-seconds

     92 0x5C Transmit an 8 cycle 40khz burst - no ranging takes place

ultrasound-1.jpg - Overview photo (266.8 kB) Anthony Rowe, 10/26/2008 05:31 pm

stacked-header.jpg - stacked header so that you can still use the debugger (120.4 kB) Anthony Rowe, 10/26/2008 05:32 pm

jumper.jpg - Optional jumper for programming node while ultrasound board attached (176.5 kB) Anthony Rowe, 10/26/2008 05:33 pm

programmer-connected.jpg - Picture of programmer connected to node with ultrasound board (521 kB) Anthony Rowe, 10/26/2008 05:39 pm

ultrasound-schmatic.png - Picture of programmer connected to node with ultrasound board (26.1 kB) Anthony Rowe, 10/26/2008 05:40 pm