Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 9 of 9

Thread: A circuit for detecting if external power supply is on

  1. #1
    Junior Member
    Join Date
    Oct 2017
    Posts
    19

    A circuit for detecting if external power supply is on

    I am working with a series of three PWM boards which are connected on external power supply.
    I noticed I don't use more than 5A (peak is 3A when all boards channels are in use).

    I wanted to design a way so that these boards are not powered before teensy is powered. These boards have a Vcc pin, connected to Teensy, which switches on the board's ICs, led, ... However power on terminals are always outputting 5V regardless of this.

    I have made a simple design, and tested it. It seems to work, but as in my previous topic, mosfet is getting too hot after just few seconds. This time I am using a PNP and NPN combination as seen in the picture.

    NPN mosfet (Q2) is actually a K4033.

    If any other idea, I would also appreciate.



    Click image for larger version. 

Name:	power controller.png 
Views:	32 
Size:	81.0 KB 
ID:	14846

  2. #2
    Senior Member
    Join Date
    Mar 2015
    Location
    UK
    Posts
    263
    First a little theory... NPN and PNP are terms used only for Bipolar transistors. That's those with Emitter, Base and Collector terminals. When describing MOSFETs, the terms are N-channel and P-channel, and they have a Source, Gate, and Drain. This is important in order to understand why your circuit will be in trouble.

    Q2 is N-channel - this means that the gate goes POSITIVE with respect to SOURCE in order to switch ON. It needs to be ZERO with respect to SOURCE to switch OFF. The circuit you have drawn has this correctly configured.

    Q1 is P-channel - this means that the gate goes NEGATIVE with respect to SOURCE in order to switch ON. It needs to be ZERO with respect to SOURCE to switch OFF. The circuit you have drawn is NOT correctly configured. The SOURCE terminal of Q2 should go to the power supply +5v. But you have incorrectly drawn an N-channel symbol for Q1 (the arrow is the same direction as Q1, and it should be pointing the other way for P-channel). And this suggests that it is the DRAIN of Q1 which is connected to the power supply +5v. Indeed, you also show the R2 10K resistor placed between the other two terminals confirming that you have Q1 incorrectly wired.

    It would have been a good idea to have labelled your resistors so that R1 was concerned with Q1, and R2 concerned with Q2. But you have chosen to do this "the other way round". That is not a fault. But it is not good practice. I will stick with your labels...

    The SOURCE terminal of Q1 should be connected to the power supply +5v as stated previously, and the DRAIN terminal should be connected to the PWM board +5v. The gate resistor R2 should be connected between the SOURCE and GATE, which changes your circuit and puts one side of the R2 10K on the power supply +5v with the other side on the GATE and the DRAIN of Q2.

    The purpose of that gate resistor R2 is to drag the voltage of the GATE to be the same voltage as the SOURCE - that is ZERO - when the Q2 transistor is switched OFF. In the way you have drawn the circuit, there is nothing to make the GATE go to ZERO "with respect to the SOURCE" when Q2 is switched OFF.

    So - in conclusion - try the changes I suggest to Q1 wiring. Then, when the power is applied, measure the voltage of the Q1 SOURCE with respect to ground - it should be the +5v. And finally, measure the voltage of Q1 DRAIN with respect to ground - it should be about +4.88v (that means a drop of 0.12v between SOURCE and DRAIN when 3 amps are flowing).

  3. #3
    Senior Member
    Join Date
    Mar 2015
    Location
    UK
    Posts
    263
    For clarification...

    Paragraph 5 should read "...which changes your circuit and puts one side of the R2 10K on the power supply +5v with the other side on the GATE of Q1 and the DRAIN of Q2."

  4. #4
    Junior Member
    Join Date
    Oct 2017
    Posts
    19
    Oh no, its my fault. I totally messed with terminology about transistors and mosfets. Also I made several mistakes on the diagram with labeling and symbols. However one important things is that I had changed the names "power supply" with "pwm board". I will upload a corrected diagram.
    Click image for larger version. 

