1 HZ generator based on crystal (32.768 khz) issue  - Page 1
Forum section: electronics / beginners

author: Mate_Well
author_rank: Contributor
timestamp: October 26, 2019, 06:01:57 pm
content: I'm planing to build a digital clock with 7 segment and BCD outputs, that part should work (will work on it later, a bit irelevant atm) and i need to make 1hz clock signal, lookedonline if there is better option then555 timer that would be more acurate, and i found one that "divides" 32.768khz to 2hz and in next "stage" it chops it further to 1hz (bingo right?) Built it on breadboard and worked fine, and thus decided to build it on a veroboard ("cracker" with copper dots), and it didn't work (even thought i checked all conections 10 times) after a minute or 2 (i accidently forgot to disconect it from psu) it started to work fine... for 30 seconds or so, then stoped. i have been trying to make it oscilate with no luck (hocked up a led after 1st "diving stage") only low frequency when i phisically touched one of the pins for the crystal, probably mains frequency coupled. Soo i decided to make 2nd board (the 1st was a chaos after trying to make it work) without the 2nd "stage" (2hz to 1hz) checked everything like 50 times just to be sure (last crystal i had) and behold nothing, same issue. When i touch anything from pin 10 to crystal (or pin 11) it couples the mains on it, i have zero idea what could be wrong, i checked every single thing and nothing made the 2nd board work ( the 1st board "worked" like 2 times and both were flukes, that jabaited me soo hard ;[ ) i will send picture of the board tomorow (and i have done my best to put all of it close together to minimalise other "factors")in short : issue with 32.768 khz to 2 hz "divider" (4060 based), worked on breadboard, no oscilation and "works" when ac coupled by body (except the fact that i got 50hz instead of 32.768khz) (all parts from trustworthy shop)scheme is in attachments (gray part was not done on 2nd part, since it needs the 1st "stage" to be working), and all values are same, voltage will be 5V and soo i tested it on 5V, only difrence is that i have got 4060B (and i have not found any difrence on interned betven them) (datasheet :https://www.gme.cz/data/attachments/dsh.427-167.1.pdf)Thanks in advance o/

author: iMo
author_rank: Super Contributor
timestamp: October 26, 2019, 06:25:31 pm
content: C1 and C2 are rather high. The 32kHz watch resonators are designed for a single 6 or 12pF capacitor. afaik.

author: Benta
author_rank: Super Contributor
timestamp: October 26, 2019, 06:32:27 pm
content: ^^^What imo said.Normally you don't needanycaps on a 32k crystal, the input capacitance of the CMOS IC is sufficient.

author: Mate_Well
author_rank: Contributor
timestamp: October 26, 2019, 06:33:25 pm
content: Thanks i will try to put 2 in series or 3 in series (if i have that many) and if that fixes it it would be golden, and i didn't gave 2nd look to the values tbh, only the 6M8 resistors semt big to me (no point of refecne when it comes to crystals) (and would be +1 to wrong cap value strugle counter, had isseu with too small cap value on 555s)Edit: or try without one as Benta said TY

author: iMo
author_rank: Super Contributor
timestamp: October 26, 2019, 07:49:43 pm
content: The parasitic capacitancy of the 4060 (plus package plus wires) pin is around ~6pF, therefore try it first without capacitors. In case you would need to tune, you may try with a gimmick capacitor (a 5mmshortlong 0.2mm thin twisted wire) wired to the 4060's xtal oscillator input.

author: Mate_Well
author_rank: Contributor
timestamp: October 27, 2019, 09:19:45 am
content: Ok i have tried it with 2 in series, soo half of the original value (33/2 = lets say 16pf) and nothing changed, soo gone to no caps, and also no mayor change, except the fact that when i put finger on the tracks the 2hz "work" faster not 20 seconds but more like 10 soo i kinda have no clue how to fix it, no caps and "looks" like it has way too much of capacitance even now (both boards same issue)board pics in attachments as "promised" and it brings me to a possible issues (both seem stupid but may actualy be critical) 1 there is a capacitance cause by the tracks (yeah i doubt it but meh) and 2 the flux might cause issues ? (considering there is 12-13M resistor it may make sence (6M8s in series))

author: iMo
author_rank: Super Contributor
timestamp: October 27, 2019, 09:26:25 am
content: Do it step by step. Do not use R1 and the Mohm resistors. Wire the bare xtal to the 4060. Look at the 4060 outputs (do not touch the xtal pins with probes). When not oscillating wire 6M8 in parallel. When not oscillating add 220k in series. When not oscillating wire 1M in parallel. Etc. Etc.

author: MagicSmoker
author_rank: Super Contributor
timestamp: October 27, 2019, 09:31:12 am
content: The crystal might have been damaged from overdrive as a result of using too much load capacitance; 32.768kHz crystals are notoriously sensitive to this.Post the part number of the crystal or its datasheet for more specific guidance, but as of now I'd say your crystal has cracked... literally.

author: Mate_Well
author_rank: Contributor
timestamp: October 27, 2019, 09:38:32 am
content: ok will do that the issue is i don't have an osciloscope, will try to do and "judge" it with led acrod pin 8 (ground) and 7 (after 1st divishion (that is ofc when it doesn't work))also labeled board in attachments (pin 9 and 10 aren't shorted, i have "depined" few pins including pin 9)and datastheets of crystal :https://www.gme.cz/data/attachments/dsh.131-036.1.pdfhttps://www.gme.cz/data/attachments/dsh.131-036.2.pdfoh and if the crystal is dead (which wouln't suprise me) i don't have any replacement rn, but i have "random" salvaged ones with difrent freqguencies (most likely much higher) can i connect them instead of for testing or will they break ? (without the caps)

