MCP Sonar Subsystem



Table of Contents

Introduction

Sonar Sensor
Figure 1: A Sonar Sensor

      The sonar system was an integral part of the robot's design. It was responsible for informing the robot what its distance was to another object. These objects could include walls, cars, or even people. The robot's large scale indicated that there would be a vast region that needed sonar sight. Given its size, one sonar sensor was insufficient to cover all viewpoints. Furthermore, having multiple sonar sensors allowed a comparison to be made between readings. This could help the MCS to make the best manuvering decision.
      The fundamental problem was that the Handy Board's Interactive C library call only supported one sonar sensor. Rather than manipulating an already consistent software package, we decided to implement a hardware solution. Thus, the sonar system truly only looks like one sonar sensor from the Handy Board's perspective. The question was, how can we have x amount of higher-level sonar sensors operating on top of the single sonar interface?

Contents


Sonar Description

Sonar Sensor
Figure 2: Diagram of sonar leads. Click to enlarge.
      The sonar sensor is composed internally of two parts. One part is fed into a digital out port with a local ground on the Handy Board. This part actually sends out the high-frequency sounds which are expected to bounce off a remote object. The other is the receiver side. This receives the reflected sounds and interprets them internally. The sonar then sends back a pulse modulated signal to the Handy Board into one of its digital input ports. This receiver side is also fed a +5V power connection from the Handy Board. It is rather ironic that the receiver gets the power while the transmitter gets the ground. Since both the ground and power sides are needed, the decision was most likely arbitrary. In either case, the sonar was treated as a blackbox unit for our purposes. We were only concerned with its predefined interface.

Contents


Circuit Design

Sonar Sensor
Figure 3: Circuit diagram created in the Eagle CAD system. Click to enlarge


      We needed a system with multiple sonar sensors that could be addressed one at a time. Common to the electric engineer are devices called multiplexers and decoders. These units perform inverse operations of each other. The decoder takes one data input and channels it to one of x outputs. Conversely, the multiplexer has x inputs, and 'multiplexes' into one desired output. The terms input and output are, of course, relative. We are speaking relative to the multiplexer and decoder chips in this case. The selection between inputs and outputs is done via control bits. For the purposes of our system, we used three digital outputs on the Handy Board. Since we want to transmit and receive from the same sonar sensor at any given time, both the multiplexer and decoder would share the control bit values. With three bits, there are 8 possible states in which the circuit can be in. This is sufficient, since having more than 8 sonar sensors would probably not be realistic in our robot in any event.
      As it turns out, we decided against using the decoder. The multiplexer and decoder chips merely pass a high current along as a return value. Since the sonar transmits a pulse signal, the thought was that a solid high would be insufficient. The solution was an 8-bit addressable latch. This chip actually includes an internal 1-of-8 decoder right behind the control inputs. The difference is when the internal decoder picks a state to be in, the decoder's data input is merely passed without being manipulated by opening a certain latch. As with a 1-of-8 decoder, only one output can be active at a time. In retrospect, we now realize that it would have been possible to use a normal digital decoder. Assuming that the toggled output was always high (independent of the input), even then we could have mirrored the input wire and fed it into the enable bit. Thus, the decoder would only be active when the input signal was high. Furthermore, it would make sense that if there was an input in the first place, that a low input would be expressed on the output's pin. Thus, in hindsight, the 8-bit addressable latch was probably not necessary.

Contents


Implementation

Sonar Sensor
Figure 4: Debuging work done on a breadboard. Click to enlarge


Sonar Sensor
Figure 5: A failed etch-board. Click to enlarge.


Sonar Sensor
Figure 6: Working Prototype on a breadboard. Click to enlarge


      The circuit's initial debugging was done on a breadboard using exceptionally long and erratic wires. This sloppiness was mostly due to the creator's nonexistent experience in the process. The next plan was to move the design to a circuit board using an electric etching system. Unfortunately, despite making a design in the Eagle CAD system, the machine's bit was too dull to perform correctly. The final circuit was manifested from scratch on another breadboard. This time, proper thought went into the layout of the board. The components were laid out more logically, leaving apparent modules within the circuit. Special cables were also made which were used to connect up to 8 sonars to a Handy Board.

Contents


Code

      Since this is a hardware solution, the code needed to make it function is remarkably simple. The only distinction between this and a single sonar sensor is the need to set the control bits before making a sonar call.
Click here for an example of multi-sonar code

Contents


Last Update December 19, 2003 by Mike Bohan