Maker Pro
Maker Pro

Quadrature Arithmetic

steve_locher25

Mar 16, 2010
5
Joined
Mar 16, 2010
Messages
5
Using IR LED piped through fiberoptic, into another fiber optic spaced about 5/8" away. This is seen by a photo transistor whose output is squared up with a schmitt trigger.

There are 2 of these, becoming A and B inputs for a quadrature decoder which then pumps an up/down counter with dual clock inputs and overflows into another counter (second stage).

I built two of these assemblies as described above and put one on the left, and one on the right, say 4 feet apart. My purpose was to count how many of something exists between the two, but most importantly, when nothing exists. That is, it sees how many step in, and doesn't give the "all clear" until it sees that many step back out in either direction, or combination of directions.

Left counter <---Down Up ---> Right counter <--- Up Down--->

The counter's outputs were added together with a full adder. The adder's ouput was NORed (if I can make up a word), so that "all clear" or empty = H, anything else = L which means there's still something in there.

This works as long as the maximum number of items in between the two does not exceed the maximum count + 1 (because they physically won't fit in between).

Thus, say moving from left to right, 54 step in.

54 + 00 = 54 (the right counter still says 00 because nothing passed the sensor yet)

If it stops and leaves the way it came in, the counter just counts back down to 00, but if it continues all the way through then.....

54 + 46 = 00 (the right counter counted down 54 from 00)

ignore the hundred's digit (carry from full adder), NOR the 1's and 10's and your back to 00....All Clear.

Problem........

I built 4 of these in series to keep track of the location of whatever was moving. I would love to build dozens, but, the 4 I built was drawing .35 Amp, being run off my homemade 5 volt 1 Amp regulated power supply.

Have tried 74HC192, with obsolete CD4560 Full Adder and 74HC193 with 74LS283 Full Adder.

Questions:

1) redesign entire circuit and use different CMOS IC's, to bring current down?

2) consider dropping one side and just have 1 counter instead of 2 counters added together. I came up with a logic circuit that would let both quadrature decoders drive the same counter at the same time even during simultaneous multiple inputs going in any direction. The idea was to get rid of as many gates as possible to try to bring down the total current draw.

your thoughts?

Steve
 

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Jan 21, 2010
25,510
Joined
Jan 21, 2010
Messages
25,510
Firstly, since the major issue is "no somethings", I presume that you have exhausted the possibilities of having a beam run obliquely across the path in such a way that it's obscured if any object is anywhere along the path?

Presuming that is not possible, I would replace most of the logic with a PIC. It will bring the current consumption way down (assuming that it isn't used mostly for your sensors) and allow you to handle much larger item counts.

I presume objects can arrive or depart from either end of the path? (otherwise no need for the quadrature complexity)
 

steve_locher25

Mar 16, 2010
5
Joined
Mar 16, 2010
Messages
5
Firstly, since the major issue is "no somethings", I presume that you have exhausted the possibilities of having a beam run obliquely across the path in such a way that it's obscured if any object is anywhere along the path?


bought a $44 laser diode 10 years ago to try that, mirrors even. wont work. would be sooooooo easy, but no, can't do it.



Presuming that is not possible, I would replace most of the logic with a PIC. It will bring the current consumption way down (assuming that it isn't used mostly for your sensors) and allow you to handle much larger item counts.



I absolutely need to learn programable logic, my life would be so much easier. Don't know anything about them, read about one type that has to be reprogramed if it loses main power (Major problem). Doesn't have to be re programable, I really need something that basically lets me create my own logic IC's and doesn't erase itself when main power is taken away.



I presume objects can arrive or depart from either end of the path? (otherwise no need for the quadrature complexity)



Yep, this is true. Because say 5 step in from the left, 12 from the right, then 8 leave to the left and then 5 to the right and the last 4 to the left it would output H=clear


So, changing to a CD40193 wouldn't really save me anything currentwise huh?

Hmmmmm........
 

55pilot

Feb 23, 2010
434
Joined
Feb 23, 2010
Messages
434
The PIC is a microprocessor that runs a C program. You will send all the square waves from the schmitt trigger to the microprocessor. The microprocessor can do the quadrature decoding, increment/decrement the counters and subtract them.

You can also do it using a CPLD or a FPGA. Those are the programmable logic that let you make your own ICs. Those would be a distant second choice. The FPGA looses its memory after power-down and needs to be re-programmed. But there are chips that can remember the program and program the FPGA when they are powered up. The CPLD remembers its program but it is more expensive and the largest CPLD does not have as much capacity as the smallest FPGA.

Before you spend too much time looking at changing the circuit, you need to figure out how much of the current is being used by the circuits and how much by the sensors. If most of your current is being used by the sensors, changing the counters will not help. If the sensors are using 0.3A and the logic is unsung 0.05A, if you could start using magic gates that do not use any current, you will only be down to 0.3A, which is not much of a savings.

---55p
 
Last edited:

steve_locher25

Mar 16, 2010
5
Joined
Mar 16, 2010
Messages
5
ok, then maybe that was the problem, I didn't consider that.

the project is disassembled now and lying here on my living room floor, but my notes from when I built it show the following:

The IR LED circuit is a 1.4 V IR LED (.080 W) connected to 5Vdc through a 51 Ohm 1 Watt resisitor. I measured 67.8mA.

Ohms law, I get ( 5 - 1.4 ) / 51 = .07 Amp

so it looks right, BUT, at the time, each sensor had its own IR LED, so, 4 of these in parrallel would be .28 Amp just for the IR circuit alone right?

I bet that is the smoking gun right there....wow, I didn't consider that. And here I thought the current draw was because of having 7 breadboards filled with logic chips.

ok, so, next I'll try this:

1) my notes also describe the current draw of the IR circuit using different value resisitors, so set that back up and running and find which one is "just enough"....no overkill. My notes don't say the reason why it had to be a 51 ohm (not enough power getting through the fiberoptic if I used a 100 ohm instead?) hmmmmm

2) set up all 4 counters/adders/sensors but this time have just one IR source, with many fibers going out to the sensors instead of having each sensor with its own IR LED. Yeah, sure I'd have to have dozens of feet of fiber optic, but who cares when it's only 2 cents per foot. I have 1000 feet spool on hand just waiting for something to do anyway.

3) consider if pulsing the IR LED would help, instead of having it hard wired like I do now. If that helps, would tweaking the duty cycle help even more?

Hmmmm......back to the breadboards, but hey, I live in my workshop anyway.

Thanks! you guys rock!
 

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Jan 21, 2010
25,510
Joined
Jan 21, 2010
Messages
25,510
Yes, I thought as much :) 70 mA is quite a lot for the average IR LED. I'd not be surprised if it didn't have a short (but brilliant) career.

There are several ways of getting more out of your LED.

1) placing the LED where it is required, rather than using fibre-optic cable.

2) focussing the LED

3) focussing the sensor

4) shielding the sensor from stray light

5) pulsing the beam and looking for the absence of an AC signal (or a missing pulse)

How far is it between the light source and the sensor? With minimal effort 70mA through a LED should be detectable several metres away with ease.
 

Resqueline

Jul 31, 2009
2,848
Joined
Jul 31, 2009
Messages
2,848
There could also be the possibility of connecting the LED's in series instead of all parallell.
 
Top