LED controlling using LDR....... circuit diagram for LED and LDR Connection

I want to control LEDs using the LDR input readings. But I don’t know how the connections should be made. Can anyone help me out by providing a circuit connection for it

on which LDR reading do you make LED on?

Hi @kn.yashwanth95,

For this system, you will need to connect the LDR and the LED together with the Bolt.
The connections are as follows

  1. +ve LED pin to 0 pin of Bolt.
  2. -ve LED pin to 1 pin of 330ohm resistor.
  3. 2nd pin of the 330ohm resistor to gnd pin of Bolt.
  4. 1 pin of LDR to 3.3v pin of the Bolt.
  5. 2nd pin of the LDR to A0 pin of the Bolt, along with 1 pin of 10k resistor.
  6. 2nd pin fo the 10k resistor to gnd pin of the Bolt.

You will then have to write your own code to use the following API on the Bolt Cloud to monitor the LDR output and accordingly set the LED on or off.

my code not working (i am new to javascript)
ignore ‘-’ in the tags, i have put them to reply:-


<-script type="text/javascript">
var A0  = "A0";
var A1  = "A1";
var A2  = "A2";
var A3  = "A3";
var True = "HIGH"
var False = "LOW"
var HIGH = "HIGH"
var LOW  = "LOW"
var debug = 0

var api_key = "";
var d_name = "";
var base_url = "https://cloud.boltiot.com/remote/"

function digitalWrite(pin,val){
    var xmlhttp = new XMLHttpRequest();
    xmlhttp.onreadystatechange = function() {
        if (xmlhttp.readyState == 4 && xmlhttp.status == 200 && debug == 1) {
            //document.getElementById("javascript_response").innerHTML = "Javascript Response : "+xmlhttp.responseText;
            var obj = JSON.parse(xmlhttp.responseText);
    xmlhttp.open("GET", base_url+api_key+"/digitalWrite?pin="+pin+"&state="+val+"&deviceName="+d_name,true);

function setKey(key,dev_name){
    api_key = key;
    d_name = dev_name;

function setDebug(bool){
    if (bool == true){
        debug = 1;
        debug = 0;

function Dark(){
   // if(ldr<500)
    digitalWrite(0, 'HIGH');
   // else
   // digitalWrite(0,'LOW');

function Light(){


        <-button onclick="Dark();">ON</button>
        <-button onclick="Light();">OFF</button>

Do we need a transistor for this circuit ?

Hi @pranavgk99
I think using transistor is not required for your circuit.