AN-1142 Bat Detector – Ultrasound Translator

In many cultures, bats are perceived as bad omens, as symbols of death or as manifestations of bloodsucking vampires. This may have arisen from the fact that a few species (eg. vampire bats) feed from cattle and can carry biological agents. However, in reality, bats are helpful creatures that play an important role in pollination, spreading seeds, and in providing a natural pest management service.

Introducing the Bat Detector

A Bat Detector can notify us about the presence of bats, along with assisting in the analyzing of the groups of bats, in a certain area. This application note will explain the implementation of a circuit using Silego’s GreenPAK™ devices to process the ultrasonic signals produced by the sounds that bats emit. It will also demonstrate how these sound waves can be converted to audible frequencies using the GreenPAK’s flexible on-chip resources like counters, comparators and PWM’s.

The sensitivity of a bat’s sound can be between 0.1 Khz to 200 Khz1, but as mentioned, this note will help in stepping down the frequency by 16 or any other programmable ratio.

Block Diagram

Figure 1. Block Diagram

We will also add 4 PWMs using the available 4 Analog Comparators.

GreenPAK Design

To conceive the idea, analog comparators, counters/delay and logical gates are required. Therefore, to present this example, the device SLG46531V has been chosen.

Frequency Step Down

The main core of this step is to have a counter (by the factor of 16 in this case) to divide the input frequency by. The result will be a pulse, indicating that a complete count has been reached, and afterwards we will be ready to start a new count.

Edge select:Rising. The output polarity is Non-inverted for simple analysis, Q mode reset, Stop and restart are enabled to have continuous counting. Its connections are set to the external clock from the matrix to enable counter input from pin 2. Here, the pulse output, in the presence of an ultrasonic signal, will be modulated.

CNT0/DLY0 configuration CNT1/DLY1 configuration

Figure 2. CNT0/DLY0 configuration

Figure 3. CNT1/DLY1 configuration

Base Half Pulse

We use an average of 40Khz for the ultrasonic signal just like the commercial emitter/receiver you might be able to test. We define the Period of the stepped down signal of 40 kHz/16 to 2.5kHz. The full period should be 0.4ms with the positive cycle being 0.2 ms. (example of ultrasonic transducer)

In order to form a 50% cycle duty waveform of 2.5kHz, the CNT1/DLY1 is supposed to have a base pulse of 0.1750ms 348 counts. (this complemented with the processing speed, reaches 0.200 ms)

Full application

Figure 4. Full application

Figure 5 shows the input of a test frequency for the continuous 40kHz applied to PIN 2 (CH2). The result of division by 16 as output of CNT0/DLY0 =F/16 is monitored on PIN3 (CH3).

Figure 6 shows the same input frequency of 40 kHz in PIN 2 (CH2) and the output pulse of 0.200 ms from CNT1/DLY1 (CH1).

Ultrasonic signal vs. Stepped down Frequency CNT1/DLY1 configuration

Figure 5. Ultrasonic signal vs. Stepped down Frequency

Figure 6. Ultrasonic signal vs. Stepped down + delay 1

This will become the base half pulse that will turn the analog comparators on. We will discuss this in the next segment.

Width modulation

The idea is to have the final output modulated in width, proportional to the input amplitude average (original soundwave volume).

In order to get this measurement, a low pass filter is implemented.

In Figure 7, the input signal is the main ultrasonic wave, and is passed through the diode D (1N4148) to avoid getting the original affected. The low pass filter is set to 5Hz to achieve sufficiently smooth averaging.

Average volume level

Figure 7. Average volume level

The function of Q is to buffer the analog level. Connecting the filtered signal directly to the device causes a drop on the voltage in the 0.1 uF capacitor.

The resulting level is compared in A CMP0- A CMP3.

The voltage level on PIN6 may always be present, but the comparison will start once a Pulse of 0.200ms is output from CNT1/DLY1 (F/16 + Pulse net).

Figure 9 shows the configuration of the A CMP0. The A CMP1-3 has a similar configuration except for the comparison level, as can be seen in Figure 8.

A CMP network A CMP0 Configuration

Figure 8. A CMP network

Figure 9. A CMP0 Configuration

Each output from the A CMP0 to A CMP3 is connected to an individual CNT/DLY. Each are programmed to have a delayed output that is proportional to the level compared.

Figure 11 shows the expected delay time according to the compare level of Pin6.

A CMP-CNT/DLY network Time-table of all Delay devices Delay devices-OR network

