This simple project illustrates how to move from

  1. an Arduino + breadboard setup, towards
  2. an Arduino on the breadboard (‘bare bones’), towards
  3. a bare bones Arduino soldered on a prototyping board,
  4. finally built into a nice sturdy housing (cookie box).

arduino+breadboard arrowbarebones-breadboard arrow

arrow IMG_20160228_124857943

The project uses an Arduino to read 2 PIR motion sensors and send an audio signal into a simple amplifier with a speaker. We could just use the sensors and a buzzer for the same functionality, but i used an Arduino to be able to generate different sounds, and to add a Real Time Clock (see below).


The 2 motion sensors (Passive InfraRed) are connected to digital pins of the Arduino. The Arduino generates the audio signal using the tone(pin, frequency) command. The PWM output of this pin is fed into a simple amplifier based on the LM386 with a gain of 200 and an 8 ohm speaker. I did not bother with the potentiometer on the input of the amplifier. Without the amplifier, the sound level is quite low, but you can probably use a single tone buzzer that can be loud without amplifier.

2 PIR sensors with an Arduino and amplified speaker, to be powered by 5V USB power bank


With this working prototype, i moved on to a ‘bare bones’ Arduino setup on a breadboard. I used a standard ATmega328P-PU chip as used on the Arduino Uno; here i describe how to burn the bootloader and upload sketches. As soon as the ATmega328 was working, i was ready to solder all components on a board for a more permanent setup. I included a header for jumper wires to the FTDI pins to be able to upload new sketches. Power is supplied by a Lithium Polymer battery (LiPo) with a nominal voltage of 3.7V which seems sufficient to power the ATmega, as expected, but also the PIR sensors which are supposed to require a minimum of 4.5V.

ATmega328 and LM386 soldered

Current version of the project, in use every day, with a Lithium charger to charge the battery once a week over USB. The booster is included to increase the amp voltage to 9V, for louder sound.

IMG_20171031_083516 - Edited IMG_20171031_083441 - Edited


In order to avoid having to manually switch off this system during the day, i tried including a real time clock (RTC).  This one has a small super capacitor that is supposed to keep the clock powered when the ATmega is switched off. It uses the DS3231 chip which is compatible with the popular DS1307. Connect to Arduino via I2C:

  • square dot: Vcc
  • SDA
  • SCL
  • n/c
  • GND

It works with RTClib library but i used the DS3232RTC library’s SetSerial to set the time using the IDE’s Serial Monitor.

Unfortunately the super capacitor does not seem to work well and the system often loses the time. I will try to replace it with a CR2032 battery.

Motion sensor alarm with RTC (bare bones Arduino)

One thought on “Motion sensor alarm with RTC (bare bones Arduino)

Leave a Reply

Your email address will not be published.