Electronic – arduino pulse to transistor power maximum

arduinocurrentpulsepwmtransistors

Hello I want to get a confirmation that what I am doing is not going to fry my Arduino Mega.

The sketch I am using to send a pulse out on pin 8 to a 2n3055 that is switching 12 volts is this:

int pulse = 8;
int sensorValue;

void setup() {
  pinMode(pulse, OUTPUT);
}

void loop() {
  int sensorValue = analogRead(A0);
  map(sensorValue, 0, 1023, 1, 2000);
  digitalWrite(pulse, HIGH);   
  delay(sensorValue);              
  digitalWrite(pulse, LOW);    
  delay(sensorValue);            
}

I am using a potentiometer between the Arduino 5v and ground with the wiper going to pin A0.

Sketch

schematic

simulate this circuit – Schematic created using CircuitLab

I want to know:

  1. could I power this directly from my USB instead of powering the transistor AND the Arduino from the source battery.

  2. If they have to be both powered from the battery do I need to connect the emitter to the ground of the Arduino AND the battery to stop all the current from flowing through the Arduino ground and get a clean pulse or do I just connect the emitter to the battery negative and the signal will be OK.

  3. In whatever configuration is best where is the best place to put a analog meter that is rated up to 3 amps so that I can see total power consumption of the board and the transistor circuit.

  4. Lastly I am using this to pulse the high voltage side coil in a microwave transformer so it has a lot of impedance and when pulsing it it draws about 300 mA max so could I power the Arduino via USB and the transistor from the battery so that I can reprogram on the fly and have a set pulse instead of using the pot. (as in write the code for a certain delay and upload while running)

Best Answer

int sensorValue = 1;

Why are you initializing this variable to 1, when it then gets overwritten in the first line of loop()?

delay(sensorValue);

Is it intentional to have a varying delay of n milliseconds, where n is the value read from port A0 each time? Also, is that delay required twice, once after setting the output pin high, once after setting it low?


You will require a base resistor between pulse (Pin 8) and the Base of the 2n3055, with a value calculated depending on how much current you intend to allow through the Collector. If you are using the transistor as a switch, then a minimum of around 220 Ohms is suggested, to keep current from the pulse pin under around 25 mA, well within the safe limits for each pin: Absolute Maximum for each pin is rated at 40 mA.

  1. You could power the Arduino from USB and the transistor from the battery, so long as the ground of the Arduino is connected to the negative pole of the battery.
  2. Either way, you will need Arduino ground connected to battery negative.
  3. Put it in series with the coil you are driving, if you want to measure the coil (the transistor's Collector) current. If you want to measure the combination, both Arduino and transistor need to be powered from the battery, and just add the meter in series with either the positive or negative pole of the battery, before any connection to either Arduino or transistor. i.e. all current to the battery must pass through the meter.
  4. Yes, see point 1.