SensComp to BrainStem Example
Last Modified: 2008-06-12
find:

basket

Acroname Robotics PDF webpage version SensComp to BrainStem Example PDF

Related
Products

Product image for BrainStem GP 2.0
BrainStem GP 2.0
Product image for USB-Serial Interface Conn V2.0
USB-Serial Interface Conn V2.0
Product image for 2600mAh AA NiMH Battery
2600mAh AA NiMH Battery
Product image for SensComp 6500 Ranging Module
SensComp 6500 Ranging Module
Product image for SensComp 600 Transducer
SensComp 600 Transducer
Product image for SensComp 600 Package
SensComp 600 Package
Product image for SensComp Instrument Package
SensComp Instrument Package

Contents

Photo of interface between BrainStem GP 1.0 and SensComp/Polaroid 6500 ranging module

Introduction

In this example, a BrainStem GP microcontroller uses a 6500 SensComp Ranging Module combined with a 600 Series Instrument grade transducer to measures distances to obstacles.  The BrainStem GP tells the sonar module to emit a "ping" and measures the time it takes to receive an echo.  It reveals the distance as a raw time in increments of the timer's resolution. 

Circuit Schematic

The digital pin selection between a BrainStem and the Senscomp ranging module will vary depending on which module that is being used.  Senscomp interfacing requires a digital pin to trigger an ultrasonic pulse and another digital pin to monitor the echo pulse that comes back from the transducer.  On a BrainStem, any digital pin that is not being used will work to trigger a pulse on the INIT line.  Measuring the digital pulse back requires the pin to have pulse timing functionality.  Please view the BrainStem Reference manual to determine which pins are capable for pulse timing for the particular BrainStem module you are using. 

The example uses the Digital 1 and Digital 2 pin on the BrainStem GP 2.0 module.  The following wiring diagram illustrates the interface between the Senscomp ranging module and the BrainStem. 

One detail is that the ECHO pin requires a pull-up resistor for operation.  Also, a power filtering capacitor is recommended between the VCC pin and Ground on the Senscomp module. 

Schematic Diagram of connections between BrainStem GP and SensComp 6500/Transducer

Source Code

This code uses the TEA language, which is a subset of ANSI C.  It is compiled using the BrainStem Console application. 

The code takes a single reading from the Senscomp ranger and prints the value out to the Console application in an infinite loop.  A short delay is introduced to allow the Console application the chance to print all the readings to the screen. 

/* file: 6500_Example.tea */ /* included for the display routines */ #include <aCore.tea> #include <aPrint.tea> /* set which pins control the 6500 */ #define a6500_INIT 1 #define a6500_ECHO 2 /* now include the 6500 driving routines */ #include <a6500.tea> void main() { int num = 0; int reading; a6500_Setup(); while (1) { reading = a6500_ReadInt(); aPrint_String("Reading "); aPrint_IntDec(num++); aPrint_String(" = "); aPrint_IntDec(reading); aPrint_Char(10); aCore_Sleep(10000); } /* while */ } /* main */

Revision History:

  • 2008-06-12: Updated page with BrainStem GP 2.0 module interface.
 

Related Links:

Senscomp (Polaroid) Sonar Ranging Primer

How to add pull-up resistors to the BrainStem GP 2.0

Related Examples:

Enhanced TEA Library for Senscomp 6500 Rangers Example

voice: 720-564-0373, email: sales@acroname.com, address: 4822 Sterling Dr., Boulder CO, 80301-2350, privacy
© Copyright 1994-2010 Acroname, Inc., Boulder, Colorado. All rights reserved.