PWM from PICAXE 18M2 amplified by MOSFET IRF640

Discussion in 'The Projects Forum' started by markodaguy, Mar 1, 2016.

  1. markodaguy

    Thread Starter New Member

    Mar 24, 2015
    A couple of months ago I posted a forum asking about how I could amplify the PWM from a PICAXE 18M2 where I received positive responses ( After building the rest of the circuit and trying solve all the problems within the circuit, I find myself coming back to the 18M2 subsystem where I can't solve the PWM amplifying problem.

    I connected the IRF 640 as I was shown in the previous forum (subsystem diagram attached) however the filament light has a small dimming range, from 6.34V to 6.74V to be exact. The PWM signal itself straight from the 18M2 has a consistent voltage range from 0V to 4V, meaning that I believe that there are no problems with the code itself as it works fine when I have a diode connected to the PWM output (without using a MOSFET, no power amplification). I want the subsystem to work so that I can dim the filament bulb from 0V-7V (or around that range). I will upload pictures of the actual connected MOSFET connected within the subsystem.

    As well I have tried to use a 2N2222 transistor to act as a power amplifier, however it has low switching voltage and the voltage across the light bulb is constantly varying when I am not changing the readadc value (which is the voltage from the potentiometer), I believe this occurs due to the transistor heating up quite a lot however I am unsure. Below I will also attach the code that I set up for the PICAXE 18M2.
    init: ;initial code, setting parameters for pwm

    pwmout b.6, 50, 300 ;generating pulse width modulation at b.6 of the 18M2 driver which is pin 12

    readadc c.2, b0 ;analogue signal at c.1 (pin 16)
    pwmduty b.6, b0
    goto main

    For the code above, after "pwmout", I'm unsure what values I should use for dimming the light bulb, these values were obtained from trial and error, and used what looked had the best dimming effect.
  2. dannyf

    Well-Known Member

    Sep 13, 2015
    Your mcu, at 4v, may not be able to turn on the MOSFET fully. Run it at higher rail, or use a mosfte with lower threshold voltage, or use a driver.
  3. Alec_t

    AAC Fanatic!

    Sep 17, 2013
    As danny says. The IRF640 has a Vgs(thr) which can be as high as 4V, so the 4V gate voltage may result in only a tiny drain current.
  4. crutschow


    Mar 14, 2008
    As noted, you need to to use a MOSFET with a lower Vth.
    They are called logic-level MOSFETs and fully turn on at a Vgs of 5V or less (look at the Vgs used for specifying the Ron value on the data sheet).
    If you read your referenced forum thread again you will see that the recommended MOSFET was changed to the logic-level IRL640.
  5. twohats

    New Member

    Oct 28, 2015
    As mentioned in the above posts(FET).
    Get a logic Fet or a Fet driver, forget about Picaxe for the moment, get the Fet working.
    Similar info on the Picaxe forum:
    Good luck, you will sort it.
  6. markodaguy

    Thread Starter New Member

    Mar 24, 2015
    Thanks all.

    May I just ask if I were to use a logic FET, would I still need to use a driver to run it? If not do I just connected it normally ?
  7. Dodgydave

    Distinguished Member

    Jun 22, 2012
    same connection, it just works from a 1v gate , the irf series need 3v minimum, you could use a pnp to pull the gate to positve, or use a tip121 darlington.