LED Control with LDR (Photoresistor) and Arduino

Поделиться
HTML-код
  • Опубликовано: 17 дек 2024

Комментарии • 233

  • @maker101io
    @maker101io  3 года назад +3

    Source Code: create.arduino.cc/editor/mertarduinotech/40f2d22f-7853-4882-b2a9-1b6d43ac81b0/preview
    Recommended Items:
    Use Your Muscles in Project - amzn.to/3wdL45C​
    37 Sensor & Module Packages - amzn.to/3m66WeQ​
    Try this Robot Arm - amzn.to/3fq8DCl​
    Best Resin 3D Printer - amzn.to/39tY8KB​
    Arduino Compatible Kits - bit.ly/2J2AFF7​
    Banggood Spring Sale - bit.ly/3slMbOn

    • @chrisjude9933
      @chrisjude9933 3 года назад

      Sorry to be off topic but does any of you know a method to get back into an Instagram account?
      I was dumb forgot my password. I love any tips you can offer me.

    • @edisonanthony1098
      @edisonanthony1098 3 года назад

      @Chris Jude Instablaster ;)

    • @chrisjude9933
      @chrisjude9933 3 года назад

      @Edison Anthony i really appreciate your reply. I found the site through google and I'm in the hacking process atm.
      Seems to take a while so I will reply here later when my account password hopefully is recovered.

    • @chrisjude9933
      @chrisjude9933 3 года назад

      @Edison Anthony it worked and I now got access to my account again. Im so happy:D
      Thank you so much you saved my account !

    • @edisonanthony1098
      @edisonanthony1098 3 года назад

      @Chris Jude happy to help :D

  • @anatoos
    @anatoos 5 лет назад +27

    For those like me who have had trouble making this work, this might be because your LDR is calibrated differently from the one in the video. To fix this issue, try replacing the "300" with other values until it works.

    • @Leonb66
      @Leonb66 3 года назад +2

      had to adjust my ldr status to

    • @namuuu
      @namuuu 14 дней назад

      thank you! it works! had to adjust to

  • @dmatter1423
    @dmatter1423 2 года назад +1

    I've been doing a project in design school that needs this exact circuit and I haven't been able to figure it out! Thank you so much!!

  • @anbolaq447
    @anbolaq447 4 года назад +5

    Would you mind explaining why we have to use 10k ohm resister with the LDR.

  • @nathysathorn
    @nathysathorn Год назад +1

    Great video, if your light sensor is still not working. Try changing your ‘ if ‘ statement. As 300 is working here it doesn’t always work for everyone. Mine was 5

  • @ochijunior1252
    @ochijunior1252 2 года назад

    The best ldr tutorial that will ever be

  • @soteropolitano3413
    @soteropolitano3413 3 года назад +1

    Muito show... Explicou em 4 minutos um conteúdo grande com riqueza de detalhes...
    O Brasil estaria em outro nível se a maioria dos professores tivessem esse dom na didática.

  • @owenonuorah1291
    @owenonuorah1291 26 дней назад

    For those that are having troubles due to constant readings, try going to a brighter environment or try to lower the LDR status, eg, LDR status

  • @KD9Sa
    @KD9Sa 3 года назад +1

    The instructions and steps are organized and clear.
    The video quality is perfect.
    Thanks very much for sharing your knowledge with us.

  • @_atomic3187
    @_atomic3187 5 лет назад +8

    You are my hero, i can sleep this night, ty bro

    • @vuk_ustipak
      @vuk_ustipak 4 года назад +3

      You can now sleep you dont have an led shining in ur eye

  • @kohchajie9701
    @kohchajie9701 5 лет назад +2

    hello, i have a question regarding the resistance value.
    why 10kohm and 220ohm is chosen instead of others value?
    is there a reason for these? if yes, are they any formula to prove so?
    looking forward for your reply.

    • @JohnnyFaber
      @JohnnyFaber Год назад

      Ohm's law. The resistor for the led controls the current and is there to kerp the led operating within it's operational parameters.

  • @reefmaster
    @reefmaster 5 лет назад

    clear guide on writing code. Comments in code section helped a lot.

  • @rakhusial3124
    @rakhusial3124 3 года назад +1

    Sir I am big fan of all of your projects kindly make GPS land leveling with arduino...

  • @uliseslazaro1766
    @uliseslazaro1766 6 лет назад +2

    Hi, why do we need the 10k resistor?

  • @wilbertortilla9233
    @wilbertortilla9233 7 лет назад +7

    why my led is always on even it its not dark? answer m pls

  • @ЮлианДимитров-ъ2ш
    @ЮлианДимитров-ъ2ш 6 лет назад

    1:27 the resistor is between the lrd and the wires and in 3:58 the resistor is after the ldr. Why?

  • @TheMystery963.
    @TheMystery963. 5 лет назад +2

    source code=
    //set pin numbers
    //const won't change
    const int ledPin = 13; //the number of the LED pin
    const int ldrPin = A0; //the number of the LDR pin

    void setup() {
    Serial.begin(9600);
    pinMode(ledPin, OUTPUT); //initialize the LED pin as an output
    pinMode(ldrPin, INPUT); //initialize the LDR pin as an input
    }
    void loop() {
    int ldrStatus = analogRead(ldrPin); //read the status of the LDR value
    //check if the LDR status is

  • @caseylocke4474
    @caseylocke4474 6 лет назад +6

    I have watched EVERY SINGLE photoresistor & arduino video on RUclips up through the first 30 results. Not only have I not found a SINGLE video that explains the need for the fixed resistor (what they are calling a "voltage divider," but at least one person in every video asks that question in the comments section and never gets an answer. I am extremely frustrated because I cannot find this information ANYWHERE. Why can't you just connect one leg of the photoresistor to +5V and the other leg to A0 and measure the output voltage (and therefore light level) directly?

    • @hesamakbari4314
      @hesamakbari4314 5 лет назад +1

      dude resistors don't change voltage, they change the current and with the fact that LDR is a resistor, you can't do that. that is why you will need a voltage divider circuit

    • @hesamakbari4314
      @hesamakbari4314 5 лет назад

      I made a video on this. you can go and check it and please subscribe

    • @aditydud
      @aditydud 5 лет назад

      @@hesamakbari4314 can you please share a link

    • @hesamakbari4314
      @hesamakbari4314 5 лет назад

      @@aditydud yes sure

    • @hesamakbari4314
      @hesamakbari4314 5 лет назад +1

      @@aditydud but unfortunately I deleted the video but I'm going to repost it in 2 days

  • @tylerarnold7526
    @tylerarnold7526 6 лет назад +1

    Helped me in my college engineering course!!! Thank you

  • @kautron
    @kautron 5 лет назад

    Thank you very much for this project. Could you put a video that when the ldr does not detect light, and the sound detection detects sound, then the led lights up. But if the ldr detects light,
    and the sound detection sensor detects sound, then the led does not light up.

  • @achrafmixmix
    @achrafmixmix 7 лет назад

    is there any diffrence btw programming an arduino uno & Leronardo !cuz i wanna try the same thing but with the leanardo arduino ! & why do we need an arduino to do this in the first place .. ?

  • @samtharachan6796
    @samtharachan6796 4 года назад

    I followed your exact sketch and cross checked the connections. I can't find out the problem. When I check the serial monitor, all I see are senseless symbols. Please help

  • @ravenborda6712
    @ravenborda6712 7 лет назад

    How can i combine this with a button? i already have an if function but when the button is pressed then the ldr does not work... thanks

  • @mustafaglnr8780
    @mustafaglnr8780 7 лет назад

    Why did you choose 300 for working rate of LDR?
    Tell some info about the working principle on Arduino codes?
    why did you plug a cable in A0 pin?
    Say sth. about the LDR and Resistor section over board.

  • @SengerMF
    @SengerMF 7 лет назад

    And to use 2 LEDs? Each one with its sensor? How would the scheme look? Thank you very much in advance!

    • @cinhuu
      @cinhuu 7 лет назад

      And to turn off LED when it's dark and turn on when have light, what i need to do?

  • @rodalynpenaranda9539
    @rodalynpenaranda9539 7 лет назад

    Hi. What if I attach about 8 LEDs? I don't know how to program it anymore. Can you help me with it?

  • @xPureStreakz
    @xPureStreakz 6 лет назад

    Question: I noticed the rate at which the serial port was displaying the output was pretty quick. Can this rate of reading the LDR values be increased with a higher baud rate?

    • @paulraymond1804
      @paulraymond1804 5 лет назад

      I don't think so. But why would you want it to display quicker than that? The reading doesn't need to be any where near that fast for a working project anyway.
      I will be building this to control the lights around my building every day, and it will read the light levels just once per minute, and only turn the lights on if the light level has been below the threshold for the last five or ten minutes. Likewise with turning the lights off.

  • @rahimahjofferi3560
    @rahimahjofferi3560 7 лет назад

    Its a great and helpful tutorial, thank you! but what if I want to add 13 more 4.5 lumens of LEDs to the construction to make it brighter? Do you mind helping me how the construction is going to be like? For eg. how many more resistors do I need to add and what are the values for each resistor? Your help and response would be more appreciated!

  • @fadhilhashim
    @fadhilhashim 5 лет назад

    The code is so simple. That is help me to understand how it work!

  • @karthiuthay2607
    @karthiuthay2607 Год назад

    this is the right way to make LDR photoresistors.

  • @michellemurray3245
    @michellemurray3245 7 лет назад

    We tried and the LED did not light up but gave the line Serial.println. Then I changed the ldr status to 1023 and the LED stayed on. Any thoughts as to why?

  • @greenchilley5616
    @greenchilley5616 4 года назад

    Hi, is it possible to dim an RBG LED with a photoresistor on Arduino?
    thanks

  • @mailmeshr15686
    @mailmeshr15686 5 лет назад +2

    How to upload these values on webserver or webpage automatically every 15 or 30 seconds??

  • @RohitKumar-iu3cd
    @RohitKumar-iu3cd 6 лет назад

    I have copied the whole program carefully but contunuesley error is coming that 'AO was not decleared in this scope' please reply me out and help me

  • @MiRRoR220
    @MiRRoR220 4 года назад

    Can anyone tell my why there has to be a resistor after the photoresistor and the wire to ground? Cant the power just go into analog in?

  • @arbaaz07
    @arbaaz07 4 года назад

    What do I add to the code if I want it to blink while not being covered?

  • @mirosorduno1796
    @mirosorduno1796 7 лет назад

    Does it also works if I use an Arduino Leonardo instead of Arduino UNO?

  • @dhyanasaiyelamanchili4495
    @dhyanasaiyelamanchili4495 5 лет назад

    Could you please make a video of how to make the LED turn on when there is light and turn it off when the LDR detects darkness?

  • @basiliosaucedo2513
    @basiliosaucedo2513 5 лет назад

    Tienes la simulación en proteus, o la placas?

  • @mitsuhatohrusoma5360
    @mitsuhatohrusoma5360 7 лет назад

    Hi. I just found about this amazing video po of yours. Can I ask po why is it 300? The reason I ask is, the first time I run the program using ldr, the monitor prints.. 1023.. what is the difference between putting 300 and 1023 in the condition? sorry for the disturbance sir.

  • @koshakprontix5821
    @koshakprontix5821 5 лет назад +1

    my led is always off for some reason. do you know why?

    • @neoline5831
      @neoline5831 5 лет назад

      sometimes its Always off but i fixed it by removing all components and reassembling them , then re upload the code

    • @frolicswithyajat4057
      @frolicswithyajat4057 4 года назад

      Same but a bit glown

  • @gabrieloentoro3802
    @gabrieloentoro3802 7 лет назад

    I'm new to arduino. Does analogRead(ldrPin) read the voltage or the current?

    • @hesamakbari4314
      @hesamakbari4314 5 лет назад

      analog pins divide 5 into 1024. and according to the input voltage ,it shows you some results(numbers).

  • @antoinesfeir4769
    @antoinesfeir4769 Год назад

    My LDR status just keeps returning 0. Would be from my wiring?

  • @hasrettv6904
    @hasrettv6904 6 лет назад

    Selam hocam elinize sağlık çok güzel ancak birde bunun tersini yapmanız mümkünmü aceba işıgi görünce yanacak karanlıkta sönecek

  • @dilawarali5390
    @dilawarali5390 4 года назад

    LDRStatus is the voltage or resistance of LDR?? kindly help me

  • @sangitasrivastava172
    @sangitasrivastava172 7 лет назад

    Followed the same steps, but led is always on even when I've focused a torch to the ldr. Please help Mert

    • @heshan_d
      @heshan_d 4 года назад

      Same happened to me.maybe your code has a fault."

  • @prashantgunjal5566
    @prashantgunjal5566 4 года назад +1

    bro u hve very cool videos suoerb videos just make yourself audible to make it extra cool

  • @wellnessstudioevexia
    @wellnessstudioevexia 7 лет назад

    you are awesome.can you connect the led strip with this method?

  • @edwincontreras7457
    @edwincontreras7457 7 лет назад

    uh, I think i made something wrong but, I have no idea what it is. Pls help (I'm trying to control two LEDs at the same time)
    //set pin numbers
    //constant won't change
    const int ledPin = 13;//the number of the LED pin
    const int ledPin_2 = 10; // the number of the second LED pin
    const int ldrPin = A0; //the number of the LDR pin
    void setup () {
    Serial.begin (9600);
    pinMode (ledpin, OUTPUT); //initialize the LED pin as an output
    pinMode (ledPin_2, OUTPUT); //initialize the second LED as an output
    pinMode (ldrpin, INPUT); //initialize the LDR pin as an input
    }
    void loop (){
    int ldrStatus = analogRead (ldrPin); //read the status of the LDR value
    //check if the LDR status is

  • @Jevinrandhawa
    @Jevinrandhawa 7 лет назад

    I have an ldr sensor board, can I still do this?

  • @guneshgupta
    @guneshgupta 6 лет назад

    Which video making software do you use

  • @lassekluth8279
    @lassekluth8279 4 года назад +2

    thank you, thats the solution for my projeckt

  • @didemeczanesi6312
    @didemeczanesi6312 6 лет назад +1

    Ithınk You are the best youtuber

  • @MAMPIism
    @MAMPIism 6 лет назад

    Can we use 470 and 1k ohm resistors instead of the ones mentioned

  • @oleksiylevenets8957
    @oleksiylevenets8957 6 лет назад

    а як зробити коли світло - показує зеленим, а коли темно - червоним?

  • @likithagowda7813
    @likithagowda7813 4 года назад

    Sir can we light 2 LEDs?
    If yes then the connection should be series or parallel?

    • @rb0317
      @rb0317 2 года назад

      Mine worked in parallel

  • @paraskhosla9622
    @paraskhosla9622 4 года назад

    how to fade rgb led with ldr not on and off just fade?

  • @hyuwooshinely4541
    @hyuwooshinely4541 6 лет назад

    any one can answer me? may LED still working even though its not dark

  • @UcanKanatsizPenguen
    @UcanKanatsizPenguen 5 лет назад

    will it explode if a use 330 r instead?

  • @tiagoabreu3488
    @tiagoabreu3488 5 лет назад +1

    what's the meaning of the 300?

    • @neoline5831
      @neoline5831 5 лет назад

      the meaning of the three hundred is the value of light that the LDR needs to turn led on, if u want it to be more sensitive u just decrease the values

  • @tangopies
    @tangopies 7 лет назад +3

    Good tutorial and I find this music very enjoyable :-)

  • @molandap3041
    @molandap3041 2 года назад

    why we use 10k resistor on ldr?

  • @ManharArt
    @ManharArt 6 лет назад +4

    Please give circuit diagram

  • @dipl.-psych.alfonskaseberg1768
    @dipl.-psych.alfonskaseberg1768 4 года назад

    Awesome, it worked!!!
    If i could understand what I'm writing down, that would be awesome. :D

  • @gulsunyazsoydan4372
    @gulsunyazsoydan4372 Год назад +1

    I wish I was the arduino console you were typing to

  • @karthiuthay2607
    @karthiuthay2607 Год назад +1

    Attach wires to short legs!

  • @gtarpclips-cortes
    @gtarpclips-cortes 5 лет назад

    how can I do to turn on more led's?

  • @frolicswithyajat4057
    @frolicswithyajat4057 4 года назад

    Sorry but its not working for some reason I tried different project before this but still can't do it bruh 😐😐

  • @dattatrayamote4173
    @dattatrayamote4173 7 лет назад

    what is logic behind (ldr status

    • @victor7777
      @victor7777 7 лет назад +3

      The LDR sends values to arduino from 0 to 1023, being 0 a state of complete darkness and 1023 the maximum brightness. Therefore anything below 300 is considered dark enough in this case, but you can set the range higher or lower. If you want to see in the serial monitor the values that the LDR is registering you can add this line to the code:
      Serial.println(ldrStatus);

    • @victor7777
      @victor7777 7 лет назад +1

      //Here's the Code:
      const int ledPin = 13;
      const int ldrPin = A0;
      void setup() {
      Serial.begin(9600);
      pinMode(ledPin, OUTPUT);
      pinMode(ldrPin, INPUT);
      }
      void loop() {
      int ldrStatus = analogRead(ldrPin);
      if (ldrStatus

    • @eaglejvjv
      @eaglejvjv 5 лет назад +1

      @@victor7777 Thanks being able to see the value solved my problem as well. found that different ldr register different readings!

    • @saifulhaqi6524
      @saifulhaqi6524 4 года назад +1

      @@victor7777 thank you soo much man

  • @mohammadmoinuddinansari8462
    @mohammadmoinuddinansari8462 6 лет назад

    From where all these components can be purchased ,.

  • @rmznkay
    @rmznkay 6 лет назад

    Hocam ben şerit led i naısl bu sistemde kullanabilirim

  • @muburning
    @muburning 7 лет назад

    my LED keeps turning on and off ? what is the problem

    • @colinbouwer5738
      @colinbouwer5738 7 лет назад +1

      It'll probably have some kind of trouble determining if it's dark or light, so then every little light beacon will trigger the LDR. Try to do this in a lighter space.

  • @mohamedlhachimi2933
    @mohamedlhachimi2933 3 года назад +1

    my ldr have black lines but all the world have ldr with red lines

  • @youssefkhaled6598
    @youssefkhaled6598 6 лет назад

    can it work with switch case

  • @AbhaySingh-wi3op
    @AbhaySingh-wi3op 6 лет назад

    Can we put 100 k resister

  • @yogabayuangganapratama
    @yogabayuangganapratama 5 лет назад +1

    nice video. thanks for the tutorial

  • @djmcg83
    @djmcg83 4 года назад

    Could You add schematic of connections.

  • @awinoebbie701
    @awinoebbie701 3 года назад

    thanks for this it worked like a charm

  • @nosoychiefkeef3141
    @nosoychiefkeef3141 7 лет назад

    Sorry, what does ldrstatus

  • @TrungTran-hw7ws
    @TrungTran-hw7ws 7 лет назад

    why we need 10kohm resistor before go to GND? anyone can explain to me? tks

    • @cabelodomato
      @cabelodomato 7 лет назад +1

      I wondered about the same thing. Isn't it useless?

    • @TrungTran-hw7ws
      @TrungTran-hw7ws 7 лет назад

      tks god :D there is someone think like me

    • @Ragran
      @Ragran 6 лет назад +1

      its because actually electrons are moving from negative to positive pole

    • @TrungTran-hw7ws
      @TrungTran-hw7ws 6 лет назад

      the same for the LED right? we should put a resistor before going to GND... i think so

    • @TrungTran-hw7ws
      @TrungTran-hw7ws 6 лет назад

      sometimes i see them put a resistor form 5V -> resistor -> positive pole of the LED :/

  • @jack16041
    @jack16041 7 лет назад

    Can i use 221k and 11k Resistors... Rply fast

  • @ameshisithumini6170
    @ameshisithumini6170 5 лет назад

    this video was really helpful!!!!

  • @khimroy3958
    @khimroy3958 Месяц назад

    Nice project 👽👍

  • @swarajprojects78
    @swarajprojects78 7 лет назад

    what is LDR

  • @PriyankaMC-cn7vp
    @PriyankaMC-cn7vp Год назад

    For this how to connect PIR sensor

  • @Prompt24
    @Prompt24 7 лет назад

    Please provide schematic in Fritzing, it would be so nice.

  • @aaronhamilton8997
    @aaronhamilton8997 6 лет назад

    what's the purpose of 10k resistor?

  • @mingyukim22
    @mingyukim22 5 лет назад

    Can I do this without a breadboard?

  • @GinnHardcore
    @GinnHardcore 5 лет назад

    Can I put a transformer one end and a 2.9 billions ohm resistor with a 2 hydra jumper cables.... some of these comments are awesome

  • @CrazyCoupleDIY
    @CrazyCoupleDIY 7 лет назад

    Thanks mate, really helpful

  • @Aiyaleee
    @Aiyaleee 7 лет назад

    is the code possible to run in arduino mega? :)
    thanks :)

    • @sazyt
      @sazyt 5 лет назад

      Yes

  • @smoothy2736
    @smoothy2736 6 лет назад

    My led got very dim ...plz help

  • @vnctv6810
    @vnctv6810 4 года назад

    did anyone tried to combine this with solar tracker?

  • @amx_mothduckrto2199
    @amx_mothduckrto2199 6 лет назад

    my LED was off when it's dark, but on when it's not dark,
    weird :/

    • @hesamakbari4314
      @hesamakbari4314 5 лет назад

      connect the 5v to LDR not the gnd. and connect the the gnd to the other resistor

  • @RixtronixLAB
    @RixtronixLAB 2 года назад

    Creative video, thanks for sharing :)

  • @padmanabhanrajesh2366
    @padmanabhanrajesh2366 6 лет назад +1

    Superb bro,works pretty well.

    • @MAMPIism
      @MAMPIism 6 лет назад

      Can we use 470 ohm and 1k ohm resistor instead of the ones mentioned??

  • @JelleRuben
    @JelleRuben 6 лет назад

    Realy I love your video's.

  • @gurindersinghmann6241
    @gurindersinghmann6241 5 лет назад

    in my case it is on all time help

  • @obaidsiddiqui4362
    @obaidsiddiqui4362 4 года назад

    Nice project but i want to turn on the lights as the sunsets and automatically turn them off after 3 hours any idea how it can be done

  • @Deb22
    @Deb22 6 лет назад

    i think you should add buzzer to it