Hello, as you might understand I'm new to arduino and electronics.
What I wonder now is how I should wire my "BC547C TO-92 transistor" if I want to give it 5V to the Collector(C) and give the base(B) value from my arduinos PWM pin number 11. Then I want to pick up the value from the emitter(E) by connecting it to analog input 0 (pin 0).
How should I do this?
When just connect everything it gives me random values.
Thank you very much!
Most likely you hare having difficulty due to a few reasons. 1) you don't really understand transistors yet. 2) what you are wanting to do might not be as simple as using 1 resistor and and 1 transistor. 3) you might not be clear on just how non-analog PWM output is (without some help).
In fact, what you want is not clear to me... are you trying to make a variable output power supply using your transistor as a "pass" device?
Example:
http://powersupply88.com/adjustable-regulated-power-supply-0-15v-1a.html
If so, you will notice that the positive supply to the collector needs to be higher than the maximum potential sent to the base...
You should also include a R/C filter in the PWM pin or you will be sampling pulses and not voltage... giving you wildly variable results.
Archelon:
Hello, as you might understand I'm new to arduino and electronics.
What I wonder now is how I should wire my "BC547C TO-92 transistor" if I want to give it 5V to the Collector(C) and give the base(B) value from my arduinos PWM pin number 11. Then I want to pick up the value from the emitter(E) by connecting it to analog input 0 (pin 0).
How should I do this?
When just connect everything it gives me random values.
Thank you very much!
First, it won't work wired like that. Second even when you do get it wired correctly (and with the proper resistors) your analogRead function will only read a +5vdc or 0vdc as a PWM signal is either fully on or fully off at any given instant in time.
The BC547C is a NPN transistor so to use it with an arduino requires two resistors, one from the arduino output pin wired to the base terminal of the transistor and can be anything from say 200 to 1,000 ohms. The collector terminal should be wired to a series resistor wired to the arduino +5vdc pin and can be anything from say 1,000 to 10,000 ohms. The emitter needs to be wired to arduino ground pin. The arduino analog input pin is then wired to the transistor collector terminal. Again you will only read values of +5vdc or ground as unless you have a low pass filter wired to the base terminal you will not read values between 0 and +5vdc no matter what PWM value you send to the transistor.
Lefty
@Archelon It seems you don't understand PWM, please read this:-
http://www.thebox.myzen.co.uk/Tutorial/PWM.html