Tag: arduino

How to quickly identify bipolar transistors.

Posted by on May 8, 2011

Introduction:

Sooner or later you’ll encounter an unknown transistor to which you cannot find a datasheet for. Here’s a quick and simple tester you can build on perfboard or you can simply wire it up temporarily on your breadboard to identify those pesky pins!

The circuit:

Explanation:

  • R2 pulls the base down so it’s not left floating whilst SW1 remains open.
  • If the transistor is correctly connected and it’s of NPN type, when pressing the button the base would be forward biased and the LED should turn on brightly. Otherwise it may not turn on or it will be barely visible, this means C and E have been swapped.
  • For PNP once power is applied the LED should turn on by itself if C and E are correct, because the base is pulled to ground by R2, if the button is pressed the base would be lifted from ground and the LED should turn off.
  • If swapping C and E on both cases does not yield a conclusive result, you can assume this BJT  is damaged or you incorrectly identified the base.
Perform your initial  tests with known good devices. Make sure you swap C and E on purpose to visualize the outcome.

You may place an ammeter between VCC and C instead of an LED. You should normally get around ~10mA across it with a general purpose NPN as long as R1 is 330 Ohms, with a PNP this value would be nearly halved due to the pull-down resistor being an order of magnitude bigger than the pull-up.

However due to the nature of this circuit the resistor values are not critical, just respect (roughly) their ratios and you’ll be fine.

 

Test procedure:

NPN

  1. Identify the transistor base using your DMM in DIODE mode. The base is going to be the anode of both “diodes”. (See Fig:1) – If you can’t identify both diodes, this may not be a BJT or it’s been damaged; throw it away.
  2. Connect base to the connector B from the transistor-tester and the rest to C and E (doesn’t matter which)
  3. Apply power, nothing should happen. Press the button, if the LED barely lights up or it doesn’t light up at all then the pin you connected on C may actually be E, if it lights up brightly then your assumption of C may have been correct.
  4. Turn C and E around even if you’ve got a result and go back to 3) to rule out a faulty device. If the transistor is shorted it would conduct either way around. With a good and properly connected transistor the LED should only turn on when the button is closed and should remain OFF for the rest of the time.

PNP

  1. Identify the transistor base using your DMM in DIODE mode. The base is going to be the cathode of both “diodes”. (See Fig:2) – If you can’t identify both diodes, this may not be a BJT or it’s been damaged; throw it away.
  2. Connect base to the connector B from the transistor-tester and the rest to C and E (doesn’t matter which)
  3. Apply power, if the LED lights up brightly then your assumption of C and E may have been correct.
  4. Press the button, the LED should go OFF, otherwise swap C and E and go back to 3) — If the results are inconclusive you may have a defective transistor. With a good and properly connected transistor the LED should only turn on when the button is  open and should remain OFF for the rest of the time.

 

Conclusion:

With just a few parts from the junk box you can identify your unknown BJTs and test known ones for YES/NO fault finding. This circuit won’t identify damaged junctions; for that you’d need a curve tracer.
However it may come in handy if you’re constantly recycling components from old devices!

Have fun and don’t forget to share your findings with the community! — Likewise if you have any old datasheets don’t hesitate to scan them!

Cheers.

MSP430 Launchpad: LED as PhotoDiode

Posted by on February 28, 2011

Story:

I’ve been meaning to build a “line seeker” robot for a while now, however I can’t source LDRs (Light Dependent Resistor) due to RoHS nonsense, so I decided to use plain old LEDs instead. While you could use a couple analog amplifiers and comparators to do this I thought it would be a fun little microcontroller project.

Right now we’re just exploring how to utilize a regular LED as a photo-diode, ie. an input sensor.

There are a couple ways to accomplish this – I chose the simplest for the time being – The idea is to sample the voltage present on the LED anode (or cathode!) by using the ADC on the MSP430, this voltage will be relative to the ambient light. You could picture the LED as a solar cell in this case.

