Difference between revisions of "UltrasonicPlayer"

From RevSpace
Jump to navigation Jump to search
m
Line 32: Line 32:
 
** <del>replace the feedback resistor on the TDA2030 amp to reduce the gain (from about 30 to 3) and increase the bandwidth as a side effect</del>
 
** <del>replace the feedback resistor on the TDA2030 amp to reduce the gain (from about 30 to 3) and increase the bandwidth as a side effect</del>
 
* check whether devices can actually play ultrasonic audio over this sound card: my laptop, perhaps some cheapish android tablets (using an OTG cable). Bus load is 1536 kB/s (stereo 16-bit @ 384 kHz). Can a Raspberry Pi do it too? -> works fine on laptop
 
* check whether devices can actually play ultrasonic audio over this sound card: my laptop, perhaps some cheapish android tablets (using an OTG cable). Bus load is 1536 kB/s (stereo 16-bit @ 384 kHz). Can a Raspberry Pi do it too? -> works fine on laptop
** reverse engineer the schematic
 
 
* work on automatically mounting USB stick and playing the file on it -> simplest alternative: just put in a USB stick and reboot
 
* work on automatically mounting USB stick and playing the file on it -> simplest alternative: just put in a USB stick and reboot
  

Revision as of 10:08, 2 May 2017

Project UltrasonicPlayer
Sa9227.jpg
An inexpensive DIY ultrasonic audio player
Status In progress
Contact bertrik
Last Update 2017-05-02

Introduction

This project is about a do-it-yourself portable ultrasonic audio player, built out of inexpensive modules available on sites like AliExpress.

A typical use case for this is a kind of "lure" for biology researchers to improve the results of trying to catch bats in a net. The player emulates (social) bat calls which attracts the bats to the net, increasing the chance for them to be caught.

The ultrasonic player consists of a USB sound card with high sampling rate plus a speaker to turn it into actual ultrasonic audio. A built-in Linux single-board-computer (something like a Raspberry Pi) controls playback of audio files. The idea is that you prepare one or more USB sticks with bat calls and just plug one in the player, then the player automatically plays them in a loop

Status

 2017-05-01: replaced a feedback resistor on the amplifier, to reduce the gain from about 30 to 3, this also makes it easier to adjust the gain using the potmeter
 2017-04-30: found the schematic for the amplifier, plan to modify it for lower gain (better level control and higher bandwidth)
 2017-04-16: created a video of current progress.
 2016-10-11: received the amplifier boards.
 2016-10-02: ordered the parts (USB audio, amplifier, a few step-up circuits).

Next steps:

  • measure the frequency range of the USB audio card, using artificial waveform(s), like sweeps and fixed-frequency tones. I can create these waveform in Audacity (which supports the 384 kHz sample rate).
  • measure the frequency range of the amplifier circuit
  • connect the 5V-12V step-up circuit and use it to power the amplifier
  • measure the current consumption of the amplifier -> about 200 mA
  • connect the speaker and verify sound production using a bat detector -> works, but audio is not really loud yet. Making it louder introduces a lot of distortion.
    • replace the feedback resistor on the TDA2030 amp to reduce the gain (from about 30 to 3) and increase the bandwidth as a side effect
  • check whether devices can actually play ultrasonic audio over this sound card: my laptop, perhaps some cheapish android tablets (using an OTG cable). Bus load is 1536 kB/s (stereo 16-bit @ 384 kHz). Can a Raspberry Pi do it too? -> works fine on laptop
  • work on automatically mounting USB stick and playing the file on it -> simplest alternative: just put in a USB stick and reboot

Hardware

50 kHz sine wave
100 kHz sine wave
150 kHz sine wave
TDA2030 amplifier schematic

The hardware consists of the following parts:

  1. Some kind of media player which takes care of the storage and playback of the ultrasonic files, this can be a tablet or laptop, or a single-board computer like a Raspberry Pi
  2. A USB audio card to create the analog ultrasonic signal
  3. An amplifier to amplify the ultrasonic signal
  4. A speaker to turn the signal into actual ultrasonic audio

media player

This is currently the greatest unknown where requirements are most vague.

This could be some kind of Linux mini computer (e.g. a Raspberry Pi / Orange Pi Zero / etc) working as follows:

  • the user puts in a USB stick (formatted as FAT32 for windows compatibility) with some wav files, and possibly a playlist file (.m3u)
  • the player mounts the USB stick as a read-only device, e.g. using udev
  • the player first looks for a playlist file and attempts to play files from the playlist, on repeat
  • if no playlist file is found, it just plays all files in undefined order, on repeat
  • when done playing, the user pulls out the USB stick, the playback process is stopped automatically

See also:

Challenges:

  • Starting playback upon USB stick plugin, using udev?
  • Stopping playback upon USB stick plugout, using udev?
  • Linux experts saying: "You can't pull the stick without unmounting! That would be bad!"

USB sound card

I'm considering this one: USB sound card based on a SA9227+PCM5102 chip.

It allows a maximum sample rate of up to 384 kHz, or equivalently audio op to about 170 kHz. Price: about E30,-

To play back the audio file noise.wav:

aplay -D plughw:CARD=Audio,DEV=0 noise.wav -v

On the right, rom top to bottom: the signal at 50 kHz, 100 kHz, 150 kHz respectively

Measurements of amplitude vs frequency:

  • on the scope you can clearly see the sampling steps: at 100 kHz one wave is sampled using only 3.84 samples.
  • the amplitude drops a bit when going higher, but only like 30% at 150 kHz compared to 50 kHz

Amplifier

I'm considering this TDA2030 module: amplifier board based on a TDA2030 chip.

The TDA2030 chip has a claimed audio bandwidth of up to 140 kHz. Price: about E1,-

Measurements with a separate power supply for the amplifier:

  • seems to be able to handle 50 kHz and 150 kHz audio input equally
  • additionally, it seems the amplifier still works down to 5 or 6V power supply voltage.

Modification: replace R5 (150k) with a 15k resistor.

Speaker

I'm considering this one: Vifa/Tymphany XT25SC90-04.

This speaker is also used in other products that produce ultrasonic audio.

Price: about E22,-

Power

I'm thinking of just using a 5V USB battery. There are plenty of models to choose from, in varying capacity ranges and prices.

To supply the amplifier with 12V, I'm considering this voltage converter: 5V-to-12V step-up cable or possibly this USB 5V to 12V converter. An important consideration for the step-up converter is that the switching frequency is considerably higher than any ultrasonics frequencies we are interested in.

Measurement results for the "AL519" converter, running into a 1 kOhm load:

  • switching period is about 134 us
  • peak-peak ripple of about 200 mV

Measurement for board with "AL697"-chip (I've got three of these):

  • TODO

Current measurement (total current over USB)

  • normally 0.36A (USB audio + step-up + amplifier)
  • when playing: 0.39A
  • current consumed by USB audio: 0.18A idle, 0.19 when playing