Go Down

Topic: Will this capacitor damage my output pin? (Read 1 time) previous topic - next topic

Nick Gammon


... running from 2xAA cells, using 1MHz RC oscillator for system clock ...


Hmm, can you do that? How did you wire that up, to save me straining my brain any more today?
http://www.gammon.com.au/electronics

dc42


But that isn't pins A4 or A5. It seems as if somehow the I2C pull-up current is somehow working its way through the DS1307 chip, and making itself felt at the Vcc pin. Well that's weird.


The I2C pins probably have internal protection diodes, anode to the pin, cathode to Vcc. So I expect you will find that the voltage on the I2C pins is about 0.6v higher than the voltage on that Vcc pin.
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

Jack Christensen

#17
Jan 28, 2012, 11:08 pm Last Edit: Jan 28, 2012, 11:10 pm by Jack Christensen Reason: 1


... running from 2xAA cells, using 1MHz RC oscillator for system clock ...


Hmm, can you do that? How did you wire that up, to save me straining my brain any more today?


Hi Nick, circuit attached below. I call it a "night light" because the sketch includes an algorithm that calculates sunrise and sunset time, and turns the LED on at sunset and off at sunrise.

Say, regarding the capacitor issue, I think it's a very interesting question, and I'd be willing to sacrifice an ATmega328P if you'd like to discuss a test protocol and circuit. I suppose we could cycle the pin hundreds if not thousands of times per second, so shouldn't be a terribly lengthy test.

MCP79411/12 RTC ... "One Million Ohms" ATtiny kit ... available at http://www.tindie.com/stores/JChristensen/

Techone

@Jack Christensen

Nice and simple project. Do you have a code to share ?  That will be nice.

Jack Christensen


@Jack Christensen

Nice and simple project. Do you have a code to share ?  That will be nice.


Hi Techone,

Yes, I'll be glad to share code as well, I'm still tweaking it a bit though. I'm working on a blog post which will describe the code as well as the circuit. I'm not sure that it's a terribly "practical" project, but it does demonstrate several interesting features, and so I found it educational if nothing else!

Give me a few days and I'll let you know when I've got the post complete.
MCP79411/12 RTC ... "One Million Ohms" ATtiny kit ... available at http://www.tindie.com/stores/JChristensen/

Nick Gammon


Hi Nick, circuit attached below. I call it a "night light" because the sketch includes an algorithm that calculates sunrise and sunset time, and turns the LED on at sunset and off at sunrise.


Thanks, Jack! But where's the 1 MHz RC oscillator? You seem to be using a 32.768 KHz crystal.


Say, regarding the capacitor issue, I think it's a very interesting question, and I'd be willing to sacrifice an ATmega328P if you'd like to discuss a test protocol and circuit. I suppose we could cycle the pin hundreds if not thousands of times per second, so shouldn't be a terribly lengthy test.


I'm not sure what that would prove, though. Basically the pins fail because of physical things (like, getting too hot). So cycling the capacitor thousands of times a second would put a totally different strain on the output circuit, compared to doing it once a minute (when it gets a chance to cool down).

I'm happy with the resistor, the capacitor seems to charge within a microsecond as far as I can tell, so it hardly introduces a lengthy delay. And as a general principle (eg. for a radio transmitter board) it is probably better to be safe than sorry.
http://www.gammon.com.au/electronics

Jack Christensen



Hi Nick, circuit attached below. I call it a "night light" because the sketch includes an algorithm that calculates sunrise and sunset time, and turns the LED on at sunset and off at sunrise.


Thanks, Jack! But where's the 1 MHz RC oscillator? You seem to be using a 32.768 KHz crystal.


Right, but the 32kHz crystal is only clocking Timer2, and the internal RC oscillator, set to 1MHz, is the system clock. Pretty cool, eh! Fuses are: lfuse=0x62, hfuse=0xD6, efuse=0x06, and then Timer2 is configured with

Code: [Select]
    TIMSK2 = 0;                        //stop timer2 interrupts while we set up
    ASSR = _BV(AS2);                   //Timer/Counter2 clocked from external crystal
    TCCR2A = 0;                        //override arduino settings, ensure WGM mode 0 (normal mode)
    TCCR2B = _BV(CS22) | _BV(CS21) | _BV(CS20);    //prescaler clk/1024 -- TCNT2 will overflow once every 8 seconds
    TCNT2 = 0;                         //start the timer at zero
    while (ASSR & (_BV(TCN2UB) | _BV(TCR2AUB) | _BV(TCR2BUB))) {}    //wait for the registers to be updated   
    TIFR2 = _BV(OCF2B) | _BV(OCF2A) | _BV(TOV2);                     //clear the interrupt flags
    TIMSK2 = _BV(TOIE2);               //enable interrupt on overflow



Say, regarding the capacitor issue, I think it's a very interesting question, and I'd be willing to sacrifice an ATmega328P if you'd like to discuss a test protocol and circuit. I suppose we could cycle the pin hundreds if not thousands of times per second, so shouldn't be a terribly lengthy test.


I'm not sure what that would prove, though. Basically the pins fail because of physical things (like, getting too hot). So cycling the capacitor thousands of times a second would put a totally different strain on the output circuit, compared to doing it once a minute (when it gets a chance to cool down).

I'm happy with the resistor, the capacitor seems to charge within a microsecond as far as I can tell, so it hardly introduces a lengthy delay. And as a general principle (eg. for a radio transmitter board) it is probably better to be safe than sorry.


Well, I'd be interested to know if a 100nF capacitive load is ultimately a harmful thing. So I was thinking we could wire it up, cycle the pin a lot of times, and see whether it fails after some large number of iterations.
MCP79411/12 RTC ... "One Million Ohms" ATtiny kit ... available at http://www.tindie.com/stores/JChristensen/

Nick Gammon


Right, but the 32kHz crystal is only clocking Timer2, and the internal RC oscillator, set to 1MHz, is the system clock. Pretty cool, eh!


<Boggle>!  Well let me test that ...


Well, I'd be interested to know if a 100nF capacitive load is ultimately a harmful thing. So I was thinking we could wire it up, cycle the pin a lot of times, and see whether it fails after some large number of iterations.


Well I suppose if it doesn't fail, that certainly proves something!

Something like the radio circuit:

http://www.gammon.com.au/forum/?id=11508

But it could be anything that cycles the pin, say, every microsecond. Too quickly and it doesn't have to work as hard.
http://www.gammon.com.au/electronics

Nick Gammon


... the internal RC oscillator, set to 1MHz, is the system clock.


Oh I see now. You are using the 8MHz internal clock and setting the "divide by 8" fuse bit.
http://www.gammon.com.au/electronics

Jack Christensen



... the internal RC oscillator, set to 1MHz, is the system clock.


Oh I see now. You are using the 8MHz internal clock and setting the "divide by 8" fuse bit.


Right, basically the same as the factory default. Or program the CKDIV8 bit and have an 8MHz system clock.
MCP79411/12 RTC ... "One Million Ohms" ATtiny kit ... available at http://www.tindie.com/stores/JChristensen/

Go Up