Trying to use an analog read (photoresistor) to measure ambient light. This is a prof of concept to be able to read other ‘analog’ hardware.
However I can’t get it to work. When data is not connected I get random voltage values and when it’s connected I only get 0.0v even if moving sensor in front of a lamp. I’ve tried both 3.3v and 5v.
Any suggestions would be appreciated.
I’ve purchased Köp Ljussensor till rätt pris @ electrokit and thought I could use it with (Analog to Digital) Analog To Digital Sensor — ESPHome
The photoresistor module is used to measure light intensity. It can determine
the presence or absence of light.
This module consists of a photoresistor and a 10 kΩ in-line resistor.
The photoresistors resistance will decrease in the presence of light and
increase in the absence of it. The output is analog and determines the
intensity of lightPower is 5v
I’m running a ESP32 Wroom 32
Configuration
sensor:
- platform: adc
pin: GPIO32
name: "Skylight Illuminance"
update_interval: 10s
Startup
[20:12:41][I][app:105]: ESPHome version 1.15.3 compiled on Nov 20 2020, 20:10:30
...
[20:12:41][C][adc:026]: ADC Sensor 'Skylight Illuminance'
[20:12:41][C][adc:026]: Unit of Measurement: 'lx'
[20:12:41][C][adc:026]: Accuracy Decimals: 0
[20:12:41][C][adc:026]: Icon: 'mdi:flash'
[20:12:41][C][adc:035]: Pin: 32
[20:12:41][C][adc:038]: Attenuation: 0db (max 1.1V)
[20:12:41][C][adc:051]: Update Interval: 10.0s
...
running values
Data pin is not connected
[20:24:37][D][adc:056]: 'Skylight Illuminance': Got voltage=0.14V
[20:24:37][D][sensor:092]: 'Skylight Illuminance': Sending state 0.14183 V with 2 decimals of accuracy
[20:24:47][D][adc:056]: 'Skylight Illuminance': Got voltage=0.08V
[20:24:47][D][sensor:092]: 'Skylight Illuminance': Sending state 0.08166 V with 2 decimals of accuracy
[20:24:57][D][adc:056]: 'Skylight Illuminance': Got voltage=0.08V
[20:24:57][D][sensor:092]: 'Skylight Illuminance': Sending state 0.08166 V with 2 decimals of accuracy
[20:25:07][D][adc:056]: 'Skylight Illuminance': Got voltage=0.08V
[20:25:07][D][sensor:092]: 'Skylight Illuminance': Sending state 0.08193 V with 2 decimals of accuracy
[20:25:17][D][adc:056]: 'Skylight Illuminance': Got voltage=0.08V
[20:25:17][D][sensor:092]: 'Skylight Illuminance': Sending state 0.08166 V with 2 decimals of accuracy
Now I connect to D32 (GPIO32)
[20:26:47][D][adc:056]: 'Skylight Illuminance': Got voltage=0.00V
[20:26:47][D][sensor:092]: 'Skylight Illuminance': Sending state 0.00000 V with 2 decimals of accuracy
Connections