Light Logic

Using a Led and CdS LDR to form inverting Photonic logic gates.
The entire Boolean logic set handled by resistors and diodes! Who'd'a thunk

Similar projects worth following
I always read that inverted logic as in a Not, Nor or Nand can not be made with just diodes and resistors. Well, this might just break out of that box. A inverting Not gate can be made with just one led and two resistors with one of the resistors being a CdS LDR. As of July 2019 I have Buffer, Not, AND, NAND, OR, NOR. XOR and XNOR gates working. Not the fastest gates around and not going to change the world as they are currently designed but they do work and that's all I set out to prove in the first place. Who knows what the future will be for Light Logic.

The idea for this circuit came to my mind as a rough diagram back around October 5, 2018. I had been working on my #ColorChord - A Steampunk inspired creation  project and sat back thinking about the relationship between the led bar and the CdS cells. Then began thinking about the logic combinations possible and thought that perhaps a diode ( led ) / resistor ( ldr ) would provide the way to a inverting logic gate. In a flash the circuit was in my mind and a quick test set up proved it would work. The rest might be history......

May 31, 2019 -  I now have worked out the circuits for eight individual gates. AND, NAND, Buffer, NOT, OR, NOR, XOR and XNOR. All gates use a single Light Logic element.

  • 1 × Led Green is best but white works well
  • 1 × CdS Photo Resistor LDR
  • 1 × Switching diode 1N914 or other switching diode
  • 1 × Resistor 220 Ohm minimum, use higher values as needed

  • Another simple XOR that works

    Dr. Cockroach5 hours ago 1 comment

    Here is another XOR circuit that I wired and tested last night. Thanks to Yann Guidon for this idea as it does further reduce the parts count. The Input resistors are optional depending on the logic level voltage. For a XNOR, just reverse the +5 and ground. This XOR, once again, has good solid logic levels on the output.

  • XOR and XNOR simple as ever

    Dr. Cockroach4 days ago 2 comments

    I now have, thanks to @Starhawk for the nudge, managed to create A XOR and XNOR gate that uses just a single Light Logic switch. I no longer need to combine other gates for these logic functions. Logic highs are 4 volts or higher and the low levels are less than 0.5 Volts. Good enough to be used with the rest of the Light Logic family.

  • XOR and still transistor less

    Dr. Cockroach06/22/2019 at 22:24 0 comments

    I am working on a educational display to showcase Light Logic and how it works.

    This is a combination of NAND, OR and AND gates to create a working XOR gate. And as the same for all Light Logic gates, transistors are not to be found. Just diodes and resistors. Power leads are under the paper to better show the logic wiring.

  • Six basic gates with Diodes and Resistors

    Dr. Cockroach05/31/2019 at 23:29 2 comments

    I have worked out the circuits for the following gates. AND, NAND, Buffer, NOT, OR and NOR. With these I can make XOR and XNOR gates as well. These gates have good fan-in and fan-out capability.

  • Light Logic AND Gate

    Dr. Cockroach05/28/2019 at 15:21 0 comments

    Light Logic now has a working 2 Input AND Gate as well as the initial NAND.

    This gate still uses a LED and CdS photo cell at its core and two other resistors. The best part of this simple DRL gate is that, as with the NAND, its logic out level is refreshed where as traditional diode resistor AND gates are not. I will continue to adjust the resistor values for best performance but this gate works well as is.

  • One Bit Nand Full Adder using Light Logic Gates

    Dr. Cockroach05/26/2019 at 23:35 0 comments

    Here it is May 26, 2019 and want to present a brief video history of Light Logic and a working full adder using Nand DRL gates.

    The basic Nand full adder circuit used for this project.

    Laying out the gates.

    Wiring the first XOR.

    Wiring the entire adder. My wiring was very messy on this project.

    First test was setting A In to one. Note the glow of the gates as they are active or inactive. Sum Out indicates a one.

    Now A In and B In are set to one. Sum is zero and Carry Out is one.

    A In, B In and Carry In are one and Sum along with Carry Out are one.

    This is a great educational tool to visually see the actions of the gates while functioning.

  • Tektronix 2230 added to my toy chest

    Dr. Cockroach12/14/2018 at 11:17 5 comments

    I had to add this to my very basic work area so I can better understand what is going on with my light gates. This Tektronix 2230 scope is just what the doctor ordered.

    I have quickly discovered that my astable clock signal for IO is in need for some improvement. Not very square is it...

  • Light Logic counter

    Dr. Cockroach11/18/2018 at 18:07 3 comments

    This test project will be a Johnson Counter with 7 segment hex display.

    First flip-flop wired, seven more to finish.

    Rough layout of the gates. Top two rows are the flip-flops. The bottom two rows are the decode and invert logic.

    The circuit on Logisim and provided by @matseng 

  • Just messing around with a Pulser circuit

    Dr. Cockroach11/15/2018 at 23:17 1 comment

    November 15, 2018 -  just messing around with Light Logic tonight and wired up the same clock pulser circuit that I had used in the first few weeks of the IO Cardboard Computer project. This time all Light Logic gates from the clock itself through to the final output led.

    Fed the clock output through three Not gates and then to one input of a And gate ( Nand + Not ) and then fed the clock directly to the other And gate input. Connected a led to the And gate output and the result was a very short pulse just like I had using DTL gates a year or so ago.

    Just proves more and more what the Light Logic gates can do in real applications.

  • Self latching Light Logic ? YES !

    Dr. Cockroach11/09/2018 at 01:48 7 comments

    It is possible. @matseng  forwarded an idea to me that does latch on and off every time. The led is a standard bright white and the CdS cell is a large 1 inch dia. cell hacked from some old 1960's equipment. Cell resistance in total dark is over 100k Ohms and when lighted comes down to less than 100 Ohms.  Also big thank you's to @Yann Guidon / YGDES  and @Morning.Star  for bringing ideas to make this all work as a package.

    View under the hood. The real business end. Yes, two led's and Ldr's in there.

    Here is the first video of the led latch in action.

