Go Down

Topic: Transistor types (Read 13159 times) previous topic - next topic

BillO


Blindly taking some advice to leave out a component designed to "protect" your design when you don't understand the reasons it's there, has a high probability of having you replace a UNO or ATMEL 328 because you didn't insert a part that costs 2 cents.  


Well, I think this thought comes close to what I am saying.  I'm not sure how that was missed.  What I am saying is, try to fully understand what it is you are doing and don't blindly take any advice.

There is a lot of misinformation passed out on this site, and many, many others, that propagate ignorance under the umbrella of "it's safe" when indeed that just obfuscates the reality.

In any case, you may have missed, or misunderstood, the entire thread because I'm not asking anyone to blindly do anything.  Where the heck are you getting that?.  We initially talked about whether it is required that you use a resistor every time you use a MOSFET or not, but it went a little beyond that.  From my perspective, as one of the contributors so far, it edged toward the behavior of the AVR and how that would affect the original thesis, then to just how the AVR behaves.  A lot of ground covered.  And over none of it did I advise anyone to blindly do anything.  In fact, I strongly suggested that folks open their eyes.  Maybe this is the remedial forum.

In any case, we are talking about a device that cost's less than a bottle of beer.  WTF!  If, and it's a big if (because I just shorted out pin 8 on 3 different 328s and it did not even affect their internal resistance characteristics, and no, no, no, I'm not saying it's the right thing to do), you demolish one by being brave or inquisitive, what the hell is the big deal?  The lack of testicles amongst the Arduino fold is astonishing!  So, because you partially or totally disable a $4 chip your going to just tear your life apart?  Get over it, for Pete's sake!  Have one less McDouble next week and carry on your exploration.

However, that is not even the point.  It's the whole attitude.  "Man, don't ever do that because I heard from some one in another post (or on another site) that that is a no no.".  Shinola!!! You should at least have tried it to know if it is fact or fiction, or try to educate yourself about the basics and put the BS aside.

In this thread I did.  What I found in what I tried was that the common sludge is just hokem fiction.

What are we afraid of?  That some MCU deity will strike us dead for threading on sacrosanct ground?  Or loosing a $4 part?  Well, I'm here to tell you this is not going to happen.  Yeah, you can destroy a ATmega328 if you try really hard, but it ain't all that easy and it ain't the end of the world either if it happens.

Okay, so here are the facts.  88mA is all I could get out of an (actually several, and BTW, I'm not the only one. Google it or try it.) AVR output, that means it will take more time than previously assumed to charge a MOSFET to the point where it operates properly, and as such it changes the nature of the "story" that has been propagated so far.  It's up to you if you want to use this information.  I really couldn't care less.

I know, I know, they hang or burn people for this sort of blasphemy.  So please, just ignore me.  I have no idea what I'm talking about.  None whatsoever.  Please, go on as you were.   I'm sure the experts here will have many like reasons to attack my responses in the future, no matter what they are based on, or how they misinterpret them, so I'll try to repent.  I've seen the light... I'll try to be a good boy and not say anything that disturbs the sacred beliefs.  LF!

You folks kill me. :-)

The fact still remains, you do not always need a gate resistor on a MOSFET

retrolefty

Quote

The fact still remains, you do not always need a gate resistor on a MOSFET


I can live with that statement. I frequently use small 2N7000 mosfets for switch smaller loads and never use a series gate resistor with them. But I'm also aware that there are applications of using very high current mosfets where anything short of using purpose designed gate driver chips is very risky. In between there are situations where a series gate resistor wired directly to an arduino output pin is the best method.

I think you main point is that unless one actually learns fundamental electronics theory and practice including semiconductor theory for themselves, but rather instead relies on memorizing a lot of 'rules' posted by random people, then you will always be at the mercy of randomly useful information and yes even wrong information.

http://xkcd.com/386/

Lefty

BillO

Thanks Lefty, you sate my intentions far more eloquently than I did.  You're right on the button.

Not to belabor this too much, but I tried to recreate some of the results found here: http://www.thebox.myzen.co.uk/Tutorial/LEDs.html

I did not have a 10R or 4R7 but did have 7.5R 1%.  I measured the resistor with a Fluke DMM and it measured at exactly 7.5 ohms.  The results presented at that site would imply that I should see a current of approximately 200mA with the 7.5 ohm resistor.

I soldered the resistor to a green LED and two short leads to ensure the circuit had the best possible connectivity and to reduce the possibility of bad connection on a bread board creating higher than actual resistances.  I used the circuit shown on the site with the resistor between the LED and ground.

I wrote a small sketch to output  a 500Hz square wave loaded it up to a brand new ATmega328,  I initially did this on pin 9 and connected the lead from the anode of the diode to pin 9 and the lead from the resistor to ground.  Then I attached a scope across the resistor as shown to measure the voltage across the resistor.  Here are my results.

The voltage across the resistor, when the output was high, was 284mV.  This implies the current through the circuit was 37.9mA.  Not any where close to 200mA.

I did a little further digging to see if any of this made sense with respect to the "Typical Characteristics" section of the 328 data sheet and the LED.  I measured the voltage coming from pin 9 to be at 3.88V when the output was high.  This meant there was 3.6V drop cross the LED, which is in line with green LED voltage drops at such currents (~40mA).

Given that the current calculated was Io = 37.9 and Vo = 3.88, this implies the output resistance of the 328 was (5-3.88) / 0.0379 =  29.6 ohms.

Looking at figure 29-162 of the ATmegaXX8 data sheet we see that at 20mA the ATmega328's output is expected to fall to around 4.48V.  We can also do calculations from the graphed values to determine the output resistance as the current increases.  We find it is about 25 ohms at 0-5 mA and about 29 ohms at 15-20 mA.  Leading us to two follow-on conclusions:

1) The output resistance increases as the current increases.  For the design of the output, this is expected behavior, implying that it would even be higher at 37.9 ma.  I measured 29.6, so this is in agreement.

2) Consequently we'd expect that if the output voltage drops .52V in the first 20 mA of load, it will drop measurably more than that in the following  20 mA of load.  What we find is that at 37.9 mA the voltage has dropped by 1.12V.  This too then, is in agreement.

I tired 2 different chips, and pins 0 to 9 on both of them.  The results all agreed to within 0.2mA.

Conclusion:  This experiment shows that an ATmega328 driving a green LED trough a 7.5 ohm resistor will pass a current of approximately 37.9 mA and that this agrees with what is presented in the ATmega328 datasheet.  It also shows that a previously predicted current of 200 mA was not observed.  This too agrees with the published datasheet.

It should also be noted, that while the current of 37.9 was 17.9 mA in excess of the LEDs recommended operating current, it was a peak current and did not exceed the maximum allowable for the ATmega328.  In fact, the average current of approximately 19ma is well in line with the safe area of both devices.


So, how does all the relate to the OP?  If you are going to delve into electronics, it pays to learn how to read the datasheet of the devices you use, understand the basics of how they work and  become familiar with the governing principles of electronics as anything else is really the mumbo jumbo.




Grumpy_Mike

Quote
Conclusion:  This experiment shows that an ATmega328 driving a green LED trough a 7.5 ohm resistor will pass a current of approximately 37.9 mA and that this agrees with what is presented in the ATmega328 datasheet.

Fair enough.

Quote
It also shows that a previously predicted current of 200 mA was not observed.

First off that was not a predicted current it was actually measured.

So basically do you think I made some sort of error in the measurements or setup or are you suggesting I made the whole thing up?

I noticed that you did not duplicate exactly what I did, which on re reading the page I see I did not explain in full detail.
I drove the LED through a PWM pin and set the PWM value to 1 giving the LED only a short pulse. It was also a yellow LED so that voltages would have been a bit different. I used a $5000 Tectonicx scope with X10 probes. Unfortunately I don't work for that company anymore so I don't have access to that equipment. However I will try and repeat the experiment, in the light of what you found and if necessary correct the web page.
However the whole point of that page is that you always need a resistor when driving an LED from an arduino pin ( or constant current supply ) which i am sure you will not disagree with. 

BillO

#49
Jul 08, 2013, 07:46 pm Last Edit: Jul 08, 2013, 07:50 pm by BillO Reason: 1

Quote
It also shows that a previously predicted current of 200 mA was not observed.

First off that was not a predicted current it was actually measured.


It was predicted in my case from your results because a value of 7R5 was used by me, which was not a value recorded in the original experiment.

Quote
So basically do you think I made some sort of error in the measurements or setup

Possibly, I am not sure.  I tried to conduct the experiment as you have explained in your write-up.

Quote
or are you suggesting I made the whole thing up?


No, that is never done.  The largest component of my job as an experimental physicist was to set up and run experiments that were original work done by others in order to see if the results are repeatable.  This is never intentionally done to ferret out false results.  It is generally a welcome practice as it helps the creator of the original work perfect his hypothesis and methods and reduce errors.  Generally speaking, if an experimental result is important enough it may get repeated 5 or more times by others.  There are invariably adjustments made to the original methods, but this process of test and improve is what experimental research is all about.  In the cases where I did do original work, as soon as I had my first results I would be on the phone to other physicist to ask them to repeat my work for verification.  Cases where this is not done, and they do happen, can result in spectacular failures.  Do you recall cold fusion?

Quote
I noticed that you did not duplicate exactly what I did, which on re reading the page I see I did not explain in full detail.  I drove the LED through a PWM pin and set the PWM value to 1 giving the LED only a short pulse. It was also a yellow LED so that voltages would have been a bit different. I used a $5000 Tectonicx scope with X10 probes.


I use a Textronics 465 analog scope along with a UNI-T 100mHz digital scope and well as various DMMs from Fluke and others.  Though I don't think it would matter too much, for our purposes, if we used Eico or Rigol, etc...  A mV or 2 here or there is fine for hobbyist work.  If I have the time I'll try it with your additional info.  The basic set-up is still on my bench.  Being retired, you'd think I'd have more time, but...

Quote
...you always need a resistor when driving an LED from an arduino pin ( or constant current supply ) which i am sure you will not disagree with.  


Yes, I fully agree with this.

BillO

Okay,

My guests left this morning so I had a chance to get back to this.

Here are the changes I made:
LED was changed from Green to Yellow
Used PWM and set analogWrite to 1

Since the 7R5 is the lowest value resistor I have, it was used again.

Here is the Code I used:
Code: [Select]

/*
  PWM current test
  Turns an Yellow LED on for 8us then off at 490Hz
*/
int OutPin=9;

void setup() {               
  // initialize the pin as an output.
  // Pin OutPin is connected to a Yellow LED then to a 7R5 resistor to ground
  pinMode(OutPin, OUTPUT);
}

void loop() {
  analogWrite(OutPin, 1);
}


Here are my measurements:
Frequency - 490Hz
Pulse width - 8uS
Voltage across the resistor - Vr = 518mV
Output Voltage @ OutPin - Vo = 2.74V
Vcc = 4.92V

Here are my calculations:
Output current Io = Vr / R = .518 / 7.5 = 69.1mA
Voltage drop across LED VD = Vo - Vr = 2.74 - .518 = 2.22V
Internal resistance of ATmega378 Ri = (Vcc - Vo) / Io = (4.92 - 2.74) / 69.1 = 31.5 ohms

The average current draw from the Arduino was 69.1mA * 8uS / 2037uS = 0.27mA and the LED was just barely lit.

Go Up