Shop OBEX P1 Docs P2 Docs Learn Events
Propeller resetting when actuating relay - Page 2 — Parallax Forums

Propeller resetting when actuating relay

2»

Comments

  • Actually my 1st meter must be wrong. Just rechecked with my scope and though it does measure 3.6V it also measures .3V when it should measure zero (when I connect leads). Sorry about that I guess my regulator's fine just my meter's off.
  • I'm now pretty sure my regulator is fine but my 1st meter is off since I changed the batteries. My scope reads 3.6 volts but I just noticed it reads .3V when it should read 0 (leads connected).
  • jmgjmg Posts: 15,173
    amg018 wrote: »
    Maybe my 2nd meter is right though. It says 3.3V almost exactly and I have changed the batteries on my 1st meter since the last time I checked with it... Still though I'd find it odd my scope and 1st meter give similar readings

    Scopes are not very accurate, unless special care is taken in their design.
    Try some other ranges, and check other regulators or voltage references you may have.
  • evanhevanh Posts: 15,918
    edited 2015-10-19 08:17
    Doh! Spoke before reading everything ...
  • I think I'm going to build this project in the hand written drawing and see what my results are.
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2015-10-20 10:59
    I can't help thinking that a redesign of this whole scheme is in order.

    The 10,000 ohms on the 2N2222 seems to be high.

    Try using a proven voltage regulator specifically designed for automotive use as it is a high noise environment. Autos have a lot of heavy switching due to battery charging, horn honking, high/low beam switches, etc. that voltage regulator designers have specifically addressed. That Parallax provided LM-2937-3.3 is an automotive rated regulator.

    And simplify the relay set-up.

    Why does one use a 9VDC relay on a 14VDC supply?
    Adding D1 helped because it brought the 14VDC down a bit and closer to the 9VDC. It may have been only 0.5V drop. The 2N2222 adds a 0.7V drop. So you have 14.0 - 1.2 = 12.8VDC. You need to do something more.

    If the user was to use a 12VDC relay, many are designed to tolerate the charging of an automotive battery at about 14.2VDC and still operate well. There may be something about the 9VDC with 100 ohm current limiting resistor that may be creating problems.

    And if you use a Darlington, such as a TIP120 to control your relay, you actually insert a 2VDC drop, so the coil would actually see 12VDC.. not 14VDC plus you have a diode provided in the Darilington that may eliminate all the noise.

    The TIP120 may seem too big for you. If that is the case, there are other Darlingtons with diode include that are about the same as the 2n2222 in size.

    ++++++++++
    I DO understand that the relay is glued in place. Why not just have use a variable voltage regulator to provide the relay coil with exactly what it needs in this circuit? It seems with the 2n2222, you need 9.7VDC without the D1 and without the 100 ohm resistor.
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2015-10-20 12:48
    The 2N2222 adds a 0.7V drop.
    Vce(sat) of a 2N2222 is only about 100mv or so if driving a relay with 1ma base current (R=3.3-0.6/1ma=2,7k so use 1k or so). I don't know where you get your figures from sometimes :)
    The TIP120 may seem too big for you. If that is the case, there are other Darlingtons with diode include that are about the same as the 2n2222 in size.

    Just use a MOSFET in the first place, Darlingtons are fine for pulsed loads but are not very good for continuous loads due to high >1V Vce(sat) which results in more heat to dissipate etc.
    I DO understand that the relay is glued in place. Why not just have use a variable voltage regulator to provide the relay coil with exactly what it needs in this circuit? It seems with the 2n2222, you need 9.7VDC without the D1 and without the 100 ohm resistor.

    Relays don't really care too much if they are overdriven, it just means a little more heat and current. But why 9V? Probably because it was there and spending many days fixing the circuit is less trouble than just using the right parts????

  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2015-10-20 17:05
    The 2N2222 adds a 0.7V drop.
    Vce(sat) of a 2N2222 is only about 100mv or so if driving a relay with 1ma base current (R=3.3-0.6/1ma=2,7k so use 1k or so). I don't know where you get your figures from sometimes :)

    Well, the 0.7V drop is a general 'Rule of Thumb' for BJT transistors per The Art of Electronics-2ed, Horowitz, et al. But the Fairchild pdf for the 2N2222 seems to indicate 0.3V and require 15ma to the base to drive 150ma load to saturation. I was simply trying to point out that the voltage drops in the circuit were not enough to get anywhere near the 9VDC.

    Obviously, you have different reference material. I can't find anything about 100mv for Vce(sat). Perhaps you are looking at a curve on a chart. My reference only offered tables.
    =====
    I also am wondering if there is more that the OP is driving from the voltage regulator and possibly leading to a thermal reset.

    It just seems to me that we are piling on more and more components rather than seeing the whole picture.

    MOSfets are always better. But one may not get what they need in a TO-92. Everything is going to SMD.
  • jmgjmg Posts: 15,173
    Well, the 0.7V drop is a general 'Rule of Thumb' for BJT transistors per The Art of Electronics-2ed, Horowitz, et al.

    You will find that is for Vbe, not Vce.

  • jmgjmg Posts: 15,173
    edited 2015-10-20 19:49
    amg018 wrote: »
    The 100 Ohm resistor was selected because it was the largest resistance with which the relay would always trigger.
    Once you have the cables maximally spaced, you could try a ferrite bead or small inductor in each relay coil lead, and split the 100R into one resistor per leg.
    You are trying to block high dV/dT paths from the capacitance of the relay itself.
    A bead like CIM21J222NE looks good, cheap and specs
    Impedance @ Frequency 2.2 kOhm @ 70MHz
    Current Rating 300mA

    Another way to drive 9V relays is current regulated - simplest is a double diode in the base and an emitter resistor.
    Or use an LED on the base, and you get a free ON indicator.
    That gives wide voltage tolerance, and does not over-drive the relay.
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2015-10-21 06:31
    I do see the Vbe versus Vce glitch.

    I am curious about the double diode arrangement for a current requlated relay coil, but can't quite envision it. Can you provide a schematic or link.

    Still, my 2N2222 data sheet seems to imply that the Base desires 15ma to reach saturation for a 150ma load, so that 10,000 ohm resistor would come down to 220 ohm for such.

    I personally would only use 10,000 ohm on an i/o for a MOSfet or Darlington. I tend to mainly use them for pull-up resistors.
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2015-10-21 07:12
    I do see the Vbe versus Vce glitch.

    I am curious about the double diode arrangement for a current requlated relay coil, but can't quite envision it. Can you provide a schematic or link.

    Still, my 2N2222 data sheet seems to imply that the Base desires 15ma to reach saturation for a 150ma load, so that 10,000 ohm resistor would come down to 220 ohm for such.

    I personally would only use 10,000 ohm on an i/o for a MOSfet or Darlington. I tend to mainly use them for pull-up resistors.

    Hmmm, in too much of a rush are we to RTM properly? :)

    Are you also confusing the "test conditions" that they used with actual operating conditions?

    Typical Hfe current gain is at least 100 so for 150ma load that would imply 1.5ma base current which but this is just a relay and none of the 9V relays I see listed that handle up to 10A contacts require more than 20ma coil current, which is about right. So with a 2k7 base resistor and 1ma base current we have no problem driving this 9V relay. So don't read "test conditions" and try to make the OP's circuit fit that. Like a certain car manufacturer the test conditions aren't necessarily real conditions.

  • jmgjmg Posts: 15,173
    edited 2015-10-21 08:13
    I am curious about the double diode arrangement for a current requlated relay coil, but can't quite envision it. Can you provide a schematic or link.
    Like this: Base diodes are more rugged, or that can be a single LED.

    images?q=tbn:ANd9GcSxAz5ijXAoCM51XouadI_zDu7XN7nzfMusfeibrsC92I4icPba7A

  • kwinnkwinn Posts: 8,697
    How about avoiding all these problems by using a zero crossing SSR that can be powered from either the 3.3V or 14V power supply since they typically need less than 20mA. Problem solved for 2 - 5 dollars.
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2015-10-22 05:20

    Hmmm, in too much of a rush are we to RTM properly? :)

    Are you also confusing the "test conditions" that they used with actual operating conditions?

    Typical Hfe current gain is at least 100 so for 150ma load that would imply 1.5ma base current which but this is just a relay and none of the 9V relays I see listed that handle up to 10A contacts require more than 20ma coil current, which is about right. So with a 2k7 base resistor and 1ma base current we have no problem driving this 9V relay. So don't read "test conditions" and try to make the OP's circuit fit that. Like a certain car manufacturer the test conditions aren't necessarily real conditions.

    Your RTM comments and assertion of 'test conditions' are absurd. I provided specific references, you merely pontificate.

    Using BJT transistors in saturated switching substantially reduces the Hfe gain figure.

    Your estimate of a 9VDC relay's coil resistance may be correct, or completely off in the weeds. I generally work with 12VDC relays that require 50-60ma, and we have recently seen a discussion of 3.3VDC relay that requires 176.5ma. Coil resistance figures are all over the place.

    Try applying an Hfe(sat) value of 10 to an actual verified relay coil resistance and voltage.

    Typical saturated BJT gain according to the main text in Chapter Two and Appendix G of 'The Art of Electronics-2ed" is 10 to 20, nowhere near that 100. And the Fairchild Semi PDF for the 2N2222a seems to indicate they prefer the Hfe(sat) to be 10.

    My take on it is that for 150ma, the highest resistor value to Base at 3.3VDC should be about 440 ohms (providing 7.5ma of Base current at 3.3VDC).

    Give me a real value for the 9VDC relay's coil resistance and I can provide you with a good value for the Base current.

    ++
    My original concern was that this thread was not dealing with solving the problem by a good comprehensive view of the problem. It you can teach that, why get so petty with belittling me?

    @jmg
    Thanks for the schematics.
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2015-10-22 05:20
    Now just remember Loopy, the :)s that are added, this should be a healthy debate, not a personal one. I provided correction in the first place because you are attempting to inform somebody who doesn't know better but you keep stating that a transistor has a Vce(sat) of 0.7V when everyone who knows transistors knows that this is not the case.

    So you are saying that a Hfe(sat) of 10 is typical????? I know that is not the case at all. I may drive a small switching transistor with up to 2ma at times and that is to switch a heavy backlight >200ma or so. These transistors saturate, otherwise they would all burn out or get hot at least, which they don't. Maybe somewhere in the 1950's the transistors behaved like this.

    To check on 9V relays I didn't guess, I went to Mouser/Digikey and selected all those with contacts up to 10A and the highest coil current figure was <20ma among the wide selection.

    I treat this as a technical forum and I don't like to see misquoted figures being propagated. I don't have any control on fritzing forums but I can have my say here.

    Now, I'm sorry if I come across as "belittling" and that is not my intention, you should know me better than that. I do apologise.
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2015-10-22 10:58
    Well, I did admit my mistake with the Vce(sat).
    "The Art of Electronics- 2ed" does get a bit confusing about transistors, and MOSfets.

    I am saying typical Hfe(sat) is between 10 and 20 according to Horowitz, and the Fairchild pdf for the 2n2222a seems to prefer 10.

    But I did return to the reference and re-read the material to explain what a supposedly reliable reference presents. And I read the 2N2222 pdf as well.

    If all that isn't good enough, provide me with reliable references.

    Sometimes people do buy junk out of Electronic Goldmine or EBay that may actually underperform whatever Mouser or Digikey is touting.
  • BTW, I did locate that Vce(sat) should range between 50mV and 200mV in "The Art of Electronics" in Chapter Two if one provides enough current to the base.

    I doubt if I will ever buy the 3rd edition as the 2nd edition's presentation of things is not easy to read.



  • You reminded me that I have a similar book that I've never read "The Circuit Designer's Companion" 2nd edition. So I decided to flick it open to active components and bjts and there in all it's glory on page 131 is the typical curve of gain versus current with the normalized Hfe starting from 0.6 and hitting its peak from 10 to 50ma more or less. Looking at the 2N2222 datasheet I see that at 50ma collector current that the Hfe is >200. If it gets hotter then the Hfe increases. To achieve a Vce(sat) of 200mv @150ma the curves show that you need just under 2ma but only about 0.1ma base current for 20 to 30 ma @200mv.

    All this proves is that you don't need 1,000 amps to drive the base of the transistor, even if the DUT is being driven so. Okay, so I'm exaggerating but transistor Hfe's of >100 are what you would expect in circuits that need to switch around 100ma or so. It is only when you get to around 500ma loads that the Hfe drops down to less than 50, but that is approaching the device limits.
  • jmgjmg Posts: 15,173
    .... To achieve a Vce(sat) of 200mv @150ma the curves show that you need just under 2ma but only about 0.1ma base current for 20 to 30 ma @200mv.
    Curves are typicals only, so you need care designing minimum cases from those.
    eg 0.1mA Ibb is a Beta of 300 at 30mA, when you should instead certainly be under the minimum HFE at the current and temperature you target.
    How much you go under the minimum HFE at the current and temperature you target, is a designer choice.
    Vce SAT improves with higher Ibb, up to some point.

    For > 100mA work, we avoid the ancient vanilla BJT and use the newer parts whose HFE does not nose-dive > 100mA

  • OrladinOrladin Posts: 17
    edited 2015-10-23 05:12
    I've built two devices using this circuit but I used a 60V 30A N-Channel MOSFET (from Sparkfun) to control a 5V relay. The relay is powered by a dedicated voltage regulator but is using the same source as the 3.3v regulator powering the prop. Both of them have been happily doing their jobs since I built them with no random reset problems.

    Edit: Here's a link to the MOSFET I used: https://www.sparkfun.com/products/10213
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2015-10-23 06:38
    Orlain seems to have a nice simple approach to this. That is the best way to get anything done without problems.

    I can't really control what the world offers up as good information.
    I tried to Google 'transistor satuaration' and got more of the wishy-washy gobbly-gook.

    While the concept is quite clear and saturation is indeed one of the standard states of a transistor, about the only way one can be sure it is achieved is to monitor the voltage drop across Vce in an actual circuit as built.

    My gut feeling is the 2n2222a often works fine with a relay without ever reaching true saturation. Some authors refer to 'forced Beta' as creating a gain of about 10 for saturation, others wander off into other speculations. So I still believe that driving the 2n2222 with lots of Base current may be the wisest choice.

    ++++++++++
    S0 the 10,000 ohm on the Base at 3.3V in the original design is just too high regardless. Use whatever suits you.... but you may only be thinking you got 'true saturation'.

    ++++++++++
    My only purpose for bring up the issue is that the more sloppiness in a circuit, the hard it is to resolve the source of an instability. In this case, why the Propeller is resetting remains ellusive. Layering fixes on top of other problem areas in a circuit may never resolve the problems.

    Personally, I don't see much benefit in using relays below 12VDC. I want to keep the coils on a separate supply, away from my digital electronics, and the coil DC does NOT have to be regulated. So a 12VDC gel cell can power the relay coils, and the same can provide for a 3.3VDC Propeller via one of many regulation alternatives.

    The tiny relays that can be soldered on a printed circuit board may have 10amp at 240VAC switching capacity, but the physical circuit board's copper won't handle 10amps. So I use relays that plug into a rail for AC mains applications. What are you going to do if your circuit board burns up?

    Also, the problem may be an overloaded voltage regulator that is causing the Propeller to reset. These will go into a thermal shut down. That is why I actually drive my relay coils outside the regulated voltage environment.. these coils don't care about regulation or noise spikes. But I still use diodes so they the spikes they create don't travel far.
  • Using a 30A MOSFET *AND* a regulator to drive a 5V relay is beyond ridiculous. Of course it will never fail but cars could be built like tanks with an extra backup engine etc to make them tough and reliable too, but who could afford it or want to drive it. Practical electronics does not go overboard.

    "Forced Beta" is a confusing term. All it is showing is that you get 60mv saturation voltage instead of 100mv saturation voltage, in other words it is "fully fully" saturated but what advantage does it give when you have to drive it so hard. A perfect switch would have zero volts but even a bit of wire still has some minute voltage drop anyway. You have to be pragmatic in designing circuits which is why 100mv or 200mv Vce(sat) at high gain is more than fine and if that isn't good enough then you are using the wrong circuit anyway. Gut feelings aren't necessary and can never be selected as the wisest choice in the true sense of the word when you have the means to try it yourself or at least LTspice it.

    10 amps on pcbs is achievable if the copper track is short and wide and even exposed and tinned or 2oz copper etc. I do this all the time. If you look at a 10A fuse then you know it shouldn't blow at 8A even though the wire is thin, it is still short and thermally sunk to some degree.

    Although there are lots of advantages in using SSRs there is also no reason why relays can't be used reliably either as this is done all the time and to a larger degree in industrial switching equipment. If you drive a relay off the board then you have a problem with EMI down the connecting wires so the diode needs to be across the coil itself or put your drive transistors with the remote relay. A ferrite EMI core or the connecting wires wound through a toroid will cut down on any EMI.
Sign In or Register to comment.