I need to control a coffee machine plugged into a wall outlet using a relay connected to an arduino. Apparently I need to connect a transistor to the relay. Why? Is it because the arduino can't supply enough current to trigger the coil in the relay?
So the info on the packaging of this relay says "R46-5D12-12 ROHS SPDT 12A-12VDC". How do I go about choosing a transistor? Will I need anything else other than a diode?
edit: The relay will need to be triggered for about 0.5 - 1 seconds every once in a while. The load is definitely not big. It'll simply replace the power button on the coffee machine with an arduino.
Answer
There are multiple reasons you want to do this in your case the reasons I can think of are:
1) The relay needs 12V on the input to turn on. An Arduino GPIO only outputs 5V. A transistor in between will allow a 5V signal from the Arduino to switch a 12V signal via the transistor to the relay - thus turning it on.
2) The transistor provides protection. In the event of a back emf voltage spike or some other undesired event only your transistor will be blown, instead of the entire Arduino.
3) Using a transistor should provide marginally faster switch times because the transistor can source more current than the few mA that an Arduino can - thus saturating the coil faster.
Read this info sheet (http://www1.electusdistribution.com.au/images_uploaded/relaydrv.pdf). and pay attention to these images in particular. They show you what a good switching circuit would be and explain how to implement them.
No comments:
Post a Comment