Use this forum to chat about hardware specific topics for the ESP8266 (peripherals, memory, clocks, JTAG, programming)

User avatar
By mojESP8266
#33711
Prodigity wrote:Measure the resistance of the photocell in the dark.
Multiply that value by 2.2 and round it off to the nearest resistor value you can find.
Connect the resistor to +3.3V and the other end to tout.
Connect the photocell to tout and ground.

That should cover a big part of the range of the ADC assuming that the resistance difference between dark
and light is big enough :)


tnx i have managed to wire up everything and it works now. I get data range from 0 to 1023. But still i have few questions.

1) Why multiply it with 2.2 (is this because of 3.3V -1V)?
My photocell has around 18K ohm x 2.2 = rounded 40k ohm. See point 2)

2) 3.3V is not fixed. 3xAA are in range from 2.7V to 4.1V(slowly dropping ...)
So should i use i dont know .. low dropout regulator LM1117 (1.8V) and than i would have fixed 1.8V? Is this ok plan? :D

If point 1) is correct and if i use LM1117(1.8V) than i would multiply it with (1.8V - 1V) = 0.8V ... so photocell 18K ohm x 0.8V = 14.4k ohm.

Is this correct path or not?
User avatar
By Prodigity
#33714 1) I calculated the value with the following method:
(Available_voltage - Desired_voltage) / Desired_voltage
(3.30 - 1.00) / 1.00 = 2.30
So it's actually 2.30 times the photocell value; 18kOhm * 2.3 = 41.4kOhm but the 40k is close enough (it only makes a difference of 20 millivolts..)

2) It's a good idea to use a voltage reference so that a value always maps to the same light intensity regardless of battery level. A LM1117 can indeed serve as voltage reference, in that case just use the formula above to calculate the required resistor :) (14.4k is correct yes)