Servomotor-based ultrasonic beacon system for adverse robot

Work in progress on this page...

More explainations

Ultrasonic pattern recognition

The ultrasonic pattern to be recognised will be a burst long enough for ensuring digitally that its frequence is exacty what we look for.

There will be a digital algorithm, edge-based, that will measure the periods of the received signal, their regularity, their number, and will decide whether or not the signal is considered to be the expected burst.

The periods are detected when the ultrasonic received signal level is above the "detection threshold" (DT). Then each cross to 0 of the signals indicates a new half-period.

If a signal overpasses the DT, then it is digitally analysed. If its main harmonic is exactly at the desired frequency and lasts long enough, then it is considered to be OK, otherwise it is simply rejected.

If a noise signal trigs the digital filter and then the desired signal comes, then the desired signal has many chance to be dropped (because of wrong frequency, or wrong duration). It is called a "collision".

Ultrasonic noise rejection with AGC

The noise rejection is intended to be done with an AGC (Automatic Gain Compensation). When a correct burst pattern has been recognized, its mean level is measured. Two thresholds are defined : - if the pattern level is "too high", then the gain is lowered. Thus, noise signals are reduced in amplitude and has lower chance to overpass the detection threshold and the burst has less chances to be subject to a collision. - if the pattern level is "too low", then the gain is emphasized. It avoids the burst whose amplitude is reducing (maybe the opponent's robot is going away...) to progressivelly disappear under the DT.

Ultrasonic channel collision avoidance

Our system has to be able to determine if a burst comes from our beacon or from an other emitter (for example commercial ultrasonic distance sensors). Then we have to choose a different frequency.

The frequency gap is not necessarily big. A digital filter analysing a 10-cycle burst discriminates non-wanted frequencies outside the bounds of +/- 5% (discrimination margin)

Most commercial sensors operate at 40kHz. Given the above rule, 42kHz would be sufficient. If the oscillator is crystal-based (very precise), we can guess the frequency is exactly around 40kHz. But they may be RC-based oscillators, and/or systems which are tuned a bit aside 40kHz. Then it is probably much safer to be at least at 43kHz or a bit above (2.5% error for commercial sensors + 5% discrimination margin)

An even more safer way is to be able to have 2 channels, for example : 43kHz and 37kHz, or 43kHz and 50kHz. A switch on the beacon and on our robot would indicate to the system the frequency to be used.

Ultrasonic burst length

The longer the burst :

  • the better the frequency discrimination (the digital filter discriminates better than 1/(2 * burst length in cycles) )
  • the lower the risk of confusing a noise with the expected burst
  • the more stable/precise the level detection of the burst => the more accurate the AGC system

But :

  • the longer the time occupation of the burst emission => the greater the probability for the burst to be altered by a big noise spike

With 5% frequency discrimination and 0.25ms, the 10 cycle burst seems to be a good compromise.

Angle measure accuracy

The goal of this system is :

  • to measure the angle bewteen the segment of the both US receivers and the segment of the both robots (called "alpha" angle)
  • to control the servomotor in order to make this angle equal to 90°
  • to know the position of the servomotor, which then gives the direction in which the opponent's robot is located

There are 3 error sources :

  • error on servo position. The GWS S125 1T is said to have a resolution of 1.5° ( With a simple calibration, and linearity compensation, the error could be less than 4 or 3 steps (about +/-3°).
  • error on the measure of "alpha". This error is due to a detection of the burst which is later on the receiver A than to the receiver B (or the inverse). An error of +/-20% of the wavelength (40kHz <=> 7.5mm) results in 1.5mm distance error. Since both receivers are spaced of 50mm, the angle error o alpha measure is arcsin(1.5mm/50mm) = +/-1.72°.
  • total error could thus be less than +/-5°

Components selection


First option

This servo is able to make a bit more than 1 tour. There are no precise datasheet, but some explainations of the technical engineer here : and here :

It seems to have 240 points per tour and to be able to run around a bit more than 360°.

Second option

Taking a servomotor of much more than 1 tour will result in inaccuracy of the angle position of the servomotor, leading to an positionning error of the opponent's robot.

There are not many '1 tour servo' on the market, but if someone finds one... let's propose !

Third option

A stepper motor ?

Needs a controler, but would provide a quite precise angle position !

The mechanical design is a bit more complicated

Fourth option

A DC motor controled with coding wheel ?

Needs a controler, an even more complex mechanical design...

Not the simplest !

US receiver

First option

This receiver (even if it is not that cheap) is very suitable to our needs :

  • Thin and small, easily adaptable on a small and compact PCB piece.
  • good sensitivity (at 40kHz : -37dBV/Pa)
  • very good bandwidth (better than 6dB flatness on 39kHz-54kHz)

US emitter

First option

This transmitter could be suitable for our needs :

  • 360° beam angle => no need for multiple transducters, no problems of interference, simple emitting architecture
  • wide and flat bandwidth : 4kHz @ -3dB (usually, it is more about 2kHz @ -6dB). Ability to run at 37kHz and 43kHz

Several drawbacks, nevertheless :

  • Low output level : 95dB @ 10cm, which is ~ 85dB @ 30cm. Usual transducers are above 110dB @ 30cm, at least 25dB more !
  • High drive voltage : 150Vpp, which is ~50Vrms. Since we will not able to design easily a driver applying more than 90Vpp, it results in additionnal -5db on output level.
  • relative complexity of a high-voltage driver (need for a -24/+24V dc-dc converter and proper AOP circuitry)

As a summup :

  • good for directivity and bandwidth. Ability to easily change frequency channel, ability to have a correct gap from standard channels
  • simple and efficient (1 transducer)
  • electronic driver not simple (but feasable)
  • low output level 30dB less than other transducers
  • risk of more collisions (collision from transducers located far away, on other tables, maybe, or issued by reflections). This risk rises only the drop rate of the discrimination algorithm. Since commercial distance sensors should (estimation) have an occupation time less than 3% (less than the ratio min distance / max distance), this shouldn't be a too big problem.
  • risk of having a signal flooded under the ambiant noise. Applauses of the crowd are emitting sonds in ultrasonic spectrum at a level that we have no idea. Maybe it's 60dB spl, maybe it's 80dB. In that second case, we won't be able to distinguish our burst from the noise.

Second option


Ok for our needs :

  • farily wide bandwidth of 4kHz at -6dB (usually, it is more about 2kHz)
  • beam angle of +/-30°, which allows to put 5 or 6 transducers only
  • available on eBay
  • standard 10Vrms rated

An even better one is the EFR-THB40K5, the small brother of ERF-TSB40K5 :

  • small size of 10mm instead of 13mm
  • higher output level (2dB)
  • frequency response a bit more flat
  • ... but harder to find on the market !

Variable gain amplifier for amplifier chain

IR transmiter

First option

This LED is in 940nm range. It fits our application because of :

  • side emission. There will be no need to curve the pins to 90°, the led has just to be soldered and enlightens at 90°
  • good directivity : tho polar diagram shows a beam angle of a bit more than 40°. It will allow to put a string of 10 leds to cover the full circle.
  • Moreover, above the beam angle, the luminuousity falls sharply. It will be usefull if we want to implement the estimation of the course direction of the opponent's robot with these leds.

IR receiver

Two or three SMD (CMS in french) LEDs will be mounted on the same plane as US receivers are.

  • There are at least 2 diodes in order to prevent a small obstacle between opponent's robot and our's from cutting the IR link totally. With 3 diodes spaced with 15mm, we can stand a lot of different obstacles up to around 10mm wide.
  • The SMD package allows to put the LEDs on the same plane as receivers

First option

  • This phototransistor is equipped with a daylight filter which gives it a sharp cutoff slope around 700nm. It will avoid extra noise sources.
  • The saturation is high : it is rated up to 3mW/cm² (30kW/m², 30 times the direct solar natural light), it helps in light ambiance such as on the Robotic Cup.
  • The beam angle is small : +/-15°
  • The response time is acceptable : 5µs (it corresponds to a distance of 1.5mm covered by the US in the air)

Second option

Maybe a better response time and a greater beam angle ? One has to keep the daylight filter.


AVR of course ! :-)