Author Topic: 3.3v GPIO controlled switch for high DC voltage (42V +)  (Read 2224 times)

0 Members and 1 Guest are viewing this topic.

Offline PhoenixAUTopic starter

  • Contributor
  • Posts: 17
  • Country: au
3.3v GPIO controlled switch for high DC voltage (42V +)
« on: March 08, 2024, 04:17:12 pm »
TLDR Version:
       I'd like some help with a circuit that is controlled via an Arduino (3.3v) to switch on a BLDC motor (700W) and other components powered by a 4.4AH battery that will fluctuate between 42V and 32V depending on battery charge level.



Hi All,
       I'm trying to design/build a power control circuit but I've got to the point where I need a little help.

Essentially what I need to do is turn on/off a high voltage battery power source via an Arduino nano (3.3v).

I'd prefer not to use a relay because they can run into issues in the long term with contacts fusing and general reliability.

Due to this I figured using a MOSFET might be a good solution but I'm open to alternate points of view.

I'd also prefer if possible that initially the circuit is in a normally off state, until the Arduino turns it on using GPIO High.

It's worth mentioning that amongst other things this will be used to indirectly turn on/off BLDC motors (via external motor Driver circuits) so there may be a chance of Back EMF.

I found a schematic online that I've been trying to adapt to work with a higher voltage source. However, I later found out that apparently the original circuit has some issues with reliability or components blowing.

At the moment I'll be using a 4.4AH battery pack that will fluctuate between 42V when fully charged and 32V when flat. However, in the future I may decide to upgrade the battery (anywhere up to 55V 20Ah) to get longer run times etc... for this reason I'd really like to better understand how to calculate resistor values used in the circuit and other considerations to adapt the circuit again later if required.

Because this is a battery powered circuit it would be great if was somewhat energy efficient.

I will have some expensive components attached to the Arduino so any advice in regard to safeguards in the case of component failure when working with a circuit like this would be appreciated!

I've read lots of articles and watched a bunch of videos researching this but unfortunately I still feel like I have more questions than answers (I'm not an EE so some of this stuff is a little over my head at the moment).

To a lesser extent I suppose it's also worth mentioning that the circuit will be subject to vibration and used outdoors (in an appropriate waterproof enclosure) so it will be subject to temperature fluctuations 6°C to maybe 80°C (Australian summer in the sun).

I'll be adding a TO220 Aluminum heat sink to the MOSFET (20 x 15 x 10mm)

This is what I have so far but i'm not attached to it, if someone has a better suggestion in regard to component selection or the general design I'm open to ideas.




Q1:     NPN -  BC547C   https://datasheet.lcsc.com/lcsc/2304140030_LGE-BC547C_C713614.pdf
Q2:     P Channel MOSFET - IRF9540NPbF   https://au.mouser.com/datasheet/2/196/Infineon_IRF9540N_DataSheet_v01_01_EN-3363104.pdf
D1:     Schottky Diode MBR1060 https://datasheet.lcsc.com/lcsc/1810301841_SMC-Sangdest-Microelectronicstronic--Nanjing-MBR1060_C260256.pdf
D2, D3: Schottky Diode SBX2050  https://diotec.com/request/datasheet/sbx2020.pdf
R2:     4.7K .25W 1% metal film resistor
R1:     2.2k .25W 1% metal film resistor
R3:     4.7K .25W 1% metal film resistor
C1:     100uF Electrolytic Capacitor   50V Polar    https://www.rubycon.co.jp/wp-content/uploads/catalog-aluminum/TXW.pdf
F1:     Fuse 10A

I also tried simulating this in LTSpice before coming here but it didn't seem to work the way I expected (I'm new to LTSpice). I suspect that it may be  have been due to the resistor values, the way I tried to simulate the load or how I how I tried to run the simulation.

See attached LTSpice simulation attempt
« Last Edit: March 08, 2024, 04:20:19 pm by PhoenixAU »
 

Online BennoG

  • Regular Contributor
  • *
  • Posts: 66
  • Country: nl
Re: 3.3v GPIO controlled switch for high DC voltage (42V +)
« Reply #1 on: March 08, 2024, 06:45:44 pm »
I think you will blow jour mosfet with this schematic.
The G-S voltage can be 40V in your solution the specs say max 20V.
You can use a totempole schematic or a specified chip to drive the P-Fet.

Benno
 
The following users thanked this post: PhoenixAU

Offline Siwastaja

  • Super Contributor
  • ***
  • Posts: 8173
  • Country: fi
Re: 3.3v GPIO controlled switch for high DC voltage (42V +)
« Reply #2 on: March 08, 2024, 06:54:17 pm »
The design will be somewhat non-trivial. A 700W BLDC inverter will have significant amount of capacitance on its input, so you want precharge to not exceed the SOA curve of your MOSFET. For different corner cases, current monitoring / "e-fuse" type, at very least one utilizing the Rds_on of the MOSFET like a "desaturation detection circuit", would be an excellent idea. Also at this current level (especially with your efficiency concerns) you might want to avoid diodes and instead use two back-to-back MOSFETs.

There are so called load switch ICs which do all of this integrated (current limiting, precharge, active SOA protection with die temperature sensing), so you might want to look at this. Last time I had a similar case though I had to do complete custom discrete solution because all of those ICs had significant off-state quiescent current which was not acceptable (I was also having a battery as an input).

Are there some kind of safety requirements? I mean, the failure mode will be that it fails as short circuit i.e. stuck ON. If this causes a risk of injury or similar then even more care is needed.
 
The following users thanked this post: PhoenixAU

Online pcprogrammer

  • Super Contributor
  • ***
  • Posts: 3710
  • Country: nl
Re: 3.3v GPIO controlled switch for high DC voltage (42V +)
« Reply #3 on: March 08, 2024, 07:17:11 pm »
Add a 10V or so zener diode from source (S) to the gate (G) and an extra resistor in between the gate and the collector of the transistor to limit the current through the zener and this will limit the source gate voltage to be below 20V.