Name:	correction.jpg 
Views:	23 
Size:	47.6 KB 
ID:	14861

    I have read your instructions and after changing the names I believe wiring is correct. The little test I have made the other day worked, but specially P-Channel mosfet was getting too hot - which might be normal, since I have read it is designed for that - but since I am not familiar with mosfets and high temperatures on my circuits, I thought I'd better ask for advices. I will make the measurements as you suggested. Thank you!

  5. #5
    Senior Member
    Join Date
    Mar 2015
    Location
    UK
    Posts
    263
    That's a much better diagram :-).

    The data sheet for the Q1 P-ch 2JS334 shows the Source/Drain resistance to be around 0.05 ohms with a Gate voltage of -4 volts (Gate wrt Source). So when Q2 gets turned on by +Vin, the Q2 Source/Drain should also be low, pulling the Q1 Gate downwards (more negative wrt Q2 Source) possibly achieving that -4volts or maybe slightly more. So Q1 should end up with Source/Drain resistance of 0.05 Ohms. Now if the PWM board pulls 3 amps through Q1, then the voltage drop across Q1 (Source to Drain) should be 3 times 0.05 = 0.15 volts, and the power dissipated in Q1 will then be 0.15 times 3 = 0.45 watts. That means Q1 will get warm.

    The data sheet also shows a thermal gradient of 62.5 degC per watt between the internal channel (Source/Drain) and ambient air. Without a heat sink, this means you can expect the device channel to be 62.5 times 0.45 watts = 28 degC above ambient temp. So if ambient is 22 degC, then the temp that Q1 is likely to rise to will be exponential towards 22 + 28 = 50 degC. That's quite warm to your finger. You probably cannot keep your finger on a 55 degC surface for any length of time.

    The only way to check if this theory is actually happening in practice is to measure the voltages with a meter. If there is a drop of 0.15 volts or more across the Source/Drain of Q1 (when switched on) then the temp of Q1 will rise to that predicted.

    If you think about it, the power taken by the PWM boards will be 4.85 volts times 3 amps = 14.55 watts. That's not insignificant, so losing a half watt across Q1 is to be expected. Put a small heat sink on Q1 if this is a problem.

    The other way to do this without such a temp rise is to use a relay (driven from Q2) to switch the PWM board on (and the relay contact bounce will be around 20 to 50 milliSecs). Don't forget to use a diode reverse biased across the relay coil, to dissipate the back emf of the coil on switch off.

  6. #6
    Junior Member
    Join Date
    Oct 2017
    Posts
    19
    This is an amazing explanation! thank you so much for giving some basis to which details to care about. I have made some tests on meanwhile but something went wrong. I would like to confirm if this is the kind of 0.05 Ohms resistor that could make sense. I admit I never used such small values for a resistor, or I might be reading it wrong.

  7. #7
    Senior Member
    Join Date
    Mar 2015
    Location
    UK
    Posts
    263
    Quote Originally Posted by Bontempos View Post
    I might be reading it wrong.
    Sadly, you are reading it wrong. The value 0.05 ohms refers to the Q1 MOSFET itself - the resistance between Source and Drain when it is operating.

    Try this with a digital voltmeter. Make three accurate voltage measurements with respect to ground (to two decimal places) when switched on and post these back on this thread - (1) The actual voltage of the +5v supply, (2) The actual voltage at the PWM board positive supply terminal, and (3) The actual voltage at the Q2 Drain terminal. From those values we can then work out what is happening.

  8. #8
    Junior Member
    Join Date
    Oct 2017
    Posts
    19
    Thanks for the clarification. So I am sticking to 10 KOhms resistor. I have replaced it (from 1/8 to 1/4 package size), and there is no change in temperature now.
    Here is the diagram with current voltage reads when Teensy is powered off (blue) and on (red)
    reClick image for larger version. 

Name:	correction.jpg 
Views:	20 
Size:	54.9 KB 
ID:	14874

    One thing I noticed is that when using all PWM channels with servos, I got my voltage dropping to 5V to 4.62V. However in the real project I have 1m flat cable between PWM boards ( i use three PWM boards ) and servos. Added resistance, I got almost 1V drop. I set my power supply to 6V to try to compensate this voltage drop and servos to start buzzing. But maybe this is another topic. I just want to clarify I have tested our power detector circuit with 6V too and it seems to work fine.

  9. #9
    Senior Member
    Join Date
    Mar 2015
    Location
    UK
    Posts
    263
    Quote Originally Posted by Bontempos View Post
    ... I have tested our power detector circuit with 6V too and it seems to work fine.
    From your info, I think this is working as intended. Its probably the best in the circumstances.

    I would suggest you add a heat sink to Q1 just to keep it a little cooler. When you add the complete servo load, your voltage drops from 5v to 4.62v. This indicates either that you are drawing more than 3 amps (at maximum loading), or that Q1 is not reaching as low as 0.05 ohms. I estimate the actual power dissipated in Q1 is more likely 1 watt (rather than 1/2 watt), which would make it quite warm over a prolonged period. Ironically, raising the supply to 6v gives Q1 a bit more gate drive and should help lower its resistance. But be careful that this 6v is still within the accepted limits for the PWM circuitry - or it could be expensive :-)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •