NerdKits - electronics education for a digital generation

You are not logged in. [log in]

NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.

Basic Electronics » Voltage throught MCU

March 05, 2012
by oliyn8h9g
oliyn8h9g's Avatar

I have setup the temperature sensor lab and it works fine. So I added a LED on PC5 to light up if the temperature is less then 70 degrees. The program was running fine. I noticed when the LED lights up the temperature goes up by about 2.5 degrees in one case this put the temp above 70 which turned off the light and dropped the temp to below 70. This caused the light to blink.

My question is "Why is the temp going up when the light is on?" I measured the voltage on the temp sensor and it dropped therefore the real voltage is less then the amount used in the calculation for temp. I assume this is a V=IR issue. The resistance of the LED used up some of the available voltage? If I am correct how do I use a sensor that uses Analog to Digital without messing it up when I try to use another part of the MCU? Thanks,

March 05, 2012
by 6ofhalfdozen
6ofhalfdozen's Avatar

Hi Oliyn8h9g!

To my ears this sounds like your battery might be dying. You might also be pulling too much current through your LED, but usually they go poof pretty quickly if that is the case. If the LED feels hot, that is your culprit. Otherwise, check your battery and associated wires.

The long version is that if you battery is weak and putting out somewhat less than 9V(which they do as the battery gets used up), the 7805 will have a harder time putting out 5V with yC + LCD + LED range current. So as the 5Vdc drops, it lowers the Aref to the ADC which would make the temp sensor's output "seem" higher to the ADC and most likely make the LCD dim a little too. Anyhow, check your battery, check your LED, and if that doesn't work, check back here. Hopefully the experts will have good ideas, if the above doesn't work.

March 05, 2012
by hevans
(NerdKits Staff)

hevans's Avatar

Hi oliyn8h9g,

6ofhalfdozen's explanation of what is going on, however I would add that your battery doesn't necessarily have to be weak to cause this problem. All batteries have an internal series resistance that is just inherit to the physics of the battery. When you try to draw current from it the battery voltage will inevitably drop. Driving an LED directly off the MCU like this actually causes a reasonable amount of current to flow, and is not recommended to run like that for a long period of time. My suggestion is to add a current limiting resistor in series with your LED, 300 ohms or so should do it. This will reduce the current through your LEDs (which will make it a bit dimmer), but it should help alleviate the voltage drop.

Humberto

March 05, 2012
by oliyn8h9g
oliyn8h9g's Avatar

Thanks for the suggestions/explanations. I am a programmer trying to understand the electrical part of things. I will try this out.

March 05, 2012
by Ralphxyz
Ralphxyz's Avatar

Also try moving the tempsensor further away from the voltage regulator!

The LM34 is actually very sensitive and lighting the led increases the current (heat) of the voltage regulator.

Ralph

Post a Reply

Please log in to post a reply.

Did you know that NerdKits has been featured on Slashdot, Hack A Day, Hacked Gadgets, the MAKE blog, and other DIY-oriented websites? Learn more...