NPN testing with Arduino Uno

Hi,
I' m stuck in my project and I hope that somebody can help me! I wish to create an Arduino based project that fully test the npn transistors (so that I can supply base witch voltage from 0-3,6V and collector witch voltage 0-12V) and after all measurements draw a I(U) characteristics and count h parameters of transistor.

First of all, I tried to connect it as simple as possible using 15V/1A SMPS and 7812 stabilizer unfortunately it didn't work properly (when Ube>0,6V Uce=0V, and when Ube<0,6V Uce was almost the voltage supplied to collector) - so completely other way around. (The circuit was like in the Fritzing sketch below:)

Then I realized that the problem can be caused by too high current on Ib, that's why I applied 2MOhms parallel resistors into base and collector supply, and I also changed the power supply unit to stabilized 12V/300mA. Unfortunately now, it's working a bit more as should but no matter what Ube would be Uce is always open (almost equals to collector supply voltage). When Uce is high (i.e. 12V) and U supplying base is low (0V) there occurs Ube voltage of approx. 0,4V. Does anyone know why is that behaving that way? And what to do in order to get rid of it. I also realized when measuring with multimeter that emitter voltage (although its connect to ground pin is not always (0V) - when Uce=12V and Ube=0,7V Ue is approx. 0,2V. That's why I plugged A4 pin to measure it and add 1M resistor to decrease that voltage before gnd pin and suddenly my Arduino stopped working (probably it burned). To make things more sure I apply also the final sketch from Fritzing:


And code: (U1 - supply on base, U2 - supply on collector)

#include <LiquidCrystal_I2C.h> //Zawarcie biblioteki do wyświetlacza LCD
LiquidCrystal_I2C lcd(0x27,16,2); //Adres wyświetlacza
float resistor1 = 20000; //Przypisanie wartości R oporników uzytych jako dzielnik napięcia
float resistor2 = 10000;
void setup() {    //Funkcja inicjująca
  Serial.begin(9600); // Inicjalizacja komunikacji szeregowej
  lcd.init(); // Inicjalizacja wyświetlacza LCD                    
  lcd.backlight();
  lcd.setCursor(0,0); 
}

void loop() { //Funkcja wykonawcza
  int wartoscAnalogowa = analogRead(A0); // Odczytaj wartość analogową z pinu A0
  float ubwej = wartoscAnalogowa * (5.0 / 1024.0); // Konwersja na napięcie [V]
  int wartoscAnalogowa1 = analogRead(A1); // Odczytaj wartość analogową z pinu A1
  float ucwej = wartoscAnalogowa1 * (5.0 / 1024.0) * (resistor1 + resistor2) / resistor2; // Konwersja na napięcie [V]
  int wartoscAnalogowa2 = analogRead(A2); // Odczytaj wartość analogową z pinu A2
  float ubwyj = wartoscAnalogowa2 * (5.0 / 1024.0);  // Konwersja na napięcie [V]
  int wartoscAnalogowa3 = analogRead(A3); // Odczytaj wartość analogową z pinu A3
  float ucwyj = wartoscAnalogowa3 * (5.0 / 1024.0) * (resistor1 + resistor2) /resistor2; // Konwersja na napięcie [V]
  int wartoscAnalogowa4 = analogRead(A4); // Odczytaj wartość analogową z pinu A4
  float ue = wartoscAnalogowa4 * (5.0 / 1024.0) * (resistor1 + resistor2) /resistor2; // Konwersja na napięcie [V]

  Serial.println("NASTAWA: ");
  Serial.print("U1 "); //Wyświetl w porcie szeregowym napis "xyz"
  Serial.print(ubwej,3); //Wyświetl w porcie szeregowym wartość napięcia Ube z dokładnością do 3 miejsc po przecinku 
  Serial.print("V ");

  Serial.print("U2 ");
  Serial.print(ucwej,3); //Wyświetl w porcie szeregowym wartość napięcia Uce z dokładnością do 3 miejsc po przecinku 
  Serial.println("V ");
  
  Serial.println("POMIAR: ");
  Serial.print("Ube ");
  Serial.print(ubwyj-ue,3); //Wyświetl w porcie szeregowym wartość napięcia Ube z dokładnością do 3 miejsc po przecinku 
  Serial.print("V ");

  Serial.print("Uce ");
  Serial.print(ucwyj-ue,3); //Wyświetl w porcie szeregowym wartość napięcia Uce z dokładnością do 3 miejsc po przecinku 
  Serial.println("V ");
  
  
  //Pomiar prądu odbywa się metodą pośrednią przez pomiar spadku napięcia na rezystorze 1MOhm: 
  Serial.print("Ib "); 
  Serial.print((ubwej-ubwyj),3); //Oblicz i wyświetl natęzenie prądu bazy z dokładnością do 3 miejsc po przecinku
  Serial.print("μA ");

  //Pomiar prądu odbywa się metodą pośrednią przez pomiar spadku napięcia na rezystorze 150hm: 
  Serial.print("Ic ");
  Serial.print((ucwej-ucwyj)/0.00015,3); //Oblicz i wyświetl natezenie prądu kolektora z dokładnością do 3 miejsc po przecinku
  Serial.println("μA ");
  
  //Wyswietl na wyświetlaczu nastawy U1 i U2 oraz wyniki pomiarów: Ube, Uce
  lcd.clear();
  lcd.print("U1");
  lcd.print(ubwyj);
  lcd.print(" U2");
  lcd.print(ucwyj);

  lcd.setCursor(0, 1);
  lcd.print("Ube");
  lcd.print((ubwyj));
  lcd.print(" Uce");
  lcd.print((ucwyj));

  delay(1000); // Opóźnienie między odczytami 1000 ms = 1s
}

To explain: Rb = 1M, Rc=150, Ri (to depress current) 2M, voltage divider R: 20k and 10k, R base supply (to decrease voltage) 3,3k and potentiometers are both 5k.
Thank you in advance! And sorry I didn't supply with proper circuit schematic but I don't know any free and intuitive app for it.
Regards

Is this a school project? I duckduckgo and got this for my first hit searching for "Arduino Component Tester" https://maker.pro/arduino/projects/diy-super-simple-electronic-component-tester I have a feeling you did not check very well or your search engine needs an oil change.

That is not the way to test bipolar transistors, which are current amplifiers.

Supply a known base current, and measure collector current.

The base-emitter voltage should never exceed about 0.7V.

I'm too lazy to convert your diagram to a schematic or analyze your code... :stuck_out_tongue:

What I would do is:

Assume an Hfe (current gain) of about 100 for the mid or upper-mid range of your measurements. Hfe is what you're trying to measure, so this is just to choose your resistors...

Then I connect different resistors to multiple I/O pins (maybe 5 resistors to 5 pins) and connect those all to the transistor base. It's easy to know/calculate/approximate the base current if you assume Vbe is about 0.7V (when current is flowing).

Then write a high to one pin at a time while monitoring the collector current to get multiple points on the curve. (You can switch the unused pins to input to effectively take them out of the circuit, making only one current source at a time.)

And, 5V on the collector is probably fine... That's through a resistor, of course, so the actual collector voltage will be less, but your goal is to measure/calculate the drop across the resistor so you can calculate the emitter-collector current.

Yes it's a school project. I think you didn't understand what I meant in that post. The key factor in my project is ability to manually change voltage supplied to base and collector of transistor. Not a simply tester which tells you what typ of transistor or element is it. Of course I did some reaserch, including searching in yt, google and asking chat gpt as well.

Well measurements principles are given to me. I mean I should test bc547 for voltage base input of 1.1 1.6 2.1 2.6 and 3.1V. (of course between this input and base itself there is a resistor which lowers the voltage up to 0,7V)

I get your point but also the voltage collector voltage input is given (0-12V, step 1V). At that time I cannot really change the voltage in this range, can I?

This is more similar to a transistor curve tracer.

To do that you need a DAC (Digital to Analog Converter). This can be achieved in many ways. The simplest is to get a DAC module for the Arduino. The second is a bit more complicated but you set up PWM feeding a low pass filter with a buffer amp following. Here is a simple circuit.
image You should add a pull up resistor to the opamp output, the LM358 shown does not swing rail to rail.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.