Another option is to look for a beefy enough N channel mosfet with a gate threshold below 3.3V. This way you only need the one transistor to get it working. Small series resistor between the gate and the GPIO of the arduino. Or use a 5V nano and an IRFZ44N. Gate threshold is 4V max and 2V min, so might even work with the 3.3V version. Id is 49A so plenty for your purpose. Vds is 55V so some head room on your 42V supply.

As long as there is no other connection to your BLDC motor driver that relies on ground the low side control is no problem.

I would not bother with the additional diodes in the setup, unless there is a real risk of reverse connection of the battery. They have a voltage drop and will dissipate more power then you might like. With a 700W motor on 42V the current is 16.6A which is near the maximum current of the SBX2050 and with .6V drop it will have to dissipate ~10W.

But like Siwastaja wrote the turn on current might be very high and an other approach might be needed.

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 19527
  • Country: gb
  • 0999
Re: 3.3v GPIO controlled switch for high DC voltage (42V +)
« Reply #4 on: March 08, 2024, 08:56:56 pm »
Why the extra Schottky diodes?

The second series one isn't needed. The one in reverse parallel should be after the first one and it only needs to be big enough to pass the leakage.

Add an emitter resistor so it forms a current sink, thus limiting the voltage across the collector resistor.

« Last Edit: March 14, 2024, 03:43:00 pm by Zero999 »
 
The following users thanked this post: PhoenixAU

Online shapirus

  • Super Contributor
  • ***
  • Posts: 1360
  • Country: ua
Re: 3.3v GPIO controlled switch for high DC voltage (42V +)
« Reply #5 on: March 08, 2024, 09:22:45 pm »
Another option is to look for a beefy enough N channel mosfet with a gate threshold below 3.3V. This way you only need the one transistor to get it working.
Beware, however, that at this load current we want to look not only at the gate threshold voltage, but also at the voltage at which the minimal value of Rds(on) is reached. Resistance at threshold voltage may still be high enough to quickly fry the transistor.
 
The following users thanked this post: pcprogrammer, PhoenixAU

Offline JustMeHere

  • Frequent Contributor
  • **
  • Posts: 744
  • Country: us
Re: 3.3v GPIO controlled switch for high DC voltage (42V +)
« Reply #6 on: March 09, 2024, 01:10:32 am »
Look at an optocoupler. 
 
The following users thanked this post: PhoenixAU

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 12862
Re: 3.3v GPIO controlled switch for high DC voltage (42V +)
« Reply #7 on: March 09, 2024, 09:10:36 am »
This statement in the video the O.P. linked from the schematics is incorrect:
https://youtu.be/tePft-bm9mw?t=501

The seventh (last) 'method' of implementing a constant power load using a BI source doesn't!  The problem is, within the +/-1V region its not resistive due to misuse of the limit() function 'hiding' the if() that is supposed to make it resistive. It becomes the fixed current Imin, so is inherently unstable, resulting in the observed large negative voltage at MOTOR_OUT.

Also, most types of DC motor are *NOT* a constant power load so simulating one as a constant power load is almost certainly inappropriate.
« Last Edit: March 09, 2024, 09:19:34 am by Ian.M »
 
The following users thanked this post: PhoenixAU

Offline Siwastaja

  • Super Contributor
  • ***
  • Posts: 8173
  • Country: fi
Re: 3.3v GPIO controlled switch for high DC voltage (42V +)
« Reply #8 on: March 09, 2024, 11:17:13 am »
mosfet with a gate threshold below 3.3V

Gate threshold voltage is completely wrong parameter to look at. It is defined such that MOSFET conducts some micro to milliamps, which is orders of magnitude too little. IRFZ44N specifically needs at least 7-8Vgs.
« Last Edit: March 09, 2024, 11:18:46 am by Siwastaja »
 
The following users thanked this post: PhoenixAU

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 19527
  • Country: gb
  • 0999
Re: 3.3v GPIO controlled switch for high DC voltage (42V +)
« Reply #9 on: March 09, 2024, 02:16:05 pm »
Look at an optocoupler.
That would work (put the phototransistor in the place of Q1 in my schematic and increase R1 to 10k) but why? 42V is not that higher voltage? Isolation isn't required, unless perhaps the connections between the MCU and driver are very long.
 
The following users thanked this post: PhoenixAU

Offline PhoenixAUTopic starter

  • Contributor
  • Posts: 17
  • Country: au
Re: 3.3v GPIO controlled switch for high DC voltage (42V +)
« Reply #10 on: March 11, 2024, 06:19:55 am »
Are there some kind of safety requirements? I mean, the failure mode will be that it fails as short circuit i.e. stuck ON. If this causes a risk of injury or similar then even more care is needed.

I've not built it yet so I cant say for sure what would happen if there was a failure occurred and it was stuck in the on state

Power alone wont cause the motors to turn - as the motors will be controlled via VESC motor controllers controlled via UART connections.

Best case scenario if it got stuck in the on state it would eventually run the batteries flat or maybe overcharge the batteries if the BMS in the battery pack does not handle that.

Worst case if somehow the motors continued to run while stuck in the on state it's plausible that it might have a chance of causing injury. As the intention of this circuit is a power control for an automated robot.

There will be an emergency off button (master power switch) but it might not always be supervised when in use.
« Last Edit: March 11, 2024, 06:48:22 am by PhoenixAU »
 

Offline PhoenixAUTopic starter

  • Contributor
  • Posts: 17
  • Country: au
Re: 3.3v GPIO controlled switch for high DC voltage (42V +)
« Reply #11 on: March 11, 2024, 06:35:24 am »
Look at an optocoupler.
That would work (put the phototransistor in the place of Q1 in my schematic and increase R1 to 10k) but why? 42V is not that higher voltage? Isolation isn't required, unless perhaps the connections between the MCU and driver are very long.

So I could use an optocoupler instead of the NPN for a gate driver?

I've seen optocouplers used for limit switches on CNC machines to prevent issues with EMF feedback.

How long is very long?

I think the longest wire harness would be around 30cm, I'll use twisted pairs of wires for any data lines and keep any high voltage power harnesses separate to the low voltage stuff.
« Last Edit: March 13, 2024, 04:38:33 am by PhoenixAU »
 

