Author Topic: 3.3v GPIO controlled switch for high DC voltage (42V +)  (Read 2229 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 »
 

Offline 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: 8178
  • 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

Offline 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: 19528
  • 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

Offline shapirus

  • Super Contributor
  • ***
  • Posts: 1369
  • 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: 12864
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: 8178
  • 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: 19528
  • 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.
 

Offline 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

Offline radiolistener

  • Super Contributor
  • ***
  • Posts: 3387
  • 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: 12864
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: 12864
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

Offline 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: 19528
  • 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 »
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf