This simple project illustrates how to move from
- an Arduino + breadboard setup, towards
- an Arduino on the breadboard (‘bare bones’), towards
- a bare bones Arduino soldered on a prototyping board,
- finally built into a nice sturdy housing (cookie box).
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.
BARE BONES ARDUINO
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.
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.
REAL TIME CLOCK
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
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.