8/30/2023 0 Comments Arduino pwm motor codeIf you are looking for extra protection you could use an optoisolator between the Arduino and the transistor. A rectifier diode like the 1N4001 or SB560 should do the job. We will need a diode fast enough to react to the kickback, and strong enough to take the load. But when that voltage spikes comes flowing the opposite direction, the diode allows it to flow back to the coil and not the transistor. So this diode (only allows current to pass one way) is normally facing the wrong direction and does nothing. This only lasts a few microseconds, but it is enough to kill our transistor. What happens is when you stop powering the coil, a reverse voltage, up to several hundred volts, spikes back. Any time you are powering a device with a coil, such as a relay, solenoid, or motor, you need this guy, and don't leave home without it. You can see that in 2 of the 3 illustrations, there is a diode parallel to the device we are powering. This type of transistor is switched by current and not voltage, so we need to make sure to supply the correct current to the base to switch it, so a resistor is connected from the Arduino to the base to limit the current to the proper amount. Hooking it up / What's the diode used for? When our arduino sends a HIGH signal to the transistor's base, it switches the transistor (connecting the collector and emitter) and completes the circuit for the motor, solenoid, or light. Ground is connected to the transistor's collector. So we connect it so that our motor, solenoid or light is connected to V+ but not ground (V-). When you send a HIGH signal to the base (control pin), the transistor switches and allows current to flow from the collector (in) to the emitter (out). You basically have an In called the Collector, an Out called the Emitter, and a Control called the Base. If you don't know transistors at all, they are 3 lead components that have 2 simple functions, to switch or amplify (in this example it is setup as a switch). it is here in an attempt to explain, in simple terms, what is going on. WARNING: I am about to simplify the crud out of this, so beware. The reason I'm covering this particular transistor is because it is readily available, and you can usually pick one up from Radio Shack, Adafruit or other local parts store in a jam, but you can use any NPN darlington transistor like the BD651 exactly the same way. Sensors, LEDs, ICs, and the like are all capable of being powered directly from your Arduino, but as many awesome 5 and 3.3v components as there are, eventually you will find yourself holding a 12v solenoid, motor, or light and wondering "How the heck am I supposed to control this from my Arduino?" Well today we are going to talk about doing just that from a magical device know as a transistor, specifically the TIP120 Darlington Transistor. Up until now, we have talked about working with a lot of low-power devices.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |