Shop OBEX P1 Docs P2 Docs Learn Events
Help needed regarding LED — Parallax Forums

Help needed regarding LED

christineeechristineee Posts: 17
edited 2013-06-26 06:45 in General Discussion
I am in need of help for my school project!
I am working on a project to adjust the LED brightness automatically according to light level detected in the surrounding. I want to enhance my circuit so that it can light up 70% of the brightness in low light and 100% brightness in no light surrounding.
Right now, i am done with the part whereby my circuit is able to turn on when there's little/no light in the surrounding and turn off when the circuit detect light
Would like to know if there's any way if i could use basic stamp programming to program my circuit to adjust the brightness according to the light level?
Or do i really have to use PWM to do the work?
Thanks in advance.

Comments

  • kwinnkwinn Posts: 8,697
    edited 2013-06-25 20:14
    You really do need to use PWM to adjust the brightness. You also need to be able to measure the light level to determine the brightness level for the LED.
  • kwinnkwinn Posts: 8,697
    edited 2013-06-25 20:16
    Can you post a little more detail/circuit diagram about what you are doing now?
  • christineeechristineee Posts: 17
    edited 2013-06-25 22:09
    testing circuit 5.jpg
    schematic of testing circuit 5.jpg


    I have uploaded a picture of my codes and the schematic diagram.
    746 x 645 - 85K
  • christineeechristineee Posts: 17
    edited 2013-06-25 22:11
    kwinn wrote: »
    You also need to be able to measure the light level to determine the brightness level for the LED.

    i have note down the measurements of the light level. :smile:

    turn on 4000
    turn off 168
  • davejamesdavejames Posts: 4,047
    edited 2013-06-25 22:28
    Hello christineee - welcome to the Forum.

    What is the intent of the circuit you posted? Meaning, what do you expect it to do?
    How is the transistor expected to operate? There's nothing connected to the base.
  • christineeechristineee Posts: 17
    edited 2013-06-25 22:54
    davejames wrote: »
    Hello christineee - welcome to the Forum.

    What is the intent of the circuit you posted? Meaning, what do you expect it to do?
    How is the transistor expected to operate? There's nothing connected to the base.

    Hi there.
    Pardon me as i am new to this forum.

    I want to create a circuit that is able to automatically adjust the brightness of an LED according to the amount of light it receives using basic stamp programming.
    For example,
    At night: LED light up to 100% brightness
    Rainy days when there's little light: LED light up to 70% brightness
    Sunny days: LED does not light up

    I have also attach a copy of a mindmap i have come up with and hope it can give you an idea of what i am planning to do.

    Development Of Light Detection System Using Microcontroller Parallax.jpg

    Many thanks.
  • christineeechristineee Posts: 17
    edited 2013-06-25 22:55
    davejames wrote: »
    How is the transistor expected to operate? There's nothing connected to the base.

    As for the transistor i am not sure how to connect the base as i am using a phototransistor and there's only 2 pins.
    Hope you can help me with that.
  • davejamesdavejames Posts: 4,047
    edited 2013-06-25 23:18
    As for the transistor i am not sure how to connect the base as i am using a phototransistor and there's only 2 pins.
    Hope you can help me with that.

    ...oohhhhh - the "transistor" is the light sensor. Sorry, got it.

    I agree with the other posters that mentioned the use of the PWM command to modulate the effective light level produced by the LED. As your code now stands, the LED will either be 'on' or 'off'; nothing in between.

    I would suggest reading up on the PWM command in the BasicStamp help, or in the hard copy Syntax and Reference manual.

    (time for nighty-nite...yawn...)
  • christineeechristineee Posts: 17
    edited 2013-06-25 23:26
    davejames wrote: »
    ...oohhhhh - the "transistor" is the light sensor. Sorry, got it.

    I agree with the other posters that mentioned the use of the PWM command to modulate the effective light level produced by the LED. As your code now stands, the LED will either be 'on' or 'off'; nothing in between.

    I would suggest reading up on the PWM command in the BasicStamp help, or in the hard copy Syntax and Reference manual.

    Thanks for the suggestion.

    By using the PWM command, is it true to say that i am unable to program the circuit to adjust brightness automatically? As from this video (http://www.youtube.com/watch?v=N9ZBd3AcOFc) ,i see that the person is turning a component on the breadboard and i presume that its the potentiometer.
  • prof_brainoprof_braino Posts: 4,313
    edited 2013-06-26 06:15
    By using the PWM command, is it true to say that i am unable to program the circuit to adjust brightness automatically?

    Using thePWM command, the LED brightness can be 100% under program control; if you also detect the light level, the prgram can adjust the LED in relation to the light level, any way you desire.

    I don't know about circuit in the video, but I would guess that your circuit will need a potentiometer to adjusts sensitivity. Even after you figure all the volts and ohms, they will vary by the tolerances, so we tend to need to adjust the analogue part of the circuit.
  • christineeechristineee Posts: 17
    edited 2013-06-26 06:45
    Ahh i see..
    thanks!
Sign In or Register to comment.