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

User avatar
By mojESP8266
#33560 Hi,

i have a problem with my TOUT pin. What i would like to do is a simple test with my Photocell to measure light intensity.
I am using ESP-13.

I have already connected my temperature sensor.

but now i would like to test analog pin ...

Is there any hardware sketch, image, video, link, good example ... so i could see how this TOUT pin is correctly connected because in documentation it says that it is using only 1V? My current breadboard-ESP project is on 3.3V.

tnx
User avatar
By dkfradk
#33562 Hi.

The TOUT pin on the ESP8266 is measuring between 0V and 1V ie. if you supply 0V to the pin you will read a 0 in software, and if you supply 1V to the pin it will give you 1024.

If your "Photocell" outputs more than 1V max, then you have to bring the voltage down using a simple voltage divider such that it is between 0-1V instead of eg. 0-5V (which is a quite common).

I hope I understood you question correctly, and that you could use my answer :)
User avatar
By xtal
#33572 It only measures 0-1volt 0-1023 counts approx .976 millivolt/count
in NodeMCU I use this code, it will display different values 0-1023 if it is not connected [ie] floating
Code: Select alladc_value = adc.read(adc_id)
                    if adc_value > 1023 then
                         adc_value = 1023
                    elseif adc_value < 0 then
                         adc_value = 0
                    end             

adc_value = adc.read(adc_id) is really probably all you need .... Hardware should control value
User avatar
By Prodigity
#33630 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 :)