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


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.


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

20 thoughts on “Hardware”

  1. Hello, i wanted to ask if ou have a picture of how final scheme looks. I mean a scheme where all components are.

      1. No, this is a very simple circuit, there is no functional scheme. Basically it is a microcontroller connected to a SD card and a speaker, it would make a scheme with three blocks and two arrows. I wonder, what do you need to know? Why do you need a functional scheme?

  2. Well I need as much information as I can get about this project because I’m going to use ir for my graduation project. Your project is a perfect example

    1. Nice to hear. Just a note and I hope you are aware of this: There is a tricky part in the project. The SD card is used in block mode without a file system. You cannot simple copy files to the SD card, you have to prepare a special image and write this image to the SD card. I published scripts to prepare the image here: https://github.com/LuckyResistor/CatProtect/tree/master/Scripts But you probably need knowledge how to use a Perl script, how to install the “sox” command which is used to convert the Audio file into the right format and how to write raw images to SD cards.

      1. Ok i will be aware of that, but my professor asked me to append( supplement, add, complement – sorry for my english) something more to my project because he said it is too simple. Maybe you have any ideas how i could upgrade this project ? Like add more features in it ? Anything will be a help

      2. My original idea was to add a LCD display to the device to show the status and the information about detected motions.

        On the data logger shield is a RTC (real time clock) which is not used in my project. It is a DS1307 chip which you can easily access using the I2C interface.

        Then add a cheap character LCD display which can be connected via I2C bus. Adafruit (https://www.adafruit.com) has some very cheap displays, and also backpacks to access them via I2C.

        With the display you can show:
        – Status of the Device
        – Current date/time
        – Number of “incidents”
        – Date/times of the incidents

        If you like to add more components, one or more buttons would be nice to control the display.

      3. Well that tricky part made me hopeless. I mean I don’t understand how you converted an audio file to image, why and where i have to use these scripts…..and now i don’t what to ask specifically…

    1. I use EAGLE from http://www.cadsoftusa.com . They have special licenses for private persons. If you only like to draw schemes, there are many free online tools – just search for “schematic editor”. The EAGLE software provides the required tools to convert the scheme into a routed PCB and has a library where you can create and use components in your scheme.

  3. I Have a new problem. When I apply 5V from arduino to test my TDA amplifier it heating up very fast after about 2 second it’s impossible to even touch it. I checked scheme and connection many times. Maybe you had similar problems ?

    1. No, I had no similar problems. Looks like a shortcut somewhere. Probably the TDA amplifier is already dead. Sorry I can not help here, please seek some local help from someone experienced with electronics.

    2. Just another thing. You probably noted, the amplifier is connected to the 9V source, not to the 5V from the Arduino. Also start with the lowest volume in your tests, the amplifier is larger than necessary for the 0.2W speaker to get a passable sound quality.

  4. ” 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. ” Are you sure this is correct sentence ?

    1. Ah, now I see what you mean. Yes, it seems I confused 100µA with 100mA. Seems you spotted this point. So, yes, technically you could remove this resistor. Still, it is a good idea to leave it in place to protect the analog input anyway.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: