Saturday, July 28, 2012

24Hr Digital Clock and Alarm Circuit Using Logic ICs - CD4017 CD4026

[Updated]
06/05/2018 - Added Month and Date Reset Feature


This is my first clock project, and used logic IC such as 4017, 4026 to build this clock circuit. Its include Date, Day, and Hourly alarm.See below picture.

Logic clock preview
Preview

It’s very complicated at first sight. But it is not. First of all you can build main circuit and check it work or not.If the circuit work fine, then add other parts step by step to the circuit.

If it’s not work check all component and connections are correct and also check Seven Segment Displays. In my circuit I used LEDs but it is possible to use Seven Segment Displays.
Add &transistors if you use LED or big Seven Segment Displays because this logic ICs can not handle large current. I connect this circuit with 6v backup battery to prevent time lost when the power is fail. In power failure displays are turned off but time is running using battery power.

Logic clock circuit
Full Circuit Diagram

1Hz Signal Generators

To generate 1Hz clock pulse for this circuit here I used circuit of a ordinary clock machine. you can buy a clock machine very cheap price at electronic shops or you can get it from old clock. In below picture you can see most common circuits of clock circuits. By giving power to this circuit we can able to get 1Hz output across the pins that are connected to coil (motor). (But actually we can get only 0.5Hz pulse in one pin. So get 1Hz we need to connect those pins by two diodes. you can see that in the diagram).

1hz signal generator circuit
Clock circuits

4017 decade counter (1-of-10)

CD4017 pin The count advances as the clock input becomes high (on the rising-edge). Each output Q0-Q9 goes high in turn as counting advances. For some functions (such as flash sequences) outputs may be combined using diodes.

 The reset input should be low (0V) for normal operation (counting 0-9). When high it resets the count to zero (Q0 high). This can be done manually with a switch between reset and +Vs and a 10k resistor between reset and 0V. Counting to less than 9 is achieved by connecting the relevant output (Q0-Q9) to reset, for example to count 0,1,2,3 connect Q4 to reset.

 The disable input should be low (0V) for normal operation. When high it disables counting so that clock pulses are ignored and the count is kept constant.

 The ÷10 output is high for counts 0-4 and low for 5-9, so it provides an output at 1/10 of the clock frequency. It can be used to drive the clock input of another 4017 (to count the tens).

4026 decade counter and 7-segment display driver

CD4026 pin The count advances as the clock input becomes high (on the rising-edge). The outputs a-g go high to light the appropriate segments of a common-cathode 7-segment display as the count advances. The maximum output current is about 1mA with a 4.5V supply and 4mA with a 9V supply. This is sufficient to directly drive many 7-segment LED displays. The table below shows the segment sequence in detail.

 The reset input should be low (0V) for normal operation (counting 0-9). When high it resets the count to zero.

 The disable clock input should be low (0V) for normal operation. When high it disables counting so that clock pulses are ignored and the count is kept constant.

 The enable display input should be high (+Vs) for normal operation. When low it makes outputs a-g low, giving a blank display. The enable out follows this input but with a brief delay.

 The ÷10 output (h in table) is high for counts 0-4 and low for 5-9, so it provides an output at 1/10 of the clock frequency. It can be used to drive the clock input of another 4026 to provide multi digit counting.

cd4026 display chart
4026 display chart

CD4073 triple 3-input AND Gate

CD4073 internal
CD4073 pin

The 4073 has three separate 3-input AND gates which you can use independently.

Truth table

The truth table of each individual gate is:
C B A Output
0 0 0
0 0 1 0
0 1 0 0
0 1 1    0
0    0
1 0 0
1 1 0    0
1 1   1 1

where '0' represents a LOW voltage, and '1' represents a HIGH voltage.

Basic operation

You can investigate the behavior of a single 3-input AND gate using this circuit:

3-input AND gate operation
The inputs of the gate must be connected, either to LOW or to HIGH, and must not be left open circuit. This is the function of the input switches with their pull-down resistors. To avoid loading the output of the gate, a transistor switch indicator circuit should be used. It is good practice with CMOS circuits to insert a decoupling capacitor, 47µF or 100µF, across the power supply. (This helps to prevent the transfer of spikes along the power supply rails.)

UM348X

UM348X  pin
The UM348X series is a mask-ROM-programmed multi instruction melody generator, implemented in the CMOS technology. They are designed to play the melody according to the previously programmed information and capable of generating 16 songs with 3 instrument sounds, the piano, the origin and the mandolin.

The devices also included a per-amplifier which provide simple interface to the driver circuit. The UM348X series is intended for applications such as toys, door bells, music boxes, melody clock/timers and telephones


Month and Date Reset

Month and Date Reset Circuit
Month and Reset Circuit
This is a newly added circuit and use 16F628A micro-controller. you have to program it before use. the purposes of this circuit are show month and reset date according to the month. Ex: Jan 31, Feb 28, Etc. PIC use its internal oscillator and circuit is very simple. To save pins, Month shows binary format.
Ex: 1=0001, 2=0010, 3=0011, etc.
For power supply and more details please refer device datasheet. 


Code

/******************************************************************************* Month and Date Reset - 16F628A Copyright (C) 2014 Praneeth Kanishka This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses >> Email: scorpionzblog@gmail.com >> Web : http://scopionz.blogspot.com *******************************************************************************/ int count=1, month=1, date=1; const char day_month[] = {0,31,28,31,30,31,30,31,31,30,31,30,31}; // Interrupt Service Routine (ISR) void interrupt() { if (INTCON.INTF) // Check for interrupt { PORTA.F2=1; count=count+1; delay_ms(5); PORTA.F2=0; if(count>day_month[month]) { count=1; if(++month>12) month=1; PORTA.F3=1; Delay_ms(5); PORTA.F3=0; PORTA.F2=1; Delay_ms(5); PORTA.F2=0; } PORTB = month<< 0x07="" a0="" clear="" cmcon="" comparators="" delay_ms="" disable="" flag="" if="" intcon.intf="0;" intcon="0b10010000;" interrupt="" interrupts="" main="" month="" nable="" option_reg.intedg="0;" pcon.oscf="1;" porta.f2="0;" porta="0x00;" portb="month<<4;" rb0="" trisa="0x03;" trisb="0x01;" void="" while="" z="">12) month=1; PORTB = month<< count="" delay_ms="" if=""> day_month[month]) { count=1; PORTA.F3=1; Delay_ms(5); PORTA.F3=0; } PORTA.F2=1; Delay_ms(50); PORTA.F2=0; Delay_ms(400); } } }

64x8 LED Matrix Moving Display Circuit - 18F2550

Matrix Display preview
Matrix Display

LED dot matrices are very popular and it can displaying information such as both static and animated text and images. you can see it at gas stations displaying the gas prices, or in the public places and alongside highways, displaying advertisements on large dot matrix panels. In this project, we can use LED dot matrix interface with a micro-controller to display static characters and symbols.

This circuit of a Dot Matrix is based on the PIC18F2550 micro-controller and software is pic basic pro and it also include Proteus ISIS simulation and Kicad PCB files.

Matrix Display pcb
Circuit Board

This circuit has 8 of 8×8 matrices and currently I used only 3 matrices.but you can use up to 8 matrices. I added two different hardware versions in download. but firmware is same. In my circuit I used CD4541 PCB and bypass the transistors. But brightness of your displays are very low or you need extra brightness then used transistors. and remember to add heat sink to regulator ic.

Character Set

The most difficult thing about using the dot matrix LED display is defining the characters. Basically for ASCII characters you need an array of 128 blocks each having 8 column data numbers.
The usual way is to get out a piece of graph paper and define your characters by drawing blocks where a pixel is on. You then translate each line into hex (binary to hex is very easy) and then transfer this information to your program source code.

Theory of LED Dot Matrix Display

In a dot matrix display, multiple LED s are wired together in rows and columns. This is done to minimize the number of pins required to drive them. For example, a 8×8 matrix of LED s would need 64 I/O pins, one for each LED pixel. By wiring all the anodes together in rows , and cathodes in columns, the required number of I/O pins is reduced to 16. Each LED is addressed by its row and column number.Characters can be displayed by fast scanning of either rows or columns.


Video Of Matrix Display

How to compile?

First install MicroCode Studio
Then install PICBASIC PRO Compiler
Finally install MPLAB IDE

Now open MicroCode Studio
Click View >> Compile and Program Option >> Compiler >> Find Automatically
Else you can manually search your pbp folder (Default C:\pbp)
Next Click Assembler >> Find Automatically
Or you can manually search by clicking Find Manually button  (Default C:\Program Files\Microchip\MPASM Suite)
Then open 18F2550.bas with MicroCode Studio, choose 18F2550 and press F9 or go to project >> compile

Now you were done.

PIC18F2550 Datasheet

18F2550 Pin
pin connection

Friday, July 27, 2012

12 24Hr Big LED Digital Clock Circuit - 16F84

Few years ago I build a 24Hr clock using logic ICs. It’s work nicely but little complex to beginners. So I think build clock using pic IC. Check the below picture. Hope you like it.

16F84A digital clock preview
16F84 digital clock

It’s very easy to build and time accuracy is 99.999%. Because I use a clock circuit to generate the 1Hz pulse. It drive the clock. Use well smoothest power supply to give power to the circuit.

Preview of clock

Use '16F84A_12Hr.Hex' for 12 hour clock and '16F84A_24Hr.Hex' for 24 hour.

What is clock circuit?

I use the clock circuit to drive the clock because it is the easiest way to keep time accurately without using Real time clock IC such as DS1307. You can buy an ordinary clock machine in a shop. It is very cheap. Then open it and get the circuit out. That is the clock circuit! Connect outputs of clock circuit (winding of coil is connected to here) to P5 and P6, (+) to P7 and (-) to P8. That’s all.

1Hz clock generator
clock circuits

Now you can work in time. :D

PIC16F84A Datasheet

16F84A Pin
pin-out

Seven Segment Up Counter and Timer Circuit - 16F628

PIC16F628 Counter Circuit
Circuit diagram

The project shows what can be done with a micro and you can modify it to set an alarm at any count-value or set a limit such as 'count-to-60'. You can add a buzzer or relay or increase the display to 3 digits. You need to remember that each additional display will reduce the illumination of each digit as they are 'multiplexed (time-sharing)'. Full circuit diagram including programming socket.

The displays do not affect the 'In Circuit Programming' as they are not active when programming and do not load the outputs. Any 7-Segment displays will work in this circuit. You need to identify the pin-out of any display you use. (Common Anode displays can be used providing you invert the values in the display table. A PNP transistor will need to be used.)

Testing the circuit

Check the circuit by removing the chip and taking pins 6 and 18 to the 5v rail ad make sure segment 'A' illuminates. Do the same for all the other segments.The circuit diagram does not have any voltages marked on it as the circuit is DIGITAL.All the 'lines' or 'wires' or pins of a micro-controller will have rail voltage (5v) on them when they are HIGH and when you come to a resistor, the resistor will drop a certain voltage. The voltage it will drop will be the difference between rail voltage and the voltage developed across the component it is driving. If it is driving a LED, the LED will drop a characteristic voltage of between 1.7v and 3.6v, depending on the color. If the component is a transistor, the voltage developed between the base and emitter will be about 0.7v.

Use Micro C For Compile.

MikroC

PIC16F628A Datasheet

PIC16F628A Pin
pin-out



PIC16F84A Datasheet

PIC16F84A Pin
pin-out


 

on line

Labels

Recent comment

Visitors

Free counters!
Copyright © 2012 - Scorpionz™.,All rights reserved | Powered by Blogger