Electronics Projects

PCA8565 based alarm clock

This device is designed to feed out cat. He got used to getting dry food early in the morning. Sometimes we want to sleep longer on weekends and eliminate a visit for friends to feed him in the morning when we are out of town. The device stores the food in a round pipe to be loaded there in advance. At time moment X the bottom part of the pipe opens and the food drops into the cat's plate. So, the idea is similar to the one from the movie "Back to the future".

This paragraph is added about a month after assembling the device. It works just great, I do not know how we leaved without it. The cat can easily hear the sound of dropping dry food, so no teaching of him was necessary. He just figured this out from the very first use, as he already new this sound. I consider this machine as one of the most useful home automation gadgets I have ever made.

The electronic part of the device is just an alarm clock based on PCA8565. The alarm initiates an interrupt that awakes the microcontroller. The later one sends a signal to the door opening mechanism controlled by a motor M on the schematic. The door must make a full turn and stop in the initial position to be ready for the next loading. This is achieved by an opto-interrupter OBP625 which provides a feedback to the microcontroller to stop powering the motor. The motor itself is controlled by PWM based on the timer IC in order to slow it down to a practical speed.

Schematic Display board Controller board

The current time and the alarm time is displayed by a 4-digit LED display, which is combined from two 2-digit displays HDSP-521E. The right one (for displaying minutes) is turned upside down in order to its right decimal point would turn into the upper point of the colon separating hours and minutes on the display. Time to display is selected by a 3-state slider connected to pins RA0 and RA1 of PIC. In the middle position of this switch both inputs are pulled up (internally). In one of the other positions one of the inputs becomes grounded and this is used to select time to display. Time setting and alarm setting is accomplished by two buttons at inputs RA4 and RA5.

The controller PCB is rather experimental. I planed to try several RTCs, but the first one I used (PCA8565) turns out to be very good. According to its data sheet, the clock can be fine tuned by a trimmer cap attached to pin 1. However, even without this cap the clock is pretty accurate - I have not noticed any difference with my other digital clock. It is powered by a separate lithium 3V battery. The RTC and PIC communicate via the I2C interface. The upper ends of the 10K resistors can be attached directly to 5V. This way the LDO MCP1703 can be eliminated. I used it for possible experiments with other RTCs which do not allow more than 3.3V on SCL and SDA lines.

The LED display is controlled by SAA1064. It is a perfect device for this purpose and I applaud to its designers. There is even no need in the LED current-limiting resistors - their brightness is regulated by internal current sources controlled by software. The controller is shown very sketchy on the schematics, however it is used in complete accordance with its data sheet, so please check it for details. The multiplexing cap I used is 2700nF, no display flickering was noticed. The controller and PIC communicate via the I2C interface too. The display is turned off after ca. 10sec after release of any button. This is achieved by simply turning off the controller and display power by a MOSFET IRLML6402 when the voltage on pin 8 of PIC becomes 5V.
Warning: I did a mistake in the display board design. This resulted in cutting some links on the PCB and rewiring the connections with wires. So, it does not look as good as on the middle picture above. This is why I do not supply Eagle files for this project.

The alarm interrupt request at pin 3 of the RTC awakes the PIC and the voltage on its pin 5 raises up from 0 to 5V. This leads to turning the MOSFET on and shorting the common wire of the PWM controller and the opto-interrupter LED to the ground. The timer starts to generate PWM at approx. 60Hz, whose duty cycle is adjusted by the 220K pot. The motor is attached to a 320:1 gearbox, whose axis rotates the door and also a plastic finger for the opto-interrupter. Its signal comes to pin 4 of the PIC is is used to drop the voltage at pin 5 down to 0 in order to turn the motor off.

Assembled device Front view Back view Motor control

Most of the electronics is assembled on two PCBs which are placed one on the top of the other in a small plastic box from Radioshack. The timer and the opto-interrupter are assembled on another small board which is mounted directly on the gearbox. The entire device is powered by a standard wall-wart adapter. The construction should be clear from the images. The button shorting the rightmost MOSFET on the schematic is for manual door control. The door turns as long as the button is pressed.

Downloads


Last modified:Mon, Jan 23, 2023.

04664