# LM339 comparator as solar panel switch

1. Jul 20, 2008

### ZPlayer

Hello folks,

I have been trying to make a circuit that would light up an LED when a small solar panel develops a certain voltage. My LED does not light up no matter how I hard I think about the circuit design. I would appreciate any help and suggestions.

Thanks to all.

#### Attached Files:

• ###### LM339_circuit.jpg
File size:
14.9 KB
Views:
226
2. Jul 20, 2008

### Redbelly98

Staff Emeritus
From your circuit, it looks like you want the LED to light up if the solar panel drops below 75 mV. Is that right?

Have you checked the obvious, such as:

Does the LM339 output go high/low when the +input is above/below the - input?

Does the LED work, and is installed with the correct polarity?

3. Jul 21, 2008

### Staff: Mentor

Your polarity is inverted on the inputs to the comparator. Your circuit will only try to light the LED for voltages below the reference, not above.

4. Jul 21, 2008

### ZPlayer

Piezo buzzer

I figured it out and include the updated circuit here. Instead of LED, I got a piezo buzzer. I did not understand LM339, so I used LM741 opamp as comparator instead. The circuit reacts to luminescence within the room and will start piezo buzzer should the light level go over a certain (small) limit. So now I will be waking up with the rise of sun.

However, I had a tough time figuring out how to link the piezo buzzer. Essentially I simply tried different resistor values until the buzzer made audible noise (at 150 Ohm.) I bought the buzzer from Radio Shack (cat. # 273-0053.) On the label, it says: 1.5V-3.0VDC, 15mA and nothing else. In order to calculate the resistor that I have to place in series with the buzzer (to lower the voltage from 6.17V to an acceptable value), I have to know the resistance of the buzzer (load) and/or its power consumption. I have tried using the multimeter for resistance measurement of the piezo buzzer, but it shows "0L." I cannot compute the power consumption of the buzzer or its resistance because only the voltage range (1.5-3.0V), not a single value was given.

So my new question is: suppose you have a device (whatever it is) that you have to link to a DC source of known voltage. The device label gives only a current rating, does not specify the power dissipation and gives a voltage range without specifying the kind of voltage. How should I go about figuring out the resistance of the load and/or power dissipation in order to calculate the resistance that (if placed in series) will allow to drop the supply voltage to an optimal value for the device to operate?

Thanks to all again.

#### Attached Files:

• ###### solar_cell_LM741_trigger.jpg
File size:
18.8 KB
Views:
183
5. Jul 21, 2008

### ZPlayer

Piezo buzzer

I figured it out and include the updated circuit here. Instead of LED, I got a piezo buzzer. I did not understand LM339, so I used LM741 opamp as comparator instead. The circuit reacts to luminescence within the room and will start piezo buzzer should the light level go over a certain (small) limit. So now I will be waking up with the rise of sun.

However, I had a tough time figuring out how to link the piezo buzzer. Essentially I simply tried different resistor values until the buzzer made audible noise (at 150 Ohm.) I bought the buzzer from Radio Shack (cat. # 273-0053.) On the label, it says: 1.5V-3.0VDC, 15mA and nothing else. In order to calculate the resistor that I have to place in series with the buzzer (to lower the voltage from 6.17V to an acceptable value), I have to know the resistance of the buzzer (load) and/or its power consumption. I have tried using the multimeter for resistance measurement of the piezo buzzer, but it shows "0L." I cannot compute the power consumption of the buzzer or its resistance because only the voltage range (1.5-3.0V), not a single value was given.

So my new question is: suppose you have a device (whatever it is) that you have to link to a DC source of known voltage. The device label gives only a current rating, does not specify the power dissipation and gives a voltage range without specifying the kind of voltage. How should I go about figuring out the resistance of the load and/or power dissipation in order to calculate the resistance that (if placed in series) will allow to drop the supply voltage to an optimal value for the device to operate?

Thanks to all again.

6. Jul 21, 2008

### Staff: Mentor

Most likely that buzzer is meant to be connected directly to a power supply with an output voltage of 1.5V to 3.0V, and when connected like that, it will draw no more than the 15mA current consumption advertised. If your power source is 6.17V, the easiest thing is to use a 3.0V 3-terminal linear voltage regulator IC to drop the voltage for the buzzer.

7. Jul 21, 2008

### ZPlayer

But if I have a power supply higher than 3V, then how should I go about figuring out the resistance to drop the voltage from the supply to 3V?

8. Jul 21, 2008

### Staff: Mentor

I'd suggested using a voltage regulator. Just using a resistor would not be reliable enough. The simplest way would be to put a 3V Zener diode in parallel with the buzzer to limit the voltage, and use the dropping resistor to supply the 15mA plus several mA for the Zener. Call it 20mA total, and size the dropping resistor accordingly. Check the standard Zener diode voltages to find a value in the 1.5V to 3.0V range of the buzzer, and then do the resistor calculation.

9. Jul 22, 2008

### Redbelly98

Staff Emeritus
Re: Piezo buzzer

The given specs (eg. 15 mA) could be a just a nominal or maximum value, it's hard to say if they don't say. To figure the resistance, use Ohm's law as a starting point, and then to play it safe try a resistor that gives even lower current or voltage to the device. See how that works, then experiment with other resistors until things work.

You can measure the voltage across the 150 ohms, this will tell you the current through the piezo. ( i=V/150) Might be good to actually measure the resistance of the "150" ohms too, and the piezo voltage.

It's also possible 15 mA is too much for the op amp, so the actual current is less than what you are expecting.

10. Jul 22, 2008

### ZPlayer

New idea: suppose I want the buzzer to stay on once it is switched on. In other words, once the light level in the room goes higher than the threshold, the buzzer goes on and the only way to switch if off is to power-off the whole circuit. What simple modification would allow me to do that?

Thanks to all the folks who respond.

11. Jul 22, 2008

### WiseKensai

There are lots of different ways to hold the state of the circuit. In general though, the technique is called "latching." Wikipedia has a decent article on digital logic latches: http://en.wikipedia.org/wiki/Latch_(electronics)

One easy way is to do it with relays, as described in this thread: https://www.physicsforums.com/showthread.php?t=123692

Here's a page on how to do it with pictures: http://www.eleinmec.com/article.asp?24 (scroll down till you get to the part on Latching Relays)

The term "Latching Relay" can either mean the technique described in the post, or a special kind of relay that holds state mechanically even with the power off (you don't want that one). See Wikipedia's relay page if you're interested though.

If you want to do it with solid-state digital logic latches, see second half of this PDF: http://www.discovercircuits.com/PDF-FILES/4013oneshots.PDF

It doesn't do exactly what you want (i.e. if it gets bright, then dark, then bright again, the buzzer will go off (and you'll have to reverse the polarity on the inputs to your op amp comparator), but it's a good starting point.

Here's something more like what you want, though, using a 555 timer: http://www.eleinmec.com/article.asp?5

Leave the reset button out of the circuit, and replace the trigger button and the 10k resistor above it with the output of the op amp (i.e. hook up the op amp's output to pin 2, and don't include the pullup resistor or the switch). That ought to do what you want, you can leave your current circuit pretty much the same, but you might need to unity-gain buffer the output of the 555 if you don't get enough current (I haven't looked at a 555 datasheet as of late so I don't know what kind of current sourcing you can expect). It's good practice anyway.

Hope this helps.