author: iMo
author_rank: Super Contributor
timestamp: October 27, 2019, 09:48:09 am
content: You may test your digital stuff by wiring an RC 4060 oscillator instead. After debugging the digital part you may start with the Xtal elaboration. Do you use CD4060B or 74HC4060?The watch crystals like low powers, like few uWatts, therefore the serial xxx Kohm resistor. The parallel xx Mohm is there to push the inverter inside the 4060 into a "linear mode" creating some gain thus the stuff oscillates. The prerequisite is the XX4060 supports the xtals like the 32kHz watch ones. For example the datasheet of the 74HC4060 does not mention an xtal as an option at all..

author: MagicSmoker
author_rank: Super Contributor
timestamp: October 27, 2019, 10:14:06 am
content: Quote from: Mate_Well on October 27, 2019, 09:38:32 amIt probably wouldn't do you any good, anyway, because the capacitance of the scope probe is significant compared to a crystal's load capacitance. It is usually the case that touching the probe to one of the crystal's pins either causes it to start oscillating when it wasn't or vice versa.Quote from: Mate_Well on October 27, 2019, 09:38:32 amI checked the first datasheet and it says the load capacitance needs to be 12.5pF - which, btw, is thetotalcapacitance seen by the crystal. The load capacitors are considered to be in series as far as the crystal is concerned, and don't forget there will be stray capacitance added to this from the traces and the IC itself. I would try using 22pF capacitors here.

author: Mate_Well
author_rank: Contributor
timestamp: October 27, 2019, 10:22:38 am
content: I use CD4060B, and i will try to do the RC oscilator but i have no idea what values to use (looked on a eguasion and should het 1-7hz with 6M8 and 4700uf cap, i have these and should "work" if my math is correct)Time t = 2 n / f osc = Secondsn is the selected Q output number2 n = Q output number = 2 x Q no times Eg. Q3 output = 2x2x2 = 8f osc = 1 / 2.5 (R1xC1) = in Hertz32768 / (1 / 2,5 * (6800000 * 0,0068)) = 1,77....... secondsis the result actualy somewhere close reality becouse i have 0 point of refence when it comes to this (personally i would say it would take hours to charg e but idk)and the 22pf is issue to me, since i would have to order the parts (shipping in czech is like 8€ for parts that cost 0.04 each) and i have tryed 16pf with no luck (worked "better" without one) and sice i have now only 1 crystal with the right frequency that may or may not be working i will probably troubleshoot on RC circuit and if even that won't work i will just say screw this and do temporarry 555 timer instead (since i will be ordering parts in like a month or so and will revisit it then (with the crystal) and with the RC i will try it untill i break the 4060s i have (2 of them, since that is the only thing i can't rly replace until i order more)TY all for the ideas and explainingEDIT: soo i have decided to test the crystal and this circuit on breadboard, with the 33pf caps, guess what it bloddy worksand boards don't, is there a possibilitty that the flux/rosin i used (the uncleaned residue) "shorts" the crystal pins (well shorts relative to the 6M8 since the tracks are close to each other) again the circuit works on breadboard which makes me wonder what could be the issue

