I read some articles about using an LED as a light sensor. I chose an IR LED and checked the voltage levels produced in different light situations resulting in about 200-300mV in full artificial light and around 30 mV in the dark, which seemed to be fine enough for an analog Arduino/AtTiny pin. The IR sensor LED also worked sufficient on the breadboard, but unfortunately the values seem to get messed up in my soldered setting which is an AtTiny dimming a 10W LED when a PIR gets activated and the light sensor value is low. In this setting I get much less sensitive analog readings from the sensor LED. The main difference are longer connecting cables as I want to place the sensor LED in some distance from the rest of the circuit.
Can it be that the current of the LED is too low and therefore the reading gets disturbed by the circuit in some way?
May I need a very high pull-down resistor for the sensor because without it the sensor pin floats in the dark?
IR is supposed to be the most sensitive but actually I want to measure daylight which has a lower IR part than warm electric light. So maybe another LED would make more sense?
I know there should also be a resistor between the PWM and the MOSFET, but it seemed to work fine on the breadboard without it.
simulate this circuit – Schematic created using CircuitLab