Offline PhoenixAUTopic starter

  • Contributor
  • Posts: 17
  • Country: au
Re: 3.3v GPIO controlled switch for high DC voltage (42V +)
« Reply #12 on: March 11, 2024, 06:40:43 am »
This statement in the video the O.P. linked from the schematics is incorrect:
https://youtu.be/tePft-bm9mw?t=501

The seventh (last) 'method' of implementing a constant power load using a BI source doesn't!  The problem is, within the +/-1V region its not resistive due to misuse of the limit() function 'hiding' the if() that is supposed to make it resistive. It becomes the fixed current Imin, so is inherently unstable, resulting in the observed large negative voltage at MOTOR_OUT.

Also, most types of DC motor are *NOT* a constant power load so simulating one as a constant power load is almost certainly inappropriate.

Hi Ian,
          Thanks very much, I was stumped as to why the negative voltages were so high!

I don't suppose you know of any good examples for simulating load in LT spice? Initially I planned to just use a resistor however I read that approach had it's own issues.

I'm not concerned about emulating motor speed or anything fancy like that.

It might be handy if it was possible to simulate back EMF however at this stage I just want a simple solution that works - one problem at a time
 

Offline PhoenixAUTopic starter

  • Contributor
  • Posts: 17
  • Country: au
Re: 3.3v GPIO controlled switch for high DC voltage (42V +)
« Reply #13 on: March 11, 2024, 06:45:05 am »
Look at an optocoupler.

Are optocouplers more resistant than BJT NPNs in a situation where the mosfet fails?

I've seen optocouplers used for limit switches on CNC machines to prevent issues with EMF feedback.
 

Online BennoG

  • Regular Contributor
  • *
  • Posts: 66
  • Country: nl
Re: 3.3v GPIO controlled switch for high DC voltage (42V +)
« Reply #14 on: March 11, 2024, 06:54:34 am »
A complete different approach would be to use a Smart High-Side Power Switch  e.g. BTS724G you can put all 4 output in parallel and get a switch current of 8A.
I think there are more beefy versions of this and you can directly switchy them with 3.3V

Benno
 
The following users thanked this post: PhoenixAU

Online radiolistener

  • Super Contributor
  • ***
  • Posts: 3378
  • Country: ua
Re: 3.3v GPIO controlled switch for high DC voltage (42V +)
« Reply #15 on: March 11, 2024, 07:09:52 am »
I think using some small mosfet as a driver to control relay is more reliable way. You can switch even mains voltage with relay.
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 12862
Re: 3.3v GPIO controlled switch for high DC voltage (42V +)
« Reply #16 on: March 11, 2024, 07:10:33 am »
I'm not saying this is a good idea vs the alternatives that have been offered above, but at least I've got your sim behaving sensibly + fixed up some poor design choices in it. 

N.B. the SBX2050.asy and SBX2050.lib must be in the same folder  as the sim.  Other .lib paths are unchanged.
 
The following users thanked this post: PhoenixAU

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 12862
Re: 3.3v GPIO controlled switch for high DC voltage (42V +)
« Reply #17 on: March 11, 2024, 07:18:21 am »
To simulate a PMDC motor, you need an inductance in series with a resistor (winding resistance, determines stall current) and a controlled voltage source proportional to the motor speed (modelling the back EMF from the coils moving in the magnetic field), scaled so that it draws the correct no load current at its no load speed.   Modelling the motor speed and acceleration under load is a whole other issue . . .

Note this simple model doesn't include torque or current ripple or the effects of commutation.
« Last Edit: March 11, 2024, 07:20:46 am by Ian.M »
 
The following users thanked this post: PhoenixAU

Online pcprogrammer

  • Super Contributor
  • ***
  • Posts: 3710
  • Country: nl
Re: 3.3v GPIO controlled switch for high DC voltage (42V +)
« Reply #18 on: March 11, 2024, 08:27:27 am »
Power alone wont cause the motors to turn - as the motors will be controlled via VESC motor controllers controlled via UART connections.

Are you referring to one of these in the vesc project?

If so these will take care of a lot of the issues. When power is connected the MCU in it has to startup before any action on the motor will take place, so current when switching on will be low.

The main issue with your original design is the to high Vgs which will kill the MOSFET, and the needless additional diodes. For protecting against reverse battery connection you can add the same P-MOSFET in series, but with reversed source and drain connection. Also needs a zener to protect against to high Vgs. See here for more info about this.

Offline sparkydog

  • Regular Contributor
  • *
  • Posts: 234
  • Country: us
Re: 3.3v GPIO controlled switch for high DC voltage (42V +)
« Reply #19 on: March 11, 2024, 08:18:03 pm »
I'd prefer not to use a relay because they can run into issues in the long term with contacts fusing and general reliability.

So, you say "I'd prefer not to use a relay"... but then explain why you'd prefer to not use a mechanical relay.

Have you considered a SSR?
 

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 19527
  • Country: gb
  • 0999
Re: 3.3v GPIO controlled switch for high DC voltage (42V +)
« Reply #20 on: March 11, 2024, 10:02:34 pm »
Look at an optocoupler.
That would work (put the phototransistor in the place of Q1 in my schematic and increase R1 to 10k) but why? 42V is not that higher voltage? Isolation isn't required, unless perhaps the connections between the MCU and driver are very long.

So I could use an optocoupler instead of the NPN for a gate driver?

I've seen optocouplers used for limit switches on CNC machines to prevent issues with EMF feedback.

How long is very long?

I think the longest wire harness would be around 30cmm, I'll use twisted pairs of wires for any data lines and keep any high voltage power harnesses separate to the low voltage stuff.
If you want to go for an opto-coupler, then change to an N-channel MOSFET and use a photovoltaic opto-coupler.

It's not so much as length but impedance, i.e. resistance and inductance. When the gate voltage rises, causing a high current to flow, the source voltage will also rise, causing the potential difference between the gate and source to fall. If the source is connected to 0V via a very low impedance, then this increase in source voltage will be very small and have no effect. In the other hand if the source connection is a higher impedance, say a long wire, with some resistance and more importantly inductance, the source voltage will rise more, which will try to turn the MOSFET off a bit, remember it's the potential difference between the gate and source, which cases it to turn on. An opto-coupler, connected between the gate and source, very close to the transistor eliminates this problem because its negative side is connected directly to the source, so the positive side will also increase, if the source voltage increases.

I'll post a schematic with simulation it the above explaination is too difficult to follow.
 
The following users thanked this post: PhoenixAU

Offline PhoenixAUTopic starter

  • Contributor
  • Posts: 17
  • Country: au
Re: 3.3v GPIO controlled switch for high DC voltage (42V +)
« Reply #21 on: March 13, 2024, 04:42:45 am »
I'll post a schematic with simulation it the above explaination is too difficult to follow.

That would be great
 

Offline PhoenixAUTopic starter

  • Contributor
  • Posts: 17
  • Country: au
Re: 3.3v GPIO controlled switch for high DC voltage (42V +)
« Reply #22 on: March 13, 2024, 05:06:07 am »
So, you say "I'd prefer not to use a relay"... but then explain why you'd prefer to not use a mechanical relay.

Have you considered a SSR?

To be honest I hadn't - but from what I can see anything suitable is going to be around $48USD and I'd require 2 of them (I only had a quick look though).
That's getting fairly expensive compared to using a MOSFET + BJT or a MOSFET + optocoupler.

Do you have any SSRs in mind that are suitable?
 

Offline PhoenixAUTopic starter

  • Contributor
  • Posts: 17
  • Country: au
Re: 3.3v GPIO controlled switch for high DC voltage (42V +)
« Reply #23 on: March 13, 2024, 05:11:56 am »
I'm not saying this is a good idea vs the alternatives that have been offered above, but at least I've got your sim behaving sensibly + fixed up some poor design choices in it. 

Thanks very much for taking the time to do that Ian! Hopefully I'll get a chance to tinker with it on the weekend!
 

Offline PhoenixAUTopic starter

  • Contributor
  • Posts: 17
  • Country: au
Re: 3.3v GPIO controlled switch for high DC voltage (42V +)
« Reply #24 on: March 13, 2024, 05:29:17 am »
Power alone wont cause the motors to turn - as the motors will be controlled via VESC motor controllers controlled via UART connections.

Are you referring to one of these in the vesc project?

If so these will take care of a lot of the issues. When power is connected the MCU in it has to startup before any action on the motor will take place, so current when switching on will be low.

I'm actually probably going to use a hacked hoverboard as a motor controller that uses UART for communication instead of a VESC but you get the general idea ( see linked video below )

