This short program will use voltage measurements on the base and collector of a transistor and resistor values entered to calculate the current gain. Of course different value resistors will result in different beta values. I tried to use the smallest collector resistor possible without causing the collector voltage to rise too much. I used the USB (5V) output for the collector resistor, so make sure the collector voltage doesn't rise over 3.3V or I think bad things will happen.
Revision 0:1dd4e19ed08e, committed 2012-04-16
- Comitter:
- RobOnk
- Date:
- Mon Apr 16 03:47:28 2012 +0000
- Commit message:
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Mon Apr 16 03:47:28 2012 +0000 @@ -0,0 +1,41 @@ +#include "mbed.h" + +AnalogIn base_voltage(p15); +AnalogIn coll_voltage(p16); + +int base_resistor, coll_resistor; +float base_current, adj_base_voltage; +float coll_current, adj_coll_voltage, beta; + +int main() { + +printf ("Please enter a base resistor value\n"); +scanf ("%i", &base_resistor); + +printf("Please enter a collector resistor value\n"); +scanf ("%i", &coll_resistor); + +//calculate base current +adj_base_voltage = (1 - base_voltage) * 3.3; //voltage across base resistor +base_current = adj_base_voltage/base_resistor; + +//calculate collector current +adj_coll_voltage = (1.515 - coll_voltage) * 3.3; //1.515 is 5V as 1 is 3.3V +coll_current = adj_coll_voltage/coll_resistor; + +//calculate current gain +beta = coll_current / base_current; +printf ("Transistor beta is %f\n", beta); +printf ("The voltage across Rb is %f\n", adj_base_voltage); +printf ("The voltage across Rc is %f\n", adj_coll_voltage); + +} + + + + + + + + +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Mon Apr 16 03:47:28 2012 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/737756e0b479