1
\$\begingroup\$

I am using the MSP430 Launchpad and I have a question regarding photoresistors. The thing is that when you connect a LED with a pin in Launchpad, which you have configured, as output I read that you must use a resistor in series as not to damage the LED. When trying to find how to connect the photoresistor every source said that one must connect a 10kOhm resistor in series as not to damage the Launchpad. Regarding both the LED and the photoresistor as a simple resistor why in the first case we connect the resistor for the protection of the LED and in the second for the protection of the Launchpad? Also why can the Launchpad be damaged by its own voltage? I mean if a pin is configured to input and one tries to use an extremely large voltage then sure it will be damaged, but when you try to use 3.3V generated from its own Vcc whay may be damaged?

\$\endgroup\$
1
\$\begingroup\$

An LED is not a resistor; it does not follow Ohm's law. Basically, once you exceed the drop voltage, it will draw as much current as it can, to the point that it destroys itself. This is what the resistor does: limit the current flowing through to a safe level. Try connecting an LED directly to a 9V battery - it may last long enough to give a visible flash of light before it dies. It may also become hot enough to be uncomfortable to hold.

As for the microcontroller on your Launchpad, again it's not the voltage but the current that will damage it. If you were to connect an output pin to ground and drive it high (or connect it to Vcc and drive it low), you are basically making a short circuit. Excess current will flow through the pin and can burn out the silicon of the chip or the internal wire connecting the silicon to the pin.

For the phototransistor, assuming you connect it only to an input, then the internal resistance of the input pin will greatly limit the current through the phototransistor and input pin. However, since GPIO pins can be programmed to either input or output, it's a good idea to put a current limiting resistor, just in case you accidentally set the pin as an output instead.

\$\endgroup\$
  • \$\begingroup\$ Thank you! Very enlightening! It is exactly what I was asking. \$\endgroup\$ – Adam Nov 2 '14 at 5:46
3
\$\begingroup\$

I think you may be getting confused between the two devices. With an LED a resistor is required to both protect the LED and the MCU's IO pin.

For a photo-resistor (I assume you mean something like an old Cadmium Sulphide Cell?) it is just a resistor which changes its resistance according to the incident light. However, an MCU has no way of directly measuring that resistance, so a second resistor is required to form a Voltage Divider:

schematic

simulate this circuit – Schematic created using CircuitLab

As the light levels change the ratio of resistance between R1 and LDR1 changes, and thus the voltage at the point between them (GPIO in this schematic) will change. The MCU can easily measure that voltage using an analogue input.

The choice of resistor for R1 sets the light sensitivity of the LDR, and also the range of voltages the MCU sees for different light levels. Different LDRs have different resistance ranges, and R1 should be sized to match. You may need to experiment with different values to get the light range you desire.

\$\endgroup\$
2
\$\begingroup\$

MSP430G2 outputs can sink about 40mA from an LED at 3.3V, so a series resistor would be required if the LED was rated for less than this. Also the maximum recommended current for all I/O pins combined is 45mA, so resistors would be required if driving multiple LEDs.

The only restriction on inputs is that the voltage must not go above Vcc or below Vss by more than 0.3V. A photoresistor is typically connected in series with a resistor between Vcc and Vss, so there is no chance of the input voltage exceeding these limits. However a small photoresistor might be damaged if it had a bright light shining on it and the port pin was set to output. Most CDS sensors are rated for 90mW or higher and so should survive such abuse (an MSP430 output can barely manage 2V * 40mA = 80mW).

MSP430G2553 Low Level Output Current

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.