How does it work?
QuoteHow does it work?How long have you got?Basically, a transistor amplifies current. You put a small current in to the base, and you control a large current flowing through the collector->emitter. With Ohm's law, it is effectively going from a small voltage (the fan) to a large voltage (the 0->5v switching signal).A transistor only has a limited amount of amplification it can do - any more than that and it becomes "saturated" - that is, the waveform becomes clipped off at the top and bottom.A transistor can only amplify positive voltages. Like a diode, if you put a negative voltage in, it gets blocked. So, to combat that, you add an extra voltage to the incoming signal - the "offset voltage". This makes the negative voltages coming in positive, and pushes up the positive voltages to make them higher, so the whole incoming waveform is made up of positive voltages.It is important to get the level of this offset correct, so that the output, which will also have a proportional offset, isn't completely in the saturation area. If that happens, then the transistor will be permanently on. We don't care about some clipping - in fact, as it is a digital input, we like clipping. It makes for a good clean square wave that the input likes, so the more amplification the better. Different incoming offsets will provide different amounts of amplification due to the way a transistor works, so hitting a sweet spot, or "operating point" can make the output signal just what we want.
No, the offset voltage is a proportion of the 5V as set by the ratio of the 1K to the 220?. It has nothing to do with Ohm's law. Yes, you can do Ohm's law calculations on it, but that would just yield you the current flowing through the combined 1K and 220?, not the voltage at the mid point.Read http://en.wikipedia.org/wiki/Voltage_divider for more detail.
Isn't that Ohms law I have used.
I think you two are discussing different circuits. The one Majenko laid out before has no led? Himym, for a red led needs IIRC at least 180 ohms resistance with 5V to keep it from burning up. Most are using 220 ohm, I don't like it so bright so I use 330, 470 or more. What you did shows that even boosted, your fan to transistor is not enough to allow much current flow or maybe some other resistor is moderating current flow.Do you have a resistor between the fan and transistor grid? Or one between power and transistor collector?
That's because it wasn't getting enough power, probably because it's running off 5V through the internal pullup resistor which is about 20k ohms. Whatever you do, don't set that pin to OUTPUT!
The one that you are using for INPUT to read the fan. I did forget that in Majenko's circuit (that I just looked at again) the internal pin pullup isn't the only possible power source to the transistor. It also gets Vcc (5V) through 10k ohms. When the transistor is OFF the pin will read HIGH. When the transistor is ON it grounds the power, the pin will read LOW, and your led gets 5V through 10k ohms which is enough to light it dim. I bet you could put 220-1k ohms instead of the 10k resistor, get a brighter led and hurt nothing. But you don't need to now since you know the fan data must be readable. Use digital instead of analog read and set up a Pin Change Interrupt. The interrupt will stop the regular program, turn interrupts off, run a special -short- routine you make (like "pulse++;") and turn interrupts back on (plus some register saving you don't care about now) and then resume your regular code like nothing happened. Your program can watch microseconds go by (with micros()) until 1 second is up and see how many pulses were counted. You can know to within 4 microseconds I think.If instead you just watch the pin you might be able to tell about how even the pulses are. There is a pulseIn command to measure ulse widths but I see people get results with variance using it.
Please enter a valid email to subscribe
We need to confirm your email address.
To complete the subscription, please click the link in the
email we just sent you.
Thank you for subscribing!
via Egeo 16