Introduction: Batuino

The Batuino is a device based on arduino (bat + arduino), that can play a high frequency range of audio files. You could call it an artificial bat :) .


Some context about the project

There are 2 devices involved in the bigger project, one being the batuino, which acts as a bat, and the other being a sound recorder device, based on intel edison. The recorder is able to pick up high ranges of sound frequencies over a period of time and displays a spectrogram. Based on that spectrogram, it can then classify different species of bats, which are good indicators of the biodiversity in parks and other green areas. The batuino player, is mostly used for demo purposes, as it acts as a bat emitting ultrasounds that would then be picked up by the recording device.

Using the device

The audio files are stored on a micro SD card and by using a rotary switch we can toggle between 6 different audio tracks. There are 2 speakers used, one is for human audible frequency and the other is for higher range of frequencies (including ultrasounds). The reason for having 2 different speakers is for being able to notice the difference in the audio spectrograms when the same audio track is played by each speaker. We can switch between which speaker is being used, by using a switch button. After we selected the track and the frequency output speaker, we then press a button to play that track.

Step 1: Components Needed

  • arduino (in the example arduino UNO is used)
  • Adafruit VS1053 audio codec
  • MAX9744 20W Amplifier (other amplifiers work as well)
  • ultrasonic piezo speaker
  • a normal audble speaker
  • 2 x ON / OFF switches
  • push button
  • 2.1 mm male jack panel
  • 2.1 mm female jack panel

The arduino sketch code is here.

Step 2: Set Up the Arduino and the Other Buttons / Switches

This section might look a bit complicated, so read it twice :)

ON / OFF switch and the 2.1mm male & female power jack

  • There are 3 legs in the 2.1mm female power jack, out of which the bigger one is the ground, and one of the other 2 is the current-in (you will have to check this with a multimeter, and ignore the last leg).
  • The current-in wire will connect the female power jack leg to one of the legs of the ON / OFF power switch.
  • The ground wire from the female power jack leg then goes to one leg of the 2.1mm male power jack.
  • From the second leg (output) of the ON / OFF switch, there are 2 wires coming out: one goes to the second leg of the 2.1mm male power jack, as power input for the arduino. The other wire will go to the amplifier power input, but more about the amplifier wiring will be discussed later on.

The result so far is: when external current is supplied to the 2.1mm female jack, the ON / OFF switch will then control whether or not this current will go to the arduino and amplifier as well. We need external power to the amplifier, as arduino can only supply 5V at relatively low current, and the amplifier can take up to 13 V.

Arduino setup and wiring:

  • 2 pieces of stripboard are placed on the arduino, to be able to solder the wires on it. The connecting copper has been cut out in some places, as shown in the pictures, to avoid pins being connected between themselves.
  • There are 10K ohms pull down resistors to the following pins of the arduino (the resistor connects the input pin to the ground): A0, A1, A2, A3, A4, A5, D2, D5.
  • The rotary switch' current input wire goes to arduino's 5V. 6 of its other legs (marked 1 to 6) will go to the analog pins of the arduino (A0 - A5).
  • The push button has one wire going to the 5V and another wire going to D5.
  • The frequency switch button has one wire going to 5V and the other to D2.

Step 3: Wire Up the Audio Codec Breakout

The audio codec breakout is soldered on another piece of stripboard, to make connections easier. Wire up the audio codec breakout to the arduino in the following way:

  • VCC -> 5v
  • GND -> GND
  • SCLK -> Arduino pin 13
  • MISO -> Arduino pin 12
  • Mosi -> Arduino pin 11
  • CS -> Arduino pin 10
  • RST -> Arduino pin 9
  • XDCS -> Arduino pin 8
  • SDCS -> Arduino pin 4
  • DREQ -> Arduino pin 3

Step 4: Assemble and Wire Up the Amplifier

Solder the capacitor in the marked circle place. Longer leg corresponds to + and smaller leg corresponds to -. The capacitor ensures the current flow is smooth, and is mostly needed when the device is used with a power supply.

By default, the amplifier is in digital mode. As we are using the amplifier in analog mode, we need to close 3 solder jumpers, marked in a rectangle and labeled: Analog, AD1 and AD2.

Now we need to solder in the potentiometer, in the place marked with Pot Vol. This will allow us to control the analog volume.

Wire up the rest of the amplifier pins:

Power pins in the middle:

  • 1 power cable from the ON / OFF switch to the +
  • Ground cable from the arduino GND to the -

Wire the next 3 pins from the audio codec breakout to the amplifier in the following way:

  • GND -> central pin ( - )
  • LOUT -> right pin ( R )
  • ROUT -> left pin ( L )

Notice the right and left pin are swapped on the amplifier, this is due to an amplifier fabric mistake. Basically right pin is the real left, and left pin is the real right.

Output speakers (+ and - order of the speakers shouldn't matter):

  • one audible speaker wire to Left +
  • one audible speaker wire to Left -
  • one ultrasonic speaker wire to Right +
  • one ultrasonic speaker wire to Right -

Now everything should be set, and the Batuino device is ready.