PWM and N channel MOSFET

Discussion in 'General Electronics Chat' started by arhem, Dec 6, 2013.

  1. arhem

    Thread Starter New Member

    Dec 6, 2013
    19
    1
    Hi, everyone
    I have an arduino uno, and a transistor N-MOSFET.
    I wante to make the MOSFET as a variable resistor. fo that i have to controle the gate pin of transistor by varying the voltatage(0 to 5v step by step) between it.
    the question is : can i use for this analogwrite PWM?
    if the answer yes, how can i do it ?
     
  2. shteii01

    AAC Fanatic!

    Feb 19, 2010
    3,395
    497
    Yes, you can use PWM.

    PWM can be used to produce dc voltage. The longer the duty cycle, the higher the dc voltage.

    Here is Arduino article about it: http://arduino.cc/en/Tutorial/PWM
    So basically, when you send 0 you get 0 volts.
    When you send 127, you get 50% duty cycle which is 2.5 volts.
    When you send 255, you get 100% duty cycle which is 5 volts.
    And anything in between.
     
    Last edited: Dec 6, 2013
    arhem likes this.
  3. arhem

    Thread Starter New Member

    Dec 6, 2013
    19
    1
    thank you,
    without making filter?
     
  4. shteii01

    AAC Fanatic!

    Feb 19, 2010
    3,395
    497
    I used PWM of Arduino Due to produce dc voltages to control speed of a fan. I did not use any filters.

    In your application, I have no idea.
     
  5. GopherT

    AAC Fanatic!

    Nov 23, 2012
    6,061
    3,826
    Using a filter is fine for a type D audio amplifier but unfiltered PWM is so great for a dc motor because you always have full voltage applied and you get much better control at low speeds. Adding capacitors to PWM removes that benefit as voltage is ramped.
     
  6. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,394
    1,606
    I once used a PWM output of a micro to directly drive a small speaker; it was not loud, it was not high fidelity, but it was quite surprisingly intelligible.
     
  7. arhem

    Thread Starter New Member

    Dec 6, 2013
    19
    1
    In my project i have solar cell and i want mesure I-V caracteristic, for that i need a varaible resistor (MOSFET as a load ), to change the value of the resistor, i need produce a dc voltage (0 to 5volt), i make the source pin in the negative of solar cell , the drain pin in the positive of solar cell and the gate pin to PWM, i want to varying the pwm step by step and i will take the I-V in each points.
     
  8. GopherT

    AAC Fanatic!

    Nov 23, 2012
    6,061
    3,826
    In that case, a filter capacitor will be useful. You can calculate the cap size with the formulas listed for power supply decoupling capacitors. Since you are supplying a mosfet that draws no current, you will want a small dummy load (10k ohm or so) to ground to allow the filter cap to drain. Use the drain resistor value to calculate current for the filter capacitor calculation.

    If you have an ADC on your micro, you can measure voltage and control PWM as a feedback and step through the voltage range.
     
  9. MikeML

    AAC Fanatic!

    Oct 2, 2009
    5,450
    1,066
    Wont work. The power dissipation in the NFET will be huge. Read and follow the advice I gave in these two threads. Start here and continue here. Read all the way through...

    When you understand the "back end", I can help you automate "turning the pot" using PWM out of the Arduino.
     
  10. arhem

    Thread Starter New Member

    Dec 6, 2013
    19
    1
    thank's for all,
    my probleme is just if i can produce un dc signal(exmple:0v,0.1v, 0.2v, 0.5v, 1v, 2.4v, 3.6v) from the PWm, if i can, tell me how?
     
  11. MrChips

    Moderator

    Oct 2, 2009
    12,449
    3,363
    All you need to do is integrate the PWM signal using a low-pass RC filter.
     
  12. Alec_t

    AAC Fanatic!

    Sep 17, 2013
    5,804
    1,105
    Don't think so.
    Low pass filtering will give you the DC average of a PWM signal but, as MikML says, if you use that on the gate of your FET the power dissipation will be huge. THEN you will have your problem.
     
  13. arhem

    Thread Starter New Member

    Dec 6, 2013
    19
    1
    so what can i do?????
     
  14. ian field

    Distinguished Member

    Oct 27, 2012
    4,415
    784
    If you make the MOSFET as a variable resistor - it isn't PWM.
     
  15. arhem

    Thread Starter New Member

    Dec 6, 2013
    19
    1
    so i think to produce a digital signal, and i make a DAC to converte it to analog signal,
    it's the one solution!
     
    Tealc likes this.
  16. shteii01

    AAC Fanatic!

    Feb 19, 2010
    3,395
    497
    Or you can use pwm do the same thing.

    Your Uno does not have DAC, but it does have pwm.

    Are you going to build the DAC circuit?
     
  17. MikeML

    AAC Fanatic!

    Oct 2, 2009
    5,450
    1,066
    Arhem, you are not listening!

    No matter how you create a DC voltage proportional to a numerical value inside your Arduino, you still have the problem of dealing with up to hundreds of Watts of dissipation in the NFET(s).

    Go read the threads I linked you to, and just maybe, you will understand...
     
  18. arhem

    Thread Starter New Member

    Dec 6, 2013
    19
    1
    no, i think to by dac 1 channel
    but if there are solution to build the dac with PWM, tell me how?
     
  19. shteii01

    AAC Fanatic!

    Feb 19, 2010
    3,395
    497
    You either do not read or do not understand what you read.

    1) You don't use PWM to make DAC. So there is nothing to tell. I already linked the Arduino tutorial about the use of PWM, in that tutorial there is a link to an example on how to setup PWM. You, obviously, did not read either. I don't see a point in continuing participating here.

    2) MikeML seem to think that there are other issues. I am not sure what exactly it is, but he seems to think that NFET will produce so much power that it will burn itself out. I don't have a hands on experience working with MOSFET, so I can not advise on this issue.
     
  20. arhem

    Thread Starter New Member

    Dec 6, 2013
    19
    1
    any way thank you for your participation.
     
Loading...