Introduction: Linkit One Light Sensor

Today I'm going to show you how to build a light sensor using the Linkit One, this can work as a day and night sensor for your home lighting system.

Step 1: List of Parts

  • Linkit One
  • LDR
  • 10K resistor
  • Bread Board
  • Wires

Step 2: Connecting the LDR

The connections to the LDR are similar to that of a button, the LDR is connected to analog pin 0.

Step 3: Micro USB

Next you need to connect a micro USB between the Linkit One and your PC, and install the necessary drivers from the Linkit One official site.

Step 4: Code

Use the arduino IDE to upload the code to the board, you need to modify the IDE to make it support the Linkit One board. Also enter your network ssid and password.

int LDR = A0; //analog pin to which LDR is connected, here we set it to 0 so it means A0
int LDRValue = 0; //that’s a variable to store LDR values int light_sensitivity = 500; //This is the approx value of light surrounding your LDR void setup() { Serial.begin(9600); //start the serial monitor with 9600 buad pinMode(13, OUTPUT); //we mostly use 13 because there is already a built in yellow LED in arduino which shows output when 13 pin is enabled } void loop() { LDRValue = analogRead(LDR); //reads the ldr’s value through LDR Serial.println(LDRValue); //prints the LDR values to serial monitor delay(50); //This is the speed by which LDR sends value to arduino if (LDRValue < light_sensitivity) { digitalWrite(13, HIGH); } else { digitalWrite(13, LOW); } }

Step 5: Run Time

Now every time the LDR detects light the LED on the Linkit One board, which is connected to digital pin 13 will light up.