Shop OBEX P1 Docs P2 Docs Learn Events
Circuit design questions.... — Parallax Forums

Circuit design questions....

Don MDon M Posts: 1,653
edited 2011-08-11 21:54 in Propeller 1
I had previously posted this in the General Forum but now feel it would be better served in the Propeller Forum. Moderators please delete the thread in the General Forum.

A. Regarding the Propeller-

1. Am I correct that it a good idea to have 4 caps surrounding the Prop tied between Vcc and ground?
2. If so what is a good value? .1uF ceramic or 1 uF tantalum?
3. Should there be a cap on the Vcc of the EEPROM as well? If so what value?

The Propeller will have all 4 power pins and ground pins tied together under the IC. The Propeller will be using a 5 Mhz (80 Mhz) crystal so no over-clocking. The EEPROM will be located next to the Propeller.

B. Regarding the attached circuit diagrams-

I want to help insure that the transistor stays biased off to keep the relay from being accidently energized. Assume that the pin labeled RLY_UP is connected to one of the Propeller pins.

Which design is better?

The ground resistor connected from base to ground...

Relay 1.png


or the ground resistor connected from the Propeller pin to ground...

Relay 2.png


I would tend to lean toward the first design but would like to hear other opinions. The resistor values I have chosen are 1K each. The transistor is a 2N3904.
527 x 420 - 9K
527 x 419 - 9K

