Author
Topic: LED not coming on $50 robot (Read 1991 times)

I've built the $50 robot circuit using admin's sire diagram for the 9V/4.8V battery combo. I'm using the atmega328p and the isp mkII programmer with avr studio v.4.18 and WinAVR-20100110. I wanted to test my setup before altering the servos. I am able to connect to and program the atmega328p without errors. I've written a simple program using the SoR_Utils.h header file and the LED_on() function. My source code and the makefile generated by avr studio are below. Also, I had some trouble programming the chip after it had already been successful several times, but it started working again after I got the chip to go deeper into the socket. I've pushed on it with moderate pressure, but I'm still wondering if it is all the way in the socket. I'm not sure if it's normal, but I had to bend the pins to get them into the socket at all. Here's an image of my mcu. Can someone tell me if it's not in all the way or if there is a problem with my source code? Thanks!... ok I need to figure out how to post the image... still, here's the source code:

#include "SoR_Utils.h"

int main(void){ configure_ports(); LED_on(); while(1){ } return 0; }

makefile:################################################################################ Makefile for the project LED_On###############################################################################

Everything's working now. Somehow, I had connected the lead of the LED that should have gone to ground to my servo power bus. I'm glad nothing got broken, and now I can turn the LED on and off and all that, although, when I write a blinking LED program, my cycles/second are different than what admin proposes in the SoR_utils.h file. Is that weird?

Crunchy, I can't get a picture right now, but looking at the original tutorial, both the schematic and the pictures shows one of the leads on the led attached to AVCC. I'm not sure how that was supposed to work. I desoldered that lead and soldered it to GND, one pin above/below, and now my led works great. Is the tutorial correct?

Looking around the forum for $50 robot LED issues, I'm finding plenty of people saying that the port should be brought low, but I just don't understand how that works... One side of the LED circuit must have positive voltage, and the other side must get to negative ground, right? The LED being connected to GND and the pin through the resistor is working on mine...

So if the ATMega pin is low (gnd) then current flows through the LED and it lights. If the ATMega pin is high (5v) then no current flows and the LED is off.

The reason for doing it this way around is the processors are much better at sinking current (ie being the place where the current flows into) than they are at sourcing current (ie being the place where the current flows from).

The common problem, therefore, is that most people ASSUME that it is wired like this:-ATMega pin ------- LED ---- resistor ------ GndWhich increases the chances of blowing the ATMega pin if the resistor doesn't limit the current.

Based on this assumption:- then a lot of people end up connected the LED the wrong way around and hence it NEVER lights.

I see... So, my LED was not turning on because I had the leadsbackwards. I didn't realize that a pin brought low was connected to ground. I'm starting to get it a little better, now. Thanks. (Should I switch the LED leads now, or leave it so that the pin is the source, since it hasn't blown out so far...? Thanks, again...)

The reason for doing it this way around is the processors are much better at sinking current (ie being the place where the current flows into) than they are at sourcing current (ie being the place where the current flows from).

Where did you get the information that processors are better at sinking than they are at sourcing? Every Atmega datasheet I've ever read has given a max current rating for IO pins, and not specified whether this is sinking or sourcing.