Pages: [1]   Go Down
Author Topic: Strange digital pin behaviour  (Read 601 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 40
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I am getting some strange behaviour and trying to figure out what is going wrong. If I connect a LED with 220 ohm resistor to any other pin than pin 13 I am getting very low output, like there is very little current for that pin. I have the pins configured as outputs in software. On pin 13 the LED is bright, on any other pin it is very dim.

I've also tried this with 2 different atmega 168 chips, so the chip itself doesn't appear to be the problem.
« Last Edit: November 20, 2007, 06:12:25 pm by agent_orange » Logged

Daniel
Guest
 Bigger Bigger  Smaller Smaller  Reset Reset

assuming you have written to the pins with the command
digitalWrite(PIN, HIGH), then it should be OK. How do you have it wired?
Is there anything else connected? What's the code you're using?

D
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 40
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I changed the pins to output pins and use digitalWrite(pinNum,HIGH). It seems like the pins can't supply much current. If I have an LED connected on pin 13 it appears dim on one atmega168 and bright on another. Connecting a digital pin through a LED and then a 220 ohm resistor, some appear bright and others appear dim. It's got me stumped whats causing the problem. I'm using a USB arduino NG modified to work as a decimelia. I have the original atmega168 that came with that and also three new ones I burned with decimelia bootloader. All the code works fine, they just don't supply much current.
Logged

SF Bay Area (USA)
Offline Offline
Tesla Member
***
Karma: 106
Posts: 6364
Strongly opinionated, but not official!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

My 168 provides plenty of current.  In this video, the AVR is both sinking and sourcing current on digital IO pins (and there isn't any current limiting resistor)

Are you sure of your resistor value (should be Red, Red, Brown)?  Sometimes a red or orange band will look a lot like brown, and you can't trust whoever threw them in the bin/bag/whatever "for sure."
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 40
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Its nowhere near that bright. I've checked the resistors using a multimeter. I've also checked the voltage using an oscilloscope. Some of the pins appear  bright and some don't. For example, one mega168 will have a bright output on pin 13, the next one won't, it will be quite dim. Even with no current limiting resistor the LED's are dim. I ordered the extra 168's direct from atmel as samples so I can't see that 3 samples would all be bad. I don't know if its something to do with the board itself. I'm thinking of buying a new decimelia and seeing how that is.
« Last Edit: November 22, 2007, 12:42:57 am by agent_orange » Logged

berlin
Offline Offline
Sr. Member
****
Karma: 0
Posts: 293
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

did you check the voltage on your pins and current through the resistor using your multimeter?
you wrote you declared your pins as outputs using pinMode(pinNumber, OUTPUT), right?
if you got your atmegas blank from atmel, you might try to burn the bootloader again (or try another) and have look on the fuse settings if you don't use arduino to burn the bootloader. some pins have internal pull-up/down resistors. i'm no expert on that. but since there are different bootladers available, i can imagine these a reason for the lost power.

another reason might be some short circuit on your modified NG board. but since your writing it affects all boards...

do the pins behave the same trying one chip across different boards? this would hint at an defective atmega or wrong bootloader.

i hope you can track the problem down before ordering a new board. these things tend to happen again and again.

kuk
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 28
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I think I know what was the cause of this.

If you forget to set the LED pin to output, you get that effect. Make sure that this is included in the setup() part of the script:

Code:
 pinMode(ledPin, OUTPUT);

Replace ledPin with whatever the name of your pin is.
Logged

Manchester (England England)
Online Online
Brattain Member
*****
Karma: 504
Posts: 31326
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Looks very likely killerdark but then on the original post he did say:-

Quote
I have the pins configured as outputs in software.

But I agree this would fit the symptoms.
Logged

Califonia, US
Offline Offline
Newbie
*
Karma: 0
Posts: 44
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Can you measure the voltage difference between pin 13 and any of the other digital pins?  Ditto for the +5V line.

One other thing you can try is to use the Blink code on pins besides 13 and see if the dim LEDs turn on an off like they're supposed to.  If they don't you have some bigger problem.

It's strange you mention that with one ATmega chip the pin 13 LED is bright and on others it's dim...
Logged

Cheers!

Pages: [1]   Go Up
Jump to: