Author Topic: ATtiny output to MOSFET  (Read 10816 times)

0 Members and 2 Guests are viewing this topic.

Offline IvoSTopic starter

  • Frequent Contributor
  • **
  • Posts: 310
  • Country: us
ATtiny output to MOSFET
« on: June 05, 2015, 08:59:07 pm »
From attached schematic, do I need R4, R5 and R14? Is it a good practice to use these resistors to hold the gate down even though the microcontroller output is LOW ?
 

Offline mushroom

  • Regular Contributor
  • *
  • Posts: 123
  • Country: fr
Re: ATtiny output to MOSFET
« Reply #1 on: June 05, 2015, 11:20:37 pm »
These resitors force the gate to LOW if the Attiny outputs are hi impedance (tri state). No ?
 

Offline alsetalokin4017

  • Super Contributor
  • ***
  • Posts: 2055
  • Country: us
Re: ATtiny output to MOSFET
« Reply #2 on: June 05, 2015, 11:42:32 pm »
Yes. It's common practice to have such a resistor, close to the mosfet itself, connected from Gate to Source, to allow the Gate charge to drain off so that the mosfet switches off cleanly and rapidly.
The easiest person to fool is yourself. -- Richard Feynman
 

exapod

  • Guest
Re: ATtiny output to MOSFET
« Reply #3 on: June 05, 2015, 11:53:46 pm »
From attached schematic, do I need R4, R5 and R14? Is it a good practice to use these resistors to hold the gate down even though the microcontroller output is LOW ?


Yes, you should use them to force a defined state when the mcu is not controlling the mosfets.
PS: Don't want to be a smartass but all the capacitor values are "wrong" ex: C3 is 0.1M wich is Mega Farad but i think that the designer meant micro Farad ( uF ).

Edit: just noticed that the reset pin of U5 is not connected, i think you should use a pull-up.
« Last Edit: June 05, 2015, 11:57:40 pm by exapod »
 

Offline IvoSTopic starter

  • Frequent Contributor
  • **
  • Posts: 310
  • Country: us
Re: ATtiny output to MOSFET
« Reply #4 on: June 06, 2015, 01:01:15 am »
Why would it be necessary to use pull up resistor on reset pin when I don't need to reset the micro? Just thinking....
 

exapod

  • Guest
Re: ATtiny output to MOSFET
« Reply #5 on: June 06, 2015, 01:12:33 am »
Why would it be necessary to use pull up resistor on reset pin when I don't need to reset the micro? Just thinking....

The reset pin is a active low so you have to pull the pin high in order to run the micro. i don't have a lot of experience withe the avr micros so read the datasheet carefully.
 

Offline janoc

  • Super Contributor
  • ***
  • Posts: 3781
  • Country: de
Re: ATtiny output to MOSFET
« Reply #6 on: June 06, 2015, 01:17:53 am »
The other reason would be that it is a good practice to put a defined logic level on unused pins - either ground them or pull them high. If you don't, the high impedance input will pick up all kinds of junk "from the air" and the circuitry may oscillate. If nothing else it will increase your current consumption, in the worst case it could prevent the circuit from working.

Now, this doesn't need to be always done externally - many chips (including that AVR, just not sure whether for reset pin too) have integrated pull-up/pull-down resistors - use them!

 

Offline matseng

  • Frequent Contributor
  • **
  • Posts: 563
  • Country: se
    • My Github
Re: ATtiny output to MOSFET
« Reply #7 on: June 06, 2015, 02:02:27 am »
Why would it be necessary to use pull up resistor on reset pin when I don't need to reset the micro? Just thinking....

The reset pin is a active low so you have to pull the pin high in order to run the micro. i don't have a lot of experience withe the avr micros so read the datasheet carefully.

I can from experience attest that reading the datasheets carefully is important. I've been burned more than a few times when I by design left out the pull up on the reset pin thinking that this device has internal pullup just as the previous device.

Most newer Microchip mcus have internal pull up and operate safely without an external resistor unless they are in extremely noisy environments. The slightly older PIC's *require* an external pullup or they will really act up.
 

Offline IvoSTopic starter

  • Frequent Contributor
  • **
  • Posts: 310
  • Country: us
Re: ATtiny output to MOSFET
« Reply #8 on: June 06, 2015, 01:01:30 pm »
Thank you. Yes, reading the data sheet is important, I agree.  :) So, from the datasheet I can just set the fuse program (‘0’) RSTDISBL and no resistor needed. I will update the schematic and put a dummy resistor from RESET pin out anyway, for future use, if I ever need more I/O.
 

Offline Neverther

  • Regular Contributor
  • *
  • Posts: 129
Re: ATtiny output to MOSFET
« Reply #9 on: June 06, 2015, 06:00:45 pm »
Disabling reset will result in write once chip. So if you do it, program it first, then set the fuses to disable reset.

Otherwise you need high voltage programmer as programming through ICSP will not work.
 

