## How do simulate photoresistor light/dark?

 Getting into gripes into electronics so sorry for a stupid question! One of the tutorial circuit (robot building for beginners pg 189) is a "balanced brightness sensing circuit" where it has 4 photoresisters. the 4 photoresistor is 100 ohm bright, and 450k ohms when its dark. How do I simulate those values (say I want it 50% dark? All I see is some weird N, TT, M_J parameters, which I haven't a clue what those are! Thanks by tweedie May 14, 2012 If you make your CircuitLab (CL) schematic public then we can have a look and offer some suggestions. Are you trying to model this: http://my.safaribooksonline.com/book/hobbies/9781893115446/variable-resistors/balanced_brightness-sensing_circuit ? :) by signality May 14, 2012 Gosh, Yep, that is the just the circuit I am trying to simulate! I've made it public. Go easy on me. I am just learning to get grips https://www.circuitlab.com/circuit/su4a2q/test-1/ by tweedie May 14, 2012 Here's your problem: your trying to build a circuit that was designed to use light dependent resistors, with photodiodes. Replace the diodes with resistors and set their values according to how much light each one is receiving. I don't know what the transfer function of CdS etc., photoresistors are in terms of resistance vs. optical input power. If you can find that out and work out how much light or optical power each resistor is receiving then you can use a behavioural resistor to set the resistance as a function of optical power. The voltage or current used as the control parameter is scaled to represent optical power. That might be a bit advance just now but bear it in mind for later. The behavioural resistor is here: by signality May 14, 2012 You could simulate a photoresistor with a potentiometer, roughly. Unfortunately the pot device does not seem to let you use a variable for the pot rotation. You're also going to have issues with the response curve of the cadmium-sulphide photocell-- most of them are more of a log response, not linear with light, I think. Thery also have a long, slow tail-- when you turn off the light the resistance goes up slowly, with a long tail lasting many seconds, unless you buy special high-speed photocells. I have a few old Clairex ones that are "high-speed", but that's because they came out of a 1958 IBM card reader, as in punch cards. by arduinohacker May 14, 2012 I have just posted a simple model for the CdS photoresistor. This requires that there be a control voltage (nominally 0-1V) that represents relative illumination, with 0 being dark and 1.0 giving the rated "light" value; I actually allow for the resistance to go to half that value under infinite illumination. This also includes the slow response to light change of these devices (typically tens of ms, though the resistor looks fairly ideal up to reasonably high frequencies, at least well beyond audio.) I set this up for 100Ω/450k as per the query from @tweedie by CarlSawtell May 14, 2012 @CarlSawtell Nice model and a good explanation. Since CL doesn't yet support hierarchical schematics or subcircuits, I'd like to suggest a minor modification to make it slightly easier to use your model in multiple copies: I've also added a bit more background information about the resistance vs. lux transfer function. I haven't found a good reference on CdS and similar photoresistors to point people at so I've had to refer to some fairly arbitrary datasheets. Do you know of any good online references? by signality May 15, 2012 Wow. Great feedback and community! many thanks everyone for some tips. I should have realised that I picked a photodiode! I will read (and re-read) all the points mentioned. by tweedie May 15, 2012 The modification by @signality is precisely equivalent to my original, but let's clarify what is needed if one uses multiple photoresistors: With my circuit, the node names pos and neg have to be made unique (perhaps pos1, pos2, pos3, pos4; neg1 neg2, neg3, neg4 for four photoresistors) and then the current source equations must each be modified to use the new names. With signality's circuit, the single node name diff must be similarly renamed, and the current source equations must each be modified. The lower side of the VCVS must be reconnected to Ground rather than the lower terminal of the photoresistor as drawn. (OK in this test circuit since the low side of the photoresistor is tied to ground) Since there is no hierarchy, and everything has to fit on a single sheet, I'm not convinced adding additional elements to the model to save renaming one node is really a help. Also, based on the problems with signality's voltage controlled capacitor (a similar circuit that currently has some unexplained simulation difficulty in CircuitLab), I figured using a single behavioral element was more compact, easier to understand and more likely to avoid simulation problems. by CarlSawtell May 15, 2012 Good points Carl. I'd forgotten that the diff net name would have to be changed anyway. And I should have made it clear about the negative end of the VCVS having to be grounded.in any application circuit. by signality May 15, 2012