Eletronics course slides

Hey everybody! In the last two weeks I gave two sessions of an electronics course organized by HackerSchool at the Alameda campus of the Instituto Superior Técnico. The slides were written in portuguese, but I decided to post them here anyway.

[scribd id=176813115 key=key-1r0mfadyaehf061xy3v4 mode=scroll]

[scribd id=176813926 key=key-1r0mfadyaehf061xy3v4 mode=scroll]

CMOS Frequency Counter – 7400 Contest Entry

I’ve wanted to create a frequency counter using logic chips for some time, but I never really got the chance to do it, mainly because nowadays there are micro-controllers that one can use in replacement of all these old chips. I heard of the 7400 Contest only 2 weeks ago and thought that it was the perfect excuse for me do build this machine!

The project consists of a frequency counter that uses only old-school CMOS chips: 4511 display drivers, 4029 decade counters a 4521 24-stage frequency divider and a 4011 chip with 4 NAND gates. The frequency counter counts from 1 Hz to 1 MHz (999.999 KHz)

CMOS Frequency Counter

CMOS Frequency Counter


This circuit can be understood by thinking about two separate blocks: the counting block, and the control block. The counting block consists of 6 4029 counters and 4511 display drivers. The terminal count pin of each counter is the clock input of the next counter. Each counter counts to 10 and as there are 6 counters, we can get a maxim count of  1.000.000 Hz, or 1 MHz. The control block takes care of the signals to control the chips in the counting block. Frequency is by definition “cycles per second”. In order to count a frequency, we must count during one second, latch the count to the displays and reset the counter to start counting again. The 4521 chip is dividing a frequency of 4.194304 MHz in order to get a frequency of 0.5 Hz (with a 50% duty cycle). During the first second the clock is HIGH and the counters are counting. As soon as the clock goes down, the RC circuit used together with the 4011 with the NAND gates triggers a quick signal that will latch the displays, and after that happened it triggers another very quick signal do reset the counters (as 4029 chips don’t have a master reset pin, I’m using a parallel load of 0 as an asynchronous reset). In the next second, the counters start counting again. I’d like to thank timescope for helping me out with this solution in the controlling signals.

This circuit was designed to be flexible, so the signal input is directly connected to the clock input pin of the first counter. This allows this circuit to be extended. If you want it to count frequencies of non-CMOS logic level signals, you can use external circuitry to convert the levels. You also can (or should) use a small transistor so that the input signal current is not drawn from the signal itself. If you want to turn this counter into a 1 KHz – 1 GHz counter, you can design a prescaler to divide the frequency by 1000 and then feed the output to the input of this circuit.

CMOS Frequency Counter Schematics

CMOS Frequency Counter Schematics



  • In the schematics, where it says “Carry in”, it’s actually “Count Enable”. This is a bug from gschem!
  • If you want to build this circuit in a breadboard, be careful with the 4521 part of the circuit. In order to start the oscillator, the 2 capacitors must have different capacitance. Now, the breadboard as a lot of capacitance (and even inductance) between its tracks – this is why breadboards are awful in high-frequency applications. So you need to try different solution in order to get the circuit to oscillate. Sometimes it will oscillate in a breadboard even without any capacitor!
  • Even if it’s not featured in the schematic diagram, you should add a weak pull-down resistor in the external singal input that you want to measure in order to keep a logic LOW even when there is nothing connected. If you don’t do this, the screens will show random values because the clock pin of the first counter is floating. I used a 1 MegaOhm resistor.
  • Do not forget to add a 100nF capacitor between the supply pin of every chip and ground. This is very important to mantain stability (and not only in this circuit, but in every circuit you may build that uses these “logi” chips).
  • The resistors used in the displays are all 330R resistors. There are people who insist to use only a common resistor per display – this works, but will significantly reduce the life of the display, and may overheat the board because sometimes there will pass more current through one of the LED’s (for example, there will be more current passing through the lit LEDs when a display shows the number 1 then when it shows the number 8. In order to have a good design, you need to use a resistor for each segment, or a total of 42 resistors.
  • Even though CMOS chips are a bit more flexible with the supplied voltage than the older TTL ones, this circuit was created to work with a stable 5V supply, sou you can use a 7805 voltage regulator in order to create the right voltage output.
  • All the tones in the video used to test my frequency counter were generated by the Arduino’s tone() function.