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

 

Notes:

  • 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.

I hope you like it! If you have any questions, be sure to contact me or leave a comment! 🙂

 

More photos:

Frequency counter

Frequency counter


Frequency Counter

Frequency Counter

MPSokoban for Android

MPSokoban for Android is a version of the classic 2D puzzle game, sokoban, that you can now play in your mobile phone and take it everywhere with you. It’s great fun! It features 25 levels and new content will be added soon! In Sokoban you need to move boxes from one place to another, but be careful to where you move them, because if you do it wrong, you may never complete the level again.


Android app on Google Play

 

Game of Life

The Game of Life is a cellular automata created by the english mathematician John Conway. This program here is my own multi-platform implementation of this automata. It is pretty fast, has multiple modes and comes with predefined forms (right click the “universe” area). To learn how the Game of Life works check out the Wikipedia Article.

Download for Windows (8, 7, Vista)


Download for All Windows | Download for Mac and Linux

 

GameOfLife

Game Of Life

MPSokoban Released

MPSokoban is my version of the classic 2D game, Sokoban. It features 25 levels. In Sokoban you need to move boxes from one place to another, but be careful to where you move them, because if you do it wrong, you may never complete the level again. The MPSokoban package also comes with MPSokoban Map Editor, which is a level editor that allows you to create your own levels to play and/or share with your friends.

DOWNLOAD

 

MPSokoban

MPSokoban

MPSokoban Map Editor

MPSokoban Map Editor

MPMath 1.2 Released

In its current shape, MPMath is a very small math expressions parser. It helps you to parse complex expressions and supports all the basic math operators and math functions. It may be used to replace those advanced physical calculators that are mostly used in education and in the learning of math. MPMath is free software, you can download it and run it as many times as you want. You are also able to share it for free in the condition of not modifying its original package and keep the credits.

MPMath 1.2 Screenshot

MPMath 1.2 Screenshot

DOWNLOAD

 

MPChip-8 Emulator 1.0 Released

MPChip-8 Emulator

MPChip-8 Emulator

I just released the first version of my first emulator, the MPChip-8 Emulator. It emulates Chip-8, a platform developed in the mid-1970s that allowed developers to easily program video games in a computer at those days. Chip-8 is like the Java or the Flash of the 1970s. The MPChip-8 Emulator allows you to run programs or games develop to Chip-8.

Features:

  • Emulates most of Chip-8 Games;
  • Comes with 28 games/programs;
  • Lots of customization;
  • Disassembler included.

Note: The Games that come in the MPChip-8 Emulator package are in public domain and were not created by me unless when I say otherwise.


DOWNLOAD

Video:

Bellow you can watch a MPChip-8 Demonstration video that will show you its basic features, as well as some games being emulated.

MPObfuscator PHP 1.0 (Beta) Released

MPObfuscator PHP 1.0 (Beta)

I just released the first version of MPObfuscator PHP, a multi-platform tool that allows you to protect your PHP scripts so nobody can reverse engineer them easily. You can use this software when you want to share your PHP script in the Internet (paid or free) and want to protect your code so nobody can modify it and distribute it with their names. You can also use it to protect your code even if you won’t share it and will only host it in your server, to make sure that if someone gets your code, won’t be able to modified easily. No obfuscating tool is 100% efficient but MPObfuscator does it’s best to protect your code.

1.0 Beta Features:

  • Automatic Comment Removing;
  • String Protection;
  • Variable Names Removing;
  • Code Encoding;
  • Multi-file protecting;
  • No need to install software in the server;
  • Multi-Language: English, Portuguese and French;
  • Multi-Platform.

MPObfuscator PHP is available on Microsoft Windows 7, Vista and XP and also on Linux and Mac OS X. To run it on Linux and Mac OS X you must have Mono Framework Installed.

DOWNLOAD

Sample
Normal Code:

";

$n = 0;

while ($n != 101)
{
	echo "
n equals to " . $n; $n++; } echo "

Done."; ?>

Obfuscated Code:


Artificial Intelligence Bot Demonstration

I’ve created a software that by checking screen colors is able to play a game for itself without needing any user’s input. I’ve randomly choose a flash game on the Internet to use as a demonstration (so it was NOT made by me). Please note that this video is NOT related with cheating in anyway. It is only a demonstration video and neither the source code nor the software itself will be released.

This concept has a wide range of applications like in robots. The software detects targets and shoot them. Some delays that are seen in the video are mainly due to the fact that video recording makes the machine slow. I would like to thank ToGGi for the introduction special effects as they are very good. You can click here to go directly to the Youtube page where the video is hosted.