Close
0%
0%

Yet Another (Discrete) Clock

I HAD to finally do this basic "exercice de style" in digital electronics, using some hundreds of transistors and diodes...

Similar projects worth following
Digital clocks are trendy and relatively simple, yet they cover most of digital electronics' aspects (sequential and combinatorial logic, inputs/outputs etc.) so they make a great educational and "fun/hobby" project that can be turned into a modern sculpture.

This project also allows me to enjoy and rediscover Complementary MOSFET-based logic circuits (and Domino-style cells).

I'm far from the first to tinker with this idea and I'd like to use this not-so-trivial circuit as an introduction project for the #Discrete YASEP.

Design constraints:
- No integrated circuit
- 3V, very low power so it can be powered by 2×AA Alkaline batteries (or Li)
- simple, modular, elegant electronic design that beginners can easily understand and build

Precision and cost are considered but not the highest priorities.

Since this project has forked (giving #Clockwork germanium), this MOSFET project is developed for "educational outreach". For example, I plan to build one version in collaboration with LOREM's "fab kids" to show kids the basics of electronics. From design idea, to prototyping then layout, fabrication, soldering and testing, there are so many things to learn and hack !

Also I'd like to create kits, in through-hole and SMT versions, for individuals and for when I organise workshops for beginners. The modular design is great to teach soldering in small/medium groups.

Many ideas and some techniques are shared with the germanium version (such as the resonator and overall structure) but the MOSFET version is cheaper, draws less current and helps me teach "how things work". People comfortable with the design of this clock might later want to play with the #Discrete YASEP.



Structure

Clock circuits have been rehashed so many times... I have even covered it in a series of french articles that teach VHDL but it's still interesting to examine it. The original version was pretty classic, a bit like transistorclock.com.

The new version doesn't use 7-segments digits. Instead it directly shows the state of the Johnson counters, thus saving a few hundreds of parts and creating a pretty unusual look. Add to this the 18KHz crystal oscillator (which is very visible and has an unusual frequency) and this clock is now pretty curious :-)

The faceplate looks like this:

The basic elements of the clock are pairs of complementary MOSFET assembled in a reconfigurable flip-flop, called 10TFF, which is used as a LEGO brick for the whole system.

Only these identical modules are needed to build all the counters, and some more transistors perform some glue logic (non-power-of-two counters, reset, alarm...).

8×10TFF modules are assembled as a HMS board that can be soldered to count 60 or 24 pulses. Three such boards are chained to count the Seconds, Minutes and Hours. One HMS board fits the standard 100mm×100mm unit of PCB manufacturers.

You can drive the seconds' HMS board with a 1pps signal (with sufficient duty cycle) but this project goes beyond that. Another special clock board contains a quartz crystal oscillator, that resonates at 18000Hz, and a ÷5 predivider. The 3600Hz is then fed to a cascade of two HMS boards to lower the frequency to 3600/(60×60)=1Hz. (That's @K.C. Lee's idea btw, which uses more transistors but might be conceptually more educational)

The whole system should look like this when the faceplate is removed:

More informations are tucked after the logs.


Logs:
1. MOSFET idiosynchrasies
2. Another inefficient design
3. Enhanced FlipFlop
4. Inventory
5. Cascaded Johnson Counters
6. Crystal oscillator with complementary MOSFETs
7. Power supply voltage
8. To MUX or not to MUX
9. BCD to 7-segments decoder
10. How to divide by two
11. A generalised minimal D-FlipFlop
12. Inventory n°2
13. Midnight reset
14. Another display option
15. Testing the Flip-Flop
16. TODO
17. Integrated 32KHz clock source
18. A faster Generalised Flip-Flop
19. Even better 10TFF
20. The first 10TFF module
21. Debouncing The Smart Way
22. Slow oscillations
23. Oscillators' basics
24. Debouncing in reality
25. Oscillator calibration
26. Dynamic MOS logic
27. Got Quartz ?
28. First 10TFF module
29. Change of architecture
30. Another MOSFET oscillator
31. Yet another MOSFET oscillator
32. The first PCB arrived today !
33. Testing a module
34. It was too easy...
35. My first discrete 5-stages Johnson counter
36. Divide by 15
37. New 10TFF layout
38. The HMS board
39. The KCL structure
40. Testing the KCL structure
41. Crystal oscillator with MOSFETs and LEDs
42. Crystal oscillator with MOSFETs (new episode)
43. Impendance matching for crystal oscillators
44. Success ! a minimalist, single-MOSFET quartz oscillator !
45. Power supply for the quartz oscillator
46. Prescaler mod 5
47. Complete 18KHz source
48. 10TFF module v2
49. 10TFF-v2 received !
50. More minimodules
51. Small...

Read more »

  • 360 × 2N7002 (N-MOSFET) Discrete Semiconductors / Transistors, MOSFETs, FETs, IGBTs
  • 164 × BSS84 (P-MOSFET) Discrete Semiconductors / Diode-Transistor Modules
  • 90 × 10K resistors (1/4W or less)
  • 41 × Red LED (3mm diameter)
  • 41 × Germanium (1N60) or Schottky (BAT) diodes Discrete Semiconductors / Diodes and Rectifiers

View all 7 components

  • Teardown of a real watch

    Yann Guidon / YGDES06/07/2018 at 23:28 0 comments
  • Small signal, high impedance amplifier

    Yann Guidon / YGDES01/08/2017 at 09:54 17 comments

    One roadblock in this project is the oscillator circuit.

    The oscillator oscillates rather well (if you accept the long power-up time) but the log Complete 18KHz source shows that there are some problems with the amplifier.

    The single-MOSFET oscillator is very very sensitive to outside influences. The 10x probe doesn't affect it too much with the low capacitance and the 10M impendance but the gate of a MOSFET is something else, particularly the BS170 with 20 to 40pF that is coupled to whatever is in the circuit. So far the whole module doesn't work.

    In the previous related log, I suggested a differential pair, which is a very interesting topology that I also study for #Germanium ECL and other BJT-based projects. I have found a very interesting description at https://en.wikibooks.org/wiki/Circuit_Idea/Revealing_the_Truth_about_ECL_Circuits that brings some more ideas to the table.

    An interesting circuit:

    MOSFET voltage followers

    Figure 13A - 'Ideal' Voltage Follower Using MOSFETs

    (courtesy of Elliott Sound Products)

    but the feedback transistor should be a N or P-FET instead of PNP. I'm not sure how I will manage that.


    Another chance find (it took a few days to realise) is inpired by the "tetrode" MOSFETs, such as the BS1012 (that's another story for later). While searching for informations about them, I found this page : http://www.radio-electronics.com/info/data/semicond/fet-field-effect-transistor/dual-gate-mosfet.php

    Dual Gate MOSFET

    "In effect, the dual gate MOSFET operation can be considered the same as two MOSFET devices in series. Both gates affect the overall MOSFET operation and hence the output."

    I see this as a single-die AND gate but there is more to this part !

    "The cascade amplifier helps overcome the Miller effect where capacitance is present between the input and output stages. Although the Miller effect can relate to any impedance between the input and output, normally the most critical is capacitance. This capacitance can lead to an increase in the level of input capacitance experienced and in high frequency (e.g. VHF & UHF) amplifiers it can also lead to instability.

    The effect is overcome by using a cascade amplifier using a single dual gate FET. In this configuration, biasing the drain-side gate at constant potential reduces the gain loss caused by Miller effect. The effects of capacitive coupling between the input and output are virtually eliminated."

    Reduced Miller effect ? That's interesting ! But what about coupling with other nodes ?

    dual gate cascade amplifier

    "Effectively a cascade amplifier is a two-stage amplifier formed from a trans-conductance amplifier which is followed by a current buffer. This provides a high level of input-output isolation, high input impedance, high output impedance, higher gain or higher bandwidth when compared to a single stage amplifier. "

    Now this is interesting and gives a clue about how to design an equivalent circuit !

    Another explanation at http://electronics.stackexchange.com/questions/69300/how-does-a-dual-gate-mosfet-reduce-miller-effect provides this diagram:

    The voltages and resistor values must be changed and experimentally tested...


    There is one interesting conclusion to draw for the "high impedance amplifier" case : there are at least 2 transitors

    • in series (for the trans-conductance case shown above)
    • in parallel (for the differential pair)

    That's two topologies that I have to test and compare !


  • More minimodules

    Yann Guidon / YGDES12/15/2016 at 18:51 0 comments

    Hopefully, I'll have a first system in June 2017. I hope to build it with the kids of CercleJ, where I teach electronics to teens.

    The subject of this log is : let's also design square-inch sized modules that perform boolean logic, like "discrete gates", but instead of just soldering a LS/HC chip, I simply put BS170/BS250. I imagine the following gates :

    • (N)AND
    • (N)OR
    • X(N)OR
    • debounce
    • (any idea ?)

    This would let the kids play with logic circuits they have built themselves, instead of using a "ready made black box". We could play with the counters and all their configurations, for example.

    Note that all the circuits provide both positive and negative levels, both for "practical" reasons and for directly driving the 10TFF modules.

  • 10TFF-v2 received !

    Yann Guidon / YGDES08/03/2016 at 18:01 4 comments

    Once again I got a great result with the batch I submitted to DirtyPCB. This time I chose a larger PCB (100×100mm) to test my idea of a universal module. I could fit 8 10TFF modules in one half of the PCB surface.

    Now I have to solder a few and test them :-)


    update 20160804:

    It appears that the distance between the pads of the axial capacitor is too short. I modify the component in Eagle to widen the gap and reduce the force on the pins.

    The other weird thing is that both types of transistors have a reversed pinout. The BS170s are non-conform and this time, I try the 2N7000 with its reversed pinout. It becomes too complex to plug all the parts in reverse so for this test, I soldered the parts on the other side of the PCB. The outlines still match the parts but on the other side...

    Another little change is the resistors values : this time I try with 120K, which should reduce power consumption AND operating frequency, for the slower parts of the clock.

    Here is a pretty "usual" module :

    This one is a bit special because the 1N60 diode is connected to the other resistor and resets the latch to the opposite value:

    Only one is required in the whole system but it's good to test it. Indeed, I should start to implement and test the mod3, mod5 and mod6 counters...

  • 10TFF module v2

    Yann Guidon / YGDES07/08/2016 at 07:55 0 comments

    I just submitted a new PCB job for the 2nd version of the 10TFF module.

    I found a short in the precedent version, fortunately I could submit a correction :-)

    I also found a solution to the reset problem. The 24H board has a 3-stages 1-hot shift register instead of a 6-stages Johnson counter. There are 2 differences: the outputs are swapped for the Johnson counter and the 1-hot has one 10TFF reset to state 1. Swapping is determined by jumpers on the HMS boards but reset to 1 has been a bit tricky. The solution is simple in the end: one 10TFF module has specific wiring of the diode, which is connected to the complementary signal. The module is already too crowded to allow the modification but it's easy to rewire just one of the modules with a short wire.

    The swapping of the 3-stages shift register will be selected with solder pads.

  • Complete 18KHz source

    Yann Guidon / YGDES05/29/2016 at 22:39 0 comments

    The complete 18KHz clock source is there :

    Now I must

    • Build the prototype
    • validate all the parts' values (easy)
    • verify the frequency and tune oscillator to the best possible precision (but my Rb source fried and my DDS is far from alive :-( )
    • place & route the PCB
    • find a temperature controlled oven/freezer to plot the stability

    Update (20160531): With the given resistor values and the REF3225, the oscillator starts within 30s, before fine-tuning !

    However the output swing of the oscillator is too low (0.5V-1.5V) to properly trigger the first amplification stage. This is solved with a P-channel MOSFET instead of a N-channel :-)


    Update (20160629) : the P-MOSFET works much better than the N-MOSFET but... new problems appear. I get really weird waveforms and interactions with the oscillator, some unexpected nasty (capacitive) coupling must be at work.

    The ideal solution would be a JFET but this is "not kosher" for this project, I have to manage amplification with a very high input impendance and low input capacitance.

    In the #Active scope probe with no dedicated power supply project, I evaluate differential amplifiers but they use JFET at the input and probably draw more than the 37µA of the primary oscillator.

    How can I shield the primary osc. from the gate capacitance of the amplifier ? @K.C. Lee suggested in a previous log (https://hackaday.io/project/9376-yet-another-discrete-clock/log/32117-crystal-oscillator-with-complementary-mosfets) to add a 100K series resistor.

    The bias is another issue : what is best for the oscillator is not best for the amplifying stage. A capacitive coupler is required, driving a self-biased NOT gate (P & N-MOSFET). Additional resistors at both sources might further shield from capacitances... The first stage will end up with 4 resistors, 2 FET and 1 capacitor. The coupling capacitor must be around 1nF, which gives a RC time of about 100µs, or 10KHz.

    The NOT gate could be preceded by a common-drain amplifier (?) or one of the circuits described in this "booster" article.

    Sorry, no drawing yet because (oh well, don't get me started)

  • Prescaler mod 5

    Yann Guidon / YGDES05/28/2016 at 08:40 2 comments

    The "KCL structure" (covered there) is such a nice, regular circuit but it requires a mod 5 prescaler to convert the 18KHz source to 3600Hz. I have tried to make such prescaler but I was not satisfied.

    5 is such an "inbetween" number, just after 4 (which requires 2 FlipFlops) and 6 (which requires 3 FF but is very easy to do with a Johnson counter). The previous approach with a reset adds nagging timing issues. So I went back to the sketchbook and made a few diagrams. I ended up with the following circuit with 3 10TFF and one NOR gate (with complementary output).

    This is not an absolutely minimal circuit, when counting transistors, but it's simple and totally synchronous, which reduces problems and debugging at high speed. No reset is needed, which also simplifies the design, and it gracefully recovers from errors.

    This is actually a "modified Johnson counter", I started with a mod 6 counter and removed one state.

    1 2 3
    0 0 0 #0
    1 0 0 #1 
    1 1 0 #2
    1 1 1 #3 => removed
    0 1 1 #4
    0 0 1 #5

    The new succession of states becomes:

    1 2 3
    0 0 0 #0
    1 0 0 #1 
    1 1 0 #2
    0 1 1 #3
    0 0 1 #4
    Now notice that the state 1 is added in FF1 only when FF2 and FF3 are 0. Yes, it's a NOR gate !

    Drawing the complete state machine gives the following diagram:

    The absence of forbidden state (as in a LFSR) or subcycles of lower size makes a RESET input useless.

    Implementing a NOR gate requires 2 P-FET and 2 N-FET, the inverter adds another complementary pair so the "cost" is 6 transistors. It's not the absolute best solution but I think it's so elegant that I adopted it :-)

  • Power supply for the quartz oscillator

    Yann Guidon / YGDES05/27/2016 at 01:54 0 comments

    The new oscillator works well but it is quite sensitive to the power supply's voltage. A change of 0.1V requires the trimmers to be re-tuned.

    A very good voltage regulator is necessary to preserve the frequency accuracy. This is the only exception to the "no IC" rule I've set myself.


    Initially I have chosen 2.5V because there is 0.5V of margin from the 3V input supply and it's easy to obtain with the LM4041-ADJ shunt regulator (a pair of resistors of identical values increase the 1.25V output to 2.5V). The goal is to have a stable, temperature-independent voltage for the oscillator to reduce long-term drift. But it's not so easy in practice.

    The LM4041 needs 60µA and draws more from the shunt operation. This is getting ridiculous because the oscillator draws less than 40µA. Overall, the power consumption is more than doubled!


    One solution is to use a voltage regulator in SOT23, for example, though these chips are designed to handle more current, while absolute voltage accuracy is a second thought. I should instead use a micropower 2.5V voltage reference !

    Digging in my old collection of samples (they were gathered to experiment with voltmeter accuracy) I find the following parts:

    I also have a MAX6126 but it's a 4.096V version and that chip draws about 380µA.

    Speaking of current, the 3 first references are rated around 100µA, which is more than the LM4041 alone, but without the hassles of calculating the series resistor of the LM4041, which risks drawing even more current when badly chosen, so this is equivalent. There is no risk of losing regulation, if the input voltage drops dangerously low, and the current draw is almost constant.

    The MAX6002 has a 100ppm/°C tempco, which is too much, despite the lowest current needs (45µA). I only have 2 samples so I can't go far and it's ruled out. Same for the bigger brother MAX6102 (only 1 sample left) with a bit more stability but more current as well (90-120µA)

    The MCP1525 draws about 100µA (90µA typ. according to the datasheet, around 80µA@3V@25°C). The tempco is better (27ppm typ. at full temperature range) and I got 5 samples, I can go further than with Maxim.

    The REF3125 has more samples left (7) and has better drift performance (15 ppm/°C max, 5ppm typ at ambient temperature). Noise characteristics are important too : 48 μV RMS from f = 10 Hz to 10 kHz but we'll talk about it later. Quiescent current is announced around 100µA (typ.@25°C). Sounds good.

    Now the more recent REF3225 has 10 samples left, maybe because in the past I might have been afraid of the SOT23-6 package. It's still drawing around 100µA but the drift is typically 4ppm/°C. This is stable ! It seems that this is the winner.

    If you have better suggestions, please contact me and/or send me samples!


    Noise is another thing. Voltage references are noisy. I learned it the hard way, for an audio project, but here, I'm not doing a VHF, ultra-low-jitter oscillator. As long as the frequency is stable over the long term, I'm fine.

    So, filter or no filter ? The power supply/input must be filtered with a LC cell to prevent switching noise from disturbing the clock. The output however is something else. I am tempted to over-filter it but this might not be the most efficient approach. The noise might actually help the oscillator to startup faster and the reference might react to the changes in load, which could actually help.

    Looking at Fig.17 and Fig.18 of the REF3225's datasheet, I'm tempted to add a small capacitive load to make a long enough "bump" that helps with the startup.

    On the contrary, without capacitor, the change in load will make a very short spike that will not bring some rebound to the quartz.

    I'm thinking about this because the goal is to startup faster, if needed with the help of an external device or button. I still have to experiment...

    Read more »

  • Success ! a minimalist, single-MOSFET quartz oscillator !

    Yann Guidon / YGDES05/26/2016 at 21:10 4 comments

    My quest is finally over !

    I didn't believe it when I wrote Impendance matching for crystal oscillators but I had to try it and it worked !

    This circuit fits all my requirements:

    • works at low voltage, below 3V, so I can use a micropower voltage regulator
    • low power (I just measured it : 37µA only, less than 100µW !)
    • minimal parts count : beside the crystal resonator, only a MOSFET and a couple of adjustable resistors (to be changed when voltage is modified)

    Yes, only 3 additional parts (not counting the decoupling capacitor), my precedent theory seems to work !

    The downsides are a) slow/lazy startup and b) 3rd harmonics but they are not critical flaws.

    (trace: 1V/div)

    The resistors need some tuning to adjust the waveform amplitude and offset but nothing too hard thanks to a simple 'scope. I don't see how to reduce the 3rd harmonics but I don't care much now.

    I wish I knew a better way to start the oscillation than tapping it.

    TODO:

    • Test with 2N7000
    • Tune to exactly 18000.00Hz
    • Design a proper output stage/buffer
    • Something something
    • Profit ?

  • Impendance matching for crystal oscillators

    Yann Guidon / YGDES05/26/2016 at 01:35 7 comments

    I think I understand better now.

    Many of my failed attempts are due to another condition that I didn't check, and which comes from one fundamental difference between MOSFET and BJT : there is no current going through the gate.

    There are two "working" BJT circuits that use a pair of transistors and one in particular works great, even with "lazy" PNP such as the OC70: the "capacitor-coupled amplifier":

    In It just works I reported that the circuit works very well but in Another MOSFET oscillator I saw that it's not possible to translate it directly to MOSFET.

    I now see what was wrong with my attempts : the BJT oscillator lets signal/current flow through the crystal, thanks to the current path from base to emitter. When I use MOSFETs, something is missing, the "driver" transistor "shakes" on pin of the crystal but the other pin is floating and can't let the equivalent LC network oscillate. No energy is input because the other pin is floating and no energy goes out.

    More important : the equivalent resistance, the impedance, is critical to allow the oscillations. All the crystal oscillators I've tried start to oscillate, or oscillate better, when one of the resistances is at a very particular value. It's the impendance matching part of the equation.

    In the classic Pierce oscillator with inverter, the impendance is set with a series resistor and the two "parallel" capacitors. The last capacitor (connected to the inverter's input) is the critical one, which connects the signal to the ground so the crystal doesn't dangle in the void. My error becomes pretty apparent in the log Crystal oscillator with complementary MOSFETs where the capacitor is missing, the crystal pin is virtually dangling with no return path for the current !


    So now, one design parameter or constraint is : the resonating element is not only the crystal, but also a resistor in series with the crystal.

    • One of the parts is connected to a stable voltage, such as ground (ideally) or Vcc.
    • The other end is connected to the "driver" transistor's output
    • The middle point is where the "sense" gets the signal.

    Let's add that the circuit must work under 3V and use a minimal number of parts, the new trick is to integrate the series resistor in the biasing network of the transistors. Naturally this leads to funky circuits with common gate or common drain configurations.

    However common drain configurations have a voltage gain less than one. I somehow came up with this strange common-gate configuration:

    (erratum: the crystal is wired in reverse... Sleep or hack, but don't do both)

    (yes, I understand now that this can't work as is but it's a start)

    According to some sources, the common gate configuration is a non-inverting voltage amplifier. The input comes from the source, where the Z resistor (impendance matching) is tied to the ground. X1 is also connected to the drain, which is the output node.

    I'm not sure at all that it will work but it could... and if it doesn't, I can still try with cross-coupled pairs. Actually, Z also gets current when the MOSFET is conducting, which increases the input and "degenerates" the output. The driving strength would be lower than the typical common source, which also amplifies the current.

    Since there is only one transistor (not a complementary pair), the working voltage would be in the 2-3V ballpark, depending on the resistor values.


    OMG OMG OMG IT WORKS

View all 52 project logs

Enjoy this project?

Share

Discussions

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates