How to energize Relay of 24v coil voltage with AT Mega 8?

Go To Last Post
17 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The output voltage level of AT Mega 8 is 5v. But I need to convert 24v from this 5v as i have to energize a relay of 24v coil without using an extra external source for the relay.
How can I do it?
Please somebody help .I am new in AVR world. This is my first project.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Use an NPN transistor. 10k from PORT pin to base. coil to collector. GND to emitter.

It is wise to put a diode across your coil (cathode to 24V).

ULN2803 or similar devices are designed for just this job.

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Swagata wrote:
...i have to energize a relay of 24v coil without using an extra external source for the relay.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I know that was the question.

He can use the AVR in 'open-drain' mode.
After all, he never specified whether he wanted the circuit to work more than once.

Open-drain should be fine to turn the relay on.
I guess that switching the drain off will probably take out the substrate diodes with the coil back-emf.

OTOH, a very small relay coil may not kill the AVR first go. It might be an interesting experiment to see just how long it lasts.

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You mean he has to make a 5V to 24V dc to dc converter?

Imagecraft compiler user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I assume that the Vcc comes from a 5V regulator, which will have an input greater than 7-8V. You should run the DC-DC converter from the input supply & not the output.
If you have 12V available at the input, there is a clever little circuit involving an additional relay which charges up a 100uF electro to 12V when the relay is normal, but when it operates, the capacitor is configured to boost the +12V supply to approx 24 Volt to operate the 24 Volt relay. The electro will discharge, but by the time it is the 24 Volt relay is operated and will hold quite OK on +12V. (This is quite often used in amateur radio circles to operate 28V RF type coaxial relays from 12 Volt). Found the cct.

Attachment(s): 

Charles Darwin, Lord Kelvin & Murphy are always lurking about!
Lee -.-
Riddle me this...How did the serpent move around before the fall?

Last Edited: Tue. Mar 20, 2012 - 11:18 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Bob and Lee,

I think that the OP already has two supplies. 5V and 24V.

If she only has a single 5V supply, it is easier to just buy a relay with a 5V coil.

There are many ways to do DC-DC converters.
New users are reluctant to buy decoupling capacitors, let alone a 10k resistor. Electrolytics or reverse-biased flyback diodes are probably off the radar.

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

OK David, that is possible, in which case there is no real issue.
I read it, because I've been there done that, that he is trying to operate a unique surplus 24(28 V) relay from a single power supply. Not so easy!
I suppose we'll have to wait for the OP to reply. The initial spec. is a little vague!

Quote:
There are many ways to do DC-DC converters.

True. I am one of those people who if it can't be done the way it should be done, I'll try & do it the way that it can be done.

Charles Darwin, Lord Kelvin & Murphy are always lurking about!
Lee -.-
Riddle me this...How did the serpent move around before the fall?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

bobgardner wrote:
You mean he has to make a 5V to 24V dc to dc converter?
That was certainly my take on the original question - maybe Swagata would like to make the requirement completely clear...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Ah-ha. You are correct. I read the title rather than the OP's actual question.

I still reckon that a 5V coil is the neatest solution.
There are many off the shelf DC-DC converter chips, but you still have the different supply level issue.

OTOH, a cheap surplus coax relay will not come in a 5V version.

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

thank u everybody.....though i didn't understand some parts of the above discussion but it was very helpful for me.
i understand that i should use relay of 5v coil.but the problem is i have to switch on/off a horn(just like the horn used in ambulance) of 220v.i m not sure how much current it will take .
i saw some 5v relay which are very small in size and i dont think that its auxiliary(no/nc) current rating will be greater than it will need to operate that kind of horn.
now what should i do.thank u again

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

will i get any 5v relay of higher auxiliary current rating in the market?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Look up the data sheet for your horn.
This will give you the rated current. Or use your DMM or clamp-meter to just read the ON current.

I would be very surprised if it is more than 1A. Probably nearer 100mA.

There will be many 5V relays that can switch 1A @ 220V a.c.

a typical relay

NOte that 220V d.c. is far more difficult.
You really need a transistor for any coil currents of 40mA or more. And use a protection diode.

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
to switch on/off a horn(just like the horn used in ambulance) of 220v

?

Generally vehicles use 12 V DC. Ambulances usually have 120/240 VAC to run the wall wart chargers on many of the medical instruments, but the vehicle's lights, siren(s), and (air) horn, are generally 12 V DC.

I think you need to look carefully at the device you need to power, and its spec's, then select an appropriate relay.

JC

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Actually my horn is of 220v ac(sorry i forgot to mention ac/dc).And you are absolutely right current is just like u assumed.The datasheet of the relay has been very helpful.thanks a lot for that...
but i have a little confusion....u wrote

Quote:

You really need a transistor for any coil currents of 40mA or more. And use a protection diode.
cant i use relay coil directly in the output port without using any transistor?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Look at your relay coil current. The link I showed is a 40mA coil.
Look at your AVR max current per PORT o/p pin. e.g. 40mA

Note that you can probably use a smaller relay. i.e. less current.

A larger current would need a transistor. However you can use several PORT pins together to share the current.

You always need a protection diode.

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Now that you have given us details of what you really want to do, here is the simplest solution. Why not use a solid state relay (SSR).
A better post name could have been "How to interface MCU to 240VAC load" & should have been in "General electronics"

Charles Darwin, Lord Kelvin & Murphy are always lurking about!
Lee -.-
Riddle me this...How did the serpent move around before the fall?