Mosfet stable Volt out


Closed Thread
Results 1 to 8 of 8
  1. #1
    Join Date
    Jan 2005
    Location
    Puerto Rico
    Posts
    133

    Question Mosfet stable Volt out

    MosFet out volt

    i need help how stable Volt out with PWM and MosFet

    the out put is up and down for one volt

    example: v1.0
    v1.1
    v1.0

    Bat: 7.2v souce

  2. #2
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    HEIN.. have you some schematic and/or more details of your stuff ???

    I really try to understand but... not sure enough to provide a good answer to that.

    Try to tell us what you really expected as output swing... can i understand you want from 0 - 1 Volt or a 0.1 volt steps with a 7.2V battery as power source???

    if i'm right... if not please somebody slap me

    7.2 / 256 = 0,028125 volts by 8 bit PWM definition duty step

    to get 0.1 volt: duty = 0.1/0.02823529 = 3.55555 = 3 or 4 test it

    to get 1 volt : duty = 1/0.02823529 = 35.5555 = 35 or 36 test it

    to get 1.1 volt: duty = 1.1/0.02823529 = 39.1111 = 39
    Last edited by mister_e; - 19th February 2005 at 23:53.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  3. #3
    Join Date
    Jan 2005
    Location
    Puerto Rico
    Posts
    133


    Did you find this post helpful? Yes | No

    Question Volt out

    I am driving a dc motor with MosFet and when i read the volt out clamp to the motor is up and down so me robot a fast and slow ...

    Example : out v is shut be 2.0 and not 2.1 but after liter of time change to 2.1 so my robot run i liter fast for a second and then go back so is not stable

    my source is 7.2v


    my MOSFET is Rectifier IRLU3103
    I use 10K resistor, with a 12K resistor gate to ground. Higher gate to ground

    resistance reduces resolution of the byte Duty Cycle variable.

  4. #4
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    mmm, in all my motor speed control, i read the voltage on the motor with an A/D input of the PIC. Kinda feedback control.

    Once you have the voltage reading from the motor, simply monitor it and do the according change in your PWM statement or routine.

    10K in serie look a bit high... is 220 Ohms to 1K do the same with the same pull down on the gate?

    May be a stupid question but, is your PIC output is an open drain?!? RA4 ???

    Last edited by mister_e; - 20th February 2005 at 23:49.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  5. #5
    Join Date
    Jan 2005
    Location
    Puerto Rico
    Posts
    133


    Did you find this post helpful? Yes | No

    Question Volt out

    Hi ken you send schematic or some help who i made that...

    my pic is pic18f252 and i conect to the pwm pin with 2 res. one to ground and the other to the gate in the same line like a volt divider..

    my code

    MotorDC VAR CCPR1L
    MotorOut VAR PORTC.2
    MotorOn CON %1111110 '16 Pre/Scale
    MotorOff CON %1111010
    MotorEnable VAR T2CON

    PumpDcSet=15
    CurrentStep = 0 to 100 of rc pulse
    MotorScaleFactor = 255 - 15
    MotorScaleFactor / CurrentStep

    MotorDC = MotorScaleFactor / 100 * CurrentStep + PumpDcSet

    Pause PauseScalefactor * 1000 / MotorScaleFactor Factor

  6. #6
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    here's something to play with
    Code:
    ' PIC18F2220 
    DEFINE OSC 20
    
    TRISC = 0 ' PORTC as output
    TRISA = 3 ' RA0 & RA1 as input
    
    PR2=$FF ' load frequency period (PWM freq=1.2 KHZ)
    
    ADCON1 = %00001101 ' Set RA0 & RA1 as analog
    ADCON2 = %10000110 ' Right justified result
                       ' Fosc/64
                       ' Tad = 0
                       
    ADCON0.0 = 1       ' enable a/d
    
    TMR2DutyVar     var word
    AdResult        var word
    Voltage         var word
    Source          var word
    SelectedVoltage var word
    Quanta          con 125 ' (5Volt/1024)*256=0.125 = 125
    
    SelectedVoltage = 110 ' mean 1.1 volt
    tmr2dutyvar = 156 ' according duty to get 1.1Volt = (1.1/7.2)*1024
    
    Start:
        gosub InitPWM
        
        ' Read Motor voltage supply line
        ' ------------------------------
        '
        ADCON0 = %00000101 'select channel 1 
        pauseus 100
        ADCON0.1 = 1 'start conversion
        while ADCON0.1 ' wait for end of conversion
        wend   
        Adresult.highbyte = ADRESH
        adresult.lowbyte = ADRESL
        Source = (adresult */ quanta )
        Source = source * 288 ' to have a range of 7.2volt
        Source = div32 100 
    
        ' Read feedback motor voltage
        ' ---------------------------
        '
        ADCON0 = %00000001 ' select channel 0
        pauseus 100
        ADCON0.1 = 1
        while ADCON0.1 ' wait for end of conversion
        wend   
        Adresult.highbyte = ADRESH
        adresult.lowbyte = ADRESL
        voltage = (adresult */ quanta )
        voltage = voltage * 144 ' to have 7.2V range
        voltage = div32 100     
        voltage = source - voltage 
    
        ' Voltage regulation
        ' ------------------
        '
        if voltage < selectedvoltage then 
           if tmr2dutyvar < 1023 then TMR2DutyVar=TMR2DutyVar+1
           gosub initpwm
        endif
    
        if voltage>Selectedvoltage then
           if tmr2dutyvar then TMR2DutyVar=TMR2DutyVar-1
           gosub initpwm
        endif
        goto start
    
    
    InitPWM:
        'set Duty cycle
        CCP1CON.5=Tmr2dutyvar.1
        CCP1CON.4=Tmr2dutyvar.0
        CCPR1L =(tmr2dutyvar>>2)
        
        T2CON=%00000110 ' start timer 2
                        ' set prescaler = 16
    
        CCP1CON = %00001100 ' pwm mode for CCP1
        return
    Attached Images Attached Images  
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  7. #7
    Join Date
    Jan 2005
    Location
    Puerto Rico
    Posts
    133


    Did you find this post helpful? Yes | No

    Lightbulb MosFet out volt

    Hi thanks for the help...

    Hi what type of software do you use for draw the Schematics ...

  8. #8
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Hi jetpr, I use P-CAD. I heard also some good comment on something called EAGLE.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

Similar Threads

  1. Stable Adc Reading Routine
    By gebillpap in forum General
    Replies: 27
    Last Post: - 13th May 2015, 02:18
  2. Help needed - MOSFET driven by PWM
    By bcd in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 2nd April 2008, 05:02
  3. Mosfet problems
    By Agent36 in forum General
    Replies: 7
    Last Post: - 2nd February 2008, 22:37
  4. Driving a mosfet directly?
    By passion1 in forum mel PIC BASIC Pro
    Replies: 21
    Last Post: - 12th July 2007, 07:45
  5. Decent 24 volt Pic power supply
    By rwskinner in forum Schematics
    Replies: 7
    Last Post: - 18th December 2006, 12:27

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

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