author: iMo
author_rank: Super Contributor
timestamp: October 27, 2019, 10:59:15 am
content: For you the T=30usecs (for your testing purposes it does not need to be such precise value)Below the formula (from DS).For ~32kHz, for example Rx=10k, Rs=33k-100k, Cx=1.2nF-1.5nF

author: Mate_Well
author_rank: Contributor
timestamp: October 27, 2019, 12:24:49 pm
content: the RC one works fine on breadboard (soo did the crystal one), and haven't tested it on the vero board (partly cuz the 2nd board took last bit of veroboard i had) but i still can't wrap my head around why it works on breadboard but doesn't on vero board. (breadboard works perfectly and when i touch one of the crystal's legs it "pauses", unlike on the veroboard where it is normaly "paused" and i literally need to touch one of the legs for the circuit to do anything (coupled 50hz from mains most likely instead of the crystal's frequency) but that a] is not remotely acurate (instead of 2hz it is more like 0.13hz) and b] is not even remotely practical. soo just to ease my mind and distract myself i have cleaed the residual flux of the board with alcohol (or something like that) and that didn't change anything (as expected, but made the board look a bit new-er)Edit: and found out that if i turn on my soldering gun (the heavy one with transformer inside, and i use that for all projects atm) near the 4060B it basicaly does 1 "oscilation) (changes the state of the led across pin 8&9 (not the one on board))and It kinda feels like it is stuck in reset but only for ascilator when on the board (and thus i have put 100nf cap across ground/reset&vcc (just to be sure, and "smoothing" cap never hurted anything yet)) but still wouldn't explain why the same ic works fine on breadboard

author: iMo
author_rank: Super Contributor
timestamp: October 27, 2019, 12:59:49 pm
content: The stray capacitance of the adjacent rows on the solderless breadboard is around 3.5pF. On your pcb it is much less. Also doublecheck whether your capacitor's and resistor's values are the right ones.Do not use transformer tesla iron with cmos chips..Blocking capacitors (ie 100n ceramics) at the chip's Vcc and Vgnd pins are important with cmos logic.Your problems are pretty standard, we all have them, and we like to debug them

author: Mate_Well
author_rank: Contributor
timestamp: October 27, 2019, 01:14:43 pm
content: ^ i have thought i'm insane when i done that on my last project (forgot vcc on 555 timer) and heureka found the issue resistance was wrong, but not on resistors, i have been close with the flux/rosin messing things up, except it was the vero board, measured 5M betven 2 pads, that would explain a lot of things, i have used this board in psu and other projects soo i never gave it inspection, but fact is i have never ever yet used resistors with value over 1M, sooo that explains a lot of headache, and i just jumped to finding issues with ic, crystal, and connections when all the time it was the pcb/vero board (for once it wasn't my brain with it's last 2 braincells completly failing :p )Thanks all who helped you guys taught me a lot in the apst 2 days, and i hope this might be helpfull to someoneand as always, the problem is always the biggest bs that it could have been <3 u guysand it is not technically solved yet, i will take cold one for that and hopefully finish a working board today (and i have a new thing to test when i will try to use pcbs) thankfully i have failed projects with pcb that i can still "salvage" but i would never ever thing about this being it (realised when the resistance of the series 6M8s was like 3M)

author: soldar
author_rank: Super Contributor
timestamp: October 27, 2019, 06:48:00 pm
content: Quote from: imo on October 26, 2019, 07:49:43 pmI have used this trick in the past and it works well.A couple years back I was repairing an old CRT TV that had problems with the color and it turned out that the frequency of the oscillator had drifted a tiny bit but just enough that the TV decoding part was not working. The frequency varied ever so slightly with temperature so the color would start failing after a while of use. It took me a while to figure it out but in the end adding a few pF in the form of a couple twisted wires brought the frequency back to where it should be.

author: iMo
author_rank: Super Contributor
timestamp: October 27, 2019, 07:01:11 pm
content: Decades back I tried to adjust my counter's oscillator, the 22pF trimmer was sooo coarse I had to go with the gimmick cap. You twist for example a 12mm long one, and then slowly cut off the free end, 0.5mm steps, till you get the frequency. When you cut off too much of it? Twist a new one