Offline IvoSTopic starter

  • Frequent Contributor
  • **
  • Posts: 310
  • Country: us
Re: ATtiny output to MOSFET
« Reply #10 on: June 06, 2015, 08:34:38 pm »
Oooohh, I see, better leave RESET pin as it is. I didn't realize that. Thank you.
There is an option to disable individual pull up resistors for I/O pins for ATtiny84 somewhere?
I have a push button connected from +5V to input pin and then with pull down resistor to GND.
They say: As inputs, Port A pins that are externally pulled low will source current if the pull-up
resistors are activated.
So, I will either have to deactivate those resistors, or re-write the code debounce button function and flip the button from input pin to GND. Yes?
 

Offline Dave

  • Super Contributor
  • ***
  • Posts: 1352
  • Country: si
  • I like to measure things.
Re: ATtiny output to MOSFET
« Reply #11 on: June 07, 2015, 03:05:55 am »
Yes. It's common practice to have such a resistor, close to the mosfet itself, connected from Gate to Source, to allow the Gate charge to drain off so that the mosfet switches off cleanly and rapidly.
Far from it.
The gate charge will mostly be depleted through the 1k resistor, as the output of the microcontroller is pulled to ground. MOSFET, 100 kiloohm and rapidly don't exactly belong in the same sentence.
The only purpose for those 100k resistors is to keep the gates grounded when the outputs of the micro are in Hi-Z mode (while programming, during reset, etc.).
<fellbuendel> it's arduino, you're not supposed to know anything about what you're doing
<fellbuendel> if you knew, you wouldn't be using it
 

Offline Psi

  • Super Contributor
  • ***
  • Posts: 9889
  • Country: nz
Re: ATtiny output to MOSFET
« Reply #12 on: June 07, 2015, 04:00:35 am »
You don't need the external pullup on the reset pin. The MCU has one built-in which pulls reset to high.

The only issue is that its a week pullup, 20k or so, so if you operate the mcu in a noisy environment (like a car) there's a chance noise might overpower this pullup and reset the mcu.

So while it's good practice to add your own external pullup on the reset pin it's not required.
Greek letter 'Psi' (not Pounds per Square Inch)
 

Offline Simon

  • Global Moderator
  • *****
  • Posts: 17728
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: ATtiny output to MOSFET
« Reply #13 on: June 07, 2015, 09:24:31 am »
You need a pull-up resistor on the reset pin for the same reason you need to pull down resistors on the gate of the MOSFET. You can indeed disable the reset pin and use it as a port pin but then you will only be able to program the device once unless you use high-voltage programming. If you take a MOSFET and wire it up with nothing on its gate chances are it will just turn itself on even if partly. I have personally experienced this. Having to put the reset pull-up resistor in is a nuisance I don't know if it's possible to omit it but ultimately you will soon find that you want to be able to reprogram your chip any time. I have just built up some tiny circuits with a programming header and pull-up resistor for reset. Yet these things will be programmed once shipped and never touched again in fact they will be potted so I will not be able to access the header again. But from my point of view it is far easier to build the circuit up so that I can program it once it is built that way I know it has been soldered successfully and works. Of course there may be times where you want to preprogram the chip and then solder it and never touch it again but that would be in low-cost small designs where you can't afford space for the programming header.
 

Offline matseng

  • Frequent Contributor
  • **
  • Posts: 563
  • Country: se
    • My Github
Re: ATtiny output to MOSFET
« Reply #14 on: June 07, 2015, 10:05:32 am »
You need a pull-up resistor on the reset pin for the same reason you need to pull down resistors on the gate of the MOSFET.
Yes and no. A pull-up resistor is required - but not always an external pull-up resistor.  Many microcontroller have them internally already. For instance most modern PIC's and almost all AVR's have them.

Have a look at the datasheet for ATmega48A, ATmega48PA, ATmega88A, ATmega88PA, ATmega168A, ATmega1688PA, ATmega328, ATmega328P  where you clearly can see that there is an internal pullup already at the reset pin.



According to the graphs later on in the doc it will pull about 100uA when vcc i s 5 volts which would give it a ballpark value of 50k.
 

Offline Simon

  • Global Moderator
  • *****
  • Posts: 17728
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: ATtiny output to MOSFET
« Reply #15 on: June 07, 2015, 10:21:12 am »
You need a pull-up resistor on the reset pin for the same reason you need to pull down resistors on the gate of the MOSFET.
Yes and no. A pull-up resistor is required - but not always an external pull-up resistor.  Many microcontroller have them internally already. For instance most modern PIC's and almost all AVR's have them.

Have a look at the datasheet for ATmega48A, ATmega48PA, ATmega88A, ATmega88PA, ATmega168A, ATmega1688PA, ATmega328, ATmega328P  where you clearly can see that there is an internal pullup already at the reset pin.



According to the graphs later on in the doc it will pull about 100uA when vcc i s 5 volts which would give it a ballpark value of 50k.

On the AVR they are there in case you use the reset pin as an I/O pin, it is not recomended to use them to pull the pin high because they need activating once the MCU has started but the MCU can't start if the reset is floating and reads low...... it's catch 22
 

Offline matseng

  • Frequent Contributor
  • **
  • Posts: 563
  • Country: se
    • My Github
Re: ATtiny output to MOSFET
« Reply #16 on: June 07, 2015, 10:34:30 am »
On the AVR they are there in case you use the reset pin as an I/O pin, it is not recomended to use them to pull the pin high because they need activating once the MCU has started but the MCU can't start if the reset is floating and reads low...... it's catch 22

What?  When the RSTDISBL fuse is blown the state of the pin is, by hardware, ignored irregardless of if the cpu is still in POR-sequencing or running normally.

There is no way to enable/disable the reset pin by software during runtime, so there can't be any catch22 as you describe it.
 

Offline Simon

  • Global Moderator
  • *****
  • Posts: 17728
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: ATtiny output to MOSFET
« Reply #17 on: June 07, 2015, 10:41:47 am »
No what I'm talking about is when you do use the reset pin as reset. The pullup that is needed to make the chip run can only be activated internally once the chip starts but it needs to start in the first place. Yes if you decide to use the reset pin as a an IO then there is a pullup as every other IO pin has.
 

Offline matseng

  • Frequent Contributor
  • **
  • Posts: 563
  • Country: se
    • My Github
Re: ATtiny output to MOSFET
« Reply #18 on: June 07, 2015, 10:52:46 am »
Now you have confused me totally....  :-//

First you said "On the AVR they are there in case you use the reset pin as an I/O pin, it is not...." and there was a catch22 in that situation. Now you say that the problem is when the reset is used as a reset pin.

Which is it?

But the block diagram of the reset logic from the datasheet shows that the 50 k pullup on the reset pin is permanently connected to the reset logic part, so it doesn't need to be activated internally. It's already there.  Unless the block diagram is wrong of course.

If the catch22 really existed then that pullup would be of no use at all.  And I don't think that Atmel fscked up their designs on multiple generations of multiple chips.  They are not that stupid.
 

Offline Simon

  • Global Moderator
  • *****
  • Posts: 17728
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: ATtiny output to MOSFET
« Reply #19 on: June 07, 2015, 11:21:08 am »
I'll have to look the diagrams up but you have to enable the pullup in software in many AVR's so the AVR has to boot and run the program to turn the pullup on - catch 22. The pullup is there for the IO pin not as a pullup for the reset pin.
 

Offline Psi

  • Super Contributor
  • ***
  • Posts: 9889
  • Country: nz
Re: ATtiny output to MOSFET
« Reply #20 on: June 07, 2015, 12:02:23 pm »
The AVR reset pullup is NOT the same as the pullups on other i/o.
If the reset pin is enabled (default fuse bits) then the reset pullup is always active, even in reset state.

Datasheet
Quote
Pullup is activated and output driver and digital input are deactivated when the pin is used as the RESET pin
« Last Edit: June 07, 2015, 12:13:03 pm by Psi »
Greek letter 'Psi' (not Pounds per Square Inch)
 

Offline Simon

  • Global Moderator
  • *****
  • Posts: 17728
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: ATtiny output to MOSFET
« Reply #21 on: June 07, 2015, 07:41:51 pm »
The AVR reset pullup is NOT the same as the pullups on other i/o.
If the reset pin is enabled (default fuse bits) then the reset pullup is always active, even in reset state.

Datasheet
Quote
Pullup is activated and output driver and digital input are deactivated when the pin is used as the RESET pin

What ? ive been wasting resistors and space all of this time ? I thought I'd read it was a bad idea.
 

Offline c4757p

  • Super Contributor
  • ***
  • Posts: 7799
  • Country: us
  • adieu
Re: ATtiny output to MOSFET
« Reply #22 on: June 07, 2015, 09:55:24 pm »
I've read lots of things, most of it conflicting and wrong.
No longer active here - try the IRC channel if you just can't be without me :)
 

Offline T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 21606
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: ATtiny output to MOSFET
« Reply #23 on: June 07, 2015, 10:03:10 pm »
Simon,

The diagram clearly shows a fixed resistor from VDD to RESET, no switch.  It is not an optional pull-up.

Note that this statement,

The only issue is that its a week pullup, 20k or so, so if you operate the mcu in a noisy environment (like a car) there's a chance noise might overpower this pullup and reset the mcu.

remains valid, so it is not unnecessary, but optional, and may be useful under some conditions.

Tim
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 

Offline Simon

  • Global Moderator
  • *****
  • Posts: 17728
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: ATtiny output to MOSFET
« Reply #24 on: June 08, 2015, 05:59:02 am »
I've not actually found a diagram specific to the reset pin in an AVR datasheet.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf