1

I have a TIP 120 to 229 NON 60V 5A transistor

I'm trying to use it to switch an electro magnet. Using the blink example to test it out:

// 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(500);              // wait for a second
  digitalWrite(13, LOW);    // turn the LED off by making the voltage LOW
  delay(500);              // wait for a second
}

pin 13 is connected to the base and I'm trying to powering the magnet with a 12V DC adapter. I'm not sure if the transistor is before or after the magnet, but I'm not sure how that would make a difference.

I'm not great with diagrams but something like this (the power source might be the other way around:

schematic

simulate this circuit – Schematic created using CircuitLab

I've tried switching between the collector and the emitter. In one instance the magnet is always active and in one instance it's always passive. What could be wrong?

The cords running of the table in the bottom is just a bit of extra wiring. enter image description here enter image description here

  • A magnet?!?! Do you mean an Electro-Magnet?? – Dat Ha Oct 26 '16 at 15:05
  • How about showing a circuit diagram? – Majenko Oct 26 '16 at 15:06
  • @canadiancyborg Yes – Himmators Oct 26 '16 at 15:09
  • @Majenko sure, gimme a sec! – Himmators Oct 26 '16 at 15:09
  • 1
    Uhhh transistor wrong way around in the schematic? – Bradman175 Oct 27 '16 at 0:35
5

Is there the only wire from Arduino to the Base of Transistor?

Basically you need something like this:
enter image description here

If you reverse the transistor (E and C), builtin protection diode will be in forward direction, so electro magnet is on.

If you have only one wire to the base, it cannot work as you need current to the base.

If you don't have R1 into the base (about 500R-1K), it'll burn your output eventually. (not if you don't have common ground)

If you have electro magnet between ground and Emitter, you'll have negative current feedback and about 4.2V on L1 tops as there must be some current into the base.

  • With reverse transistor do you mean reverse collector and emitter? What is "the base"? I'll put in R1 but would that make this setup not work? I don't have D1 either, what does that do? – Himmators Oct 26 '16 at 15:34
  • If the wire marked by white is +12V, it will be the last case, so no. Also you need common ground, but be carefull, I can see the smoke generator more likely... – KIIV Oct 26 '16 at 15:40
  • The transistor is connected to on the wire with a white mark, is that the right or wrong wire? – Himmators Oct 26 '16 at 15:47
  • White is usually the positive supply. You have to measure it. – KIIV Oct 26 '16 at 15:48
  • You need a resistor between the arduino and the base of the darlington transistor. – Gerben Oct 27 '16 at 8:35
2

The program is fine.

Looking at the first photograph - The Ground of the Arduino needs to be connected to the ground of your circuit.

I do not understand the two-transistor part of your circuit, so I can't say if this is OK or not. You could also switch the electro-magnet using a relay.

  • 2
    I don't understand the two-transistor part of your circuit - It's a Darlington transistor – Nick Gammon Oct 27 '16 at 5:34
  • @Kingsley, needs to be connected to the ground ok thanks! Is this likely what's causing my problem or is this for some other reason (trying to learn as much as possible). – Himmators Oct 27 '16 at 9:31
  • Can confirm the darlington transistor, concerning the relay, I needed something really fast for my application, so I went with a transistor. – Himmators Oct 27 '16 at 9:32
  • Also How would I do ground arduino in practice? Should i run a wire from ground on the Arduino to the negative pole on the 12V DC-converter? – Himmators Oct 27 '16 at 15:21
  • @Himmators - Yes, the ground of the arduino should be connected to the power supply ground. Generally all grounds are connected together. – Kingsley Oct 30 '16 at 9:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.