It is possible that I might also use a BLDC motor driver such as JKONG Motors JKBLD300 ( https://www.jkongmotor.com/Product/JKBLD300-Brushless-DC-Motor-Driver.html )
paired with a BLDC motor such as JK57BLS02 ( https://www.jkongmotor.com/Product/JKM-57BLS-Round-BLDC-Motor.html ).

None the less, yes the motors should not be turning until told to do so by the MCU.


« Last Edit: March 13, 2024, 05:32:23 am by PhoenixAU »
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 12862
Re: 3.3v GPIO controlled switch for high DC voltage (42V +)
« Reply #25 on: March 13, 2024, 05:42:20 am »
Beware: the constant power load still isn't quite working right.  The problem is the transition between resistive and constant power, which has a discontinuity, which causes the sim to hang if you add any series resistance to C1 (the presence of which prevents infinite  dV/dt at the transition, allowing the solver to pass it more easily).

Personally I'd recommend finding a more realistic model for an ESC as a load or using LTspice's native constant power load.
 
The following users thanked this post: PhoenixAU

Offline PhoenixAUTopic starter

  • Contributor
  • Posts: 17
  • Country: au
Re: 3.3v GPIO controlled switch for high DC voltage (42V +)
« Reply #26 on: March 13, 2024, 05:50:56 am »
Thanks Ian - at the moment something simple will do, initially I just want to verify the circuit works as expected. So the native constant load approach sounds good.

I'll worry about trying to simulate Back EMF once i've tackled the basics.

I'd imagine that i'm going to have a hard time finding something that is identical to what im using so near enough will have to be good enough.
 

Offline PhoenixAUTopic starter

  • Contributor
  • Posts: 17
  • Country: au
Re: 3.3v GPIO controlled switch for high DC voltage (42V +)
« Reply #27 on: March 13, 2024, 05:57:29 am »
The main issue with your original design is the to high Vgs which will kill the MOSFET, and the needless additional diodes.

I suspected that might have been the case when I initially posted the schematic (thanks).

For protecting against reverse battery connection you can add the same P-MOSFET in series, but with reversed source and drain connection. Also needs a zener to protect against to high Vgs. See here for more info about this.

I can't quite picture that. Is there any chance you could draw a rough circuit diagram showing how that might work, please?
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 12862
Re: 3.3v GPIO controlled switch for high DC voltage (42V +)
« Reply #28 on: March 13, 2024, 06:32:29 am »
You should probably read https://ltwiki.org/index.php?title=B_sources_(complete_reference) for details of LTspice's native constant power load, and also https://ltwiki.org/?title=Undocumented_LTspice
 
The following users thanked this post: PhoenixAU

Offline PhoenixAUTopic starter

  • Contributor
  • Posts: 17
  • Country: au
Re: 3.3v GPIO controlled switch for high DC voltage (42V +)
« Reply #29 on: March 13, 2024, 06:40:34 am »
Why the extra Schottky diodes?

The second series one isn't needed. The one in reverse parallel should be after the first one and it only needs to be big enough to pass the leakage.

Add an emitter resistor so it forms a current sink and thus, the voltage across the collector resistor.

I believe the intention for the second series resistor (D3 in the original post) is to protect against reverse polarity in the instance where the BLDC is manually turned causing the motor acts as a dynamo or perhaps its an attempt to protect against Back EMF when the motor turns off?

It's also my (limited) understanding that if a motor is under heavy load (torque slowing the motor down) then it can also cause some issues due to back EMF.

Although from what I've seen online usually a Schottky diode in reverse polarity across the motor terminals as Flyback/Snubber/Suppressor Diode, I've also seen capacitors across the terminals of brushed DC motors to help filter the noise from the Back EMF

To be honest I don't totally understand why D1 is there although once again I suspect it's also to help tame Back EMF.
« Last Edit: March 13, 2024, 06:56:14 am by PhoenixAU »
 

Offline PhoenixAUTopic starter

  • Contributor
  • Posts: 17
  • Country: au
Re: 3.3v GPIO controlled switch for high DC voltage (42V +)
« Reply #30 on: March 13, 2024, 06:45:22 am »
A complete different approach would be to use a Smart High-Side Power Switch  e.g. BTS724G you can put all 4 output in parallel and get a switch current of 8A.
I think there are more beefy versions of this and you can directly switch them with 3.3V

Benno

Thanks for the suggestion Benno, I do remember reading somewhere that they are meant to be more efficient than than using a MOSFET.

Do you know if they are more tolerant to Back EMF than a MOSFET? Apparently if a MOSFET fails due to Back EMF/reverse voltage over current it can cause it to feed voltage through the gate (frying the Microcontroller) or cause the MOSFET to turn on when it's meant to be off
« Last Edit: March 13, 2024, 04:00:46 pm by PhoenixAU »
 

Online pcprogrammer

  • Super Contributor
  • ***
  • Posts: 3710
  • Country: nl
Re: 3.3v GPIO controlled switch for high DC voltage (42V +)
« Reply #31 on: March 13, 2024, 08:00:54 am »
For protecting against reverse battery connection you can add the same P-MOSFET in series, but with reversed source and drain connection. Also needs a zener to protect against to high Vgs. See here for more info about this.

I can't quite picture that. Is there any chance you could draw a rough circuit diagram showing how that might work, please?

See attached picture. To protect against voltage spikes I added a TVS with 47V rating at the output. The IRF9540 might be to weak for the task with a Id of 19A. Not a lot of head room with a load of 16A. And with Rds on of 0.2 Ohm you still loose 3.2V per MOSFET. There are beter MOSFETS with lower Rds on out there for sure. Power dissipation will also be around 50W per MOSFET. So in this case a schottky diode for the reverse voltage protection might work out better.

The first IRF9540 is to protect against wrong battery connection, and the second IRF9540 is to switch the power on and off. The zener diodes might need a bit more current to work properly, but it gives you an idea of what the circuit looks like.

Edit: I forgot to add a pullup resistor for the second MOSFET, that needs to be parallel to the zener diode.
« Last Edit: March 14, 2024, 07:22:01 am by pcprogrammer »
 
The following users thanked this post: PhoenixAU

Online radiolistener

  • Super Contributor
  • ***
  • Posts: 3378
  • Country: ua
Re: 3.3v GPIO controlled switch for high DC voltage (42V +)
« Reply #32 on: March 13, 2024, 03:21:19 pm »
I'd prefer not to use a relay because they can run into issues in the long term with contacts fusing and general reliability.

Usually mosfet lifetime is much shorter than relay, especially when they are working at high voltage. You're needs to have a dozen of replacement mosfets for repair, while relay can work for ten years with no issue :)
 
The following users thanked this post: PhoenixAU

Offline sparkydog

  • Regular Contributor
  • *
  • Posts: 234
  • Country: us
Re: 3.3v GPIO controlled switch for high DC voltage (42V +)
« Reply #33 on: March 13, 2024, 05:07:22 pm »
So, you say "I'd prefer not to use a relay"... but then explain why you'd prefer to not use a mechanical relay.

Have you considered a SSR?

To be honest I hadn't - but from what I can see anything suitable is going to be around $48USD and I'd require 2 of them (I only had a quick look though).

Do you have any SSRs in mind that are suitable?

Ah, yes, I was forgetting the little $2 ones are only rated for ~0.1A. Unfortunately, Octopart hates me right now, but based on what I could find before it quit working, I would guess you can probably find something for closer to $20. Certainly there are SSRs rated for... hold on, you said you're driving an 18A motor? That's a honking lot of current.

In any case, it's not obvious why you'd need two? (You might need a $2 SSR to control a bigger SSR; the larger ones seem to want higher "coil" voltages.)

On further consideration, I suspect, as others have noted, that there's a way to just "talk" to whatever is driving the BLDC that would make your life ever so much easier. (Even if that means replacing the driver.)

That said, I also suspect you underrate mechanical relays. Unless safety is a critical consideration (in which case you shouldn't be squawking at the idea of paying $50), a suitably rated EMR from a reputable manufacturer shouldn't be terribly expensive and will probably last for years without trouble.
 
The following users thanked this post: PhoenixAU

Offline Siwastaja

  • Super Contributor
  • ***
  • Posts: 8173
  • Country: fi
Re: 3.3v GPIO controlled switch for high DC voltage (42V +)
« Reply #34 on: March 13, 2024, 05:22:54 pm »
Seeing that VESC apparently is open-source, then the obvious solution is to integrate everything onto that one piece of hardware and software. The motor controller itself already consists of transistors. All you need to do is to not enable the the motor control and put the microcontroller and all relevant circuits in some low-power state. I don't know if that is possible without hardware modifications, but it would be simpler than cutting the high current path and managing high inrush currents to the capacitors without blowing up these extra power switches.

Only if you need bi-directional switching i.e. prevent back-EMF generated by rotating motor going through the diodes of the VESC's existing bridge, only then you would need to add another power switch.
 
The following users thanked this post: PhoenixAU

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 19527
  • Country: gb
  • 0999
Re: 3.3v GPIO controlled switch for high DC voltage (42V +)
« Reply #35 on: March 13, 2024, 07:18:08 pm »
Why the extra Schottky diodes?

The second series one isn't needed. The one in reverse parallel should be after the first one and it only needs to be big enough to pass the leakage.

Add an emitter resistor so it forms a current sink and thus, the voltage across the collector resistor.

I believe the intention for the second series resistor (D3 in the original post) is to protect against reverse polarity in the instance where the BLDC is manually turned causing the motor acts as a dynamo or perhaps its an attempt to protect against Back EMF when the motor turns off?

It's also my (limited) understanding that if a motor is under heavy load (torque slowing the motor down) then it can also cause some issues due to back EMF.

Although from what I've seen online usually a Schottky diode in reverse polarity across the motor terminals as Flyback/Snubber/Suppressor Diode, I've also seen capacitors across the terminals of brushed DC motors to help filter the noise from the Back EMF

To be honest I don't totally understand why D1 is there although once again I suspect it's also to help tame Back EMF.
There is no need for another diode, because it's impossible for there to be any reverse voltage, with a BLDC and drive.

The motor is a BLDC type and driver. BLDC is a misnomer, it's really a type of three phase AC motor. The driver will have diodes connected between each phase and both of its supply rails, forming a three phase full bridge rectifier. If the motor is manually turned, it'll generate an AC voltage, which is rectified to the same polarity as the driver, hence no further reverse polarity protection is required.


I'll post a schematic with simulation it the above explaination is too difficult to follow.

That would be great
Attached is a simulation. The inductor represents a long cable. The MOSFET is being switched at a high frequency. The yellow plot shows the load current and red the source voltage. The increase in source voltage, due to the long, inductive cable, greatly slows down the switching speed. Connecting an optically isolated MOSFET driver between the gate and as close as possible to the source, would increase the switching speed.

In your case, you're only switching slowly and at a much lower current, so it's unnecessary. The only reason why you might want to use an optically isolated driver, is so you can use an N-channel MOSFET and switch the high side.

Come to think of it, why are you switching it at all? Is it possible to send the BLDC driver a disable command? That would make much more sense, than switching the power.
 
The following users thanked this post: PhoenixAU

Offline Siwastaja

  • Super Contributor
  • ***
  • Posts: 8173
  • Country: fi
Re: 3.3v GPIO controlled switch for high DC voltage (42V +)
« Reply #36 on: March 13, 2024, 07:24:37 pm »
Come to think of it, why are you switching it at all? Is it possible to send the BLDC driver a disable command? That would make much more sense, than switching the power.

Usual reasons for switching the power:
* Prevention of rectified BEMF voltage (generated by the motor when manually turned un-powered) running into the battery/supply
* Extra safety layer
* Powering off drivers that do not have the enable feature at all, or consume too much power in disabled state, and can't be modified
 
The following users thanked this post: PhoenixAU

Offline PhoenixAUTopic starter

  • Contributor
  • Posts: 17
  • Country: au
Re: 3.3v GPIO controlled switch for high DC voltage (42V +)
« Reply #37 on: March 14, 2024, 02:28:15 pm »
Usually mosfet lifetime is much shorter than relay, especially when they are working at high voltage. You're needs to have a dozen of replacement mosfets for repair, while relay can work for ten years with no issue :)

That said, I also suspect you underrate mechanical relays. Unless safety is a critical consideration (in which case you shouldn't be squawking at the idea of paying $50), a suitably rated EMR from a reputable manufacturer shouldn't be terribly expensive and will probably last for years without trouble.

That's food for thought - thanks very much guys!

I didn't realise that relays had a longer lifespan than mosfets.

(I'd heard lots of bad press about fusing/failing contact due to arcing - which I figured would be an issue with the power i'll be using)

I suppose that most cars utilise relays and mechanical light switches have a fairly long service life.

One pro for relays is that they don't have drain leakage current.

Although I'll have to compare how much power is required to power the coil for the magnet - compared to the alternate solutions.

(If I went with relays I'd be using the Normally Open configuration so the coils would be drawing power while it was turned on.)
 

Online shapirus

  • Super Contributor
  • ***
  • Posts: 1360
  • Country: ua
Re: 3.3v GPIO controlled switch for high DC voltage (42V +)
« Reply #38 on: March 14, 2024, 02:38:38 pm »
Speaking of mechanical relays, I use a Powercom KIN-1000AP UPS for my desktop PC, and it's been in service since 2005 -- that's almost 20 years!

It uses relays to switch between line power and batteries and also to activate AVR, and these events are far more frequent than I'd wish them to be.

It still works (at least, for an external observer) like new.
 
The following users thanked this post: PhoenixAU

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 19527
  • Country: gb
  • 0999
Re: 3.3v GPIO controlled switch for high DC voltage (42V +)
« Reply #39 on: March 14, 2024, 02:39:29 pm »
I'd prefer not to use a relay because they can run into issues in the long term with contacts fusing and general reliability.

Usually mosfet lifetime is much shorter than relay, especially when they are working at high voltage. You're needs to have a dozen of replacement mosfets for repair, while relay can work for ten years with no issue :)
What makes you think that?

There is no reason why a MOSFET will have a shorter life time, compared to a MOSFET. It depends on the application. A relay will have a finite number of on,off cycles, which will depend on the current and voltage. A MOSFET has infinite on, off cycles. A relay will be more robust, when it comes to over voltage and ESD, which will easily kill a MOSFET.
 
The following users thanked this post: PhoenixAU

Offline PhoenixAUTopic starter

  • Contributor
  • Posts: 17
  • Country: au
Re: 3.3v GPIO controlled switch for high DC voltage (42V +)
« Reply #40 on: March 14, 2024, 03:02:14 pm »
Attached is a simulation. The inductor represents a long cable. The MOSFET is being switched at a high frequency. The yellow plot shows the load current and red the source voltage. The increase in source voltage, due to the long, inductive cable, greatly slows down the switching speed. Connecting an optically isolated MOSFET driver between the gate and as close as possible to the source, would increase the switching speed.

In your case, you're only switching slowly and at a much lower current, so it's unnecessary. The only reason why you might want to use an optically isolated driver, is so you can use an N-channel MOSFET and switch the high side.

Thanks very much for taking the time to do that Zero999, I really appreciate it!!

In regard to the inductor representing the long cable - have you got a rough idea of how long a cable needs to be before it starts to cause issues?  At this stage I can't foresee any wiring harnesses being much longer than 30cm (12") - I'll use twisted pairs for data lines and keep the higher voltage harnesses separate.
 

Offline PhoenixAUTopic starter

  • Contributor
  • Posts: 17
  • Country: au
Re: 3.3v GPIO controlled switch for high DC voltage (42V +)
« Reply #41 on: March 14, 2024, 04:56:47 pm »
Come to think of it, why are you switching it at all? Is it possible to send the BLDC driver a disable command? That would make much more sense, than switching the power.
Usual reasons for switching the power:
* Prevention of rectified BEMF voltage (generated by the motor when manually turned un-powered) running into the battery/supply
* Extra safety layer
* Powering off drivers that do not have the enable feature at all, or consume too much power in disabled state, and can't be modified
Exactly

In any case, it's not obvious why you'd need two? (You might need a $2 SSR to control a bigger SSR; the larger ones seem to want higher "coil" voltages.)

Hi guys,
             yep I suppose there has been a little bit of obfuscation.

The circuit in my original post was supplied to keep things easily digestible - the design below essentially uses two of the circuits from the original post and is coupled with an INA169 module for power monitoring, I understand the basics of what was going on, however like many of you I had a few questions to regarding design choices - before my initial post I had tried to simulate it it hope that would answer my questions but the simulation didn't work as I expected - which only led to more questions. I also asked the guys who designed the original circuit, but they didn't seem to know themselves.

The circuit in my original post was derived from the following designs:
   https://github.com/HoverMower/Ardumower_PCBs

   which was derived from:
   https://github.com/Starsurfer78/Ardumower_PCBs/blob/main/Charging_PCB/charge_pcb.pdf

The schematic above performs the following:
            Turns on/off charging to ensure batteries do not get over charged via Q1 + Q2
            Q3 + Q4 controls power to J4, J5, J6, J7, J9 - this could be used to turn off the device to prevent battery undercharge or just to turn off the device when required
            Monitors charge current via an INA169 Module
            Monitors Charge Voltage, Batt Voltage via Voltage dividers
            J8 is a Normally open switch (momentary) used as a start button to turn on the robot

However the original schematic (https://github.com/Starsurfer78/Ardumower_PCBs) above was designed for use with a 29.4V battery.

Initially I'll be using a 42V 4.4AH battery (10S2P) from a hoverboard - the battery has a built in BMS but it's pretty basic.
However there's a high chance I'll upgrade the battery at some point in the future to get longer run times (anywhere up to 55V 20Ah) although that all depends on how it performs with the battery I have.

Connected to this "Power PCB" via J4, J5, J6, J7, J9
   Meanwell DDR-30L-5 30W 5V DC/DC converter  (to power all 5V devices incl. Arduino Nano and Nvidia Jetson)
   hacked hoverboard motor driver + BLDC motors  (for driving robot)
   Additional motor driver + BLDC motor  (for cutting grass)

Arduino Nano @3.3v (controls Power PCB and some other peripherals)
Nvidia Jetson Nano 4GB B01 (main MCU - controls Arduino nano via USB cable)
   Stereo depth camera
   IMU
   RTK GPS

I'll also have include an emergency stop so that it kills power to all motors but not the computers - that way it can resume what it was doing if the "emergency" has passed (like a pause button).

So yeah one of my main concerns I suppose was if the mosfet fails, I don't want it surging through the gate pin and frying everything via the connection to the Arduino GPIO however obviously that can be prevented via isolation such as by using an optocoupler, capacitive isolated gate driver, relay etc...

« Last Edit: March 15, 2024, 05:36:54 am by PhoenixAU »
 

Offline sparkydog

  • Regular Contributor
  • *
  • Posts: 234
  • Country: us
Re: 3.3v GPIO controlled switch for high DC voltage (42V +)
« Reply #42 on: March 14, 2024, 05:15:02 pm »
I'd heard lots of bad press about fusing/failing contact due to arcing - which I figured would be an issue with the power I'll be using.

It's true that contact welding can happen, but so far as I know it's more of an issue with relays being abused beyond their rated capacity. There are also various ways to manage arcing.

Elsewhere you said "BLDC is a misnomer, it's really a type of three phase AC motor", but we also seem to be talking about disconnecting a battery. What's the actual load current that the relay needs to interrupt? My understanding is that AC is usually a lot less problematic than DC as far as contact welding. (Basically, it's hard to sustain an arc with AC because the voltage drops to zero 120 times per second.)

"Battery" also implies a portable, possibly hand-held application. Is that the case? I ask because, if you are highly space-constrained, I'm told you can get some serious industrial contactors (e.g. the kind used to control air conditioners) for $20 or less. These are not small components, but they can handle significant loads with high reliability.

Usual reasons for switching the power:
* Prevention of rectified BEMF voltage (generated by the motor when manually turned un-powered) running into the battery/supply
* Extra safety layer
* Powering off drivers that do not have the enable feature at all, or consume too much power in disabled state, and can't be modified
Exactly

This suggests that your goal is more electrical isolation than needing to switch a very large current. Specifically, if you can "soft stop" the motor before opening the relay, such that the relay needs to carry a lot of current but never needs to interrupt a lot of current... then you can definitely be a lot less paranoid about contact welding. Arcing happens when you try to interrupt large currents. If you're using the relay for physical isolation (in which capacity an EMR is far superior to a FET), but you can arrange to only open/close it when the load current is low, that will greatly improve reliability.
« Last Edit: March 14, 2024, 05:27:20 pm by sparkydog »
 

Offline PhoenixAUTopic starter

  • Contributor
  • Posts: 17
  • Country: au
Re: 3.3v GPIO controlled switch for high DC voltage (42V +)
« Reply #43 on: March 15, 2024, 05:33:54 am »
Elsewhere you said "BLDC is a misnomer, it's really a type of three phase AC motor", but we also seem to be talking about disconnecting a battery.

It was Zero999 that was talking about AC motor.  It's a battery powered project - I'll be switching DC (either on or off).

However, it might be possible that there could be some AC current introduced into the system if the BLDC motor was manually turned while unpowered or via Back EMF or if the motor was turned off/stopped suddenly or is under heavy torque loads ( https://www.portescap.com/en/newsroom/whitepapers/2021/12/running-a-brushed-dc-motor-as-a-generator ) - I'm not sure what safegaurds (if any) have been included in the design of the Hoverboard driver PCB or the the other BLDC motor controller - if they have sufficient safegards in place it might not even be something I need to consider.

In saying that if those circuits were isolated properly that would be less of an issue - Only the motor drivers, the Meanwell DC/DC stepdown and the battery BMS would be on the 42V circuit (And the INA169 power monitor). I'm sure the Meanwell stepdown would shield the low power circuits.

If you can "soft stop" the motor before opening the relay, such that the relay needs to carry a lot of current but never needs to interrupt a lot of current... then you can definitely be a lot less paranoid about contact welding. Arcing happens when you try to interrupt large currents. If you're using the relay for physical isolation (in which capacity an EMR is far superior to a FET), but you can arrange to only open/close it when the load current is low, that will greatly improve reliability.

That could be done - it could easily be handeld by software for shutdown sequences.

This suggests that your goal is more electrical isolation than needing to switch a very large current.

Yes, I'd like to be able to turn it on or off via an Microcontroller (on 3.3v GPIO OUT) - for system start up, system shut down and battery charge management.

I have no need for high speed switching for these switches, I wont be using PWM - they will either be on or off.

However, I'd prefer for it to be in a normally open (off) state if it looses power.

The charger that I have at the moment is a 42V 2A charger. The charge current would at most be 7A at 50.4V - that's if I upgraded the battery and charger.

The only time that I'd need to actually switch a very large current while the motors are running would be via the the emergency kill switch however that would be handled by a mechanical switch - I could use a DPST switch there for extra safety. Tripping the emergency kill switch would not effect the current state of the Relay/Contactor/Mosfet etc..

Note: Drain leakage current from a mosfet probably wouldn't be an issue due to the frequency that the robot would be in use - grass grows year round where I am. However, knowing that the batteries are always fully charged would be helpful.

"Battery" also implies a portable, possibly hand-held application. Is that the case? I ask because, if you are highly space-constrained, I'm told you can get some serious industrial contactors (e.g. the kind used to control air conditioners) for $20 or less. These are not small components, but they can handle significant loads with high reliability.

Yep it's battery powered - a robot mower.

Size, weight and electrical efficiency are all considerations.

Weight and electrical efficiency will eat into run time.

Obviously I don't want it to be too bulky - but I'm flexible and I'm open to ideas! 

How big are these industrial contactors? Have you got any examples?
« Last Edit: March 15, 2024, 06:08:20 am by PhoenixAU »
 

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 19527
  • Country: gb
  • 0999
Re: 3.3v GPIO controlled switch for high DC voltage (42V +)
« Reply #44 on: March 15, 2024, 08:13:15 am »

It was Zero999 that was talking about AC motor.  It's a battery powered project - I'll be switching DC (either on or off).

However, it might be possible that there could be some AC current introduced into the system if the BLDC motor was manually turned while unpowered or via Back EMF or if the motor was turned off/stopped suddenly or is under heavy torque loads ( https://www.portescap.com/en/newsroom/whitepapers/2021/12/running-a-brushed-dc-motor-as-a-generator ) - I'm not sure what safegaurds (if any) have been included in the design of the Hoverboard driver PCB or the the other BLDC motor controller - if they have sufficient safegards in place it might not even be something I need to consider.

In saying that if those circuits were isolated properly that would be less of an issue - Only the motor drivers, the Meanwell DC/DC stepdown and the battery BMS would be on the 42V circuit (And the INA169 power monitor). I'm sure the Meanwell stepdown would shield the low power circuits.
As I said before, any AC generated by the motor, will be rectified by the driver.

The output stage has six transistors, each containing a body diode, forming a three phase bridge rectifier. Any AC or back EMF will be rectified and fed into the power supply.

https://www.digikey.com/en/articles/how-to-power-and-control-brushless-dc-motors



https://www.electronics-tutorials.ws/power/three-phase-rectification.html
 
The following users thanked this post: Siwastaja

Offline sparkydog

  • Regular Contributor
  • *
  • Posts: 234
  • Country: us
Re: 3.3v GPIO controlled switch for high DC voltage (42V +)
« Reply #45 on: March 15, 2024, 09:12:30 pm »
How big are these industrial contactors? Have you got any examples?

Mmm... I'm not actually seeing much that isn't listed as a contactor (and $50+) that's rated for DC voltage above 24V-30V. Interrupting DC is hard. 🙂 (Finding $2 relays rated for 250V AC is a piece of cake.) That said, after much digging, AZDC105 might work but it's still ~$25.

It looks like you can find some automotive contactors that are not much bigger than a "D" battery, but most general-purpose ones are a few inches on a side. Maybe a little larger than a typical Rubik's Cube. Some DIN-mount models are about the size of a household circuit breaker. Not necessarily a deal-breaker on a mower, but bigger than you'd want in most hand-held tools (at least until you start talking about something more like a chainsaw or leaf blower).
 

Offline Siwastaja

  • Super Contributor
  • ***
  • Posts: 8173
  • Country: fi
Re: 3.3v GPIO controlled switch for high DC voltage (42V +)
« Reply #46 on: March 16, 2024, 06:48:34 am »
What makes you think that?

It's radiolistener. He has usually pretty good advice, you just need to run absolutely everything he says through an inversion filter. This transforms his 0% correctness rate to near 100%. For example, when he says that relays have longer lifetimes than MOSFETs, you obviously negate that --> relay has shorter lifetime --> correct!
 

Online BennoG

  • Regular Contributor
  • *
  • Posts: 66
  • Country: nl
Re: 3.3v GPIO controlled switch for high DC voltage (42V +)
« Reply #47 on: March 16, 2024, 09:43:22 am »
What makes you think that?

It's radiolistener. He has usually pretty good advice, you just need to run absolutely everything he says through an inversion filter. This transforms his 0% correctness rate to near 100%. For example, when he says that relays have longer lifetimes than MOSFETs, you obviously negate that --> relay has shorter lifetime --> correct!

Yes I also find that mosfet has a far longer lifetime than mechanical relais.
I have burned mechanical reilas controlling 3 phase AC motors in 1 month switching over 100 times a day.
Replaced it with an inverter MOSFET based and it is running for 8 years now without problems.

Benno
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf