I would like to use the FET and I tried to use a resistor but how do I need to calculate the resistance, like for a Voltage divider?Note that a FET is not the only solution for your task. You also can use an OTA (integrated circuit) or a light-dependent resistor (LDR) instead. It is always good to know the alternatives...