Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

60Hz pulse generator

Status
Not open for further replies.

nathanoyler

New Member
Hi there. I'm an electronics novice that decided to build a digital clock as a good starter project. I got the concept from this site: HowStuffWorks "How Digital Clocks Work" and ordered a bunch of stuff to get it going. Of course, I realize that modern clocks aren't jammed full of a bunch of decade counters, but that's not the point of the project.

The concept is simple enough...using a 10VAC/1.2A power supply, I could take the 60hz wave of the AC and divide it down twice with decade counters (one dividing by 10 and another by 6). Voila, a 1 Hz pulse to feed into a 74LS90 IC as a second counter. To do this, though, I need to get a 60Hz pulse into the first decade counter. From the diagram (attached), it should be done simply with a resistor and a 5.1v zener diode. So, I finish out the basic circuit consisting of the 5VDC power supply and decade counters. The 60hz pulse, though, isn't working. It seems like this should be the easiest part, but alas, it has me stumped.

From the attached diagram, I have 10VAC connected to a 1K resistor. The other side of the resistor is then connected to the zener and the input on the decade counter. The other side of the zener is connected to the 5VDC ground. I have LEDs connected to the outputs of the second decade counter so that I can see it output binary 0 to 9. It just turns on a single LED and doesn't count, though.

From the look of things, I think that the pulse just isn't there. I have tried three different zeners, but no luck. I don't have an oscilloscope to veify the pulse, but my multimeter tells me that the expected 5.1VDC is coming from the zener.

Any ideas?
 
Last edited:
Your multimeter is probably not going to display a pulse. A logic probe is a handy tool for digital logic troubleshooting and cheaper than a scope.
 
Hmm, I'll look into a logic probe. Thanks!

I also forgot to attach the diagram for the pulse and 5vdc power supply I'm using. Here it is!
 

Attachments

  • digclock-power-supply.gif
    digclock-power-supply.gif
    10.2 KB · Views: 554
If you can find one, a stand-alone MM5369 oscillator with a 3.58MHz crystal will work. If not, using a NAND or NOR oscillator with a counter/ divider also works. You will need a set frequency to set the time, though.
 
Are you sure that your "wall transformer" is putting out AC and not DC?
 
I think the voltage will still be AC only clipped to 5.1V so I would expect a ~3.5VAC
 
If you can find one, a stand-alone MM5369 oscillator with a 3.58MHz crystal will work. If not, using a NAND or NOR oscillator with a counter/ divider also works. You will need a set frequency to set the time, though.
You are correct but these devices are almost obsolete and only you may get few for service purposes. As I see from Indian scenario, they are charging fancy prices like $8/- each less crystal.

I was wondering why not implement the same with chips like 12F510 with external 4MHz crystal

this was once suggested by one of our members.-whether it is Pommie, I don't remember.
I wrote a small patch for getting 60Hz on 2 pins and and an inverted signal on a third pin using 16F628 and presently with Config as 3F10. I may have to make it with xt crystal and the change the chip as 12F510.

This was to meet my need for restoring LM8560 based clock radios where the local mains is inconsistent, leave alone discussion around the inconsistency.
Code:
;********************* Gen60Hz.asm  12/16/08  **********************
;********************************************************************

 LIST P=16F628A   ; Device number (PIC16F628A)
#include	<P16F628A.inc>
; 
 ERRORLEVEL -302 ; suppress message because of page change

;--------------------- Configuration ---------------------------------
 ;__CONFIG _CP_OFF & _WDT_OFF & _int_OSC & _PWRTE_ON & _LVP_OFF & _BODEN_OFF & _MCLRE_OFF
 	__CONFIG	3F10	
;--------------------- Define Variables -----------------------------

 
CounterA    equ     20h      
CounterB	equ		21h 
CounterC	equ		22h
CounterD	equ		23h

      movlw       0X07 
      movwf       CMCON          ; Comparators off	
      bSf         STATUS,RP0     ; Select memory bank 1 
      movlw       b'00100000'     
      movwf       TRISA      	 ; Set port A as output, RA5 = Input 
      movlw       b'00000000'
      movwf       TRISB          ; Set port B as output, 
      bcf         STATUS,RP0     ; Select memory bank 0  
abcd  	 MOVLW	d'4'
         MOVWF  PORTB 		      
		movlw	D'1'
		movwf	CounterD
		movlw	D'1'
		movwf	CounterC
		movlw	D'11'
		movwf	CounterB
		movlw	D'205'
		movwf	CounterA