Figure 10. A CMP-CNT/DLY network

Figure 11. Time-table of all Delay devices

Figure 12. Delay devices-OR network

That timing diagram is tested by setting an input volume, which varies in amplitude and the resulting voltage is applied to Pin 6 and the 2-L3 output gets monitored on Pin 4 (Figs. 13-18)

Pin6 (CH2)<300mV Delay =none (CH1) Pin6>300 mV(CH2) Dly =0.050 ms (CH1)

Figure 13. Pin6 (CH2)<300mV Delay =none (CH1)

Figure 14. Pin6>300 mV(CH2) Dly =0.050 ms (CH1)

Pin6>600 mV(CH2) Dly=0.100ms (CH1) Pin6>900 mV (CH2) Dly=0.150 ms (CH1)

Figure 15. Pin6>600 mV(CH2) Dly=0.100ms (CH1)

Figure 16. Pin6>900 mV (CH2) Dly=0.150 ms (CH1)

Pin6>1200 mV (CH2) Dly=0.200 ms (CH1)

Figure 17. Pin6>1200 mV (CH2) Dly=0.200 ms (CH1)

The parameters of CNT5/DLY5 can be observed in Figure 18.

The CLK/4 is used as is suitable for our time needs having as result in each case:

CNT5/DLY5 is set to 0.050 mS (25 counts)

CNT4/DLY4 is set to 0.100 mS (49 counts)

CNT3/DLY3 is set to 0.150 ms (74 counts)

CNT6/DLY6 is set to 0.200 ms (99 counts)

CNT5/DLY5 Configuration Ultrasonic detection

Figure 18. CNT5/DLY5 Configuration

Figure 19. Ultrasonic detection

Final Outcome

A modulated ultrasonic signal is applied to a piezo transducer which is close to a bat’s echolocation call.

The different ultrasonic stimulus and the pulse width output can be seen on PIN 4.

It is observed that depending on the intensity of the signal, the counts are likelier to be performed. This means that the output frequency may be decreased if the main source is weak and will be more stable when the source wave is stronger.

Ultrasonic signal in Piezo applied to Pin6, Output on Pin4 (0.050ms) Ultrasonic signal in Piezo applied to Pin6, Output on Pin4 (0.100ms)

Figure 20. Ultrasonic signal in Piezo applied to Pin6, Output on Pin4 (0.050ms)

Figure 21. Ultrasonic signal in Piezo applied to Pin6, Output on Pin4 (0.100ms)

Ultrasonic signal in Piezo applied to Pin6, Output on Pin4 (0.150ms) Ultrasonic signal in Piezo applied to Pin6, Output on Pin4 (0.200ms)

Figure 22. Ultrasonic signal in Piezo applied to Pin6, Output on Pin4 (0.150ms)

Figure 23. Ultrasonic signal in Piezo applied to Pin6, Output on Pin4 (0.200ms)

Output Stage

In this exercise, an 8 ohm speaker was used to transduce the output pulses via 2 stages: a 2N2222A transistor was used in the first stage and a BC558 was used in the 2nd; for driving the speaker.

Speaker driver

Figure 24. Speaker driver


This application explores the capabilities of basic logic, counters and delays in GreenPAK that can be used to enhance a concept that was, in the past, developed using basic TTL technology. It’s possible to add more features to get the outcome closer to the original source, such as varying the width of the pulse according to the input amplitude. This innovation to the standard detectors adds more value by informing us about the strength of the source. Even the distance parameters can be measured and presented in a visible indicator.

This Bat Detector offers new tools to identify the presence of these wonderful living creatures and lays the foundation for further developments in the attempt to identify frequency range, intensity, sequence, etc.

Many more options can still be added to this base design, such as digital data, or timeouts.

If we look at what lies ahead, this very same application can be extrapolated to have an audible signal proportional to the intensity of an ultrasonic wave, maybe reflected, such as in a proximity radar, impact prevention alert.

  •  MacDonald, D. "Bats." The Encyclopedia of Mammals. New York, 1984: 792-794. “Bat echolocation calls: adaptation and convergent evolution”

About the Author

Name: Jorge Alberto Martinez Alvarado (or Jorge Martinez for short)

Background: Jorge Martinez is an Industrial Engineer on Electronics. He graduated from Instituto Tecnologico de San Luis Potosi. He has worked in electronics development for over 10 years and has experience with general appliances, power metering, telecommunications, automotive manufacturing, and infotainment products.




See full list of Application Notes