Diy Mood lamp

Discussion in 'The Projects Forum' started by mentaaal, Dec 16, 2007.

  1. mentaaal

    Thread Starter Senior Member

    Oct 17, 2005
    451
    0
    Hey guys, i decided to try and make this mood lamp:
    http://tobe.nimio.info/led_mood_lamp.php
    All the details regarding this project are at the same page.
    I got it all together, i programmed the pic with the included hex file but i did use a different rgb led. I used this one: http://www.maplin.co.uk/Module.aspx?ModuleNo=35893&criteria=rgb led&doy=16m12
    The problem is when i tried to use it, the led would come on but bbaaaaaarely on. Like just about visible at a few inches away. Then when i turn of the PSU the leds flash on briefly. I took my multimeter and measured the voltage coming out of the output pins of the pic and they measure in the millivolts (i think around 400 millivolts cant really remember) So i think that that is the problem as the voltage coming out of the pic should be at least .7 volts to turn on the transistors right? Also i used bc548 transistors. Anyone have any ideas or suggestions for me?

    Thanks alot,
    Greg
     
  2. cumesoftware

    Senior Member

    Apr 27, 2007
    1,330
    10
    What seems strange to me is that there are no base resistors connected to the transistors. Thus, the transistors may be over-saturated and almost no current will flow to the collector. Ideally, the current flowing through the base should be at least 10 times smaller than the current flowing through the colector. Also, the base voltage should be greater than 0.6V so the transistor starts conducting.

    A program error might be the cause too, because these 16F628 outputs are the outputs of DACs. Perhaps the most significant bits at these outputs are not changing for some reason. Did you checked your program?
     
  3. beenthere

    Retired Moderator

    Apr 20, 2004
    15,815
    282
    It may be that the mood lamp uses PWM to control the apparent intensity of the LED's. The lack of current limiting resistors in the base circuit of the transistors is a concern - after going into conduction, a transistor has effectively no resistance and can "eat" the source.

    Any old NPN transistor that is rated for switching will do. But base resistors are absolutely necessary. If the Microcontroller is running on 5 volts, something like 300 ohms should be about right.

    As a quick test of your transistors, open up the path to the base from the microcontroller. Put 5 volts to the base of each transistor through a 300 ohm resistor (300, 330, or 360 will do) and see if the LED comes on at full intensity.

    If so, the transistor is good, and the microcontroller may have had the associated output pin fail from sourcing too much current.
     
  4. mentaaal

    Thread Starter Senior Member

    Oct 17, 2005
    451
    0
    excellent thanks alot for that guys i will give it a shot and let you know how i get on. and to answer that question i havent checked the code because frankly i dont know how to code we only start learning c next semester :)
     
  5. mentaaal

    Thread Starter Senior Member

    Oct 17, 2005
    451
    0
    Ok i did as you guys suggested and stuck in some resistors between the outputs of the pic and the bases of the trannies. i isoloated the pic outputs and tried the 5 volts at the base through the 300 (330 is what i am using) and the trannies work because the rgb led lit up with a nice white (although with a blue tinge)

    But something altogether crazy happens.... when i touch the resistors with the multimeter's probes the led's go brighter (this is after i have put the outputs back into the circuit and tried it again. i even touched the resistors with my finger and the leds go brighter (they are still barely on normally)

    Could someone explain this? Does it have something to do with capacitance? OH yeah i tried measuring the frequency of the output with my multimeter and when i just apply one probe to the output of the pic to get the frequency (50 hertz) how is this possible?

    So then would you think that i have messed up the pic by not using resistors on the outputs? i will try another pic maybe tomorrow then in that case.
     
  6. mentaaal

    Thread Starter Senior Member

    Oct 17, 2005
    451
    0
    please excuse my ignorance here but when you overdrive a transistor, the collector wont allow current to be drawn? so when you overdrive a transistor it can behave almost like its in cutoff? How is this possoble? I was taught to believe that when the transistor is in saturation, very little voltage is dropped across it, allowing most of the voltage to be dropped across the load. Again please excuse the ignorance but transistors have been very badly taught to us thus far ( without even really explaining the transistor we have been given hybrid parameter models without any experience with transistors whatsoever)

    Thanks,
    Greg
     
  7. cumesoftware

    Senior Member

    Apr 27, 2007
    1,330
    10
    It is really possible. Test is yourself. The practical effect is a cut-off, but what really happens is that almost all the current is drawn to the base.

    Ah! The faults of teaching!
    Well, most of the teachers are theorists and don't want to recognize the importance of practice. They dream about a perfect world that obeys perfectly to the man made laws of physics, and then they extrapolate it to the real world.

    What happens is that the transistors are not in saturation anymore. They are over saturated.
     
  8. mentaaal

    Thread Starter Senior Member

    Oct 17, 2005
    451
    0
    thats crazy stuff! hey did you by any chance read my second last post? i could really use your opinion on that one! why the hell does touching the resistor with my finger make the led suddenly light???? and i am definitely not making a faulty connection because the resistors are really in there and i only have to just barely touch the metal on the resistor for this to occur
     
  9. cumesoftware

    Senior Member

    Apr 27, 2007
    1,330
    10
    The 330Ohm resistor seems to small for me. It may happen that the transistor is still being over driven, and it may explain the fact why touching the base resistors would make the LED brighter. My explanation it that you are grounding the resistors when you touch them, dropping the potential on that point, and so less current flows through the base, almost canceling the over saturation effect. I would suggest a 950Ohm resistor, if the LEDs are actually being driven at 50mA (R = (5V - 0.6V) / 0.005A = 880Ohm).

    Remember that to safely drive a transistor in the saturation zone Ib < 10 x Ic, but that is a rule of thumb for most transistors that guarantees that over saturation will never occur. Beyond that, the behavior will be unpredictable, like in your case. It seems to me that the author had the luck of never coming across with this problem (or he did came across, but omitted/ignored the problem), but is just a matter of luck, with no guarantees.

    One thing that seems odd to me are the values of the LED resistors. Shouldn't the blue LED, the LED with the most voltage drop across, be the one with the smallest value resistor?
     
  10. mentaaal

    Thread Starter Senior Member

    Oct 17, 2005
    451
    0
    but how can i be grounding the resistor when i am only touching the board at one point? sure thing i will try increasing the resistors and let you know if anything happens
     
  11. cumesoftware

    Senior Member

    Apr 27, 2007
    1,330
    10
    The ground path of it is the one with the biggest surface, and so has the best chance of having contact with your hand by electrostatic interference. It happens a lot, and with the circuits I've assembled, the tendency is always grounding, even if I'm touching it with one finger.
     
  12. mentaaal

    Thread Starter Senior Member

    Oct 17, 2005
    451
    0
    oh ok cool so what you are saying is that for my multimeter example, the other end of the multimeter was coupled wirelessly to the ground terminal such that i didnt have to touch the other end physically to the ground? woah!
     
  13. cumesoftware

    Senior Member

    Apr 27, 2007
    1,330
    10
    That is how I explain this phenomenon that happened to me lots of times, but might not be the correct explanation.

    By the way, how is the lamp working? Did you tried resistors with a higher value connected to the bases? If so, is the lamp brighter that way?
     
  14. mentaaal

    Thread Starter Senior Member

    Oct 17, 2005
    451
    0
    Well, i have done all this on a breadboard, i did as you suggested and stuck some 900 odd resistors. I tried a different pic as well for good measure and it does something :confused: I think that the problem at the moment is that there is a pin on the pic not making proper contact or something because when i push the pic down with my finger the lights dont come on at all but when i just tap it the light comes on and is sometimes different colours. Dont really understand when i push the pic in it should work but it doesnt. I guess it was a bad idea to try this in the first place particularly as i know practically nothing about pics or their programming for that matter. But hey thanks loads for all your help. In my opinion it was better for it to have not worked because i have learnt too more things about it that i never knew before. Would you know of a different rgb light project at all? One that is perhaps a bit more reliable? Now dont go looking for one, i can do that myself its that if you know one off the top of your head.

    I will give this project one more crack tomorrow and post up the results.

    Cheers!
     
  15. cumesoftware

    Senior Member

    Apr 27, 2007
    1,330
    10
    If you are using a breadboard, probably pushing the IC will turn the problem more severe. You should test your breadboard, and perhaps, buy a new one.

    About the project, it seems to be reliable for me. Except for the lack of resistors (and for the excess of switches - I would take those out) I would give 5 stars to it. It seems a motivating project for me as well. I don't know other RGB projects. If you are worried about the transistors, don't be. It is a common way to drive a high power LED.
     
  16. Audioguru

    New Member

    Dec 20, 2007
    9,411
    896
    Hi Folks,
    This is my first post here. I have thousands of posts on other websites' forums.

    The author of the Mood Lamp project made a mistake and did not include series resistors for the bases of the transistors.
    The max allowed output current of a PIC is 25mA and without resistors then about 60mA will flow. People on the author's forum reported that their PIC got so hot it stopped or burned out.

    At www.electronics-lab.com the author posted a revised circuit with 10k series base resistors that are far too high. For adequate base current then 680 ohms should be used.

    The project has the current-limiting resistors for the colours mixed up. The red LED will have a max current of 553mA (its max allowed current is 350mA) and the blue one has hardly any current. People on the author's forum reported that their red LED burned out.

    The project uses BC337 transistors that have a max allowed current of 800mA. Greg on the first page of this thread used BC548 transistors which have a max allowed current of only 100mA.

    Greg also used an RGB LED that has about 1/10th of the max allowed current that the author used. Greg's PIC, transistors and LED are probably all fried.
     
  17. cumesoftware

    Senior Member

    Apr 27, 2007
    1,330
    10
    680Ohm seems to be too low, according to the calculation I've previously made. Then again, I assumed a LED current of 50mA. What is the value of this current according to the author. I can't find that LED datasheet anywhere.

    Also, isn't strange that the LED protection resistors are in the wrong place? Shouldn't have the red LED the highest value resistor and the blue one the lowest?

    A good rule of thumb: always triple check your project. Even though, it happened to me. Just see what happened with my adjustable power supplies.
     
  18. Audioguru

    New Member

    Dec 20, 2007
    9,411
    896
  19. cumesoftware

    Senior Member

    Apr 27, 2007
    1,330
    10
    Being that the case...

    Now, interesting what this guy said when answering back to you:
    Arguing against the existence of base resistors!? As if they were not necessary!? They are essential!

    Then again, we should expect funny arguments!
     
  20. mentaaal

    Thread Starter Senior Member

    Oct 17, 2005
    451
    0
    OK as you guys are putting so much effort into helping me with this project i can at least do the same. I removed the outputs from the pic and left them floating. I measured the voltage between these outputs and ground and the voltage is around 950 mV. When i reconnect the outputs to their respective base resistors then the voltage between the outputs and ground falls to 300 odd mV?? I originally had the pic in a recepticle in the breadboard so i removed it from that and stuck it into the breadboard on its own and whilst the project was off i measured the resistance between pins on the pic and the connections and checked for continuity and it seems fine.... one thought has occurred to me though, the unused pins on the pic have been left floating. Should these be tied to either +5 volts or 0 volts? Or is it ok to leave them floating?
     
Loading...