# Proposal based on quad comparator

A project log for anaGoL - Conway's Game of Life the analog way

A design for a non-microcontroller / non-digital logic Conway's Game of Life cellular automata simulator

The following circuit shows a possible way to do this. It uses a quad comparator similar to the LM339. Note that these can only sink current at their output, so they need a pull-up resistor. It also means that the outputs can be connected together to form a wired AND gate.

I use an 8 volt power supply, in that case the voltage at the summing point will be (almost) equal to the number of surrounding active cells. Easy for measurements. But it will work with other voltages too. I here assume that the comparator outputs are almost equal to GND or VCC.

The opamps A and B form a classic window comparator. The upper one compares to 3.5 V, the lower one compares to a voltage determined by R1, R2, R3. These resistors should be calculated such that:

When the output of C is HIGH (cell dead), the voltage of the - terminal of B should be 2.5V, and

When the output of C is LOW (cell alive), the voltage of the - terminal of B should be 1.5V,

Comparator C holds the actual state of the cell. In each cycle, it gets a short negative-going reset pulse followed (or partially overlapped) by a positive going set pulse. The set pulse will only be effective if the set-signal is not shorted to ground by the window comparator. The C comparator has positive feedback so the state is remembered. The output drives a LED if the output is LOW, that indicates if the cell is alive.

The output of C is connected to the inverted input of D, that delivers a active-high signal for the neighbors. Note that there is a low-pass filter that keeps the output from changing while the pulses are applied. The output of the R1,R2,R3 circuit also has a capacitor with the same purpose.

No tests or simulations were done yet, so it might be needed to do changes. It might also be possible to simplify the circuit. Note that the input summing resistors could be in a single resistor array. It should be checked that the comparators have sufficient input range.

## Discussions

matseng wrote 02/18/2019 at 12:43 point

I've uploaded the LTspice sim for this schematics the file section.  Instead of using a number of resistors as the summing part I just step a voltage up from 0 to 8 and back to 0 in steps of 1v.

Are you sure? yes | no

roelh wrote 02/18/2019 at 13:33 point

And did it work ?

Are you sure? yes | no

matseng wrote 02/18/2019 at 13:47 point

Not sure... ;-) I have to think about the result for a bit... I post the trace in the group-chat since the comments here dosen't support images.

Are you sure? yes | no

matseng wrote 02/18/2019 at 12:31 point

R1=10K, R2=7k2, R3=2k gives set-points at 2.51 volts high and 1.51 low

Are you sure? yes | no

matseng wrote 02/18/2019 at 12:33 point

But that doesn't take the LED and its resistor into consideration...

Are you sure? yes | no

roelh wrote 02/18/2019 at 12:39 point

Thanks....  but when I calculate upper setpoint with this values I get 2.586 V, also close to 2.5V but different from your value...

EDIT ok you also take the 1K pullup into account...  I didn't

Are you sure? yes | no

matseng wrote 02/18/2019 at 12:40 point

Did you use 11k in parallel to VCC in the calculation?

Are you sure? yes | no

roelh wrote 02/18/2019 at 12:44 point

If the LED is off, there will be almost no current in that branch provided that the voltage over the pullup-resistor is low enough.

Are you sure? yes | no

roelh wrote 02/18/2019 at 12:07 point

I have an idea to lower the part count, hope to post it this evening (it is now 1 :08 PM here)

Are you sure? yes | no

matseng wrote 02/18/2019 at 11:24 point

I have a hard time figuring out how the upper window of 3.5 can be stable when the pull of the bottom resistor changes.  This would affect the current thru the entire chain.

But it would be easy enough to just add one resistor to completely decouple the upper set point do the lower by having two separate voltage dividers.

Are you sure? yes | no

roelh wrote 02/18/2019 at 11:43 point

The upper limit voltage is determined by the 4k5 and 3k5 resistors, connected to the power supply. I do not see how this is affected when the lower limit changes... There already are two separate resistor deviders.

Are you sure? yes | no

matseng wrote 02/18/2019 at 11:49 point

Ah yes... That's true. On my printout it, by some reason, looks to me like there's a junction-dot between the inverting input of B and the 3k5 resistor. But now when I look closely I see that's just a straight crossing.

Are you sure? yes | no

matseng wrote 02/18/2019 at 11:51 point

I was also confused by the unnecessary R2 when assuming that there was a junction at B-inv.  But now it makes better sense... ;-)

Are you sure? yes | no

K.C. Lee wrote 02/18/2019 at 09:00 point

The comparators are OC (Open Collector).

- A&B does not have a pull up before the diode.   (Your Set is normally Low.) This rendered A&B inactive.  Or is diode wired backwards or A&B wired to the wrong place?
- The diode for Reset is not needed as shorting A&B (which are OC) to ground is allowed.   Think wired-OR.

Are you sure? yes | no

roelh wrote 02/18/2019 at 09:54 point

- The resistor that is connected to SET is also the pullup diode, because the signal is only needed when SET is high.

- The RESET line is in common for all cells. If the diode was left out, inputs to all C comparators would be the same, and all cells would always go into the same state

I hope this answers your questions !

Are you sure? yes | no

K.C. Lee wrote 03/10/2019 at 04:21 point

The outputs of the comparators are open collectors, so without any pull ups, they are non-active.  Output diode only conduct when the output is high i.e. SET is at high state.

This is inmaterial as new design doesn't use  this.

Are you sure? yes | no

tophalfofabarn wrote 02/17/2019 at 23:42 point

What is the lowest difference between comparator inputs for any valid input state? I was only able to get 125mV with my approach, which would be the limiting factor for cell stability.

Are you sure? yes | no

roelh wrote 02/18/2019 at 07:33 point

For easy calculation purpose, the power supply is 8 volts. The input then comes in 1 volt steps for each additional living neighbor. It is compared against an upper limit of 3.5V and a lower limit of 1.5 or 2.5 volts. So the difference between the comparator inputs is always at least 0.5V. The other two comparators handle digital signals, so they are less critical.

Are you sure? yes | no 