I have a kit of 37 sensors as described here:

I want to create a simple circuit:

  • if the light is detected - flash LED
  • if there is no light - do nothing

Among 37 sensors I don't seem to find anything related to light / brightness / lumens...

Can you please advise me which sensor to get?

Shall I get a photocell (Light Dependent Resistor) as described here: https://learn.adafruit.com/adafruit-arduino-lesson-9-sensing-light/parts ?

4 Answers 4


You are after the "KY-018 Photo resistor module". It is number #23 "Photoresistor" on the instructables.com webpage.

KY-018 Photo resistor module

The module contains a Light Dependant Resistor (LDR).

More information on the module can be found at https://tkkrlab.nl/wiki/Arduino_KY-018_Photo_resistor_module.


Number 23 in the list says photoresistor, corresponding to module KY-018 in your kit, which is what you called photocell (a photocell is another type of sensor to my knowledge). As the name states, a photoresistor is a device changing it's resistance depending on the amount of light it detects/receive.

A photoresistor usually looks like: enter image description here

In order to get a meaningful reading from an LDR you need to convert the resistance into a voltage which the Arduino's ADC can read. The simplest method is to use a voltage divider: the junction between the LDR (photoresistor) and R1 is the node to connect your analog pin to get your readings, which will be a voltage that is a proportion of the supply voltage (5V) defined by the ratio of the two resistances.

The KY-018 module mentioned above already provides all the necessary and provides you 3 pins: 5V, ANALOG and GND.


simulate this circuit – Schematic created using CircuitLab

  • Your last paragraph is complete nonsense.
    – Majenko
    Oct 3, 2016 at 0:18
  • Why do you say so @Majenko? If he connects the LDR directly to 5V and GND and he moves the rig under a 50W lamp he will create a short, with the LDR resistance quickly becoming negligible under strong light. Oct 3, 2016 at 0:33
  • 1
    @Majenko where on earth did I mention getting a reading? And anyway, does my last paragraph make sense now? Also, will he be able to get a reading out of its rig by using a voltage divider? Not to mention how many times I've seen beginners getting surprised they were constantly getting a 1023 or 0 out of their analog readings just because they had connected their pin to the 5V or GND lines. Anyway, I'm going to update that paragraph, but relax! Oct 3, 2016 at 0:45
  • 1
    No, that is not much better at all. It has absolutely nothing whatsoever to do with sinking or sourcing too much current and everything to do with the fact that the Arduino ADC reads a voltage and a voltage divider is the easiest way to get a variable voltage from a variable resistance.
    – Majenko
    Oct 3, 2016 at 1:03
  • 1
    I edited my answer once again to remove the absolutely nothing whatsoever infringing part you seem to care so much, but I believe it is still a valid general advice. Nonetheless you have no reason to be that aggressive to me, I am trying to help people here and my advice was not like stick your fatty fingers in the mains socket, so cool down and be more kind to your fellow contributors! I appreciate the comments and corrections, that doesn't justify an aggressive wording though. Oct 3, 2016 at 9:29

Use a photoresistor aka photocell. They are variable resistors that change there values depending on the intensity of the light source.

It is sensor KY-018 : KY-018 Photo resistor module.

Here is a helpful code:

const int sensor = A0; //declare photocell pin
const int led = 13;

void setup()
  pinMode(sensor, INPUT);
  pinMode(led, OUTPUT);

void loop()
  int val = analogRead(sensor);
  if(val > 512)
    digitalWrite(led, HIGH);
    digitalWrite(led, LOW);

No, I would suggest you not bother with photocell, phototransisters nor light-dependent resistors.

Better answer is the 1750 light-detection and measurement module.

enter image description here

It connects by I2C and reads out a numeric value corresponding to the amount of light (Lux) it senses.

Very easy to set up.

I use one to measure the light of the sky so I can compare it to the output of my solar cells.

Here is a cool light meter project (complete with hookup instructions and code) that uses one to sense light and displays the results on a 7-segment display:


  • 2
    The OP already owns a light-detecting sensor. Unless you are selling those, it makes very little sense to advice the OP to buy yet another module. May 29, 2017 at 9:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.