Comments

  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2011-08-01 19:18
    Either way will work of course although the first circuit is a fairly typical one and the one used most often as most people think that it needs to be done this way (inherited from linear circuits) . Of course in a digital switching circuit the base cutoff resistor is a useful pull-down but doesn't need to be there if driven from an I/O pin (source//sink).

    If you must use 1K values then I would use the first circuit, the conventional one as the Prop's I/O will only be sourcing 2.5ma rather than 5.8ma with the second arrangement. Of course you could change the pull-down to 10K.
  • JonnyMacJonnyMac Posts: 9,208
    edited 2011-08-01 21:44
    Use the second circuit, with a 10k pull-down to ground and 470 current limiter into the base of the NPN. I use this circuit all the time.
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2011-08-01 22:07
    Of course looking at your original post you said you wanted to keep the relay from being "accidentally energized". I'm not sure what you mean by this as even without a pull-down resistor there is no problem as there is no drive current. The pull-down serves no real purpose on a source/sink I/O into a bipolar transistor. Also, driving a relay does not require much current at all so you will find that a base resistor of 220R will work just as a base resistor of 3K3 (156mv VCEsat @120ma) or more will work. Only difference is how much more current your Prop and it's regulator has to supply for no extra benefit. If you were using a heavier transistor and driving a heavier load you would normally want a lower value drive resistor, but it's easy to do your sums for this.
  • Mark_TMark_T Posts: 1,981
    edited 2011-08-02 02:32
    The first circuit is more commonly seen, probably because you can have more agressive base-pull-down should you need it for fast switching (not an issue here). Its wise to have a bit of base pull-down to ensure the transistor is fully off at high temperatures where the leakage currents are higher and to prevent capacitive pick-up doing anything nasty.
  • Mark_TMark_T Posts: 1,981
    edited 2011-08-02 02:54
    Don M wrote: »
    A. Regarding the Propeller-

    1. Am I correct that it a good idea to have 4 caps surrounding the Prop tied between Vcc and ground?
    2. If so what is a good value? .1uF ceramic or 1 uF tantalum?
    3. Should there be a cap on the Vcc of the EEPROM as well? If so what value?

    The basic requirement for decoupling is that the power pins see a low-inductance path to a high-frequency capable decoupling capacitor. In practice this means a decoupling cap close to each pin (within 1cm) - sharing caps between pins is OK if they are close enough usually.

    To keep inductance low use wide power traces directly over a ground plane if possible. People often say the decoupling should be a combination of cap values like 0.1u, 1u, 100u, but usually that's overkill for a purely digital circuit (I tend to use 0.22u and 10u for the prop) - with mixed analog and digital it all matters more. If you are controlling high current switched loads then you'll need more decoupling for that (such as LED arrays), especially larger cap values to deal with larger current loads. Ultimately at lower frequencies the regulator chip does the decoupling of course, so the lower frequency decoupling caps are bolstering the performance of the regulator.

    And in general the higher the current consumption of a chip (and thus its current fluctuations) the more capacitance its power-rails should see. The EEPROM is low power, 0.1u would be OK and if its close to the prop it can share a cap with it.

    But basically don't skimp on decoupling to save a couple of cents, a few ceramic caps are cheap!
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2011-08-02 04:08
    Mark_T wrote: »
    The first circuit is more commonly seen, probably because you can have more agressive base-pull-down should you need it for fast switching (not an issue here). Its wise to have a bit of base pull-down to ensure the transistor is fully off at high temperatures where the leakage currents are higher and to prevent capacitive pick-up doing anything nasty.

    Hi Mark, I just see this base resistor being added to a lot of circuits that are hard-wired to I/O pins that are always an output in operation. I wanted to help others to see that this resistor is essentially redundant as any of the issues you mentioned (which I'm well aware of) are taken care of by the much lower value series resistor being pulled down to ground when it's not active. Yes, it's only a 1 cent resistor and one can put it in, but without it in this type of circuit one is no worse off.
  • Beau SchwabeBeau Schwabe Posts: 6,568
    edited 2011-08-02 09:46
    There are different reasons for using either circuit and each has it's place..

    In the first circuit, (voltage limited configuration) the resistors form a voltage divider from ground to the input voltage. As long as the ratio on the resistor divider is enough that the transistors base 'sees' the required B-E voltage then the transistor will turn "on". In this configuration with the right ratios you could make an effective comparator if your input voltage varied or had various levels that needed to be distinguished this would be the circuit to use.

    In the second circuit, (current limited configuration) both of the resistors in series form a pull-down across the B-E only if the input is floating. When the pin is active high or low, the B-E junction is only current limited from the input voltage. This configuration is better suited for driving a higher current load.

    The first circuit requires slightly less I/O drive current than the second circuit, but depending on the load of the transistor and the Hfe of the transistor, that I/O current might be necessary for adequate load current drive.

    Conclusion: In most cases either circuit would work, but it's important to understand the subtle differences and how they could be applied.


    @Peter Jakacki - "I just see this base resistor being added to a lot of circuits that are hard-wired to I/O pins that are always an output in operation... ...essentially redundant" - not necessarily true ... the default I/O state is an input until the software has a chance to take control, so during a power-up or even (a power down) the pins can be left floating. A resistor to ground on such external pins is a good safety measure to ensure that the device operates in a 'known' state.
  • Don MDon M Posts: 1,653
    edited 2011-08-02 14:49
    Thanks to everyone that replied to this thread. I have decided to go with circuit version #2. My intentions were to help insure that the transistor was biased off during any uncertain transitions with the Propeller pin. In other words not to leave it floating. I bread boarded up the circuit below using the values shown. I did some voltage and current measurements and noted them on the drawing. Using Ohm's law I figure there is approximately 5.2 mA of current on the Propeller pin when switched on.

    I used a 1N4001 diode as the catch diode.

    Relay 3.png


    Here's a snippet from the 2N3904 data sheet. It looks as though I am within spec.

    2N3904 Specs.png


    Any further comments in this regard are surely appreciated.
    621 x 155 - 18K
    527 x 419 - 30K
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2011-08-02 20:16
    There are different reasons for using either circuit and each has it's place..

    <snip>

    @Peter Jakacki - "I just see this base resistor being added to a lot of circuits that are hard-wired to I/O pins that are always an output in operation... ...essentially redundant" - not necessarily true ... the default I/O state is an input until the software has a chance to take control, so during a power-up or even (a power down) the pins can be left floating. A resistor to ground on such external pins is a good safety measure to ensure that the device operates in a 'known' state.

    Hi Beau,

    I hope I have the last word on this matter :) (just joking, consider it a debate) which is of very little matter but everything I hear about why it "needs" to be there is specious in my opinion (without intending offense). A bipolar transistor will not turn on simply because it is floating (MOS will), you could actually count it a feature if you like. The BJT as you know is a current device and with limited gain there is no way it's going to turn on the output unless you pump enough current into it's base. Microamps (assuming sufficient voltage etc) will only allow 100's of microamps through the collecter but with such a low input resistance and in-circuit you just don't get stray voltages that are ever capable of turning on a BJT in a power switch configuration.

    There are plenty of good safety measures that I employ in my designs, but I don't go in for stuff that I have calculated can have no benefit, a little maybe yes, but none, no. If I were using a MOSFET
    instead then I would definitely put that resistor in, no arguments whatsoever.

    So, it won't hurt with, but it definitely won't hurt without it either.

    Cheers,
    Peter
  • Don MDon M Posts: 1,653
    edited 2011-08-11 12:29
    Here's some info on a biased transistor that would work good with the Propeller


    Biased transistor.png
  • Cluso99Cluso99 Posts: 18,069
    edited 2011-08-11 14:52
    I am about to use a SOT223-6 which has an NPN transistor and a PNP transistor with the base series and base emitter resistor (2K2 & 47K) included. Nice tiny package, and with volume works out equivalent to buying half the qty of both NPN & PNP transistors, and I have both to play with.
  • Beau SchwabeBeau Schwabe Posts: 6,568
    edited 2011-08-11 15:19
    Peter Jakacki,

    "I hope I have the last word on this matter" - hello, you forget it's me your talking to ;-)

    "A bipolar transistor will not turn on simply because it is floating" - Here I disagree ... I have seen plenty of times where a single touch to nothing but the transistors base will cause it to pick-up noise. In most cases 50/60Hz. As a kid, I exploited this into t touch sensor with what I called a 'super transistor'. Basically 4 or 5 transistors all configured together as one Darlington. All collectors connected together, the first stage base is the touch input, all other stages, the emitter of the preceding stage connects to the base of the next stage and so on.

    Now days you could almost get one transistor with enough Hfe to count for all 4 or 5 that I used, so this boils down to stray interference entering the base of the transistor that MIGHT have enough current to turn the transistor 'on', unless you specifically bias the transistor off with an external resistor. Now as you said it might not be 'on' that much, and not enough to power a significant load but from the perspective that I try to keep in a design, letting it float any amount is a waste current and is a bad design practice. But that's my opinion.
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2011-08-11 19:56
    Peter Jakacki,

    "I hope I have the last word on this matter" - hello, you forget it's me your talking to ;-)

    "A bipolar transistor will not turn on simply because it is floating" - Here I disagree ... I have seen plenty of times where a single touch to nothing but the transistors base will cause it to pick-up noise. In most cases 50/60Hz. As a kid, I exploited this into t touch sensor with what I called a 'super transistor'. Basically 4 or 5 transistors all configured together as one Darlington. All collectors connected together, the first stage base is the touch input, all other stages, the emitter of the preceding stage connects to the base of the next stage and so on.

    Now days you could almost get one transistor with enough Hfe to count for all 4 or 5 that I used, so this boils down to stray interference entering the base of the transistor that MIGHT have enough current to turn the transistor 'on', unless you specifically bias the transistor off with an external resistor. Now as you said it might not be 'on' that much, and not enough to power a significant load but from the perspective that I try to keep in a design, letting it float any amount is a waste current and is a bad design practice. But that's my opinion.

    Hey! I did that too with the "super transistor" thing as a kid, exactly the same thing, wow.

    But floating and touching with your big grubby finger coupled to your body which is soaking up all kinds of electrical noise is not the same thing. Look, in-circuit and in close proximity to the driver there is no way of turning that transistor on unless you come up to it with your big finger and even then you have to be lucky as this might just result in a few measly milliamps flowing through the collector (for the few msecs before the driver switches in). It just isn't an issue at all (he says with a cheeky laugh). Of course if we want to play it safe we can, but I don't go around with aluminum foil wrapped on my head just in case of evil radiation (and grubby fingers).

    Last word? Oh, that's right! I'm talking to Beau :lol:
  • 10gigbill10gigbill Posts: 79
    edited 2011-08-11 20:41
    Related circuit design question:
    Rs485 question;
    I’ve been using an sn75176 with the prop and using a 2n2222 transistor for level shifting on the transmit and control pins and a 3k resistor on the rx line back to the prop. Looking at the data sheet it looks like minimum voltage for control and transmit is 2v… so can I drive the SN75176 directly from the prop?

    Thank you for your support.

    Bill
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2011-08-11 21:54
    This is OT and it is so easy just to start a new thread anyway. But to answer you quickly and briefly just drive it directly although it begs the question, why an ancient power hungry 75176 in place of the more modern equivalent I don't understand. BTW, if you want to ask anymore questions on this subject please start a new thread with an appropriate thread title.......please.
Sign In or Register to comment.