Light Sensor (LM358)

The Grove Light sensor integrates a photoresistor (light dependent resistor) to detect the intensity of light. The resistance of photoresistor decreases when the intensity of light increases. A dual OpAmp chip LM358 on board produces a voltage corresponding to the intensity of light (based on resistance value). The output signal is an analog value. When the light is brighter, the value becomes larger. Please check the official WiKi for details.

Setup and Execution

  1. Download the sketch file for the light sensor example.

  2. Open the downloaded Light_Sensor.ino with the Arduino IDE.

  3. Modify line 20 from 1023 to 4095 to fit the 12-bit ADC output of LinkIt 7697, for example:

    void loop()
    { 
        int sensorValue = analogRead(LIGHT_SENSOR); 
        Rsensor = (float)(4095-sensorValue)*10/sensorValue; 
        Serial.println("the analog read data is ");
  4. Click the Upload icon to compile and upload the sketch file to the board.

  5. Open the serial monitor (with baud rate 9,600) and reset the board to execute the application. You should be able to see the output as below:

Last updated