The code:

We’re going to use the on-board LEDs on the LaunchPad to simplify things. The Red LED will be our “sense” input and the Green LED will be used to depict the current state of the sensor.

You’ll have to modify the header (and your project target) depending on which MCU you’re using, I happen to have a G2452 currently populated for another project I’m working on, but you can use any value-line MCU as long as it’s got an ADC.

/* LED as Photo-Sensor
 / By: Gustavo J. Fiorenza (GuShH - info@gushh.net)
 / No external components required, simply shine a light to the RED onboard LED!
 /
 / Note: Tested on a G2452 only, should also work with other value-line MCUs.
*/

#include "msp430g2452.h"	// Change the header to "msp430x20x2.h" if you're using the default MCU bundled with the LaunchPad.

#define LED_SENSE INCH_0 	// LED 1 (Red LED from LaunchPad).

unsigned int adcval = 0;

unsigned int analogRead(unsigned int pin) {

  ADC10CTL0 = ADC10ON + ADC10SHT_2 + SREF_1 + REFON + REF2_5V;
  ADC10CTL1 = ADC10SSEL_0 + pin;

  ADC10CTL0 |= ENC + ADC10SC;

  while (1) {
    if ((ADC10CTL1 ^ ADC10BUSY) & ((ADC10CTL0 & ADC10IFG)==ADC10IFG)) {
      ADC10CTL0 &= ~(ADC10IFG +ENC);
      break;
    }
  }

  return ADC10MEM;
}

void main(void) {
	unsigned int i, delay;

	WDTCTL = WDTPW + WDTHOLD;	// Hold the watchdog.
	P1DIR = BIT6; // LED 2 (Green LED from LaunchPad).

	while (1){

		// Multi-sampling (8 samples with delay for stability).
		adcval = 0;
		for ( i=0; i < 8; i++ ) {
			adcval += analogRead( LED_SENSE );	// Read the analog input.
			delay = 1000;
			while (--delay);
		}
		adcval >>= 3; // division by 8

		// Interpret the result
		if ( adcval < 500 ){
			P1OUT |= BIT6;	// Turn on the onboard Green LED.
		}else{
			P1OUT = 0x00;	// Turn off the entire Port 1, thus turning off the LED as well.
		}

	}

}

Why so vague?

Lately I've been suffering a serious mental block, I would really like to explain the theory behind all this but not only am I uninspired I also can't focus on writing... I would however recommend you Google "LED Sensor" (or similar query) to learn more about the subject.

Have fun.

Harte Hanks and TI – Backordered MSP430

Posted by on August 17, 2010

These Harte Hanks, or should I call them “Hard at Wanks” guys are shameless. I (and a few others) could not contact them or get any information whatsoever on the shipping status for the MSP430 Launchpad.

To contact TI you must spend at least half an hour filling out a massive form just to never be contacted by them…

It’s rather obvious that the whole MSP430 Launchpad was an afterthought and that TI has no infrastructure for small companies and/or buyers; they play with the big fish and they don’t know how to handle regular human beings. Heck, they’re paying some clowns to deal with them and look at what happened! More…

What is LaunchPad?

Posted by on June 25, 2010

Bullshit, that’s what it is. They targeted the “Launchpad”  toward the maker/hacker market and yet they don’t provide the according payment methods, these corporate weasels will only take your credit card, tell me how many students actually own a credit card? only the rich kids, who are probably more interested in getting more free money from their parents and living la vida loca than spending their time hacking away on a TI development board alone in their basement.

It just makes no sense whatsoever! they’re trying to get a piece of this huge market by introducing a ridiculously cheap product and yet theres no way anyone outside the US without a CC would be able to get one!.

Therefore TI’s product is as appealing to me as sucking a rusty nail while watching a match of cricket under severe chronic depression! It’s going to end one way and it won’t be pretty.

More…