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:
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.