View all 30 project logs

Enjoy this project?



David H Haffner Sr wrote 04/04/2019 at 19:13 point

Hello Doc, yeah been out for awhile, I was hospitalized at the VA hospital for a time but all is better now. I wasn't sure what was going to happen so I shut down a lot of my online presense except for this place, which I consider the best fit for me anyway. Glad tto see your wonderful creation evolving into a real thing of beauty! 

  Are you sure? yes | no

Dr. Cockroach wrote 04/05/2019 at 00:28 point

Glad your OK David, I wondered where you have been. Great to have you back :-D

  Are you sure? yes | no

retrac wrote 03/29/2019 at 04:16 point

This is a creative and unusual idea.  I think both neon lamps and even incandescent bulbs would work instead of an LED.  Perhaps it's possible to build a computer faster than relay logic entirely out of neons, resistors, and photoresistors.  No semiconductors at all.

One could also use a phototransistor instead of a photoresistor.  That would be quite fast with an LED compared to a photoresistor.  Rise times in the tens of microsecond.  So many variations possible!  You've struck my curiosity, I think I'll see what I can build.  Thank you.

  Are you sure? yes | no

Dr. Cockroach wrote 03/29/2019 at 11:09 point

Hey there retrac and thanks for the input :-) Oh for sure it is doable to not use any semiconductors at all by using other light sources. But as far as speed, well, the CdS photo resistors do have a fairly long reaction time so sequential logic circuits start to have issues as soon as I ramp up the clock speed. If I use a photo transistor then I defeat the idea of this project but yes, that would be a faster way to switch :-)

A friend did send me some PIN photo diodes so going to check them out once I get this project moving again.

  Are you sure? yes | no

Samuel A. Falvo II wrote 02/19/2019 at 17:09 point

If  speed becomes a concern, which I suspect it would if you are trying to build complex logic like instruction decoders and such, then you could use a 2D mask to implement a kind of ROM-like device.  The idea is that the inputs illuminate rows, and the CdS cells detects light along the columns.  The mask, which remains interstitial between the input rows and output columns, implements the complex logic.  (Remember to keep the light from each row isolated from adjacent rows!)  This restricts your propagation delays to just three layers: the input buffering/inverting to drive the rows, and the output logic to collect the columnar results into specific outputs.  This device would be "field programmable" by just swapping out the mask with a new one.

  Are you sure? yes | no

Dr. Cockroach wrote 02/19/2019 at 18:36 point

Thank you @Samuel A. Falvo II , I had not given thought that far ahead but that sounds like a great idea to try out. Yes indeed, speed will be a major factor for more complex logic.

  Are you sure? yes | no

matseng wrote 11/08/2018 at 14:35 point

-H-o-w- (EDIT: Have) you been able to make a self-latching circuit out of this?  I.E basically just a single LDR and one LED connected in series and pointed to each other?  

At full darkness the resistance of the LDR is high enough to not light up the LED, then you temporary short the LDR to light up the LED causing the resistance of the LDR to drop enough to keep the LED on permanently.

If you then temporary short the LED so it will go dark causing the LDR to be high-resistance keeping the LED in a permanent off-state.

(Some current limiting might be a good thing here...)

I played around with it a bit, but my LEDs are so sensitive that they light up enough to cascade-trigger the LDR to full-on.

If it would be possible then a memory matrix rivaling the first core memories in density could be within reach.

  Are you sure? yes | no

Dr. Cockroach wrote 11/08/2018 at 16:04 point

Hey there, The Not, Nor and Nand gates interconnect and work just like their transistor counterparts.... The only connection between the Led and Ldr is their common ground. The led is turned on and off by the previous gate by shunting to ground. So far my s-r latch and D latch are working fine as well as the master slave J-K using the clock signal from the astable that is also using the led/ldr combo :-) Excess room/sun light needs to be shielded to some extent. The self latching idea sounds like something for me to try out....Need to look into it :-)

  Are you sure? yes | no

Dr. Cockroach wrote 11/14/2018 at 10:40 point

It is very possible :-D

  Are you sure? yes | no

matseng wrote 10/29/2018 at 09:41 point

So this means that each gate have both voltage and current gain... Or else the signal would "fizzle out" after chain of a few gates.   So possibly it could be possible to make an (very bandwidth limited) audio amplifier out of LEDs and LDR's then.

[ The department of ancient knowledge wants to remind you all that the word fizzle meant "to break wind without making noise" back 500 years ago ;-) ]

  Are you sure? yes | no

Dr. Cockroach wrote 10/29/2018 at 10:45 point

Fizzle, I can still learn something new every day ;-)

Yep, each gate refreshes the output levels so I might give the gates a try at audio and hear what happens. I do not expect Hi-Fi quality though ;-)

One issue to contend with is the latency of the CdS material as that is limiting the speed of the gates.

  Are you sure? yes | no

Yann Guidon / YGDES wrote 10/15/2018 at 21:18 point

Did you see ?
It shows one example of ROM/decoder with CdS cells :-D

  Are you sure? yes | no

Dr. Cockroach wrote 10/15/2018 at 15:08 point

Thanks Yann for bringing me out of the darkness. Glad you caught this :-)

  Are you sure? yes | no

Yann Guidon / YGDES wrote 10/15/2018 at 18:41 point

it's a pleasure to see you hacking, and I'm glad your experiments are rewarded !

  Are you sure? yes | no

esot.eric wrote 10/14/2018 at 05:43 point

Breaking all the rules! Perfect teaching-aide, too! Nicely done.

  Are you sure? yes | no

Dr. Cockroach wrote 10/14/2018 at 07:31 point

Broke / Bend, I lost track :-) Thanks :-)

  Are you sure? yes | no

Yann Guidon / YGDES wrote 10/14/2018 at 03:52 point

Is there an "optimisation" to merge the input diodes with the LED function ?

Just have the CdR as "high side" resistor, and the 1N4148 are replaced by LEDs that both shine on the photocell :-)

  Are you sure? yes | no

Dr. Cockroach wrote 10/14/2018 at 07:29 point

I was planning on trying to mount real small SMD leds to the CdS and someone else mentioned using fiber optic cables to couple the gates to each other...

  Are you sure? yes | no

Starhawk wrote 10/14/2018 at 01:50 point

You can get LED night lights with CdS cells inside at Dolla Tree, IIRC...

  Are you sure? yes | no

Dr. Cockroach wrote 10/14/2018 at 07:30 point

My Dollar Tree keeps running out of them but I will keep checking my store :-)

  Are you sure? yes | no

Kelly Heaton wrote 10/11/2018 at 13:29 point

What are the specs of your CdS Photo Resistor LDR (what resistance in light and dark)?

  Are you sure? yes | no

Dr. Cockroach wrote 10/11/2018 at 14:55 point

I read about 40K blacked out and 200 Ohms very bright. These Ldrs are from night lights sold at Wal-Mart. @Morning.Star  sent me one of his that went to almost inf when blacked out and about 30 Ohms lighted but I misplaced it for the moment :-)
 For small purchases, the four pack of led night lights with the Ldr runs about $5 and besides the Ldr and Smd led there are a few more useful parts to hack out of them ;-)

  Are you sure? yes | no

Kelly Heaton wrote 10/12/2018 at 01:47 point


  Are you sure? yes | no

Peabody1929 wrote 10/10/2018 at 15:51 point

How about using fiber optic cable to connect the LED output to the photocell input?  A 2 input gate would have two cables over a single photocell.  The fiber optic cable could even be the "wiring" between gates.

  Are you sure? yes | no

Dr. Cockroach wrote 10/10/2018 at 16:26 point

That has been mentioned as well as attaching very small SMD leds to the face of the CdS. Many ways to try this out and looking forward to testing them all :-) Thanks :-)

  Are you sure? yes | no

Morning.Star wrote 10/09/2018 at 05:21 point

Thats what I've been told, not possible. Lol, sounds like a challenge :-D

This is impressive, low level theory and technology. Nice discovery dude. Nice work! :-)

  Are you sure? yes | no

Dr. Cockroach wrote 10/09/2018 at 11:01 point

It looks as if I am going to have to write my own book on how this works. The rules have changed a little bit ;-)

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates