Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

5V Relay Driving Circuit


  • Please log in to reply
11 replies to this topic

#1 Charlie M

Charlie M

    New Member

  • Members
  • Pip
  • 4 posts

Posted 24 September 2011 - 04:44 PM

Hi All, I have been trying to control several external mains voltage devices (mostly kettles) from my NetDuino. I have been doing this by using a simple transistor ciircuit to drive SSR's from the digitial pins. This works great. I uses a cicuit like the on in this PDF. http://www.arduino.c...ning/relays.pdf However I also need to drive a small relay to control a low voltage DC device using the same circuit as the SSR's. This is a 5V relay which is what I thought was outputting. It turns out the output to the SSR's & relay is actually 3.3v. The SSR's can work at this voltage but the relay can't. However the transistors are connected to the 5v onboard power, so I expected the output to be at 5V rather than 3.3v is that correct? I have confirmed the NetDuino is outputting 5v on the 5v onboard output and if I connect the relay directly it works fine. Any ideas, have I misunderstood something? Thanks, Charlie M

#2 Mario Vernari

Mario Vernari

    Advanced Member

  • Members
  • PipPipPip
  • 1768 posts
  • LocationVenezia, Italia

Posted 24 September 2011 - 05:05 PM

I would help you, but I don't understand the point... So, you are using SSR (=Solid State Relay?) to drive some mains outlets...you say they are kettles (first time I read this word!), they should be "resistors". Unless you won't use inductive loads, such as motors or coils, that's perfect. Could you explain me better the rest of the scenario?
Biggest fault of Netduino? It runs by electricity.

#3 monewwq1

monewwq1

    Advanced Member

  • Members
  • PipPipPip
  • 104 posts

Posted 24 September 2011 - 11:41 PM

However the transistors are connected to the 5v onboard power, so I expected the output to be at 5V rather than 3.3v is that correct?

I have confirmed the NetDuino is outputting 5v on the 5v onboard output and if I connect the relay directly it works fine.

Any ideas, have I misunderstood something?

Thanks,

Charlie M


I don't quite follow this. Are you connecting the transistors to the 3v3 or the 5v on the Netduino? The Netduino has outputs of 3.3vdc and 5vdc depending on which pin you use.

Also, what is the application with the kettles? When you say kettles, do you mean like teakettles for boiling water?

#4 monewwq1

monewwq1

    Advanced Member

  • Members
  • PipPipPip
  • 104 posts

Posted 24 September 2011 - 11:44 PM

However the transistors are connected to the 5v onboard power, so I expected the output to be at 5V rather than 3.3v is that correct?

I have confirmed the NetDuino is outputting 5v on the 5v onboard output and if I connect the relay directly it works fine.

Any ideas, have I misunderstood something?

Thanks,

Charlie M


I don't quite follow this. Are you connecting the transistors to the 3v3 or the 5v on the Netduino? The Netduino has outputs of 3.3vdc and 5vdc depending on which pin you use.

Also, what is the application with the kettles? When you say kettles, do you mean like teakettles for boiling water?

---> Edit, I think I follow now. Do you mean you are getting 3.3vdc from the I/O pins? That is what you will get. The I/O pins output 3.3v but are 5v tolerant. See the lower right corner of the spec sheet.


You will need to use the 5v supply pin to power your 5v device.

Oops, I didn't mean to double post! Sorry! :mellow:

P.S., when it says that the I/O pins are 5v tolerant, it means you can connect a 5v signal input to the pins without damaging them.

#5 Charlie M

Charlie M

    New Member

  • Members
  • Pip
  • 4 posts

Posted 25 September 2011 - 08:17 AM

Sorry I probably wasn't being very clear. The overall application of the NetDuino is to control my home made brewery. It can make all kinds of beer from there basic ingredents. It consists of various heating elements taken from some budget ketles (i.e. normally used to make cups of tea). There also lots of temperature probes. These are all controled via Solid State Relays. I have also got a small low volatage DC pump. I have a 12v power supply which powers the Net Duino, the pump and a WIFI bridge. I have a traditional low power relay to control the pump. I know the digital IO's are 3v and not powerful enough to drive the SSRs and relay. So I have built 6 versions of the circuit in the link on my first post. I put it on a wireshield. I have used the 5v line of the NetDuino as the input to the cirucit. So I thought the output would be 5v but its only 3.3v. Thats enough to drive the SSRs but not the relay. The 5v line on the NetDuino is outputtng 5v correctly, its just not comming out at 5v. So my question is should that circuit be outputting 5v and if not what have I done wrong. Have I got the tranistor the wrong way around. Thanks Charlie

#6 Mario Vernari

Mario Vernari

    Advanced Member

  • Members
  • PipPipPip
  • 1768 posts
  • LocationVenezia, Italia

Posted 25 September 2011 - 12:32 PM

Charlie, the circuit shown is perfect for driving either a SSR, or a relay. The output of the Netduino will drive the transistor, which is turned on by the *current* flowing out the Netduino's output: the actual voltage provided from the board is secondary. Of course, you should wire the transistor correctly, otherwise nothing will work. When the Netduino output will turn "high" (i.e. "true"), will have enough current to "switch" the transistor on. Under this condition, the collector lead (where the relay+diode is connected) must have a voltage close to zero Volts, respect to the ground. If not something is going wrong. You should also check the polarity of the diode (mandatory for relays). I'd suggest to use a multimeter, because the voltages in the circuit are important to give you useful clues. If you want, you may substitute temporarily the SSR/relay (and diode) with a resistor (let's say 1KOhm, but it's not critical). At this point, check the voltages again. Let me know. Cheers
Biggest fault of Netduino? It runs by electricity.

#7 Robert L.

Robert L.

    Advanced Member

  • Members
  • PipPipPip
  • 100 posts

Posted 25 September 2011 - 12:43 PM

I know the digital IO's are 3v and not powerful enough to drive the SSRs and relay. So I have built 6 versions of the circuit in the link on my first post. I put it on a wireshield. I have used the 5v line of the NetDuino as the input to the cirucit. So I thought the output would be 5v but its only 3.3v. Thats enough to drive the SSRs but not the relay. The 5v line on the NetDuino is outputtng 5v correctly, its just not comming out at 5v.

So my question is should that circuit be outputting 5v and if not what have I done wrong. Have I got the tranistor the wrong way around.
Thanks
Charlie


Several tings to consider......

If you are applying the Netduino output to an NPN transistor thru a resistor as shown, the Netduino will be able to drive the transistor into what is called saturation. Saturation means the collector of the transistor will be as close to the same voltage as the emitter, that the transistor is capable to causing. This voltage will never be zero, however. Typically the voltage will be more like 1 volt. So if the relay is powered with 5 volts, and 1 volt is "lost" across the transistor, then the relay will only have a net of 4 volts across it. The 4 volts may or may not be enough power to make the relay active.

If you are measuring 3.3 volts across the relay when the Netduino is trying to activate the relay, you either have the transistor wired wrong, or the relay needs more current than the Netduino is able to supply. With the netduino output off, you should measure 0 volts at the transistors base (the lead with the resistor), and 5 volts at the collector (the lead connected to the relay). With the Netduion output on, you should measure around 0.7 volts at the base and 1 volt or less at the collector. Also the other side of the relay should continue to measure 5 volts.

With all that you are trying to do, you should consider using 12 volt relays, and power them from the 12 volt supply rather than from the 5 volts that comes from the Netduino.

I hope this helps.

#8 Charlie M

Charlie M

    New Member

  • Members
  • Pip
  • 4 posts

Posted 25 September 2011 - 07:03 PM

Thanks all for the info. I think saturation won't be an issue as 3v is bottom limit of the SSRs range and clearly the relay won't work with 3v. I have connected the relay directly to the 5V pin on the NetDuino and it works well. I was thiniking that because the output is 3.3v it must be being directly powered by the IO pin rather than the 5v pin. Looking at the DataSheet for the transistors (http://www.datasheet...or/mXyzqszz.pdf) I appear to have got the legs in the correct place in the circuit. One thing I have noticed is I have got the relay / SSR in a slightly different place. Its connected between the Emitter and the Ground rather than the 5v and collector as it is in the PDF. Would that be causing my problem? Thanks, Charlie

#9 Robert L.

Robert L.

    Advanced Member

  • Members
  • PipPipPip
  • 100 posts

Posted 25 September 2011 - 10:53 PM



One thing I have noticed is I have got the relay / SSR in a slightly different place. Its connected between the Emitter and the Ground rather than the 5v and collector as it is in the PDF. Would that be causing my problem?

Thanks,

Charlie


When you connect the relay between the emitter and ground, the voltage across the relay will at most be the base voltage minus a fraction of a volt. That configuration is called an "emitter follower" and in that case the transistor can provide current gain but not voltage gain. So the 3.3 volts that the output port of the netduino will generate is the max the relay will get.

When the relay is connected between the collector and the power supply, the transistor can provide both voltage & current gain. This is what you need and what was shown in the diagram you posted. So I assumed that was what you were doing. So, yes, that is causing you a problem.

#10 Bill E.

Bill E.

    Member

  • Members
  • PipPip
  • 26 posts
  • LocationSilicon Valley, California

Posted 26 September 2011 - 01:33 AM

Charlie M, you have received a LOT of good info from the members. From my experience, use a darlington transistor as a relay switcher for a microcontroller. The TIP102 would work for probably starting a car!! An MPSA12 will work for your apps no problem. Microcontrollers are very good at handling "hysterisis" issues. All schmitt outputs are good at that. Please research that as a side issue. Whenever I come across a switching issue with relays (unique animals, I have to admit) I immediately go with a darlington and a "flyback" diode. Your pdf circuit is perfectly accurate and will work fine. Opto22 used to make SSRs that were "digitally" controlled. I haven't used them for MANY years so you will have to look them up yourself. The Mini or any micro should be able to turn them on and off. Major point here: what will happen if your transistor shorts? Semiconductors shorting is the "norm" of their failure modes. If the switch shorts then the relay will be on all the time. Consider a "back-up" secondary switch or a fault-redundant switch. You wouldn't want an IV circuit to be injecting drugs into your arms because of a cheap, simple transistor failing. Or, in the case of your kettles, you would not want your house, or brewery, burning down because of a $.05 transistor! Another example of my concern with good people mucking with household mains. Really serious stuff! Charlie! Good luck and post again if you have a tech question. What a good one you put out!

#11 Charlie M

Charlie M

    New Member

  • Members
  • Pip
  • 4 posts

Posted 27 September 2011 - 12:07 PM

Thanks all for the great advise. I will build the circuit exactly as in the diagram which I think should resolve the issue. In terms of safety I am very careful with the mains side of this project. Unfortunately you can't boil 40L of water without using mains power, so there is no real alternative. Although some people do use propane burners and control them via a micro controller, buts probably more risky! The NetDuino is controlling 3 x 13 amp (@220v) power supplies so there is certainly plenty of power there. I continuity test everything with a continuity tester first to make sure its all wired as intend before connecting the mains. The actual mains wiring is very straight forward. If the transistors fail the worst case scenario would be that the heating elements run continuously. For the boiler that just means it boils indefinitely which isn't likely to be a problem as its boiled for 90 mins as part of the brewing process any way. In theory it could turn the elements on when the boiler is empty which certainly could damage the elements. The power connector for each element has an LED on it so I can see when they are on. Each output socket of the board has its own isolation switch so its easy to turn anyone off. Also everything is fused and its used on modern wiring so the entire ring main is on an RCD. Also the brewing process is very labour intensive so its not going to be left for more than 15 mins unattended. Thanks, Charlie

#12 Bill E.

Bill E.

    Member

  • Members
  • PipPip
  • 26 posts
  • LocationSilicon Valley, California

Posted 29 September 2011 - 01:48 AM

Charlie, what do you think your duty cycle will be on your boilers? That is, how long will you have them heating vs not-heating? And, I have to ask this, where in the world are you getting the power to energize 39AMPS@220V worth of power supplies?!! Thats ~ 8600 Watts!! Never mind - don't answer that!!! It's best we don't know, I think... ;-} Fire is always a possibility when high energy sources are used. Good going with the fuses. Transistors will burn, fiercely, at high currents. "I love the smell of burning transistors in the morning!" Possible scenario - cycle the heaters. Never have more than one on at a time. Now you can run from standard 30A 220V mains. If you are simply turning on and off heaters (I assume they are water tank heaters?) then consider triacs. A lot cheaper than relays feeding relays. You could use MOSFETs to turn on the triacs. When PC boards are manufactured there is a process called "profiling" the process. Boards go through multi-zone ovens which melt solder at specific temperatures. One part of the process is considering the residual energy left at a zone in the oven. That means the PC board will carry heat from the zone so you want to consider that into the equation for the next zone, and so on. Point being, can you determine how long a heater will continue heating AFTER you turn it off? That will determine your overall duty cycle. Good luck, and I would love to sample some of your brew!! Regards, Bill




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.