Author Topic: Voltage sensing/adjusting with MOSFET and Arduino  (Read 3807 times)

0 Members and 1 Guest are viewing this topic.

Offline 3dgeoTopic starter

  • Frequent Contributor
  • **
  • Posts: 289
  • Country: au
Voltage sensing/adjusting with MOSFET and Arduino
« on: March 13, 2018, 02:17:09 pm »
Hi,

I have transformer which provides up to 50V, I want to step it down to ~28V with N channel mosfet and arduino based board.
Will it work if I make in parallel of my main load (2 DC motors) a voltage divider and feed low voltage to arduino and adjust mosfet accordingly?
If not what is a good practice to make this work?

Thank You.
 

Offline Inverted18650

  • Frequent Contributor
  • **
  • Posts: 875
  • Country: us
    • Test Gear Addicts
Re: Voltage sensing/adjusting with MOSFET and Arduino
« Reply #1 on: March 13, 2018, 02:27:21 pm »
Can you add the schematic, mosfet and motor details?

Offline 3dgeoTopic starter

  • Frequent Contributor
  • **
  • Posts: 289
  • Country: au
Re: Voltage sensing/adjusting with MOSFET and Arduino
« Reply #2 on: March 13, 2018, 03:23:03 pm »
Can you add the schematic, mosfet and motor details?

Will be using appropriate components, no worries here, all I need is to know if this concept will work and if it's good idea to do this:


I don't like that I need to connect microcontroller and mosfet grounds together, but I can live with that...
« Last Edit: March 13, 2018, 11:45:58 pm by 3dgeo »
 

Offline David Chamberlain

  • Regular Contributor
  • *
  • Posts: 249
Re: Voltage sensing/adjusting with MOSFET and Arduino
« Reply #3 on: March 14, 2018, 09:52:18 am »
Given we know nothing about the arduino board, the mosfet, the resistors, the motor, the power supply.. the concept looks fine.

A little more technical detail would go a long way.
 

Offline 3dgeoTopic starter

  • Frequent Contributor
  • **
  • Posts: 289
  • Country: au
Re: Voltage sensing/adjusting with MOSFET and Arduino
« Reply #4 on: March 14, 2018, 10:43:59 am »
Thank You for Your reply, Mr David,

