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.

Project Help and Ideas » LCD fades as LED is lit

August 04, 2011
by edb
edb's Avatar

I am trying to 'fiddle' with the system now that I've completed the basic projects. I'm using the temperature sensor project and combining it with a simple LED flash when the temperature exceeds a set limit. The modifications to the temperature project program are included below. My question, why does the LCD dim (completely) when the LED is on? Can I not run both devices? Does the ADC take too much current to run these together? Capacitor not big enough? Is smoke eminent? The project notes seem to imply that this should work...

Thanks for any insights!

// pin definition DDRB |= (1<<PB5);

int main() {

// original code while(1) { //check temperature and average

  // new code (flash LED on pin 5 of register B):
  if(temp_avg >= tLimit) {
     // turn on LED for 200 msec (tried 500 as well)
     PORTB |= (1<<PB5);

     // turn off LED
     PORTB &= ~(1<<PB5);

  // program continues...
August 04, 2011
by Rick_S
Rick_S's Avatar
  1. Are you using a current limiting resistor on your LED?
  2. Are you running off Battery Power?
  3. Are you using the backlight on your LCD?

If you are not using a current limiting resistor on your LED, use one. For experimentation purpose, you probably don't need to drive the LED at full power and without a current limiting resistor, you are giving it everything the micro-controller is capable of. For my workbench setups, I typically will use a 1k resistor but anything from about 150 ohms up to that should work fine. This will prevent the LED from dropping the voltage so much.

If you are using battery power for your kit, it may be time to upgrade to a wall wart power supply or change the battery. The more you use your kit the more you will find the benefit of an external power supply.

If you are using the backlight for your LCD, you will either want to go with the external supply or disconnect it.


August 04, 2011
by bretm
bretm's Avatar

Make sure you use a current-limiting resistor for the LED (the NerdKits Guide skips that in places), and try a fresh battery.

August 04, 2011
by Rick_S
Rick_S's Avatar

Ha Ha bretm, I was a bit too fast for you. LOL

August 04, 2011
by edb
edb's Avatar

I tried a small resistor, but maybe the wrong type? I'll check into that. It's battery right now but I probably have a dozen wall warts to choose from...

Thanks for the assist, as always!

Post a Reply

Please log in to post a reply.

Did you know that negative numbers are represented in two's complement notation in binary? Learn more...