Need help on a counter

Discussion in 'The Projects Forum' started by amaynew, Oct 23, 2007.

Jul 9, 2007
18
0
Guys, how do i use a comparator circuit in order for it to count 3 packages. My project is about a conveyor counting 3 packages before it automatically stops.

2. beenthere Retired Moderator

Apr 20, 2004
15,815
283
The comparitor will have to sense a change in a voltage level to be able to indicate the presence of a package. perhaps it might have a LDR (light dependant resistor) tied to an input. The packages would have a light source behind them, so blocking the light would make a voltage increase take place. That would make the comparitor change state and clock a counter.

3. techroomt Senior Member

May 19, 2004
198
1
or, an algebraic comparator can be comparing the number of boxes passed to the number three.

Jul 9, 2007
18
0
next question, how do i make an algebraic comparator. . .i do get an idea on the first post but the algebraic comparator gives me all the question marks. . can anyone help me how to design it. im really a noob at designing and still dont know how to fully incorporate the theories ive learned

5. beenthere Retired Moderator

Apr 20, 2004
15,815
283
If memory serves, look at the function of a 74XX86. It is a magnitude comparator, with >, <, and = outputs. The diagram on the spec sheet will show how this is managed.

6. techroomt Senior Member

May 19, 2004
198
1
the concept would be if two 3 digit binary values were to be compared, say numer a and b, the most significant bits of each would be compared first. if a had a 1 and b had a zero, it could stop there and say a is greater then b. if the msb's were equal, the next bits would be evaluated, and so on. until a greater then, less then, or equal to was determined.

7. RiJoRI Well-Known Member

Aug 15, 2007
536
26
My first idea was to feed the output of the comparator into a counter, and use a NAND gate to stop the conveyor. The conveyor stopping would reset the counter.

My next idea was to feed the output of the comparator into a small microcontroller in order to do the same thing. This would have the advantage of "reprogrammability," which is A Good Thing in The Real World. ("Oh, sorry, we now need the counter to stop after [two or seven, or whatever] boxes.")

(Another Real World problem is that if you have humans putting the boxes onto the conveyor, you will have boxes touching each other so the sensor will see one long box.)

--Rich

Jul 9, 2007
18
0
RIJORI, i think your first idea was the one i have to implement, my question again is, how do i necessarily do that?? LOL i really cant get the idea that much right now, can i make a circuit and you guys could check it?? id really appreciate it

9. GS3 Senior Member

Sep 21, 2007
408
35
As I also said in this thread dividing by any number is very straightforward and a divider can be built which can be set with (DIP) switches to divide by any number which can then be changed easily using the switches.

All you need is a straight binary counter with enough bits for the largest number you may wish to count or divide by and a NAND or AND gate with enough inputs for the bits you need to identify as set.

Suppose I want to count to (divide by) 13. I need a 4 bit binary counter and a 3 bit (N)AND gate. With the gate connected to bits 1, 4 and 8 it generates a pulse which resets the counter to zero. As simple as that. In the case of dividing by 3 it is trivial as you only need 2 bits.

Jul 9, 2007
18
0
Okay, i got your point, my next problem now is, how do i drive a 12volts motor, with the sequential logic i just made? because as far as i know, the voltage produced by the logic gates is only 5 volts.

In other words, how do i make a 12 volts output from the 5 volts output of my logic?

11. GS3 Senior Member

Sep 21, 2007
408
35
You cannot drive a motor with the power available at the output of a gate no matter what the voltage. You use the gate to control a switch which controls power to the motor. Your best bet is to have a 12 V power supply for the motor and control a (relay or solid state) switch with the control circuit.

Jul 9, 2007
18
0
ah so you mean that , i have to keep the motor to the 12 volts source. and allow the logic to execute the switch to open or close??? do you have any suggestions on what switch to use??? LOL . . .im still a bit lost sorry guys. I dont have plans on using a relay for this project

13. GS3 Senior Member

Sep 21, 2007
408
35
Well, it depends on the motor and how much current it will use but you can use a transistor or relay. Normally you can have an unregulated 12V power supply for the motor and have a regulator step down from 12 to 5 V for the control circuit. That is pretty common.

Jul 9, 2007
18
0
guys i already made a circuit. please check if im getting nearer to the real thing. ^^

everything works well now, but now my question is how do i wire the relays to act as a switch for those motors?? thanks

15. thingmaker3 Retired Moderator

May 16, 2005
5,072
6
You still can't drive a motor with TTL. You need MOSFETs between your flip-flop and your motors.

16. GS3 Senior Member

Sep 21, 2007
408
35
I am not even going to bother straining my eyes with that graphic or trying to figure out what the circuit does. A better graphic and an explanation would have been helpful.

At any rate, here is a possible way to interface a TTL output to a DC motor using bipolar transistors. There are many ways to skin this cat.

• TTL_motor_interface.png
File size:
1.5 KB
Views:
27

Jul 9, 2007
18
0
okay this is how the circuit operates. the circuit counts 3 packages. the counter is represented by the switch A. When it counts up to 3 packages, Motor A stops and Motor B starts running. Switch B acts as a reset for the counter. so when switch B is switched, the Motor A starts running again and Motor B stops.

is the interfacing diagram you presented me earlier applicable to my type of circuit? because i really ddnt understand the circuit that you gave me yesterday well. Sorry. and if yes, what type of transistor should i use in that circuit?? thanks

Jul 9, 2007
18
0
What do you mean by using mosfets between my Flip- flops?? can you give me a better picture?? ^^ thanks

19. thingmaker3 Retired Moderator

May 16, 2005
5,072
6
GS3 already gave you a picture. A good one.

The 74LS74 will not source enough current to run a motor. You can use the driver circuit GS3 provided. Tie your Flip-Flop TTL o/p to the 1k8 resistor in that circuit.

Aug 15, 2007
536
26