I setup the whole prototype on a breadboard as you can see above. The power comes from a lab power source which I set to 9 volts. The device is split into five parts:

  1. Controller (Arduino Uno + Data Logger Shield)
  2. Sensor
  3. Signal LED
  4. Digital to analog converter (DAC)
  5. Amplifier + Speaker

Controller

There is not much to say about the controller. You find the connection diagram below. The digital lines 10, 11, 12 and 13 are already used by the data logger shield to access the SD-Card, also analog input 4 and 5 are used for the real time clock on this shield.

Cat Protect Schema Arduino

The microcontroller is powered with 9V from the lab power source over the VIN pin. The 5V output is used to power the sensor and the DAC. I labeled the power sources with +5V and +9V to specify at which power source they are attached.

The Sensor

The sensor is attached to the regulated 5V power from the Arduino board. This sensor provides up to 100µA current on the sensor output pin, therefore I put a 1kΩ resistor in front of the analog input to limit the current to 5mA. A second 56kΩ resistor to pull the port down if there is no signal from the sensor.

Cat Protector Schema Sensor

The Signal LED

Another really simple part of the circuit. There are two different resistors to create a equal brightness of both LED.

Cat Protector Schema LED

Digital to Analog Converter

The DAC is not connected to the default pins for SPI because there is a conflict with the SD card. Even if the chip select signal is operated correctly, the clocks sent to the DAC seem to confuse some SD cards. Therefore I used the digital outputs on pin 2-6 to serve the DAC and implemented the SPI protocol manually. This is not as fast as the SPI port, but there is no second dedicated SPI port and the transfer rate is fast enough.

The capacitor C4 should stabilize the voltage, but actually there is noise from the microcontroller and I have no clue how to filter it.

Amplifier + Speaker

This was the part which took most of the time to design, just because I made wrong assumptions about the amplifier IC. With the help of Stack Exchange I could solve the problems and got a working circuit.

cp-schema-amp

The output of the DAC is between 0V and 4V, this is way too much for the amplifier which requires maximum ±0.4V at the input. Therefore I put the capacitor C6 after the DAC to filter the DC parts and the resistor R4 and R1 to bring the signal in the right range for the input. C6, C2, R4 and R1 also build a band pass filter which reduces a lot of noise from the microcontroller.

There is a second filter on the output side, with C1, C5 and R5. Actually everything is working really well, there is no hearable noise if the audio signal is on 0V.

Version 2

Meanwhile, I replaced the LM386N-1 which the TDA 7052, which has more power and a better sound output. I did a few changes to the schema. Here the final versions:

Cat Protect V2 Schema 1 Cat Protect V2 Schema 2

Continue with: Software