loop	decfsz	CounterA,1
		goto	loop
		decfsz	CounterB,1
		goto	loop
		decfsz	CounterC,1
		goto	loop
		decfsz	CounterD,1
		goto	loop 
        MOVLW	 D'3'
        MOVWF   PORTB 
   	    movlw	D'1'
		movwf	CounterD
		movlw	D'1'
		movwf	CounterC
		movlw	D'11'
		movwf	CounterB
		movlw	D'205'
		movwf	CounterA
loop1	decfsz	CounterA,1
		goto	loop1
		decfsz	CounterB,1
		goto	loop1
		decfsz	CounterC,1
		goto	loop1
		decfsz	CounterD,1
		goto	loop1
  		goto abcd
  	 	END
 
I am sure a person new to electronics has no idea what a PIC is let alone what all that source code means.
Using the AC mains as a frequency source is a perfectly valid method.
 
Last edited:
Since nathanoyler appears to be looking for a 1Hz signal in the end, gut a battery desk/wall clock. They have two 0.5Hz, 1.5V outputs across the drive coil, 180 degrees out of phase, that can be added to make a 1Hz pulse generator. As for accuracy, the only time I have to reset them is after changing the battery or Daylight Savings Time.

Ken
 

Attachments

  • 1 Second Clock.gif
    1 Second Clock.gif
    13 KB · Views: 709
Hmm, I'll look into a logic probe. Thanks!

I also forgot to attach the diagram for the pulse and 5vdc power supply I'm using. Here it is!

hi,
Make this simple change, use a 1N4001 or equivalent diode.
 

Attachments

  • digclock-power-supply.gif
    digclock-power-supply.gif
    10.4 KB · Views: 282
Eric,

Isn't the output pulse rate across the +/- terminals of a bridge rectifier 120Hz (100Hz UK). I think in the original circuit the lower right diode "shorts out" the resistor/Zener on one half cycle, so you only see every other pulse.

Ken
 
Last edited:
Eric,

Isn't the output pulse rate across the +/- terminals of a bridge rectifier 120Hz (100Hz UK). I think in the original circuit the lower right diode "shorts out" the resistor/Zener on one half cycle, so you only see every other pulse.

Ken

hi Ken,

I thought the OP was going to use a div by2 on his original circuit.??
I would use a 7492 for 60Hz [at 120pps] to give the 'tenths' decade.

In the UK we would use a 7490 for the 'tenths'

He is reporting that the original cct isnt working at all.?
 
Hello,


General purpose crystals are a little difficult to get to work well in wall clocks because their tolerance isnt that good. Even though they are often spec'd at the seemingly low number of 50ppm (50 parts per million) with a near 4MHz crystal that still means a full 26 minutes per year error. I dont know about you, but that's too much for me. That also means about 2 minutes per month.
What that means is that you have to have some means to adjust the crystal frequency, either in hardware with a small adjustable cap or in software (when using a uC ic chip). This also helps to make up for the errors introduced by the not so perfectly valued load caps (or the lack of them over temperature) which is also responsible for errors that could easily be another 50ppm or more.
This is only part of the problem however, as even then we still need to adjust the frequency, and that is not very easy to do either. It could easily take several weeks to get it right while waiting for the error to accumulate after each adjustment. This is a real pain.

A simpler and much more accurate method is to use an oscillator made just for real time clocks. These are usually 32.768kHz and although a bit expensive (maybe as high as 10 dollars USD) they are also temperature compensated so you can expect decent time keeping.

If you have the option of running off of an AC wall wart (as some of the other posts suggests) then you can of course sense the 50 or 60Hz line frequency and use that as a time base after dividing down by 50 or 60. This results in excellent time keeping because the power companies keep their average line frequency very constant over long periods of time with constant little adjustments whenever needed. If you dont have to run off of batteries, this is a good method. For battery backup protection however you'll also need to incorporate some kind of free standing oscillator too so that the clock can keep reasonably accurate time when the power line goes down. This means you would be using the line frequency most of the time and only the backup oscillator when the line goes dead and the battery backup takes over. In this case the oscillator doesnt need to be super accurate because the time the line is down is assumed to be rather short term.
 
Last edited:
hi Al, Happy New 2011.

Did you note the year of this post.?
 
Hi there Eric,

Wow, that was almost two years ago! I wonder how it got up so high on my list of 'recent' posts. Was still interesting though :)
Happy 2011 :)
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top