hi all, just wanna to ask about ttl design a little bit. i has made one with my own mcu but still have problem that still not answered yet. i need to produce 1 clock output for 2 clock input, i.e. in real application, it asking 2 coin arcade game and 1 credit to play. anyone know how to design it quickly with ttl chip? something like shift register maybe, shame on me, i'm not too good in ttl design, i mean i need to refer to ttl book each time asked by someone.

thanks for your time, it's appreciated ;)
Posted on 2003-02-21 09:05:27 by dion
Can't you use an adder, and a 1 bit register?

The adder feeds itself, along with a pulsed signal (to signify the entry of a coin), and the carry output will then be raised for a clock when there have been two entries.

Posted on 2003-02-21 09:15:00 by Mirno
thanks Mirno, i really got tired working more than 12 hours to this late night :(
Posted on 2003-02-21 09:21:18 by dion
Shift Register?
I dont even know what prosessor used by Arcade Machine.
Posted on 2003-02-21 09:27:22 by realvampire
A simple flip flop will do a divide by two. Either a D type with D connected to not Q, and the coin signal to the clock, or a JK type with J and K both tied to VCC.

The main problem with such an approach is its so fixed. If you ever want it to take three quarters your bleeped, you need a board rev.

Thats why micro controllers are the best and simplest for any application. Well worth learning about.
Posted on 2003-02-21 21:44:05 by Ernie
thanks Ernie, yes, i'm using mcu. its fix right now. but i had problem, Ernie.

do you know how to drive a 4.5V relay from ttl level output? i had tried once at mcu output with buffer 7407, but it dont work, so i add a pull-up resistor. it work then . but when i put 7805 as regulator in input supply, then powered all my circuitry, it doesnt work. do you know another easy way to drive it?

realvampire: i'm facing with most of z80 and 68k mpu ;)
Posted on 2003-02-22 07:28:00 by dion
This should work. The reason your other circuit did not work might be because it couldn't supply enough current. I forgot to include a limiting resistor in the relay path, on the collector side. You can calculate its size if you know how much current the relay needs (R = 4.5V/I). R1 is used to protect your ttl output (actually bias the base of the transistor). It can be 470 ohms. You could experiment with either one to determine the best size.
Posted on 2003-02-22 09:06:50 by drhowarddrfine
hi Dr, thanks, maybe it would be like this :
Posted on 2003-02-22 23:55:47 by dion
Driving a relay prompts a bunch of questions since you have a new design.

First off, you say you have a 4.5V relay. I'll assume it will be happy off the same 5.0 VDC VCC running your TTL. But the lower the voltage a relay needs, the higher the current it needs. Its a power thing, you need the same power to move the contactors, so less voltage means more power.

What I'm driving at is if you have a higher voltage available, use that. One good place to find this in an simple AC powerd unit is right at the filter cap (assuming a non-switching power supply, just a step-down xfmer rectfier diodes, filter cap, and linear regulator). The ripple on the cap wouldn't affect the relay operation, and you might get a higher drive voltage.

If you stick to a transistor driver such as drhowarddrfinedrhoward suggested you need not worry. (BTW, I'm using a neet transistor from Panasonic right now that has the base resistor built in to it, and its in a sub SOT-3 sized SMD package to boot. I can get the P/N Monday if you wish). However, when I have a lot of relays to drive, I like an IC to drive them (less wiring for me).

So I'll use a 7407 high voltage open collector output hex inverter. You would use it by tying an output to your relay, and the other end of the relay to your positive supply (and since its a hex inverter, you can drive 6 relays with one IC). High here means 30 volts. It can sink up to 16 mA, which is less then the 5V version of the style of relays I use, but acceptable for the 12 V ones.

One thing oft overlooked at first is a relay is an inductive element. Inductors don't like fast changes of current. In any of these suggested drivers you'll need whats called a 'catch diode.' Take drhowarddrfinedrhoward's circuit. When you first turn the driver on, it will work. But the very first time you turn it off, the inductance of the coil will generate a huge positive transient voltage. Real voltage that adds to the circuit VCC and is seen by the transistor's collector. One such pulse is all it usually takes to turn the transistor into toast.

So you ALWAYS put a diode around the relay to 'catch' this transient. It goes in parallel to the relay 'pointing' to VCC so its normally reeverse biased). Just about any diode will work, 1 1N4148 would be OK for a small relay, maybe a 1N4001 for a heavier one.

One good thing is relay manufacturers also know this, and many will put this diode right inside your relay for you. (I always buy em this way which is why I forgot to tell you this before I edited this post.).

Hope I didn't confuse the issue here, but this is the type of stuff I do for a living, so I've been there done that in lots of ways, just trying to make suggestions so you can pick the optimal way for you. Good luck.
Posted on 2003-02-22 23:58:21 by Ernie

So I'll use a 7407 high voltage open collector output hex inverter. You would use it by tying an output to your relay, and the other end of the relay to your positive supply (and since its a hex inverter, you can drive 6 relays with one IC). High here means 30 volts. It can sink up to 16 mA, which is less then the 5V version of the style of relays I use, but acceptable for the 12 V ones.

yes, i'm using that Ernie. i'm using 7407 to drive the relay but it didnt work. about the relay, i felt wierd too, it is written in the body 4.5V. actually i had made it work with a pull up about 100 ohm, but then when i add a regulator 7805 it didnt work anymore :(
Posted on 2003-02-23 00:09:18 by dion

Ditch the 100 ohm pull up. Wire the relay direct from the output to the +5 V VCC, no series or parallel resistor. DO put the diode there if the relay doesn't have one.

If the relay does have the diode, its gonna need the polarity observed. One way it works, the other way the diode shorts the relay out.

Relays have two voltage ratings to work, the pull in voltage, how much it needs to energize the coil and change the contactor, and the drop out voltage, how low you can go to have the coil just let go of the contactor. Obviously, the pull in voltage is greater then drop out.

Does your relay have a part number on it? You should go look up its data sheet. (Post the number here so I can see it too). If digi-key sells it, they have links to all the manufacturers data sheets they can.

Posted on 2003-02-23 12:12:21 by Ernie
sorry Ernie, late reply, but it is fixed right now, like what you said ;) thanks a lot :grin:
Posted on 2003-02-25 04:28:07 by dion
Posted on 2003-02-25 18:20:22 by Ernie
hi Ernie, i consider to build one like what you said before with d flip-flop, to make 2 pulse become one pulse. but i'm worried about it, that later it cant drive relay in such a very short pulse time. or do i'm wrong thinking like that? i dont remember, but somehow i read somewhere that relay cant be moved/on in such short delay, i.e. in miliseconds. if it is true then, how would you overcome this problem, Ernie?

Posted on 2003-03-01 09:36:42 by dion
hi all , just wanna to made it and facing a problem. i'd design the fixed 2 clock to 1 clock with cmos chip. it needs 2 chip, they're d flip-flop and nand gate. i first tried with divide by two by d flip-flop like suggested by Ernie before. i wired it to the coin switch and seeing that the switch was bouncing. i attach the picture below. i use pic a in beginning, but i look at how arcade board handle coin input etc by using pic b. so i wired pic b and test it, and guess what... i still bouncing, i know by seeing Q output from flip-flop. it supposed to be high after one clock and low after next clock. what happened is it sometimes 1/2 or maybe more clock goes in the clk pin of the flip-flop. actually when i make it with mcu, i had same problem like this, but i trick it with delay time so it work . but because that time is in hurry, so i can do nothing about it. realized that i'll have to face it and found the cause, now i know that it really bouncing. so the debouncing circuit in pic a and b are somewhat so useless :(

i had tried to seek debouncer in digital books, and found one with 2 nand gates form a r-s like flip-flop, with s and r tied up to the two of the switch leave, and the common is grounded. what i dont like with this circuit is, i need 1 more 4011 chip and it need three wire from the switch. i want just two wire from switch, cause if arcade board and anyone else could do it with two wire, why cant i? poor me that i dont know again what to do with this conventional debouncer ciucuit :( anyone know the other circuit or do i'm doing something wrong in the circuit?

thanks a lot
Posted on 2003-03-19 08:51:53 by dion
Here's an article that explains switch debouncing.


The only significant difference from what you've shown is the addition of a gate with hysteresis input. Gates with Schmitt trigger inputs have this property.

Fundamentally, you need the RC circuit to eliminate the noise (bounce) generated by the switch. And you need the hysteresis to ensure your digital signal has "square" edges.
Posted on 2003-03-19 17:52:39 by tenkey
Switches bounce. Take that as a given.

(We all discover this one day. I had that day myself.)

The problem with RC filters is you need to know how long the switch will bounce. The problem is, you can measure the bounce of a switch TODAY, but can you really sleep nights content its still gonna have the same bounce next week? In a year? Five years from now?

Especially the coin counter. Imagine dropping in one coin and playing free for the rest of the day. Disasterous!

However.... 50 to 100 millisecs seems to be the max. Someone (Maxim?) makes a switch debounce IC. Debounces multiple switches, one in, one out per switch. Uses delay lines clocked off an internal RC oscillator.

Here is my favorite debouncer. Its based on the principle that a switch will never bounce to the OTHER state. If you take apart a real switch, you'll see why this HAS to be true. The main drawback is you need a double throw switch to make it work.

Each position of the switch is used to set/reset a NAND gate flip flop, so for 4 resistors and one IC you get two debouncers.
Posted on 2003-03-19 22:04:54 by Ernie
thanks tenkey and Ernie ;)
you guys right! because of this things, i somewhat became paranoia to bouncing effect, such pretty annoying feature, eh :grin: :grin:

Ernie: well, that's what i mean with two nand gates act as r-s flip-flop, Ernie. and you're right, that need 3 cable connected to the sw. and i felt it was really burdensome somehow, because i need to make it clear which one is common and which one is connected to s and r.

tenkey: i promise to read it very carefully :grin:
Posted on 2003-03-20 06:02:20 by dion

The only significant difference from what you've shown is the addition of a gate with hysteresis input. Gates with Schmitt trigger inputs have this property.

btw, tenkey, or somebody else, is it must be a 7414, a schmitt inverter? can i use normal gate instead?
Posted on 2003-05-08 05:58:11 by dion
Hi, dion,

I have a few circuits for you. For debouncing, it's best to use some D-type flipflops clocked at 50Hz ~ 200Hz. A clock like that will give you enough debouncing time and it's easy to produce, even from the line frequency if you are careful. Also, this circuit uses simple switches, it does not need 3-pin ones. Of course, you can use either the Q or the /Q output, whichever suits you.
This now reminds me of another question of yours: in the R-S latches, you do not need Schmitt trigger gates.

As for your divide by-n counter, look at the second circuit, that uses a 74161 counter. You preset it with the value given by the switches. When it rolls over, you get a pulse that lasts for one period of your input clock.
To divide by a number between 2 and 16 (not 1, though!) you need to preset the switches to 16-n, where n is the number you want to divide by. For example, to divied by 2 you need to set the switches to 16-2=14=1110b. To divide by 5, you need 16-5=11=1011b, and so on.
Note that the first output pulse will occur after 1~16 pulses and then the circuit starts normal operation.
That is because we did not preset the counter with anything and we did not reset it. To do that, you need to force the /LOAD input low at startup.

My third circuit has a power on reset, as well as an additonal switch, which should be used for "Coin return", that is if the client inserts some coins but changes his mind before inserting all the required ones, he can press "Coin return" and your counter will start over.
This circuit will produce a pulse after the correct number of input pulses even the first time.
Note that on this circuit the output goes HIGH when the last coin has been inserted and only goes back LOW after another the next coin. If that is undesirable, you will have to use some circuit to give you a fixed -duration pulse, such as ( for example) a one-shot.
I would think that this should not be a concern, though.

And now my last point: note the relative complexity of the circuit. As Ernie says, a microcontroller would do this job easily, and possibly much more, such as having extra inputs for different coin denominations. A simple 8-pin uC, such as a PIC12C50x would do it.

Anyway, exercise did me good.
Good luck.

P.S. I don't know how to insert more than one picture, so I zipped them all up.
Posted on 2003-05-16 11:48:42 by VVV