I'm remaking old sit/stand desk circuit and reusing most of the main power supply components (I can't find data sheets for motors and mosfets (ON5247), but they were used before and worked fine). Resistors 180K and 20K to reduce voltage  10 times for microcontroller (I'm good at coding).
Problem I found so far is that I will be checking "RAW" voltages, not "PWM'ed", I would like to check final voltages and adjust it accordingly, but that's not easily achievable, isn't it?
If I connect voltage divider ground to motor ground then when mosfet is off controller will get full raw voltage... Any ideas?
« Last Edit: March 14, 2018, 10:54:38 am by 3dgeo »
 

Offline Abbas

  • Contributor
  • Posts: 12
  • Country: ph
    • Project Electronics
Re: Voltage sensing/adjusting with MOSFET and Arduino
« Reply #5 on: March 20, 2018, 08:56:10 am »
From what I understand, well you could throw in another MOSFET(2nd one) between the motor and the main MOSFET, so when the motor is switched on, then you would check the voltage that is being feeded back to the controller via the second switch mosfet.
 

Online Siwastaja

  • Super Contributor
  • ***
  • Posts: 8110
  • Country: fi
Re: Voltage sensing/adjusting with MOSFET and Arduino
« Reply #6 on: March 20, 2018, 02:17:13 pm »
The diagram lacks the freewheeling (synchronous) diode to the motor. It's extremely important.

Otherwise, given usual things such as layout and proper power bypass capacitors, no problem in concept.

So it seems you are just measuring the DC link voltage. Either a buffer opamp, or a 100n ceramic cap right next to the MCU input pin is needed to provide the ADC low AC impedance it needs.

Edit: since the picture doesn't match the first post description at all, it's hard to say. I based my answer on the picture, but where's the second motor, transformer, etc?
« Last Edit: March 20, 2018, 02:19:59 pm by Siwastaja »
 

Offline 3dgeoTopic starter

  • Frequent Contributor
  • **
  • Posts: 289
  • Country: au
Re: Voltage sensing/adjusting with MOSFET and Arduino
« Reply #7 on: March 20, 2018, 07:45:15 pm »
Thank You for Your replies.

After 2 dead mosfets I realised that I do not have flyback diodes (hope it's correct name), I added them and for few seconds I was able to control voltage via PWM, but then mosfet died again, I don't know why it did this time, I will add additional diode next to mosfet. Is there a specific frequency?
I'm out of mosfets for now (IRFZ44N and STP80NF70 incoming).
Motors specs are: 24V/2,5A/1000N/2Ohm, same transformer (~50V) for both motors.
Motors work with 50V, but I doubt they will for a long time...

In old board voltage regulation was atchieved (I think) by this part of the circuit (image below).
Can someone explain how it works and what are those unknown components? BJTs?
I think I should just replicate it to save headache.

"RAWIN" is rectified tranformer output (no smoothing cap)

« Last Edit: March 20, 2018, 08:02:52 pm by 3dgeo »
 

Offline 0xfede

  • Regular Contributor
  • *
  • Posts: 201
  • Country: it
Re: Voltage sensing/adjusting with MOSFET and Arduino
« Reply #8 on: March 22, 2018, 07:09:06 pm »
Hi 3dgeo,

the SOT23 markings seems 3B. These are likely to be the good old BC856B (PNP transistor). Unfortunately I cannot read the marking on the leftmost, maybe you can provide another picture.
Do not use IRFZ44N for switching an high inductive load such a motor powered with 50V. These MOSFET are 55V and even with a diode paralleled with the motor they will die fast.

Best,
0xfede
Semel in anno licet insanire.
 
The following users thanked this post: 3dgeo


Offline 3dgeoTopic starter

  • Frequent Contributor
  • **
  • Posts: 289
  • Country: au
Re: Voltage sensing/adjusting with MOSFET and Arduino
« Reply #10 on: March 24, 2018, 08:15:14 pm »
Hi 3dgeo,

the SOT23 markings seems 3B. These are likely to be the good old BC856B (PNP transistor). Unfortunately I cannot read the marking on the leftmost, maybe you can provide another picture.
Do not use IRFZ44N for switching an high inductive load such a motor powered with 50V. These MOSFET are 55V and even with a diode paralleled with the motor they will die fast.

Best,
0xfede

Than You for Your reply, 0xfede,
sorry for being dummy– I should attach marking on them too, I don't know why I did not do that, here it is:


I had a feeling that IRFZ44N would be "too weak" so I ordered IRF3710PbF, they look great on paper, I hope 100V will be enough. I would like to drive IRF3710PbF with simple PC817 optocoupler. I already tested  PC817 with 31kHz, it seems to work just fine. The main question now is what PWM frequency is ideal for STP80NF70 particularly in this circuit?

IRF3710PbF datasheet:
https://www.infineon.com/dgdl/irf3710pbf.pdf?fileId=5546d462533600a4015355df95df1947

Finally made more detailed blueprint (MOSFET should be IRF3710PbF, 100V/57A/23m?):
Diode next to capacitor is B350B (Surface Mount Schottky Rectifier) https://www.vishay.com/docs/89122/b360b.pdf


While I was making it I realized few potential issues:
If I connect optocoupler voltage divider as is (cyan to ground "after" mosfet) voltage should be stable despite mosfet duty cycle but will there be a ripple due to rectification and lack of capacitor directly between + and - after rectifier (gray)?
If I connect cyan "before" mosfet voltage will change according to mosfets duty cycle, thats not good as well, any suggestions?
« Last Edit: March 25, 2018, 01:17:52 pm by 3dgeo »
 

Offline Beamin

  • Super Contributor
  • ***
  • Posts: 1567
  • Country: us
  • If you think my Boobs are big you should see my ba
Re: Voltage sensing/adjusting with MOSFET and Arduino
« Reply #11 on: March 24, 2018, 11:10:00 pm »
The diagram lacks the freewheeling (synchronous) diode to the motor. It's extremely important.

Otherwise, given usual things such as layout and proper power bypass capacitors, no problem in concept.

So it seems you are just measuring the DC link voltage. Either a buffer opamp, or a 100n ceramic cap right next to the MCU input pin is needed to provide the ADC low AC impedance it needs.

Edit: since the picture doesn't match the first post description at all, it's hard to say. I based my answer on the picture, but where's the second motor, transformer, etc?

2nd the diode across inductive loads. That spike can kill the arduno or even fets...
Max characters: 300; characters remaining: 191
Images in your signature must be no greater than 500x25 pixels
 

Offline 0xfede

  • Regular Contributor
  • *
  • Posts: 201
  • Country: it
Re: Voltage sensing/adjusting with MOSFET and Arduino
« Reply #12 on: March 25, 2018, 02:32:16 pm »
Hi 3dgeo,

let's try to make some order.

Than You for Your reply, 0xfede,
sorry for being dummy– I should attach marking on them too, I don't know why I did not do that, here it is:


If the marking is 1BW you are dealing with another common transitor, this time a NPN BC846B. 18W doesn't ring any bell to me.

I had a feeling that IRFZ44N would be "too weak" so I ordered IRF3710PbF, they look great on paper, I hope 100V will be enough. I would like to drive IRF3710PbF with simple PC817 optocoupler. I already tested  PC817 with 31kHz, it seems to work just fine. The main question now is what PWM frequency is ideal for STP80NF70 particularly in this circuit?

It is not easy to estimate the ideal frequency without knowing important data from the motors. But I can roughly say that the lower frequency you will choose, the lesser problem you willl have. Tipically you would set it higher than 16KHZ (to avoid motor to make any audible high pitched noise) and lower than 30KHZ (to maintain low both the switching losses and the radiated emissions).
Is a 100V MOSFET  enough? Typically a brushed DC motors without a proper snubber can even exceed twice as the input voltage in some circustances. The clamping diode will help but not solve all the situations the system will encounter (like heavy variations in the mechanical load). So as per design guidelines choose a MOSFET that has at least the double of the voltage you want to switch (and IRF3710PbF is fine) and then ensure that you design a proper snubber.


Finally made more detailed blueprint (MOSFET should be IRF3710PbF, 100V/57A/23m?):
Diode next to capacitor is B350B (Surface Mount Schottky Rectifier) https://www.vishay.com/docs/89122/b360b.pdf



The schematic attached does not drive the MOSFET gate properly since the gate is never pulled low level.
The B350 is a 50V schottky diode and like the MOSFET it will not have a long and happy life.
The 2200u 50V paralleled with clamping diode may cause a series of unwanted effects and I recommend to start without it.
The lack of smoothing cap may cause a series of unwanted effects and I recommend to start with it.

Best,
0xfede
« Last Edit: March 25, 2018, 02:50:50 pm by 0xfede »
Semel in anno licet insanire.
 
The following users thanked this post: 3dgeo

Offline 3dgeoTopic starter

  • Frequent Contributor
  • **
  • Posts: 289
  • Country: au
Re: Voltage sensing/adjusting with MOSFET and Arduino
« Reply #13 on: March 25, 2018, 05:04:53 pm »
Hello again, Mr 0xfede,

thank You for Your help, I really appreciate it.

Yes, actually it's 1BW, sorry for misleading – it's very hard to see it.
Already ordered thru-hole variance of these transistors (BC556 and BC546), will try to replicate that circuit and see what will happen, all I need to find out now is those caps capacities, is there an easy way to do that without special equipment?

To be honest most problems I encounter I can't solve is because I don't have proper equipment, lack of knowledge doesn't help as well :)
What other information about motors I should provide? They're rated at 24V, 2,5A (guessing on "free run"), 2Ohms, 1000N.
According to rated voltage and measured resistance they should be able to handle up to 12A (288W)
Did I mentioned this is for sit stand desk? Motors will be running very rarely, at most few times a day for like 30s max.
I would like to continue logic part of the circuit till I get new mosfets and I was wondering if shortly (5-10s while testing code) running these motors at 50V with practically no load will damage them? I don't know if my assumptions is correct but I think motor should take ~6A while running on 50V with no load, it's still less than 12A I calculated so I should be ok, am I right?
 
What comes to running mosfet, yes, I forget pulldown resistor, thats not a biggie...
I can't understand why optocoupler shouldn't be safe in this situation – voltage divider should protect it by reducing voltage to 10 V. At this point I'm ok with the idea that I have to kill few components to figure this out :)
What comes to CAP - ok, I will move it in to "gray" position.
Well, I ordered this cheep DSO138 oscilloscope, with it I hope to monitor what happens in circuit.
 

Offline Seekonk

  • Super Contributor
  • ***
  • Posts: 1938
  • Country: us
Re: Voltage sensing/adjusting with MOSFET and Arduino
« Reply #14 on: March 25, 2018, 06:55:28 pm »
If it hasn't been mentioned you need a resistor from gate to source.  More likely, the opto feeds the voltage divider to the fet.
 

Offline 0xfede

  • Regular Contributor
  • *
  • Posts: 201
  • Country: it
Re: Voltage sensing/adjusting with MOSFET and Arduino
« Reply #15 on: March 25, 2018, 07:54:39 pm »
If it hasn't been mentioned you need a resistor from gate to source.  More likely, the opto feeds the voltage divider to the fet.

The PC817 transistor, depending on production variant and production year may withstand only 35V so it is not recommended to place the divider after the optocoupler.

Hello again, Mr 0xfede,

thank You for Your help, I really appreciate it.

Yes, actually it's 1BW, sorry for misleading – it's very hard to see it.
Already ordered thru-hole variance of these transistors (BC556 and BC546), will try to replicate that circuit and see what will happen, all I need to find out now is those caps capacities, is there an easy way to do that without special equipment?

Luckily you don't need any special equipment to calulate the main smoothing cap but you are just required to do some simple math: Vripple = Iload / (2 F C)
Where Vripple is the maximum voltage swing you want tolerate, Iload is the nominal current flow thru the load, F the line frequency and C the capacitor in Farad (note that the above formula is for full wave rectification). Now let's say that your load draw 5A, that you have 50HZ mains frequency, that your smoothing cap is 10000uf:  the resulting ripple is around 5 volts. For the voltage bear in mind that a capacitor should work at a lower voltage for reliability and, since you have 50V you should use at least a 63V rated cap.
By the way, a nice calculator, that makes even neat graphs is here:
https://www.changpuak.ch/electronics/power_supply_design.php


Did I mentioned this is for sit stand desk?

I was starting being curious....

Motors will be running very rarely, at most few times a day for like 30s max.
I would like to continue logic part of the circuit till I get new mosfets and I was wondering if shortly (5-10s while testing code) running these motors at 50V with practically no load will damage them? I don't know if my assumptions is correct but I think motor should take ~6A while running on 50V with no load, it's still less than 12A I calculated so I should be ok, am I right?

You should not exceed device ratings at any time, for whatever reason.
 
What comes to running mosfet, yes, I forget pulldown resistor, thats not a biggie...
I can't understand why optocoupler shouldn't be safe in this situation – voltage divider should protect it by reducing voltage to 10 V. At this point I'm ok with the idea that I have to kill few components to figure this out :)
What comes to CAP - ok, I will move it in to "gray" position.
Well, I ordered this cheep DSO138 oscilloscope, with it I hope to monitor what happens in circuit.

Well, the circuit can work with an optocupler, but is just not needed. As a rule of thumb in electronics you shouldn't add unneeded component. Any extra device in the circuit will add a pletora of new potential problems that will come back to bite.

Best,
0xfede

« Last Edit: March 25, 2018, 08:08:02 pm by 0xfede »
Semel in anno licet insanire.
 

Offline Seekonk

  • Super Contributor
  • ***
  • Posts: 1938
  • Country: us
Re: Voltage sensing/adjusting with MOSFET and Arduino
« Reply #16 on: March 27, 2018, 09:20:31 pm »
If it hasn't been mentioned you need a resistor from gate to source.  More likely, the opto feeds the voltage divider to the fet.

The PC817 transistor, depending on production variant and production year may withstand only 35V so it is not recommended to place the divider after the optocoupler.


Sure it is 35V.  I buy PC817 500 at a time. Who knows what this was or what you are designing. I just know this circuit is wrong as shown and the FET will turn on and probably never turn off as you have shown it.  The gate has to have a resistor to the source.  Just trying to give you  a heads up on your mistake which you appear to be oblivious to.
« Last Edit: March 27, 2018, 09:24:30 pm by Seekonk »
 

Offline 0xfede

  • Regular Contributor
  • *
  • Posts: 201
  • Country: it
Re: Voltage sensing/adjusting with MOSFET and Arduino
« Reply #17 on: March 28, 2018, 03:17:30 pm »
..... Who knows what this was or what you are designing.

I'm not designing anything. It is not my project and I'm not the OP.

I just know this circuit is wrong as shown and the FET will turn on and probably never turn off as you have shown it.

I've already pointed out that to the OP before your message.

The gate has to have a resistor to the source. 

There is no gate in a bipolar transistor so you mean base. Even with a resistor on the base when cut off it will see  the full differential voltage on Vce (in the OP project 50V) and it will have an hard day.

Best,
0xfede
Semel in anno licet insanire.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf