Jump to content
43oh

Using a Relay with the MSP430, help?


Recommended Posts

Hiya,

 

For a new small project i want to use a relay with the MSP430.

I obtained a simple 5 volt relay, which i tested with a 2x double A battery pack (about 2.8/2.9 volt effectively) and it worked fine with the 15v AC signal i'm trying to switch.

Now i know it's not a good idea to hook it up to the msp430 directly.

So, what would be the "proper" way to attach stuff?

I did some googling, but most diagrams are way too complicated for my objective, or don't really seem safe for use with the msp430 (or I am just looking at the wrong places ; )

 

Thanks,

MarkoeZ

 

p.s. rest of the project is shaping up nicely, so expect a new topic soon :)

Link to post
Share on other sites

Ah thanks! I had all those elements in place (except the protection diode, but not really crucial in a battery test setup).

But turned out i had a transistor that was too weak since im trying to switch it on 3 volt instead of the regular 5, and a resistor that was too high. This Page from a previous discussion turned out very helpful, measuring resistance and calculating from that.

Link to post
Share on other sites
Can you guys explain that animated schematic, It is pretty wild...

 

If i could i would. But dont really understand it myself (the safety of it), and could not get it to work on my breadbord. Do I need a specific type of diode? Just used some ones I had laying around for the quick test...

Link to post
Share on other sites
Can you guys explain that animated schematic, It is pretty wild...

The point of the animation is to show the importance of the diode; it is there to protect the circuit from the inductive surge produced when the relay releases.

 

1- 3v3 is applied to the circuit, and the relay closes

2- 3v3 power is removed, the relay opens. The collapse of the magnetic field creates a reverse current in the relay's coil. The protection diode (note the orientation) allows the current to harmlessly dissipate (without entering the rest of the circuit)

3- The circuit stabilizes. (This all happens in a small fraction of a second.)

 

EEs in the forum: Please correct me if I am mistaken. :)

Link to post
Share on other sites

http://en.wikipedia.org/wiki/Relay

 

Not sure theres not much to understand with a relay?

A relay is simply a magnetically controlled switch. The magnetic control element is simply an inductor with a resistor in series.

 

A relay generally has 4 input pins.

 

2 contacts should have ~ 10-100ohms of resistance between them. Use your multimeter to find these. This is the inductor that you use to control the switch. Apply whatever voltage is specified in the datasheet for the relay. The relay that I used with my oven was a "5V relay" and thus I applied 5Vs to it and used a simple LSD configuration as seen below with a mosftet. No protection diodes are really required because, provided your driving your relay correctly (aka not pumping a crapload of current through it) the inductive kickback shouldn't be enough to damage the fet. Another thing to note is that the relay is not polarized, a resistor in series with a inductor is not a polarized element so there is no positive or negative terminals.

 

The other 2 contacts on your relay are you switch elements. They should go from infinite resistance to 0 resistance depending on the voltage you apply to the control element. Again, no polarization since its simply a switch. Simple representational diagram is below.

 

relayc.png

 

Hope that helps! Sorry if your question was already answered.

Link to post
Share on other sites

Yes that is correct. LSD(Low side driver) meaning a transistor between GND and load. A HSD (high side driver) would be a transistor between power and the load.

 

As for usage of a mosfet, versus a BJT.... well you saw my flop in the IRC.... Ultimately, which to use depends on your application and as far as us hobbyists are concerned, it generally comes down to personal preference. The reason being you can commonly make either work. I personally prefer mosfets because they do not require a constant current to be applied at the gate in order to be turned on. Hook them up directly to the msp430 and not worry about current consumption. (provided i'm not pwming at a fast frequency)

 

Regarding the protection diode, I take back what I said. As a rule of thumb it is probably best to have one in your circuit when dealing with inductive loads.

 

Here is an excellent video regarding them:

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...