Problem controlling a motor with a transistor swich

im having problems with this basic switching circute: R1= 470 ohm The transistor is BC337 -> Datasheet im using arduino uno with the blink code The code is as follows:

// the setup function runs once when you press reset or power the board
void setup() {
  // initialize digital pin 13 as an output.
  pinMode(13, OUTPUT);
}

// the loop function runs over and over again forever
void loop() {
  digitalWrite(13, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);              // wait for a second
  digitalWrite(13, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);              // wait for a second            // wait for a second
}

im trying to build a simple switching cicrute to switch the motor on and off if i connect the base is dissconnected i get ~0.07amp (the motor is off) if i connect the base to the 5v pin i get 0.3~0.5amp (the motor moves) pin 13's led blinks just fine while i do those but if i connect the base to pin 13 the it will stop blinking and stay HIGH and the current i get is ~0.15amp constantly while i expected it to switch from 0.007 to 0.5 .

what am i missing here?

Thanks for the link to the datasheet, you clearly took time to read the instructions for posting :)

if the base is disconnected the motor current should be less than 1uA, not 70mA - your transistor must be fried if that genuinely is the current with open base...

I presume by connected you mean the base resistor is connected to pin 13 - the base resistor must be used to limit the current.

The BC337 mas a max current of 0.8A, and in practice that means 0.5A since running the absolute maximum is not intended as a continuous rating.

I would use a 150 ohm base resistor so the transistor can saturate properly and waste less power as heat.

Check you motor draws a max of 0.5 to 0.8A at stall - if more then you'll need a better transistor or logic level MOSFET.

And lastly and most importantly, you must have a free-wheel diode across the motor to prevent the transistor being damaged by high voltage spikes. Whenever an inductive load like a motor, servo,relay,solenoid is switched you have to use protection against inductive kickback, typically in DC circuits by using a diode, in AC circuits an RC snubber or MOV.

My suspicion is you blew the transistor the first time you used it due to no free-wheel diode, hence the 70mA leakage current.

Hi, When you connected the base to 5V, did you still have the 470R resisitor in series? If not then you have cooked the Base - Emitter junction. If you have a DMM with diode test,

  • test pos lead to base and neg lead to emitter.
  • test neg lead to base and pos lead to emitter.

The first test should indicate about 0.6V The second test should be open circuit or OVL.

If both directions are conducting then you have damaged the transistor.

Hope this helps.. Tom.. :)

Thank you very much for your help i got it to work a few seconds ago! it seems like the transistor was bad becouse i connected it to the base whitout a resistor on my first try. the current on the motor is now 0.00amp when 13 is LOW and 0.34amps when the transistor is HIGH and its moving just like i wanted it to.

I am about to attempt to build an h-bridge now to control the direction of the motor. is there any risk of burning a transistor when cascading them(after testing i found i already brunt 5 while experamenting XD), also i lack diods, after reading about h-bridge i wasnt able to understand why we use them, are the issential for the bridge and what values should i expect?

update: after more reading i understood that they protect from spikes created once the motor stops. are there any methoods to get rid of them whitout diodes? becouse i dont use mosfet they dont have built in diods and if i order one now i will only get it in about 2 mounths

image of H-Bridge for illustration:

You can use TVS diodes, MOV clamps or diodes.